


      OOOOPPPPEEEENNNN((((2222))))                     ((((UUUUNNNNIIIIXXXX 5555....0000))))                    OOOOPPPPEEEENNNN((((2222))))



      NNNNAAAAMMMMEEEE
           open - open for reading or writing

      SSSSYYYYNNNNTTTTAAAAXXXX
           ####iiiinnnncccclllluuuuddddeeee <<<<ffffccccnnnnttttllll....hhhh>>>>
           iiiinnnntttt ooooppppeeeennnn ((((ppppaaaatttthhhh,,,, ooooffffllllaaaagggg [ ,,,, mmmmooooddddeeee ] ))))
           cccchhhhaaaarrrr ****ppppaaaatttthhhh;;;;
           iiiinnnntttt ooooffffllllaaaagggg,,,, mmmmooooddddeeee;;;;

      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
           _P_a_t_h points to a path name naming a file.  _O_p_e_n opens a file
           descriptor for the named file and sets the file status flags
           according to the value of _o_f_l_a_g.  _O_f_l_a_g values are
           constructed by or-ing flags from the following list (only
           one of the first three flags below may be used):

           OOOO____RRRRDDDDOOOONNNNLLLLYYYY Open for reading only.

           OOOO____WWWWRRRROOOONNNNLLLLYYYY Open for writing only.

           OOOO____RRRRDDDDWWWWRRRR   Open for reading and writing.

           OOOO____NNNNDDDDEEEELLLLAAAAYYYY This flag may affect subsequent reads and writes.
                    See _r_e_a_d(2) and _w_r_i_t_e(2).

                    When opening a FIFO with O_RDONLY or O_WRONLY set:

                    If O_NDELAY is set:

                         An _o_p_e_n for reading-only will return without
                         delay.  An _o_p_e_n for writing-only will return
                         an error if no process currently has the file
                         open for reading.

                    If O_NDELAY is clear:

                         An _o_p_e_n for reading-only will block until a
                         process opens the file for writing.  An _o_p_e_n
                         for writing-only will block until a process
                         opens the file for reading.

                    When opening a file associated with a communication
                    line:

                    If O_NDELAY is set:

                         The open will return without waiting for
                         carrier.

                    If O_NDELAY is clear:

                         The open will block until carrier is present.



      Page 1                                                   (9010-E)






      OOOOPPPPEEEENNNN((((2222))))                     ((((UUUUNNNNIIIIXXXX 5555....0000))))                    OOOOPPPPEEEENNNN((((2222))))



           OOOO____AAAAPPPPPPPPEEEENNNNDDDD If set, the file pointer will be set to the end of
                    the file prior to each write.

           OOOO____CCCCRRRREEEEAAAATTTT  If the file exists, this flag has no effect.
                    Otherwise, the file's owner ID is set to the
                    process's effective user ID, the file's group ID is
                    set to the process's effective group ID, and the
                    low-order 12 bits of the file mode are set to the
                    value of _m_o_d_e modified as follows (see _c_r_e_a_t(2)):

                         All bits set in the process's file mode
                         creation mask are cleared.  See _u_m_a_s_k(2).

                         The ``save text image after execution bit'' of
                         the mode is cleared.  See _c_h_m_o_d(2).

           OOOO____TTTTRRRRUUUUNNNNCCCC  If the file exists, its length is truncated to 0
                    and the mode and owner are unchanged.

           OOOO____EEEEXXXXCCCCLLLL   If O_EXCL and O_CREAT are set, _o_p_e_n will fail if
                    the file exists.

           Upon successful completion a non-negative integer, the file
           descriptor, is returned.

           The file pointer used to mark the current position within
           the file is set to the beginning of the file.

           The new file descriptor is set to remain open across _e_x_e_c
           system calls.  See _f_c_n_t_l(2).

           No process may have more than 64 file descriptors open
           simultaneously.

           The named file is opened unless one or more of the following
           are true:

                A component of the path prefix is not a directory.
                [ENOTDIR]

                O_CREAT is not set and the named file does not exist.
                [ENOENT]

                A component of the path prefix denies search
                permission.  [EACCES]

                _O_f_l_a_g permission is denied for the named file.
                [EACCES]

                The named file is a directory and _o_f_l_a_g is write or
                read/write.  [EISDIR]




      Page 2                                                   (9010-E)






      OOOOPPPPEEEENNNN((((2222))))                     ((((UUUUNNNNIIIIXXXX 5555....0000))))                    OOOOPPPPEEEENNNN((((2222))))



                The named file resides on a read-only file system and
                _o_f_l_a_g is write or read/write.  [EROFS]

                Sixty-four (64) file descriptors are currently open.
                [EMFILE]

                The named file is a character special or block special
                file, and the device associated with this special file
                does not exist.  [ENXIO]

                The file is a pure procedure (shared text) file that is
                being executed and _o_f_l_a_g is write or read/write.
                [ETXTBSY]

                _P_a_t_h points outside the process's allocated address
                space.  [EFAULT]

                O_CREAT and O_EXCL are set, and the named file exists.
                [EEXIST]

                O_NDELAY is set, the named file is a FIFO, O_WRONLY is
                set, and no process has the file open for reading.
                [ENXIO]

      RRRREEEETTTTUUUURRRRNNNN VVVVAAAALLLLUUUUEEEE
           Upon successful completion, a non-negative integer, namely a
           file descriptor, is returned.  Otherwise, a value of -1 is
           returned and _e_r_r_n_o is set to indicate the error.

      SSSSEEEEEEEE AAAALLLLSSSSOOOO
           close(2), creat(2), dup(2), fcntl(2), lseek(2), read(2),
           write(2).























      Page 3                                                   (9010-E)



