version 1, including all changes.
.
| Rev |
Author |
# |
Line |
| 1 |
perry |
1 |
WRITE |
| |
|
2 |
!!!WRITE |
| |
|
3 |
NAME |
| |
|
4 |
SYNOPSIS |
| |
|
5 |
DESCRIPTION |
| |
|
6 |
RETURN VALUE |
| |
|
7 |
ERRORS |
| |
|
8 |
CONFORMING TO |
| |
|
9 |
SEE ALSO |
| |
|
10 |
---- |
| |
|
11 |
!!NAME |
| |
|
12 |
|
| |
|
13 |
|
| |
|
14 |
write - write to a file descriptor |
| |
|
15 |
!!SYNOPSIS |
| |
|
16 |
|
| |
|
17 |
|
| |
|
18 |
__#include __ |
| |
|
19 |
|
| |
|
20 |
|
| |
|
21 |
__ssize_t write(int__ ''fd''__, const void |
| |
|
22 |
*__''buf''__, size_t__ |
| |
|
23 |
''count''__);__ |
| |
|
24 |
!!DESCRIPTION |
| |
|
25 |
|
| |
|
26 |
|
| |
|
27 |
__write__ writes up to ''count'' bytes to the file |
| |
|
28 |
referenced by the file descriptor ''fd'' from the buffer |
| |
|
29 |
starting at ''buf.'' POSIX requires that a __read()__ |
| |
|
30 |
which can be proved to occur after a __write()__ has |
| |
|
31 |
returned returns the new data. Note that not all file |
| |
|
32 |
systems are POSIX conforming. |
| |
|
33 |
!!RETURN VALUE |
| |
|
34 |
|
| |
|
35 |
|
| |
|
36 |
On success, the number of bytes written are returned (zero |
| |
|
37 |
indicates nothing was written). On error, -1 is returned, |
| |
|
38 |
and ''errno'' is set appropriately. If ''count'' is |
| |
|
39 |
zero and the file descriptor refers to a regular file, 0 |
| |
|
40 |
will be returned without causing any other effect. For a |
| |
|
41 |
special file, the results are not portable. |
| |
|
42 |
!!ERRORS |
| |
|
43 |
|
| |
|
44 |
|
| |
|
45 |
__EBADF__ |
| |
|
46 |
|
| |
|
47 |
|
| |
|
48 |
''fd'' is not a valid file descriptor or is not open for |
| |
|
49 |
writing. |
| |
|
50 |
|
| |
|
51 |
|
| |
|
52 |
__EINVAL__ |
| |
|
53 |
|
| |
|
54 |
|
| |
|
55 |
''fd'' is attached to an object which is unsuitable for |
| |
|
56 |
writing. |
| |
|
57 |
|
| |
|
58 |
|
| |
|
59 |
__EFAULT__ |
| |
|
60 |
|
| |
|
61 |
|
| |
|
62 |
''buf'' is outside your accessible address |
| |
|
63 |
space. |
| |
|
64 |
|
| |
|
65 |
|
| |
|
66 |
__EFBIG__ |
| |
|
67 |
|
| |
|
68 |
|
| |
|
69 |
An attempt was made to write a file that exceeds the |
| |
|
70 |
implementation-defined maximum file size or the process' |
| |
|
71 |
file size limit, or to write at a position past than the |
| |
|
72 |
maximum allowed offset. |
| |
|
73 |
|
| |
|
74 |
|
| |
|
75 |
__EPIPE__ |
| |
|
76 |
|
| |
|
77 |
|
| |
|
78 |
''fd'' is connected to a pipe or socket whose reading end |
| |
|
79 |
is closed. When this happens the writing process will |
| |
|
80 |
receive a __SIGPIPE__ signal; if it catches, blocks or |
| |
|
81 |
ignores this the error __EPIPE__ is |
| |
|
82 |
returned. |
| |
|
83 |
|
| |
|
84 |
|
| |
|
85 |
__EAGAIN__ |
| |
|
86 |
|
| |
|
87 |
|
| |
|
88 |
Non-blocking I/O has been selected using __O_NONBLOCK__ |
| |
|
89 |
and the write would block. |
| |
|
90 |
|
| |
|
91 |
|
| |
|
92 |
__EINTR__ |
| |
|
93 |
|
| |
|
94 |
|
| |
|
95 |
The call was interrupted by a signal before any data was |
| |
|
96 |
written. |
| |
|
97 |
|
| |
|
98 |
|
| |
|
99 |
__ENOSPC__ |
| |
|
100 |
|
| |
|
101 |
|
| |
|
102 |
The device containing the file referred to by ''fd'' has |
| |
|
103 |
no room for the data. |
| |
|
104 |
|
| |
|
105 |
|
| |
|
106 |
__EIO__ |
| |
|
107 |
|
| |
|
108 |
|
| |
|
109 |
A low-level I/O error occurred while modifying the |
| |
|
110 |
inode. |
| |
|
111 |
|
| |
|
112 |
|
| |
|
113 |
Other errors may occur, depending on the object connected to |
| |
|
114 |
''fd''. |
| |
|
115 |
!!CONFORMING TO |
| |
|
116 |
|
| |
|
117 |
|
| |
|
118 |
SVr4, SVID, POSIX, X/OPEN, 4.3BSD. SVr4 documents additional |
| |
|
119 |
error conditions EDEADLK, ENOLCK, ENOLNK, ENOSR, ENXIO, |
| |
|
120 |
EPIPE, or ERANGE. Under SVr4 a write may be interrupted and |
| |
|
121 |
return EINTR at any point, not just before any data is |
| |
|
122 |
written. |
| |
|
123 |
!!SEE ALSO |
| |
|
124 |
|
| |
|
125 |
|
| |
|
126 |
open(2), read(2), fcntl(2), |
| |
|
127 |
close(2), lseek(2), select(2), |
| |
|
128 |
ioctl(2), fsync(2), |
| |
|
129 |
fwrite(3) |
| |
|
130 |
---- |