Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ read(2) — sys5 — Apollo Domain/IX SR9.5

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

dup(2)

fcntl(2)

ioctl(2)

open(2)

pipe(2)



READ(2)                  DOMAIN/IX SYS5                   READ(2)



NAME
     read - read from file

USAGE
     int read(fildes, buf, nbyte)
     int fildes;
     char *buf;
     unsigned nbyte;


DESCRIPTION
     Fildes is a file descriptor obtained from a creat, open,
     dup, fcntl, or pipe system call.

     Read attempts to read nbyte bytes from the file associated
     with fildes into the buffer pointed to by buf.

     On devices capable of seeking, the read starts at a position
     in the file given by the file pointer associated with
     fildes.  Upon return from read, the file pointer is incre-
     mented by the number of bytes actually read.

     Devices that are incapable of seeking always read from the
     current position.  The value of a file pointer associated
     with such a file is undefined.

     Upon successful completion, read returns the number of bytes
     actually read and placed in the buffer; this number may be
     less than nbyte, if the file is associated with a communica-
     tion line (see ioctl(2)), or if the number of bytes left in
     the file is less than nbyte bytes.  The call returns a value
     of 0 when an end-of-file has been reached.

     When attempting to read from an empty pipe (or FIFO):

     ⊕  If O_NDELAY is set, the read will return a 0.

     ⊕  If O_NDELAY is clear, the read will block until data is
        written to the file or the file is no longer open for
        writing.

     When attempting to read a file associated with a tty that
     has no data currently available:

     ⊕  If O_NDELAY is set, the read will return a 0.

     ⊕  If O_NDELAY is clear, the read will block until data
        becomes available.





Printed 12/4/86                                            READ-1







READ(2)                  DOMAIN/IX SYS5                   READ(2)



RETURN VALUE
     A successful read returns a non-negative integer indicating
     the number of bytes actually read.  A failed call returns -1
     and sets errno as indicated below.

ERRORS
     Read will fail if one or more of the following is true:

     [EBADF]   Fildes is not a valid file descriptor open for
               reading.

     [EFAULT]  Buf points outside the allocated address space.

     [EINTR]   A signal was caught during the read system call.

RELATED INFORMATION
     creat(2) dup(2), fcntl(2), ioctl(2), open(2), pipe(2)




































READ-2                                            Printed 12/4/86





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026