posix module reference

Interface to the libc POSIX API.

More…

Data Types

stat_buf

Container for file metadata from stat.

jmp_buf

Container for the jump point buffer created by setjmp().

sigjmp_buf

Container for the jump point buffer (with signals) created by sigsetjmp()

Functions/Subroutines

chmod()

Change mode of a file.

mkdir()

Create a file directory.

stat()

Get file status.

signal()

Create a signal handler handle to be called when sig is detected.

kill()

Send signal sig to process pid.

getpid()

Get the ID of the current process.

getppid()

Get the ID of the parent process of the current process.

sleep()

Force the process to a sleep state for seconds seconds.

longjmp()

Restore program to state saved by env, and return the value val.

siglongjmp()

Restore program to state saved by env, and return the value val.

setjmp_missing()

Placeholder function for a missing or unconfigured setjmp.

longjmp_missing()

Placeholder function for a missing or unconfigured longjmp.

sigsetjmp_missing()

Placeholder function for a missing or unconfigured sigsetjmp.

siglongjmp_missing()

Placeholder function for a missing or unconfigured siglongjmp.

Detailed Description

Interface to the libc POSIX API.

Type Documentation

type posix/stat_buf

Container for file metadata from stat.

Type fields:
  • % state [character (kind=c_char)(144)] :: Byte array containing file metadata.

type posix/jmp_buf

Container for the jump point buffer created by setjmp().

Type fields:
  • % state [character (kind=c_char)(200)] :: Unstructured array of bytes used to store the process state.

type posix/sigjmp_buf

Container for the jump point buffer (with signals) created by sigsetjmp()

Type fields:
  • % state [character (kind=c_char)( 200)] :: Unstructured array of bytes used to store the process state.

Function/Subroutine Documentation

function posix/chmod(path, mode) [integer]

Change mode of a file.

This changes the file permission of file path to mode following POSIX conventions. If successful, it returns zero. Otherwise, it returns -1.

Called from:

mom_file_parser_tests::cleanup_open_param_file_ioerr

function posix/mkdir(path, mode) [integer]

Create a file directory.

This creates a new directory named path with permissons set by mode. If successful, it returns zero. Otherwise, it returns -1.

Called from:

mom_get_input::get_mom_input

function posix/stat(path, buf) [integer]

Get file status.

This obtains information about the named file and writes it to buf. If found, it returns zero. Otherwise, it returns -1.

Parameters:
  • path :: [in] Pathname of file to be inspected

  • buf :: [out] Buffer containing information about the file if it exists

Return:

undefined :: Function return code

Called from:

mom_get_input::get_mom_input

function posix/signal(sig, func) [procedure(handler_interface)]

Create a signal handler handle to be called when sig is detected.

If successful, the previous handler for sig is returned. Otherwise, SIG_ERR is returned.

function posix/kill(pid, sig) [integer]

Send signal sig to process pid.

If successful, this function returns 0. Otherwise, it returns -1.

function posix/getpid() [integer]

Get the ID of the current process.

function posix/getppid() [integer]

Get the ID of the parent process of the current process.

function posix/sleep(seconds) [integer]

Force the process to a sleep state for seconds seconds.

The sleep state may be interrupted by a signal. If it sleeps for the entire duration, then it returns 0. Otherwise, it returns the number of seconds remaining at the point of interruption.

Called from:

mom_error_handler::mom_error

subroutine posix/longjmp(env, val)

Restore program to state saved by env, and return the value val.

This “nonlocal goto” alters program execution to the state stored in env produced by a prior execution of setjmp. Program execution is moved back to this setjmp, except the function will now return val.

subroutine posix/siglongjmp(env, val)

Restore program to state saved by env, and return the value val.

This “nonlocal goto” alters program execution to the state stored in env produced by a prior execution of setjmp. Program execution is moved back to this setjmp, except the function will now return val. siglongjmp behaves in the same manner as longjmp, but also provides predictable handling of the signal state.

function posix/setjmp_missing(env) [integer(kind=c_int)]

Placeholder function for a missing or unconfigured setjmp.

Parameters:

env :: [in] Current process state (unused)

Return:

undefined :: Function return code (unused)

subroutine posix/longjmp_missing(env, val)

Placeholder function for a missing or unconfigured longjmp.

Parameters:
  • env :: [in] Current process state (unused)

  • val :: [in] Enable signal state flag (unused)

function posix/sigsetjmp_missing(env, savesigs) [integer(kind=c_int)]

Placeholder function for a missing or unconfigured sigsetjmp.

Parameters:
  • env :: [in] Current process state (unused)

  • savesigs :: [in] Enable signal state flag (unused)

Return:

undefined :: Function return code (unused)

subroutine posix/siglongjmp_missing(env, val)

Placeholder function for a missing or unconfigured siglongjmp.

Parameters:
  • env :: [in] Current process state (unused)

  • val :: [in] Enable signal state flag (unused)