Annotation of 43BSDReno/lib/libc/sys/fcntl.2, revision 1.1

1.1     ! root        1: .\" Copyright (c) 1983 The Regents of the University of California.
        !             2: .\" All rights reserved.
        !             3: .\"
        !             4: .\" Redistribution and use in source and binary forms are permitted provided
        !             5: .\" that: (1) source distributions retain this entire copyright notice and
        !             6: .\" comment, and (2) distributions including binaries display the following
        !             7: .\" acknowledgement:  ``This product includes software developed by the
        !             8: .\" University of California, Berkeley and its contributors'' in the
        !             9: .\" documentation or other materials provided with the distribution and in
        !            10: .\" all advertising materials mentioning features or use of this software.
        !            11: .\" Neither the name of the University nor the names of its contributors may
        !            12: .\" be used to endorse or promote products derived from this software without
        !            13: .\" specific prior written permission.
        !            14: .\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
        !            15: .\" WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
        !            16: .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
        !            17: .\"
        !            18: .\"    @(#)fcntl.2     6.6 (Berkeley) 6/23/90
        !            19: .\"
        !            20: .TH FCNTL 2 "June 23, 1990"
        !            21: .UC 5
        !            22: .SH NAME
        !            23: fcntl \- file control
        !            24: .SH SYNOPSIS
        !            25: .nf
        !            26: .ft B
        !            27: #include <fcntl.h>
        !            28: .PP
        !            29: .ft B
        !            30: res = fcntl(fd, cmd, arg)
        !            31: int res;
        !            32: int fd, cmd, arg;
        !            33: .ft R
        !            34: .SH DESCRIPTION
        !            35: .I Fcntl
        !            36: provides for control over descriptors.
        !            37: The argument
        !            38: .I fd
        !            39: is a descriptor to be operated on by
        !            40: .I cmd
        !            41: as follows:
        !            42: .TP 15
        !            43: F_DUPFD
        !            44: Return a new descriptor as follows:
        !            45: .IP
        !            46: Lowest numbered available descriptor greater than or equal to
        !            47: .I arg.
        !            48: .IP
        !            49: Same object references as the original descriptor.
        !            50: .IP
        !            51: New descriptor shares the same file pointer if the object
        !            52: was a file.
        !            53: .IP
        !            54: Same access mode (read, write or read/write).
        !            55: .IP
        !            56: Same file status flags (i.e., both file descriptors
        !            57: share the same file status flags).
        !            58: .IP
        !            59: The close-on-exec flag associated with the new file descriptor
        !            60: is set to remain open across
        !            61: .IR execv (2)
        !            62: system calls.
        !            63: .TP 15
        !            64: F_GETFD
        !            65: Get the close-on-exec flag associated with the file descriptor
        !            66: .IR fd .
        !            67: If the low-order bit is 0, the file will remain open across
        !            68: .IR exec ,
        !            69: otherwise the file will be closed upon execution of
        !            70: .I exec.
        !            71: .TP 15
        !            72: F_SETFD
        !            73: Set the close-on-exec flag associated with
        !            74: .I fd
        !            75: to the low order bit of
        !            76: .I arg
        !            77: (0 or 1 as above).
        !            78: .TP 15
        !            79: F_GETFL
        !            80: Get descriptor status flags, as described below.
        !            81: .TP 15
        !            82: F_SETFL
        !            83: Set descriptor status flags.
        !            84: .TP 15
        !            85: F_GETOWN
        !            86: Get the process ID or process group
        !            87: currently receiving SIGIO and SIGURG
        !            88: signals; process groups are returned
        !            89: as negative values.
        !            90: .TP
        !            91: F_SETOWN
        !            92: Set the process or process group
        !            93: to receive SIGIO and SIGURG signals;
        !            94: process groups are specified by supplying
        !            95: .I arg
        !            96: as negative, otherwise 
        !            97: .I arg
        !            98: is interpreted as a process ID.
        !            99: .LP
        !           100: The flags for the F_GETFL and F_SETFL flags are as follows:
        !           101: .TP 15
        !           102: FNDELAY
        !           103: Non-blocking I/O; if no data is available to a
        !           104: .I read
        !           105: call, or if a write operation would block,
        !           106: the call returns -1 with the error EWOULDBLOCK.
        !           107: .TP
        !           108: FAPPEND
        !           109: Force each write to append at the end of file;
        !           110: corresponds to the O_APPEND flag of
        !           111: .IR open (2).
        !           112: .TP
        !           113: FASYNC
        !           114: Enable the SIGIO signal to be sent to the process group
        !           115: when I/O is possible, e.g.,
        !           116: upon availability of data to be read.
        !           117: .SH "RETURN VALUE
        !           118: Upon successful completion, the value returned depends on
        !           119: .I cmd
        !           120: as follows:
        !           121: .sp .5v
        !           122: .nf
        !           123: .ta .25i 1.25i
        !           124:        F_DUPFD A new file descriptor.
        !           125:        F_GETFD Value of flag (only the low-order bit is defined).
        !           126:        F_GETFL Value of flags.
        !           127:        F_GETOWN        Value of file descriptor owner.
        !           128:        other   Value other than \-1.
        !           129: .fi
        !           130: .sp .5v
        !           131: Otherwise, a value of \-1 is returned and
        !           132: .I errno
        !           133: is set to indicate the error.
        !           134: .SH ERRORS
        !           135: .I Fcntl
        !           136: will fail if one or more of the following are true:
        !           137: .TP 15
        !           138: [EBADF]
        !           139: .I Fildes
        !           140: is not a valid open file descriptor.
        !           141: .TP 15
        !           142: [EMFILE]
        !           143: .I Cmd
        !           144: is F_DUPFD and the maximum allowed number of file descriptors are currently
        !           145: open.
        !           146: .TP 15
        !           147: [EINVAL]
        !           148: .I Cmd
        !           149: is F_DUPFD and
        !           150: .I arg
        !           151: is negative or greater than the maximum allowable number
        !           152: (see
        !           153: .IR getdtablesize (2)).
        !           154: .TP 15
        !           155: [ESRCH]
        !           156: .I Cmd
        !           157: is F_SETOWN and
        !           158: the process ID given as argument is not in use.
        !           159: .SH "SEE ALSO
        !           160: close(2), execve(2), getdtablesize(2), open(2), sigvec(2)
        !           161: .SH BUGS
        !           162: The asynchronous I/O facilities of FNDELAY and FASYNC
        !           163: are currently available only for tty and socket operations.

unix.superglobalmegacorp.com

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