Annotation of cci/usr/src/man/man2/write.2, revision 1.1.1.1

1.1       root        1: .TH WRITE 2 "27 July 1983"
                      2: .UC 4
                      3: .SH NAME
                      4: write, writev \- write on a file
                      5: .SH SYNOPSIS
                      6: .nf
                      7: .ft B
                      8: write(d, buf, nbytes)
                      9: int d;
                     10: char *buf;
                     11: int nbytes;
                     12: .PP
                     13: .ft B
                     14: #include <sys/types.h>
                     15: #include <sys/uio.h>
                     16: .PP
                     17: .ft B
                     18: writev(d, iov, ioveclen)
                     19: int d;
                     20: struct iovec *iov;
                     21: int ioveclen;
                     22: .fi
                     23: .SH DESCRIPTION
                     24: .I Write
                     25: attempts to write
                     26: .I nbytes
                     27: of data to the object referenced by the descriptor
                     28: .I d
                     29: from the buffer pointed to by
                     30: .IR buf .
                     31: .I Writev
                     32: performs the same action, but gathers the output data
                     33: from the \fIiovlen\fP buffers specified by the members
                     34: of the \fIiovec\fP array: iov[0], iov[1], etc.
                     35: .PP
                     36: On objects capable of seeking, the \fIwrite\fP starts at a position
                     37: given by the pointer associated with
                     38: .IR d ,
                     39: see
                     40: .IR lseek (2).
                     41: Upon return from
                     42: .IR write ,
                     43: the pointer is incremented by the number of bytes actually written.
                     44: .PP
                     45: Objects that are not capable of seeking always write from the current
                     46: position.  The value of the pointer associated with such an object
                     47: is undefined.
                     48: .PP
                     49: If the real user is not the super-user, then
                     50: .I write
                     51: clears the set-user-id bit on a file.
                     52: This prevents penetration of system security
                     53: by a user who
                     54: \*(lqcaptures\*(rq a writable set-user-id file
                     55: owned by the super-user.
                     56: .SH "RETURN VALUE
                     57: Upon successful completion the number of bytes actually writen
                     58: is returned.  Otherwise a \-1 is returned and
                     59: .I errno
                     60: is set to indicate the error.
                     61: .SH ERRORS
                     62: .I Write
                     63: will fail and the file pointer will remain unchanged if one or more
                     64: of the following are true:
                     65: .TP 15
                     66: [EBADF]
                     67: \fID\fP is not a valid descriptor open for writing.
                     68: .TP 15
                     69: [EPIPE]
                     70: An attempt is made to write to a pipe that is not open
                     71: for reading by any process.
                     72: .TP 15
                     73: [EPIPE]
                     74: An attempt is made to write to a socket of type SOCK_STREAM
                     75: which is not connected to a peer socket.
                     76: .TP 15
                     77: [EFBIG]
                     78: An attempt was made to write a file that exceeds the process's
                     79: file size limit or the maximum file size.
                     80: .TP 15
                     81: [EFAULT]
                     82: Part of \fIiov\fP or data to be written to the file
                     83: points outside the process's allocated address space.
                     84: .SH "SEE ALSO"
                     85: lseek(2), open(2), pipe(2)

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.