1 .\" Copyright (c) 1980 Regents of the University of California.
2 .\" All rights reserved. The Berkeley software License Agreement
3 .\" specifies the terms and conditions for redistribution.
5 .\" @(#)write.2 6.5 (Berkeley) 5/14/86
7 .TH WRITE 2 "May 14, 1986"
14 #include <sys/types.h>
17 ssize_t write(int \fId\fP, const void *\fIbuf\fP, size_t \fInbytes\fP)
23 of data to the object referenced by the descriptor
25 from the buffer pointed to by
28 On objects capable of seeking, the \fBwrite\fP starts at a position
29 given by the pointer associated with
35 the pointer is incremented by the number of bytes actually written.
37 Objects that are not capable of seeking always write from the current
38 position. The value of the pointer associated with such an object
41 When using non-blocking I/O on objects such as TCP/IP channels that are
42 subject to flow control,
44 may write fewer bytes than requested;
45 the return value must be noted,
46 and the remainder of the operation should be retried when possible.
48 Upon successful completion the number of bytes actually written
49 is returned. Otherwise a \-1 is returned and the global variable
51 is set to indicate the error.
54 will fail and the file pointer will remain unchanged if one or more
55 of the following are true:
58 \fID\fP is not a valid descriptor open for writing.
61 An attempt is made to write to a pipe that is not open
62 for reading by any process.
65 An attempt is made to write to a TCP channel
66 that is not connected to a peer socket.
69 An attempt was made to write a file that exceeds the process's
70 file size limit or the maximum file size.
73 Part of the data to be written to the file
74 points outside the process's allocated address space.
77 There is no free space remaining on the file system
82 The user's quota of disk blocks on the file system
83 containing the file has been exhausted.
87 An I/O error occurred while reading from or writing to the file system.
90 The file was marked for non-blocking I/O,
91 and no data could be written immediately.