


      FFFFCCCCNNNNTTTTLLLL((((2222))))                    ((((UUUUNNNNIIIIXXXX 5555....0000))))                   FFFFCCCCNNNNTTTTLLLL((((2222))))



      NNNNAAAAMMMMEEEE
           fcntl - file control

      SSSSYYYYNNNNTTTTAAAAXXXX
           ####iiiinnnncccclllluuuuddddeeee <<<<ffffccccnnnnttttllll....hhhh>>>>

           iiiinnnntttt ffffccccnnnnttttllll ((((ffffiiiillllddddeeeessss,,,, ccccmmmmdddd,,,, aaaarrrrgggg))))
           iiiinnnntttt ffffiiiillllddddeeeessss,,,, ccccmmmmdddd,,,, aaaarrrrgggg;;;;

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _F_c_n_t_l provides for control over open files.  _F_i_l_d_e_s is an
           open file descriptor obtained from a _c_r_e_a_t, _o_p_e_n, _d_u_p, or
           _f_c_n_t_l.  system call.

           The _c_m_ds available are:

           F_DUPFDReturn a new file descriptor as follows:

                  Lowest numbered available file descriptor greater
                  than or equal to _a_r_g.

                  Same open file as the original file.

                  Same file pointer as the original file (i.e., both
                  file descriptors share one file pointer).

                  Same access mode (read, write or read/write).

                  Same file status flags (i.e., both file descriptors
                  share the same file status flags).

                  The close-on-exec flag associated with the new file
                  descriptor is set to remain open across _e_x_e_c(2)
                  system calls.

           F_GETFDGet the close-on-exec flag associated with the file
                  descriptor _f_i_l_d_e_s.  If the low-order bit is 0000 the
                  file will remain open across _e_x_e_c, otherwise the file
                  will be closed upon execution of _e_x_e_c.

           F_SETFDSet the close-on-exec flag associated with _f_i_l_d_e_s to
                  the low-order bit of _a_r_g (0000 or 1111 as above).

           F_GETFLGet _f_i_l_e status flags.

           F_SETFLSet _f_i_l_e status flags to _a_r_g.  Only certain flags can
                  be set; see _f_c_n_t_l(5).

           _F_c_n_t_l will fail if one or more of the following are true:

                _F_i_l_d_e_s is not a valid open file descriptor.  [EBADF]




      Page 1                                                   (9010-E)






      FFFFCCCCNNNNTTTTLLLL((((2222))))                    ((((UUUUNNNNIIIIXXXX 5555....0000))))                   FFFFCCCCNNNNTTTTLLLL((((2222))))



                _C_m_d is F_DUPFD and 64 file descriptors are currently
                open.  [EMFILE]

                _C_m_d is F_DUPFD and _a_r_g is negative or greater than 64.
                [EINVAL]

      RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
           Upon successful completion, the value returned depends on
           _c_m_d as follows:
                F_DUPFDA new file descriptor.
                F_GETFDValue of flag (only the low-order bit is
                       defined).
                F_SETFDValue other than -1.
                F_GETFLValue of file flags.
                F_SETFLValue other than -1.
           Otherwise, a value of -1 is returned and _e_r_r_n_o is set to
           indicate the error.

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           close(2), dup(2), dup2(2), exec(2), open(2), fcntl(5).



































      Page 2                                                   (9010-E)



