Minix Man Pages

Man Page or Keyword Search:
Man Architecture
Apropos Keyword Search (all sections) Output format
home | help
WRITE(2)                      System Calls Manual                     WRITE(2)

NAME
       write - write output

SYNOPSIS
       #include <sys/types.h>
       #include <unistd.h>

       ssize_t write(int d, const void *buf, size_t nbytes)

DESCRIPTION
       Write  attempts to write nbytes of data to the object referenced by the
       descriptor d from the buffer pointed to by buf.

       On objects capable of seeking, the write starts at a position given  by
       the  pointer  associated with d, see lseek(2).  Upon return from write,
       the pointer is incremented by the number of bytes actually written.

       Objects that are not capable of seeking always write from  the  current
       position.   The  value of the pointer associated with such an object is
       undefined.

       When using non-blocking I/O on objects such as TCP/IP channels that are
       subject  to  flow  control, write may write fewer bytes than requested;
       the return value must be noted, and  the  remainder  of  the  operation
       should be retried when possible.

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

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

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

       [EPIPE]        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 TCP channel that is not
                      connected to a peer socket.

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

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

       [ENOSPC]       There is no free space  remaining  on  the  file  system
                      containing the file.

       [EIO]          An  I/O  error occurred while reading from or writing to
                      the file system.

       [EAGAIN]       The file was marked for non-blocking I/O,  and  no  data
                      could be written immediately.

SEE ALSO
       fcntl(2), lseek(2), open(2), pipe(2), read(2).

4th Berkeley Distribution        May 14, 1986                         WRITE(2)

NAME | SYNOPSIS | DESCRIPTION | RETURN VALUE | ERRORS | SEE ALSO