Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ writev(2) — A/UX 0.7

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

creat(2)

lseek(2)

open(2)

pipe(2)

socket(2N)

ulimit(2)



     write(2)                                                 write(2)



     NAME
          write, writev - write on a file

     SYNOPSIS
          int write (fildes, buf, nbytes)
          int fildes;
          char *buf;
          unsigned nbytes;

          #include <sys/types.h>
          #include <sys/uio.h>

          writev(d, iov, ioveclen)
          int d;
          struct iovec *iov;
          int ioveclen;

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

          write attempts to write nbytes bytes from the buffer pointed
          to by buf to the file associated with the fildes.  writev
          performs the same action, but gathers the output data from
          the iovlen buffers specified by the members of the iovec
          array: iov[0], iov[1], etc.

          On devices capable of seeking, the actual writing of data
          proceeds from the position in the file indicated by the file
          pointer.  Upon return from write, the file pointer is
          incremented by the number of bytes actually written.

          On devices incapable of seeking, writing always takes place
          starting at the current position.  The value of a file
          pointer associated with such a device is undefined.

          If the OAPPEND flag of the file status flags is set, the
          file pointer will be set to the end of the file prior to
          each write.

          write will fail and the file pointer will remain unchanged
          if one or more of the following are true:

          [EBADF]   fildes is not a valid file descriptor open for
                    writing.

          [EPIPE] and IGPIPE] signal
                    An attempt is made to write to a pipe that is not
                    open for reading by any process.

          [EPIPE]   An attempt is made to write to a pipe that is not
                    open for reading by any process.



     Page 1                                        (last mod. 1/14/87)





     write(2)                                                 write(2)



          [EFBIG]   An attempt was made to write a file that exceeds
                    the process's file size limit or the maximum file
                    size.  See ulimit(2).

          [EFAULT]  Part of iov or data to be written to the file
                    points outside the process's allocated address
                    space.

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

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

          If a write requests that more bytes be written than there is
          room for (e.g., the ulimit (see ulimit(2)) or the physical
          end of a medium), only as many bytes as there is room for
          will be written.  For example, suppose there is space for 20
          bytes more in a file before reaching a limit.  A write of
          512  bytes will return 20.  The next write of a non-zero
          number of bytes will give a failure return (except as noted
          below).

          If the file being written is a pipe (or FIFO) and the
          ONDELAY flag of the file flag word is set, then write to a
          full pipe (or FIFO) will return a count of 0.  Otherwise
          (ONDELAY clear), writes to a full pipe (or FIFO) will block
          until space becomes available.

     RETURN VALUE
          Upon successful completion the number of bytes actually
          written is returned.  Otherwise, -1 is returned and errno is
          set to indicate the error.

     SEE ALSO
          creat(2), lseek(2), open(2), pipe(2), socket(2N), ulimit(2).




















     Page 2                                        (last mod. 1/14/87)



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