HELPLIB.HLB  —  CRTL  fcntl  Return Values
    n                  Upon successful completion, the value returned
                       depends on the value of the request argument
                       as follows:

                       o  F_DUPFD - Returns a new file descriptor.

                       o  F_GETFD - Returns FD_CLOEXEC or 0.

                       o  F_SETFD, F_GETLK, F_SETLK, F_UNLCK - Return
                          a value other than -1.

    -1                 Indicates that an error occurred. The function
                       sets errno to one of the following values:

                       o  EACCES - The request argument is F_SETLK;
                          the type of lock (l_type) is a shared (F_
                          RDLCK) or exclusive (F_WRLCK) lock, and the
                          segment of a file to be locked is already
                          exclusive-locked by another process; or
                          the type is an exclusive (F_WRLCK) lock and
                          the some portion of the segment of a file
                          to be locked is already shared-locked or
                          exclusive-locked by another process.

                       o  EBADF - The file_desc argument is not a
                          valid open file descriptor and the arg
                          argument is negative or greater than or
                          equal to the per-process limit.

                          The request parameter is F_SETLK or F_
                          SETLKW, the type of lock (l_type) is a
                          shared lock (F_RDLCK), and file_desc is not
                          a valid file descriptor open for reading.

                          The type of lock (l_type) is an exclusive
                          lock (F_WRLCK), and file_desc is not a
                          valid file descriptor open for writing.

                       o  EFAULT - The arg argument is an invalid
                          address.

                       o  EINVAL - The request argument is F_DUPFD
                          and arg is negative or greater than or
                          equal to OPEN_MAX.

                          Either the OPEN_MAX value or the per-
                          process soft descriptor limit is checked.

                          An illegal value was provided for the
                          request argument.

                          The request argument is F_GETLK, F_SETLK,
                          or F_SETLKW and the data pointed to by arg
                          is invalid, or file_desc refers to a file
                          that does not support locking.

                       o  EMFILE - The request argument is F_DUPFD
                          and too many or OPEN_MAX file descriptors
                          are currently open in the calling process,
                          or no file descriptors greater than or
                          equal to arg are available.

                          Either the OPEN_MAX value or the per-
                          process soft descriptor limit is checked.

                       o  EOVERFLOW - One of the values to be
                          returned cannot be represented correctly.

                          The request argument is F_GETLK, F_SETLK,
                          or F_SETLKW and the smallest or, if l_
                          len is nonzero, the largest offset of any
                          byte in the requested segment cannot be
                          represented correctly in an object of type
                          off_t.

                       o  EINTR - The request argument is F_SETLKW,
                          and the function was interrupted by a
                          signal.

                       o  ENOLCK - The request argument is F_SETLK or
                          F_SETLKW, and satisfying the lock or unlock
                          request would exceed the configurable
                          system limit of NLOCK_RECORD.

                       o  ENOMEM - The system was unable to allocate
                          memory for the requested file descriptor.
Close Help