OSDN Git Service

ba30c7ba6be623652947db646cb0f46d1d412088
[linuxjm/LDP_man-pages.git] / draft / man2 / write.2
1 .\" Hey Emacs! This file is -*- nroff -*- source.
2 .\"
3 .\" This manpage is Copyright (C) 1992 Drew Eckhardt;
4 .\"                               1993 Michael Haardt, Ian Jackson.
5 .\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
6 .\"
7 .\" Permission is granted to make and distribute verbatim copies of this
8 .\" manual provided the copyright notice and this permission notice are
9 .\" preserved on all copies.
10 .\"
11 .\" Permission is granted to copy and distribute modified versions of this
12 .\" manual under the conditions for verbatim copying, provided that the
13 .\" entire resulting derived work is distributed under the terms of a
14 .\" permission notice identical to this one.
15 .\"
16 .\" Since the Linux kernel and libraries are constantly changing, this
17 .\" manual page may be incorrect or out-of-date.  The author(s) assume no
18 .\" responsibility for errors or omissions, or for damages resulting from
19 .\" the use of the information contained herein.  The author(s) may not
20 .\" have taken the same level of care in the production of this manual,
21 .\" which is licensed free of charge, as they might when working
22 .\" professionally.
23 .\"
24 .\" Formatted or processed versions of this manual, if unaccompanied by
25 .\" the source, must acknowledge the copyright and authors of this work.
26 .\"
27 .\" Modified Sat Jul 24 13:35:59 1993 by Rik Faith <faith@cs.unc.edu>
28 .\" Modified Sun Nov 28 17:19:01 1993 by Rik Faith <faith@cs.unc.edu>
29 .\" Modified Sat Jan 13 12:58:08 1996 by Michael Haardt
30 .\"   <michael@cantor.informatik.rwth-aachen.de>
31 .\" Modified Sun Jul 21 18:59:33 1996 by Andries Brouwer <aeb@cwi.nl>
32 .\" 2001-12-13 added remark by Zack Weinberg
33 .\" 2007-06-18 mtk:
34 .\"     Added details about seekable files and file offset.
35 .\"     Noted that write() may write less than 'count' bytes, and
36 .\"     gave some examples of why this might occur.
37 .\"     Noted what happens if write() is interrupted by a signal.
38 .\"
39 .\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
40 .\"         all rights reserved.
41 .\" Translated Tue Mar  4 00:18:20 JST 1997
42 .\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
43 .\" Updated & Modified Wed Jun 13 20:57:55 JST 2001
44 .\"         by Yuichi SATO <ysato@h4.dion.ne.jp>
45 .\" Updated Mon Jun 25 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
46 .\" Updated Fri Dec 21 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
47 .\" Updated 2002-09-24 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
48 .\" Updated 2005-10-14 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
49 .\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
50 .\" Updated 2007-09-01, Akihiro MOTOKI, LDP v2.64
51 .\" Updated 2008-04-13, Akihiro MOTOKI, LDP v3.20
52 .\"
53 .\"WORD:        descriptor              ¥Ç¥£¥¹¥¯¥ê¥×¥¿
54 .\"WORD:        buffer                  ¥Ð¥Ã¥Õ¥¡¡¼
55 .\"WORD:        file system             ¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à
56 .\"WORD:        object                  ¥ª¥Ö¥¸¥§¥¯¥È
57 .\"WORD:        pipe                    ¥Ñ¥¤¥×
58 .\"WORD:        socket                  ¥½¥±¥Ã¥È
59 .\"WORD:        signal                  ¥·¥°¥Ê¥ë
60 .\"WORD:        catch                   Êá³Í(catch)
61 .\"WORD:        block                   Ää»ß(block)
62 .\"WORD:        interrupt               ³ä¤ê¹þ¤ß
63 .\"WORD:        nonblocking I/O         ÈóÄä»ß I/O
64 .\"WORD:        device                  ¥Ç¥Ð¥¤¥¹
65 .\"WORD:        low-level I/O           Äã¥ì¤Ù¥ë I/O
66 .\"
67 .TH WRITE 2 2010-08-29 "Linux" "Linux Programmer's Manual"
68 .\"O .SH NAME
69 .SH Ì¾Á°
70 .\"O write \- write to a file descriptor
71 write \- ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿ (file descriptor) ¤Ë½ñ¤­¹þ¤à
72 .\"O .SH SYNOPSIS
73 .SH ½ñ¼°
74 .B #include <unistd.h>
75 .sp
76 .BI "ssize_t write(int " fd ", const void *" buf ", size_t " count );
77 .\"O .SH DESCRIPTION
78 .SH ÀâÌÀ
79 .\"O .BR write ()
80 .\"O writes up to
81 .\"O .I count
82 .\"O bytes from the buffer pointed
83 .\"O .I buf
84 .\"O to the file referred to by the file descriptor
85 .\"O .IR fd .
86 .BR write ()
87 ¤Ï¡¢
88 .I buf
89 ¤¬»Ø¤¹¥Ð¥Ã¥Õ¥¡¤«¤é¡¢¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿
90 .I fd
91 ¤¬»²¾È¤¹¤ë¥Õ¥¡¥¤¥ë¤Ø¡¢ºÇÂç
92 .I count
93 ¥Ð¥¤¥È¤ò½ñ¤­¹þ¤à¡£
94
95 .\"O The number of bytes written may be less than
96 .\"O .I count
97 .\"O if, for example,
98 .\"O there is insufficient space on the underlying physical medium, or the
99 .\"O .B RLIMIT_FSIZE
100 .\"O resource limit is encountered (see
101 .\"O .BR setrlimit (2)),
102 .\"O or the call was interrupted by a signal
103 .\"O handler after having written less than
104 .\"O .I count
105 .\"O bytes.
106 .\"O (See also
107 .\"O .BR pipe (7).)
108 ½ñ¤­¹þ¤Þ¤ì¤ë¥Ð¥¤¥È¿ô¤Ï
109 .I count
110 ¤è¤ê¤â¾®¤µ¤¯¤Ê¤ë¤³¤È¤¬¤¢¤ë¡£
111 Î㤨¤Ð¡¢½ñ¤­¹þ¤ßÂоݤÎʪÍý¥á¥Ç¥£¥¢¤Ë½½Ê¬¤ÊÎΰ褬¤Ê¤¤¾ì¹ç¡¢
112 ¥ê¥½¡¼¥¹¾å¸Â
113 .B RLIMIT_FSIZE
114 ¤Ë㤷¤¿¾ì¹ç
115 .RB ( setrlimit (2)
116 »²¾È)¡¢
117 .I count
118 ¥Ð¥¤¥È̤Ëþ¤Î½ñ¤­¹þ¤ß¤¬¹Ô¤ï¤ì¤¿¸å¤Ç
119 ¸Æ¤Ó½Ð¤·¤¬¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿¾ì¹ç¡¢
120 ¤Ê¤É¤Ç¤¢¤ë¡£
121 .RB ( pipe (7)
122 ¤â»²¾È¤Î¤³¤È¡£)
123
124 .\"O For a seekable file (i.e., one to which
125 .\"O .BR lseek (2)
126 .\"O may be applied, for example, a regular file)
127 .\"O writing takes place at the current file offset,
128 .\"O and the file offset is incremented by
129 .\"O the number of bytes actually written.
130 .\"O If the file was
131 .\"O .BR open (2)ed
132 .\"O with
133 .\"O .BR O_APPEND ,
134 .\"O the file offset is first set to the end of the file before writing.
135 .\"O The adjustment of the file offset and the write operation
136 .\"O are performed as an atomic step.
137 seek ²Äǽ¤Ê¥Õ¥¡¥¤¥ë (¤Ä¤Þ¤ê
138 .BR lseek (2)
139 ¤¬Å¬ÍѤǤ­¤ë¥Õ¥¡¥¤¥ë¡¢Î㤨¤ÐÄ̾ï¤Î¥Õ¥¡¥¤¥ë) ¤Ç¤Ï¡¢
140 ½ñ¤­¹þ¤ß¤Ï¸½ºß¤Î¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤«¤é¹Ô¤ï¤ì¡¢
141 ¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤Ï¼ÂºÝ¤Ë½ñ¤­¹þ¤ß¤¬¹Ô¤ï¤ì¤¿¥Ð¥¤¥È¿ôʬ
142 ²Ã»»¤µ¤ì¤ë¡£¥Õ¥¡¥¤¥ë¤¬
143 .B O_APPEND
144 ¤Ç
145 .BR open (2)
146 ¤µ¤ì¤¿¾ì¹ç¡¢¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤Ï½ñ¤­¹þ¤ßÁ°¤Ë
147 ¥Õ¥¡¥¤¥ë¤ÎËöÈø¤ËÀßÄꤵ¤ì¤ë¡£
148 ¥Õ¥¡¥¤¥ë¡¦¥ª¥Õ¥»¥Ã¥È¤ÎÄ´À°¤È½ñ¤­¹þ¤ßÁàºî¤Ï¥¢¥È¥ß¥Ã¥¯¤Ê½èÍý¤È¤·¤Æ
149 ¼Â¹Ô¤µ¤ì¤ë¡£
150
151 .\"O POSIX requires that a
152 .\"O .BR read (2)
153 .\"O which can be proved to occur after a
154 .\"O .BR write ()
155 .\"O has returned returns the new data.
156 .\"O Note that not all file systems are POSIX conforming.
157 POSIX ¤Ï
158 .BR write ()
159 ¤¬¹Ô¤Ê¤ï¤ì¤¿¸å¤Ë¼Â¹Ô¤·¤¿
160 .BR read (2)
161 ¤¬
162 ¿·¤·¤¤¥Ç¡¼¥¿¤òÊÖ¤¹¤³¤È¤òÍ׵ᤷ¤Æ¤¤¤ë¡£
163 Á´¤Æ¤Î¥Õ¥¡¥¤¥ë¡¦¥·¥¹¥Æ¥à¤¬ POSIX ½àµò¤Ç¤Ï¤Ê¤¤ÅÀ¤ËÃí°Õ¤¹¤ë¤³¤È¡£
164 .\"O .SH "RETURN VALUE"
165 .SH ÊÖ¤êÃÍ
166 .\"O On success, the number of bytes written is returned (zero indicates
167 .\"O nothing was written).
168 .\"O On error, \-1 is returned, and \fIerrno\fP is set
169 .\"O appropriately.
170 À®¸ù¤·¤¿¾ì¹ç¡¢½ñ¤­¹þ¤Þ¤ì¤¿¥Ð¥¤¥È¿ô¤¬ÊÖ¤µ¤ì¤ë
171 (¥¼¥í¤Ï²¿¤â½ñ¤­¹þ¤Þ¤ì¤Ê¤«¤Ã¤¿¤³¤È¤ò¼¨¤¹)¡£
172 ¥¨¥é¡¼¤Ê¤é¤Ð \-1 ¤¬ÊÖ¤µ¤ì¡¢\fIerrno\fP ¤¬Å¬ÀÚ¤ËÀßÄꤵ¤ì¤ë¡£
173
174 .\"O If \fIcount\fP is zero and
175 .\"O .I fd
176 .\"O refers to a regular file, then
177 .\"O .BR write ()
178 .\"O may return a failure status if one of the errors below is detected.
179 .\"O If no errors are detected,
180 .\"O 0 will be returned without causing any other effect.
181 .\"O If
182 .\"O \fIcount\fP is zero and
183 .\"O .I fd
184 .\"O refers to a file other than a regular file,
185 .\"O the results are not specified.
186 \fIcount\fP ¤¬ 0 ¤Ç¡¢
187 .I fd
188 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë (regular file) ¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
189 .BR write ()
190 ¤Ï¸å½Ò¤Î¥¨¥é¡¼¤Î¤¤¤º¤ì¤«¤ò¸¡½Ð¤·¤¿¾ì¹ç¡¢¼ºÇÔ¤òÊÖ¤¹¤³¤È¤¬¤¢¤ë¡£
191 ¥¨¥é¡¼¤¬¸¡½Ð¤µ¤ì¤Ê¤«¤Ã¤¿¾ì¹ç¤Ï¡¢
192 0 ¤òÊÖ¤·¡¢Â¾¤Ë²¿¤Î±Æ¶Á¤âÍ¿¤¨¤Ê¤¤¡£
193 \fIcount\fP ¤¬ 0 ¤Ç¡¢
194 .I fd
195 ¤¬Ä̾ï¤Î¥Õ¥¡¥¤¥ë°Ê³°¤Î¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤ë¾ì¹ç¡¢
196 ¤½¤Î·ë²Ì¤Ïµ¬Äꤵ¤ì¤Æ¤¤¤Ê¤¤¡£
197 .\"O .SH ERRORS
198 .SH ¥¨¥é¡¼
199 .TP
200 .B EAGAIN
201 .\"O The file descriptor
202 .\"O .I fd
203 .\"O refers to a file other than a socket and has been marked nonblocking
204 .\"O .RB ( O_NONBLOCK ),
205 .\"O and the write would block.
206 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿
207 .I fd
208 ¤¬¥½¥±¥Ã¥È°Ê³°¤Î¥Õ¥¡¥¤¥ë¤ò»²¾È¤·¤Æ¤¤¤Æ¡¢
209 ÈóÄä»ß (nonblocking) ¥â¡¼¥É
210 .RB ( O_NONBLOCK )
211 ¤ËÀßÄꤵ¤ì¤Æ¤ª¤ê¡¢½ñ¤­¹þ¤ß¤ò¹Ô¤¦¤ÈÄä»ß¤¹¤ë¾õ¶·¤Ë¤¢¤ë¡£
212 .TP
213 .\"O .BR EAGAIN " or " EWOULDBLOCK
214 .BR EAGAIN " ¤Þ¤¿¤Ï " EWOULDBLOCK
215 .\" Actually EAGAIN on Linux
216 .\"O The file descriptor
217 .\"O .I fd
218 .\"O refers to a socket and has been marked nonblocking
219 .\"O .RB ( O_NONBLOCK ),
220 .\"O and the write would block.
221 .\"O POSIX.1-2001 allows either error to be returned for this case,
222 .\"O and does not require these constants to have the same value,
223 .\"O so a portable application should check for both possibilities.
224 ¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿
225 .I fd
226 ¤¬¥½¥±¥Ã¥È¤ò»²¾È¤·¤Æ¤¤¤Æ¡¢ÈóÄä»ß (nonblocking) ¥â¡¼¥É
227 .RB  ( O_NONBLOCK )
228 ¤ËÀßÄꤵ¤ì¤Æ¤ª¤ê¡¢½ñ¤­¹þ¤ß¤ò¹Ô¤¦¤ÈÄä»ß¤¹¤ë¾õ¶·¤Ë¤¢¤ë¡£
229 POSIX.1-2001 ¤Ï¡¢¤³¤Î¾ì¹ç¤Ë¤É¤Á¤é¤Î¥¨¥é¡¼¤òÊÖ¤¹¤³¤È¤âǧ¤á¤Æ¤ª¤ê¡¢
230 ¤³¤ì¤é 2 ¤Ä¤ÎÄê¿ô¤¬Æ±¤¸Ãͤò»ý¤Ä¤³¤È¤âµá¤á¤Æ¤¤¤Ê¤¤¡£
231 ¤·¤¿¤¬¤Ã¤Æ¡¢°Ü¿¢À­¤¬É¬Íפʥ¢¥×¥ê¥±¡¼¥·¥ç¥ó¤Ç¤Ï¡¢Î¾Êý¤Î²ÄǽÀ­¤ò
232 ³Îǧ¤¹¤Ù¤­¤Ç¤¢¤ë¡£
233 .TP
234 .B EBADF
235 .\"O .I fd
236 .\"O is not a valid file descriptor or is not open for writing.
237 .I fd
238 ¤¬Í­¸ú¤Ê¥Õ¥¡¥¤¥ë¡¦¥Ç¥£¥¹¥¯¥ê¥×¥¿¤Ç¤Ê¤¤¤«½ñ¤­¹þ¤ß¤Î¤¿¤á¤Ë¥ª¡¼¥×¥ó
239 (open) ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
240 .TP
241 .B EDESTADDRREQ
242 .\"O .I fd
243 .\"O refers to a datagram socket for which a peer address has not been set using
244 .\"O .BR connect (2).
245 .I fd
246 ¤¬¡¢
247 .BR connect (2)
248 ¤ò»È¤Ã¤ÆÄÌ¿®Áê¼ê¤Î¥¢¥É¥ì¥¹¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¥Ç¡¼¥¿¥°¥é¥à¥½¥±¥Ã¥È¤ò
249 »²¾È¤·¤Æ¤¤¤ë¡£
250 .TP
251 .B EFAULT
252 .\"O .I buf
253 .\"O is outside your accessible address space.
254 .I buf
255 ¤¬¥¢¥¯¥»¥¹²Äǽ¤Ê¥¢¥É¥ì¥¹¶õ´Ö (address space) ¤Î³°¤Ë¤¢¤ë¡£
256 .TP
257 .B EFBIG
258 .\"O An attempt was made to write a file that exceeds the implementation-defined
259 .\"O maximum file size or the process's file size limit,
260 .\"O or to write at a position past the maximum allowed offset.
261 ¼ÂÁõÄêµÁ¤ÎºÇÂç¥Õ¥¡¥¤¥ë¥µ¥¤¥º¤Þ¤¿¤Ï¥×¥í¥»¥¹¤Î¥Õ¥¡¥¤¥ë¥µ¥¤¥ºÀ©¸Â¤ò
262 Ķ¤¨¤Æ¥Õ¥¡¥¤¥ë¤Ë½ñ¤­¹þ¤â¤¦¤È¤·¤¿¡£
263 ¤Þ¤¿¤Ïµö²Ä¤µ¤ì¤¿¥ª¥Õ¥»¥Ã¥ÈÃͤ賦¤òĶ¤¨¤¿Àè¤Î°ÌÃÖ¤Ë
264 ½ñ¤­¹þ¤â¤¦¤È¤·¤¿¡£
265 .TP
266 .B EINTR
267 .\"O The call was interrupted by a signal before any data was written; see
268 .\"O .BR signal (7).
269 ²¿¤Î¥Ç¡¼¥¿¤â½ñ¤«¤Ê¤¤´Ö¤Ë¥·¥°¥Ê¥ë¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿ (interrupt)¡£
270 .BR signal (7)
271 »²¾È¡£
272 .TP
273 .B EINVAL
274 .\"O .I fd
275 .\"O is attached to an object which is unsuitable for writing;
276 .\"O or the file was opened with the
277 .\"O .B O_DIRECT
278 .\"O flag, and either the address specified in
279 .\"O .IR buf ,
280 .\"O the value specified in
281 .\"O .IR count ,
282 .\"O or the current file offset is not suitably aligned.
283 .I fd
284 ¤¬½ñ¤­¹þ¤ß¤¬ÉÔŬÀڤʥª¥Ö¥¸¥§¥¯¥È¤ò»²¾È¤·¤Æ¤¤¤ë¡£
285 ¤â¤·¤¯¤Ï¡¢¥Õ¥¡¥¤¥ë¤¬
286 .B O_DIRECT
287 ¥Õ¥é¥°¤ò»ØÄꤷ¤Æ¥ª¡¼¥×¥ó¤µ¤ì¤Æ¤¤¤ë¤¬¡¢
288 .I buf
289 ¤Ë»ØÄꤵ¤ì¤¿¥¢¥É¥ì¥¹¡¢
290 .I count
291 ¤Ë»ØÄꤵ¤ì¤¿ÃÍ¡¢
292 ¸½ºß¤Î¥Õ¥¡¥¤¥ë¥ª¥Õ¥»¥Ã¥È¤Î¤¤¤º¤ì¤«¤Î
293 ¥¢¥é¥¤¥ó¥á¥ó¥È¤¬ÉÔŬÀڤǤ¢¤ë¡£
294 .TP
295 .B EIO
296 .\"O A low-level I/O error occurred while modifying the inode.
297 inode ¤Î½¤ÀµÃæ¤ËÄã¥ì¤Ù¥ë (low-level) I/O ¥¨¥é¡¼¤¬È¯À¸¤·¤¿¡£
298 .TP
299 .B ENOSPC
300 .\"O The device containing the file referred to by
301 .\"O .I fd
302 .\"O has no room for the data.
303 .I fd
304 ¤Ë¤è¤Ã¤Æ»²¾È¤µ¤ì¤ë¥Õ¥¡¥¤¥ë¤ò´Þ¤à¥Ç¥Ð¥¤¥¹ (device) ¤Ë½½Ê¬¤Ê¶õ¤­¤¬¤Ê¤¤¡£
305 .TP
306 .B EPIPE
307 .\"O .I fd
308 .\"O is connected to a pipe or socket whose reading end is closed.
309 .\"O When this happens the writing process will also receive a
310 .\"O .B SIGPIPE
311 .\"O signal.
312 .\"O (Thus, the write return value is seen only if the program
313 .\"O catches, blocks or ignores this signal.)
314 .I fd
315 ¤¬¥Ñ¥¤¥× (pipe) ¤«¥½¥±¥Ã¥È (socket) ¤ËÀܳ¤µ¤ì¤Æ¤ª¤ê¡¢
316 ¤½¤ÎÈ¿ÂЦ (Æɤ߹þ¤ß¦) ¤¬¥¯¥í¡¼¥º (close) ¤µ¤ì¤Æ¤¤¤ë¡£
317 ¤³¤ì¤¬È¯À¸¤·¤¿¾ì¹ç¤Ë¤Ï¡¢½ñ¤­¹þ¤ß¤ò¹Ô¤Ê¤¦¥×¥í¥»¥¹¤Ï
318 .B SIGPIPE
319 ¥·¥°¥Ê¥ë (signal)¤â¼õ¤±¤ë¡£
320 (¤·¤¿¤¬¤Ã¤Æ¡¢¥×¥í¥°¥é¥à¤¬¤³¤Î¥·¥°¥Ê¥ë¤òÊá³Í (catch)¡¢Ää»ß (block)¡¢Ìµ»ë (ignore)
321 ¤·¤¿¾ì¹ç¤Î¤ß¡¢write ¤ÎÊÖ¤êÃͤò»²¾È¤Ç¤­¤ë¡£)
322 .PP
323 .\"O Other errors may occur, depending on the object connected to
324 .\"O .IR fd .
325 .I fd
326 ¤ËÀܳ¤µ¤ì¤¿¥ª¥Ö¥¸¥§¥¯¥È¤Ë¤è¤Ã¤Æ¤Ï¡¢Â¾¤Î¥¨¥é¡¼¤¬µ¯¤³¤ë¤«¤â¤·¤ì¤Ê¤¤¡£
327 .\"O .SH "CONFORMING TO"
328 .SH ½àµò
329 SVr4, 4.3BSD, POSIX.1-2001.
330 .\"O .\" SVr4 documents additional error
331 .\"O .\" conditions EDEADLK, ENOLCK, ENOLNK, ENOSR, ENXIO, or ERANGE.
332 .\" SVr4 ¤Ë¤Ï¾¤Ë EDEADLK, ENOLCK, ENOLNK,
333 .\" ENOSR, ENXIO, ERANGE ¥¨¥é¡¼¤Ë¤Ä¤¤¤Æ¤Îµ­½Ò¤¬¤¢¤ë¡£
334
335 .\"O Under SVr4 a write may be interrupted and return
336 .\"O .B EINTR
337 .\"O at any point,
338 .\"O not just before any data is written.
339 SVr4 ¤Ç¤Ï write ¤¬³ä¤ê¹þ¤Þ¤ì¤ë¤È¡¢¥Ç¡¼¥¿¤¬½ñ¤­¹þ¤Þ¤ì¤ëľÁ°¤Ç¤Ï¤Ê¤¯¡¢
340 ¤½¤Î»þÅÀ¤Ç
341 .B EINTR
342 ¤¬Ê֤롣
343 .\"O .SH NOTES
344 .SH Ãí°Õ
345 .\"O A successful return from
346 .\"O .BR write ()
347 .\"O does not make any guarantee that data has been committed to disk.
348 .BR write ()
349 ¤¬À®¸ù¤·¤ÆÊ֤äƤ­¤Æ¤â¡¢¥Ç¡¼¥¿¤¬¥Ç¥£¥¹¥¯¤Ëµ­Ï¿¤µ¤ì¤¿¤³¤È¤ò
350 Êݾڤ¹¤ë¤â¤Î¤Ç¤Ï¤Ê¤¤¡£
351 .\"O In fact, on some buggy implementations, it does not even guarantee
352 .\"O that space has successfully been reserved for the data.
353 ¼ÂºÝ¡¢¥Ç¡¼¥¿¤Î¤¿¤á¤Î¥¹¥Ú¡¼¥¹¤¬³ÎÊݤµ¤ì¤¿¤³¤È¤¹¤éÊݾڤµ¤ì¤Ê¤¤¤È¤¤¤¦
354 ¥Ð¥°¤Ã¤Ý¤¤¼ÂÁõ¤â¤¢¤ë¡£
355 .\"O The only way to be sure is to call
356 .\"O .BR fsync (2)
357 .\"O after you are done writing all your data.
358 ¤³¤ì¤ò³Î¼Â¤Ë¤¹¤ëÍ£°ì¤ÎÊýË¡¤Ï¡¢
359 Á´¤Æ¤Î¥Ç¡¼¥¿¤ò write ¤·¤¿¸å¤Ë
360 .BR fsync (2)
361 ¤ò¸Æ¤Ó½Ð¤¹¤³¤È¤Ç¤¢¤ë¡£
362
363 .\"O If a
364 .\"O .BR write ()
365 .\"O is interrupted by a signal handler before any bytes are written,
366 .\"O then the call fails with the error
367 .\"O .BR EINTR ;
368 .\"O if it is interrupted after at least one byte has been written,
369 .\"O the call succeeds, and returns the number of bytes written.
370 .BR write ()
371 ¤¬ 1 ¥Ð¥¤¥È¤â½ñ¤­¹þ¤Þ¤Ê¤¤¤¦¤Á¤Ë¥·¥°¥Ê¥ë¥Ï¥ó¥É¥é¤Ë¤è¤ê³ä¤ê¹þ¤Þ¤ì¤¿¾ì¹ç¡¢
372 .BR write ()
373 ¤Ï¥¨¥é¡¼
374 .B EINTR
375 ¤Ç¼ºÇÔ¤¹¤ë¡£
376 1¥Ð¥¤¥È¤Ç¤â½ñ¤­¹þ¤ó¤À¸å¤Ç³ä¤ê¹þ¤Þ¤ì¤¿¾ì¹ç¤Ë¤Ï¡¢
377 .BR write ()
378 ¤ÏÀ®¸ù¤·¡¢½ñ¤­¹þ¤ó¤À¥Ð¥¤¥È¿ô¤òÊÖ¤¹¡£
379 .\"O .SH "SEE ALSO"
380 .SH ´ØÏ¢¹àÌÜ
381 .BR close (2),
382 .BR fcntl (2),
383 .BR fsync (2),
384 .BR ioctl (2),
385 .BR lseek (2),
386 .BR open (2),
387 .BR pwrite (2),
388 .BR read (2),
389 .BR select (2),
390 .BR writev (2),
391 .BR fwrite (3)