pxffcntl

Date:

10-20-2011

NAME

PXFFCNTL - Provides a subset of fcntl functionality, except the third argument is always an integer

SYNOPSIS

INTEGER ifildes, icmd, iargin, iargout, ierror
CALL PXFFCNTL (ifildes, icmd, iargin, iargout, ierror)

IMPLEMENTATION

Cray Linux Environment (CLE)

DESCRIPTION

The PXFFNCTL() subroutine provides a subset of the functionality of fcntl(2), except that the third argument is always an integer.

When using the Cray Fortran compiler, all arguments must be of default kind unless documented otherwise. The default kind is KIND=4 for integer, real, complex, and logical arguments.

The arguments for PXFFNCTL() are:

ifildes

An open file descriptor. ifildes is an input integer variable.

icmd

An input integer variable. Specifies the action for fcntl to perform, as described on the fcntl(2) man page. The constant values for use in specifying icmd are available through calls to PXFCONST(). The following values are currently supported for icmd:

F_DUPFD
F_GETFD
F_GETFL
F_GETLK
F_SETFD
F_SETFL
F_SETLK
F_SETLKW
iargin

An input integer variable. As described below, iargin may also be an output variable. iargin can be a handle for an instance of the flock structure or an integer, depending on the argument icmd under the conditions defined in POSIX.1.

  • If icmd is F_GETLK, F_SETLK, or F_SETLKW, then iargin is a handle for an instance of the flock structure. This handle should be created by a call to the PXFSTRUCTCREATE() subroutine, with the string flock given as the STRUCTNAME argument. The components are then accessed with the subroutines PXFINTSET() and PXFINTGET(), as shown following:

          Components for flock structure
---------------------------------------------------------
 Posix.1                  Structure procedures used to
component   COMPNAM       access
---------------------------------------------------------
 l_type     l_type        PXFINTGET, PXFINTSET
 l_whence   l_whence      PXFINTGET, PXFINTSET
 l_start    l_start       PXFINTGET, PXFINTSET
 l_len      l_len         PXFINTGET, PXFINTSET
 l_pid      l_pid         PXFINTGET, PXFINTSET
---------------------------------------------------------

If icmd is F_GETLK, the retrieved information overwrites the information described in the handle used as the iargin argument.

iargout

An output integer variable. The value returned in iargout depends on the icmd argument. See fcntl() for more information.

ierror

An output integer variable. It contains the exit status.

EXIT STATUS

Upon successful completion of PXFFCNTL(), the argument ierror is set to 0. If any of the following conditions occur, ierror is set to the corresponding value:

EINVAL

icmd is not valid.

EINVAL

icmd is F_GETLK, F_SETLK, or F_SETLKW and iargin is not a valid handle.

errno

The fcntl(2) system call failed.

EBADHANDLE

iargin, when icmd is F_GETLK, F_SETLK, or F_SETLKW, is an invalid handle or has an incorrect handle type for this routine.

SEE ALSO

fcntl(2)

PXFCONST(3F), PXFINTGET(3F), PXFINTSET(3F)