posix module reference

Interface to the libc POSIX API

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()

Procedure Interfaces

chmod_posix

C interface to POSIX chmod() Users should use the Fortran-defined chmod() function.

mkdir_posix

C interface to POSIX mkdir() Users should use the Fortran-defined mkdir() function.

stat_posix

C interface to POSIX stat() Users should use the Fortran-defined stat() function.

signal_posix

C interface to POSIX signal() Users should use the Fortran-defined signal() function.

kill_posix

C interface to POSIX kill() Users should use the Fortran-defined kill() function.

getpid_posix

C interface to POSIX getpid() Users should use the Fortran-defined getpid() function.

getppid_posix

C interface to POSIX getppid() Users should use the Fortran-defined getppid() function.

sleep_posix

C interface to POSIX sleep() Users should use the Fortran-defined sleep() function.

setjmp

Save the current program execution state to env.

sigsetjmp

Save the current execution and ,optionally, the signal state to env.

longjmp_posix

C interface to POSIX longjmp() Users should use the Fortran-defined longjmp() function.

siglongjmp_posix

C interface to POSIX siglongjmp() Users should use the Fortran-defined siglongjmp() function.

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

Type Documentation

type, bind(c) :: stat_buf

Container for file metadata from stat

NOTE: This is currently just a placeholder containing fields, such as size, uid, mode, etc. A readable Fortran type may be used in the future.

Parameters
  • state

    Byte array containing file metadata

type, bind(c) :: jmp_buf

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

The buffer typically contains the current register values, stack pointers, and any information required to restore the process state.

Parameters
  • state

    Unstructured array of bytes used to store the process state

type, bind(c) :: sigjmp_buf

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

In addition to the content stored by jmp_buf, it also stores signal state.

Parameters
  • state

    Unstructured array of bytes used to store the process state

Procedure Interface Documentation

function chmod_posix(path, mode) result(rc) bind(c, name="chmod")

C interface to POSIX chmod() Users should use the Fortran-defined chmod() function.

Parameters
  • path [in]

    Zero-delimited file path

  • mode [in]

    File permission to be assigned to file.

  • rc

    Function return code

Callers call graph
Callers of posix::chmod_posix calls cluster_posix posix posix::chmod chmod posix::chmod_posix chmod_posix posix::chmod->posix::chmod_posix
Text view
function mkdir_posix(path, mode) result(rc) bind(c, name="mkdir")

C interface to POSIX mkdir() Users should use the Fortran-defined mkdir() function.

Parameters
  • path [in]

    Zero-delimited file path

  • mode [in]

    File permission to be assigned to file.

  • rc

    Function return code

Callers call graph
Callers of posix::mkdir_posix calls cluster_posix posix posix::mkdir mkdir posix::mkdir_posix mkdir_posix posix::mkdir->posix::mkdir_posix
Text view
function stat_posix(path, buf) result(rc) bind(c, name="stat")

C interface to POSIX stat() Users should use the Fortran-defined stat() function.

Parameters
  • path [in]

    Pathname of a POSIX file

  • buf [inout]

    Information describing the file if it exists

  • rc

    Function return code

Callers call graph
Callers of posix::stat_posix calls cluster_posix posix posix::stat stat posix::stat_posix stat_posix posix::stat->posix::stat_posix
Text view
function signal_posix(sig, func) result(handle) bind(c, name="signal")

C interface to POSIX signal() Users should use the Fortran-defined signal() function.

Parameters
  • sig [in]

    Signal to be configured

  • func [in]

    Function handle to be called when sig is raised

  • handle

    Prior handle for sig to be replaced by func

Callers call graph
Callers of posix::signal_posix calls cluster_posix posix posix::signal signal posix::signal_posix signal_posix posix::signal->posix::signal_posix
Text view
function kill_posix(pid, sig) result(rc) bind(c, name="kill")

C interface to POSIX kill() Users should use the Fortran-defined kill() function.

Parameters
  • pid [in]

    Process ID which is to receive the signal

  • sig [in]

    Signal to be sent to the process

  • rc

    Function return code

Callers call graph
Callers of posix::kill_posix calls cluster_posix posix posix::kill kill posix::kill_posix kill_posix posix::kill->posix::kill_posix
Text view
function getpid_posix() result(pid) bind(c, name="getpid")

C interface to POSIX getpid() Users should use the Fortran-defined getpid() function.

Parameters
  • pid

    Process ID of the current process.

Callers call graph
Callers of posix::getpid_posix calls cluster_posix posix posix::getpid getpid posix::getpid_posix getpid_posix posix::getpid->posix::getpid_posix
Text view
function getppid_posix() result(pid) bind(c, name="getppid")

C interface to POSIX getppid() Users should use the Fortran-defined getppid() function.

Parameters
  • pid

    Process ID of the parent process to the current process.

Callers call graph
Callers of posix::getppid_posix calls cluster_posix posix posix::getppid getppid posix::getppid_posix getppid_posix posix::getppid->posix::getppid_posix
Text view
function sleep_posix(seconds) result(rc) bind(c, name="sleep")

C interface to POSIX sleep() Users should use the Fortran-defined sleep() function.

Parameters
  • seconds [in]

    Number of real-time seconds which the thread should sleep

  • rc

    Function return code

Callers call graph
Callers of posix::sleep_posix calls cluster_posix posix posix::sleep sleep posix::sleep_posix sleep_posix posix::sleep->posix::sleep_posix
Text view
function setjmp(env) result(rc) bind(c, name="setjmp_missing")

Save the current program execution state to env.

This function creates a snapshot of the process state to env, which can be restored by calling longjmp. When setjmp is called, the function returns 0. When longjmp is later called, the program is restored to the point where setjmp was called, except it now returns a value (rc) as specified by longjmp.

Parameters
  • env [in]

    Current process state

  • rc

    Function return code; set to 0 if setjmp() was called, otherwise specified by the corresponding longjmp() call.

function sigsetjmp(env, savesigs) result(rc) bind(c, name="sigsetjmp_missing")

Save the current execution and ,optionally, the signal state to env.

This function creates a snapshot of the process state to env, which can be restored by calling longjmp. When setjmp is called, the function returns 0. When longjmp is later called, the program is restored to the point where setjmp was called, except it now returns a value (rc) as specified by longjmp.

If savesigs is set to a nonzero value, then the signal state is included in the program state.

Parameters
  • env [in]

    Current process state

  • savesigs [in]

    Flag to enable signal state when set to a nonzero value

  • rc

    Function return code; set to 0 if sigsetjmp() was called, otherwise specified by the corresponding siglongjmp() call.

Callers call graph
Callers of posix::sigsetjmp calls cluster_mom_unit_testing MOM_unit_testing cluster_posix posix mom_unit_testing::run_unit_test run_unit_test [private/internal] posix::sigsetjmp sigsetjmp mom_unit_testing::run_unit_test->posix::sigsetjmp
Text view
subroutine longjmp_posix(env, val) bind(c, name="longjmp_missing")

C interface to POSIX longjmp() Users should use the Fortran-defined longjmp() function.

Parameters
  • env [in]

    Process state to restore

  • val [in]

    Return code sent to setjmp()

Callers call graph
Callers of posix::longjmp_posix calls cluster_posix posix posix::longjmp longjmp posix::longjmp_posix longjmp_posix posix::longjmp->posix::longjmp_posix
Text view
subroutine siglongjmp_posix(env, val) bind(c, name="siglongjmp_missing")

C interface to POSIX siglongjmp() Users should use the Fortran-defined siglongjmp() function.

Parameters
  • env [in]

    Process state to restore

  • val [in]

    Return code sent to sigsetjmp()

Callers call graph
Callers of posix::siglongjmp_posix calls cluster_posix posix posix::siglongjmp siglongjmp posix::siglongjmp_posix siglongjmp_posix posix::siglongjmp->posix::siglongjmp_posix
Text view

Functions/Subroutine Documentation

function chmod(path, mode) result(rc)

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.

Callees call graph
Callees of posix::chmod calls cluster_posix posix posix::chmod chmod posix::chmod_posix chmod_posix posix::chmod->posix::chmod_posix
Text view
function mkdir(path, mode) result(rc)

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.

Callees call graph
Callees of posix::mkdir calls cluster_posix posix posix::mkdir mkdir posix::mkdir_posix mkdir_posix posix::mkdir->posix::mkdir_posix
Text view
Callers call graph
Callers of posix::mkdir calls cluster_mom_get_input MOM_get_input cluster_posix posix mom_get_input::get_mom_input get_MOM_input posix::mkdir mkdir mom_get_input::get_mom_input->posix::mkdir
Text view
function stat(path, buf) result(rc)

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

  • rc

    Function return code

Callees call graph
Callees of posix::stat calls cluster_posix posix posix::stat stat posix::stat_posix stat_posix posix::stat->posix::stat_posix
Text view
function signal(sig, func) result(handle)

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.

Callees call graph
Callees of posix::signal calls cluster_posix posix posix::signal signal posix::signal_posix signal_posix posix::signal->posix::signal_posix
Text view
function kill(pid, sig) result(rc)

Send signal sig to process pid.

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

Callees call graph
Callees of posix::kill calls cluster_posix posix posix::kill kill posix::kill_posix kill_posix posix::kill->posix::kill_posix
Text view
function getpid() result(pid)

Get the ID of the current process.

Callees call graph
Callees of posix::getpid calls cluster_posix posix posix::getpid getpid posix::getpid_posix getpid_posix posix::getpid->posix::getpid_posix
Text view
function getppid() result(pid)

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

Callees call graph
Callees of posix::getppid calls cluster_posix posix posix::getppid getppid posix::getppid_posix getppid_posix posix::getppid->posix::getppid_posix
Text view
Callers call graph
Callers of posix::getppid calls cluster_mom_error_handler MOM_error_handler cluster_posix posix mom_error_handler::disable_fatal_errors disable_fatal_errors posix::getppid getppid mom_error_handler::disable_fatal_errors->posix::getppid
Text view
function sleep(seconds) result(rc)

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.

Callees call graph
Callees of posix::sleep calls cluster_posix posix posix::sleep sleep posix::sleep_posix sleep_posix posix::sleep->posix::sleep_posix
Text view
subroutine 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.

Callees call graph
Callees of posix::longjmp calls cluster_posix posix posix::longjmp longjmp posix::longjmp_posix longjmp_posix posix::longjmp->posix::longjmp_posix
Text view
subroutine 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.

Callees call graph
Callees of posix::siglongjmp calls cluster_posix posix posix::siglongjmp siglongjmp posix::siglongjmp_posix siglongjmp_posix posix::siglongjmp->posix::siglongjmp_posix
Text view
Callers call graph
Callers of posix::siglongjmp calls cluster_mom_error_handler MOM_error_handler cluster_posix posix mom_error_handler::err_handler err_handler [private/internal] posix::siglongjmp siglongjmp mom_error_handler::err_handler->posix::siglongjmp
Text view
function setjmp_missing(env) result(rc) bind(c)

Placeholder function for a missing or unconfigured setjmp

Parameters
  • env [in]

    Current process state (unused)

  • rc

    Function return code (unused)

subroutine longjmp_missing(env, val) bind(c)

Placeholder function for a missing or unconfigured longjmp

Parameters
  • env [in]

    Current process state (unused)

  • val [in]

    Enable signal state flag (unused)

function sigsetjmp_missing(env, savesigs) result(rc) bind(c)

Placeholder function for a missing or unconfigured sigsetjmp

Parameters
  • env [in]

    Current process state (unused)

  • savesigs [in]

    Enable signal state flag (unused)

  • rc

    Function return code (unused)

subroutine siglongjmp_missing(env, val) bind(c)

Placeholder function for a missing or unconfigured siglongjmp

Parameters
  • env [in]

    Current process state (unused)

  • val [in]

    Enable signal state flag (unused)

API generated with Flint · Rendered from reStructuredText