Annotation of cci/usr/src/man/man2/fcntl.2, revision 1.1

1.1     ! root        1: .TH FCNTL 2 "18 July 1983"
        !             2: .UC 4
        !             3: .SH NAME
        !             4: fcntl \- file control
        !             5: .SH SYNOPSIS
        !             6: .nf
        !             7: .ft B
        !             8: #include <fcntl.h>
        !             9: .PP
        !            10: .ft B
        !            11: res = fcntl(fd, cmd, arg)
        !            12: int res;
        !            13: int fd, cmd, arg;
        !            14: .ft R
        !            15: .SH DESCRIPTION
        !            16: .I Fcntl
        !            17: provides for control over descriptors.
        !            18: The argument
        !            19: .I fd
        !            20: is a descriptor to be operated on by
        !            21: .I cmd
        !            22: as follows:
        !            23: .TP 15
        !            24: F_DUPFD
        !            25: Return a new descriptor as follows:
        !            26: .IP
        !            27: Lowest numbered available descriptor greater than or equal to
        !            28: .I arg.
        !            29: .IP
        !            30: Same object references as the original descriptor.
        !            31: .IP
        !            32: New descriptor shares the same file pointer if the object
        !            33: was a file.
        !            34: .IP
        !            35: Same access mode (read, write or read/write).
        !            36: .IP
        !            37: Same file status flags (i.e., both file descriptors
        !            38: share the same file status flags).
        !            39: .IP
        !            40: The close-on-exec flag associated with the new file descriptor
        !            41: is set to remain open across
        !            42: .IR execv (2)
        !            43: system calls.
        !            44: .TP 15
        !            45: F_GETFD
        !            46: Get the close-on-exec flag associated with the file descriptor
        !            47: .IR fd .
        !            48: If the low-order bit is 0, the file will remain open across
        !            49: .IR exec ,
        !            50: otherwise the file will be closed upon execution of
        !            51: .I exec.
        !            52: .TP 15
        !            53: F_SETFD
        !            54: Set the close-on-exec flag associated with
        !            55: .I fd
        !            56: to the low order bit of
        !            57: .I arg
        !            58: (0 or 1 as above).
        !            59: .TP 15
        !            60: F_GETFL
        !            61: Get descriptor status flags, as described below.
        !            62: .TP 15
        !            63: F_SETFL
        !            64: Set descriptor status flags.
        !            65: .TP 15
        !            66: F_GETOWN
        !            67: Get the process ID or process group
        !            68: currently receiving SIGIO and SIGURG
        !            69: signals; process groups are returned
        !            70: as negative values.
        !            71: .TP
        !            72: F_SETOWN
        !            73: Set the process or process group
        !            74: to receive SIGIO and SIGURG signals;
        !            75: process groups are specified by supplying
        !            76: .I arg
        !            77: as negative, otherwise 
        !            78: .I arg
        !            79: is interpreted as a process ID.
        !            80: .LP
        !            81: The flags for the F_GETFL and F_SETFL flags are as follows:
        !            82: .TP 15
        !            83: FNDELAY
        !            84: Non-blocking I/O; if no data is available to a
        !            85: .I read
        !            86: call, or if a write operation would block,
        !            87: the call returns -1 with the error EWOULDBLOCK.
        !            88: .TP
        !            89: FAPPEND
        !            90: Force each write to append at the end of file;
        !            91: corresponds to the O_APPEND flag of
        !            92: .IR open (2).
        !            93: .TP
        !            94: FASYNC
        !            95: Enable the SIGIO signal to be sent to the process group
        !            96: when I/O is possible, e.g.
        !            97: upon availability of data to be read.
        !            98: .SH "RETURN VALUE
        !            99: Upon successful completion, the value returned depends on
        !           100: .I cmd
        !           101: as follows:
        !           102: .sp .5v
        !           103: .nf
        !           104: .ta .25i 1.25i
        !           105:        F_DUPFD A new file descriptor.
        !           106:        F_GETFD Value of flag (only the low-order bit is defined).
        !           107:        F_GETFL Value of flags.
        !           108:        F_GETOWN        Value of file descriptor owner.
        !           109:        other   Value other than \-1.
        !           110: .fi
        !           111: .sp .5v
        !           112: Otherwise, a value of \-1 is returned and
        !           113: .I errno
        !           114: is set to indicate the error.
        !           115: .SH ERRORS
        !           116: .I Fcntl
        !           117: will fail if one or more of the following are true:
        !           118: .TP 15
        !           119: [EBADF]
        !           120: .I Fildes
        !           121: is not a valid open file descriptor.
        !           122: .TP 15
        !           123: [EMFILE]
        !           124: .I Cmd
        !           125: is F_DUPFD and the maximum allowed number of file descriptors are currently
        !           126: open.
        !           127: .TP 15
        !           128: [EINVAL]
        !           129: .I Cmd
        !           130: is F_DUPFD and
        !           131: .I arg
        !           132: is negative or greater the maximum allowable number
        !           133: (see
        !           134: .IR getdtablesize (2)).
        !           135: .SH "SEE ALSO
        !           136: close(2), execve(2), getdtablesize(2), open(2), sigvec(2)
        !           137: .SH BUGS
        !           138: The asynchronous I/O facilities of FNDELAY and FASYNC
        !           139: are currently available only for tty operations.
        !           140: No SIGIO signal is sent upon draining of output sufficiently
        !           141: for non-blocking writes to occur.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.