home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / gnu / ixemul-39.47-env-bin.lha / man / cat2 / fcntl.0 < prev    next >
Text File  |  1993-12-07  |  4KB  |  133 lines

  1.  
  2. FCNTL(2)                   UNIX Programmer's Manual                   FCNTL(2)
  3.  
  4. NNAAMMEE
  5.      ffccnnttll - file control
  6.  
  7. SSYYNNOOPPSSIISS
  8.      ##iinncclluuddee <<ssyyss//ffccnnttll..hh>>
  9.  
  10.      _i_n_t
  11.      ffccnnttll(_i_n_t _f_d, _i_n_t _c_m_d, _i_n_t _a_r_g)
  12.  
  13. DDEESSCCRRIIPPTTIIOONN
  14.      FFccnnttll() provides for control over descriptors.  The argument _f_d is a de­
  15.      scriptor to be operated on by _c_m_d as follows:
  16.  
  17.      F_DUPFD    Return a new descriptor as follows:
  18.  
  19.                     oo   Lowest numbered available descriptor greater than or
  20.                         equal to _a_r_g.
  21.                     oo   Same object references as the original descriptor.
  22.                     oo   New descriptor shares the same file offset if the ob­
  23.                         ject was a file.
  24.                     oo   Same access mode (read, write or read/write).
  25.                     oo   Same file status flags (i.e., both file descriptors
  26.                         share the same file status flags).
  27.                     oo   The close­on­exec flag associated with the new file
  28.                         descriptor is set to remain open across execv(2) sys­
  29.                         tem calls.
  30.  
  31.      F_GETFD    Get the close­on­exec flag associated with the file descriptor
  32.                 _f_d. If the low­order bit of the returned value is 0, the file
  33.                 will remain open across eexxeecc(), otherwise the file will be
  34.                 closed upon execution of eexxeecc() (_a_r_g is ignored).
  35.  
  36.      F_SETFD    Set the close­on­exec flag associated with _f_d to the low order
  37.                 bit of _a_r_g (0 or 1 as above).
  38.  
  39.      F_GETFL    Get descriptor status flags, as described below (_a_r_g is ig­
  40.                 nored).
  41.  
  42.      F_SETFL    Set descriptor status flags to _a_r_g.
  43.  
  44.      F_GETOWN   Get the process ID or process group currently receiving SIGIO
  45.                 and SIGURG signals; process groups are returned as negative
  46.                 values (_a_r_g is ignored).
  47.  
  48.      F_SETOWN   Set the process or process group to receive SIGIO and SIGURG
  49.                 signals; process groups are specified by supplying _a_r_g as neg­
  50.                 ative, otherwise _a_r_g is interpreted as a process ID.
  51.  
  52.      The flags for the F_GETFL and F_SETFL flags are as follows:
  53.  
  54.      O_NDELAY   Non­blocking I/O; if no data is available to a read call, or
  55.                 if a write operation would block, the read or write call re­
  56.                 turns ­1 with the error EWOULDBLOCK.
  57.  
  58.      O_APPEND   Force each write to append at the end of file; corresponds to
  59.                 the O_APPEND flag of open(2).
  60.  
  61.      O_ASYNC    Enable the SIGIO signal to be sent to the process group when
  62.                 I/O is possible, e.g., upon availability of data to be read.
  63.  
  64. RREETTUURRNN VVAALLUUEESS
  65.      Upon successful completion, the value returned depends on _c_m_d as follows:
  66.  
  67.  
  68.            F_DUPFD    A new file descriptor.
  69.  
  70.            F_GETFD    Value of flag (only the low­order bit is defined).
  71.  
  72.            F_GETFL    Value of flags.
  73.  
  74.            F_GETOWN   Value of file descriptor owner.
  75.  
  76.            other      Value other than ­1.
  77.  
  78.      Otherwise, a value of ­1 is returned and _e_r_r_n_o is set to indicate the er­
  79.      ror.
  80.  
  81. EERRRROORRSS
  82.      FFccnnttll() will fail if:
  83.  
  84.      [EBADF]       _F_i_l_d_e_s is not a valid open file descriptor.
  85.  
  86.      [EMFILE]      _C_m_d is F_DUPFD and the maximum allowed number of file de­
  87.                    scriptors are currently open.
  88.  
  89.      [EINVAL]      _C_m_d is F_DUPFD and _a_r_g is negative or greater than the max­
  90.                    imum allowable number (see getdtablesize(2)).
  91.  
  92.      [ESRCH]       _C_m_d is F_SETOWN and the process ID given as argument is not
  93.                    in use.
  94.  
  95. SSEEEE AALLSSOO
  96.      close(2),  execve(2),  getdtablesize(2),  open(2),  sigvec(2)
  97.  
  98. BBUUGGSS
  99.      The asynchronous I/O facilities of FNDELAY and FASYNC are currently
  100.      available only for tty and socket operations.
  101.  
  102. HHIISSTTOORRYY
  103.      The ffccnnttll function call appeared in 4.2BSD.
  104.  
  105. 4.2 Berkeley Distribution       March 10, 1991                               2
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.