OSDN Git Service

Retire LDP man-pages repository
[linuxjm/LDP_man-pages.git] / release / man2 / write.2
diff --git a/release/man2/write.2 b/release/man2/write.2
deleted file mode 100644 (file)
index 69d1cdf..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-.\" This manpage is Copyright (C) 1992 Drew Eckhardt;
-.\"             and Copyright (C) 1993 Michael Haardt, Ian Jackson.
-.\" and Copyright (C) 2007 Michael Kerrisk <mtk.manpages@gmail.com>
-.\"
-.\" %%%LICENSE_START(VERBATIM)
-.\" Permission is granted to make and distribute verbatim copies of this
-.\" manual provided the copyright notice and this permission notice are
-.\" preserved on all copies.
-.\"
-.\" Permission is granted to copy and distribute modified versions of this
-.\" manual under the conditions for verbatim copying, provided that the
-.\" entire resulting derived work is distributed under the terms of a
-.\" permission notice identical to this one.
-.\"
-.\" Since the Linux kernel and libraries are constantly changing, this
-.\" manual page may be incorrect or out-of-date.  The author(s) assume no
-.\" responsibility for errors or omissions, or for damages resulting from
-.\" the use of the information contained herein.  The author(s) may not
-.\" have taken the same level of care in the production of this manual,
-.\" which is licensed free of charge, as they might when working
-.\" professionally.
-.\"
-.\" Formatted or processed versions of this manual, if unaccompanied by
-.\" the source, must acknowledge the copyright and authors of this work.
-.\" %%%LICENSE_END
-.\"
-.\" Modified Sat Jul 24 13:35:59 1993 by Rik Faith <faith@cs.unc.edu>
-.\" Modified Sun Nov 28 17:19:01 1993 by Rik Faith <faith@cs.unc.edu>
-.\" Modified Sat Jan 13 12:58:08 1996 by Michael Haardt
-.\"   <michael@cantor.informatik.rwth-aachen.de>
-.\" Modified Sun Jul 21 18:59:33 1996 by Andries Brouwer <aeb@cwi.nl>
-.\" 2001-12-13 added remark by Zack Weinberg
-.\" 2007-06-18 mtk:
-.\"            Added details about seekable files and file offset.
-.\"    Noted that write() may write less than 'count' bytes, and
-.\"    gave some examples of why this might occur.
-.\"    Noted what happens if write() is interrupted by a signal.
-.\"
-.\"*******************************************************************
-.\"
-.\" This file was generated with po4a. Translate the source file.
-.\"
-.\"*******************************************************************
-.\"
-.\" Japanese Version Copyright (c) 1997 HANATAKA Shinya
-.\"         all rights reserved.
-.\" Translated Tue Mar  4 00:18:20 JST 1997
-.\"         by HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Updated & Modified Wed Jun 13 20:57:55 JST 2001
-.\"         by Yuichi SATO <ysato@h4.dion.ne.jp>
-.\" Updated Mon Jun 25 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
-.\" Updated Fri Dec 21 JST 2001 by Kentaro Shirakata <argrath@ub32.org>
-.\" Updated 2002-09-24 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2005-10-14 by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2007-05-01, Akihiro MOTOKI, LDP v2.46
-.\" Updated 2007-09-01, Akihiro MOTOKI, LDP v2.64
-.\" Updated 2008-04-13, Akihiro MOTOKI, LDP v3.20
-.\" Updated 2012-04-30, Akihiro MOTOKI <amotoki@gmail.com>
-.\" Updated 2013-05-04, Akihiro MOTOKI <amotoki@gmail.com>
-.\"
-.TH WRITE 2 2015\-01\-22 Linux "Linux Programmer's Manual"
-.SH 名前
-write \- ファイルディスクリプター (file descriptor) に書き込む
-.SH 書式
-\fB#include <unistd.h>\fP
-.sp
-\fBssize_t write(int \fP\fIfd\fP\fB, const void *\fP\fIbuf\fP\fB, size_t \fP\fIcount\fP\fB);\fP
-.SH 説明
-\fBwrite\fP()  は、 \fIbuf\fP が指すバッファーから、ファイルディスクリプター \fIfd\fP が参照するファイルへ、最大 \fIcount\fP
-バイトを書き込む。
-
-書き込まれるバイト数は \fIcount\fP よりも小さくなることがある。 例えば、書き込み対象の物理メディアに十分な領域がない場合、 リソース上限
-\fBRLIMIT_FSIZE\fP に達した場合 (\fBsetrlimit\fP(2)  参照)、 \fIcount\fP バイト未満の書き込みが行われた後で
-呼び出しがシグナルハンドラーにより割り込まれた場合、 などである。 (\fBpipe\fP(7)  も参照のこと。)
-
-seek 可能なファイル (つまり \fBlseek\fP(2)  が適用できるファイル、例えば通常のファイル) では、
-書き込みは現在のファイルオフセットから行われ、 ファイルオフセットは実際に書き込みが行われたバイト数分 加算される。ファイルが \fBO_APPEND\fP
-で \fBopen\fP(2)  された場合、ファイルオフセットは書き込み前に ファイルの末尾に設定される。
-ファイルオフセットの調整と書き込み操作はアトミックな処理として 実行される。
-
-POSIX は \fBwrite\fP()  が行なわれた後に実行した \fBread\fP(2)  が 新しいデータを返すことを要求している。
-全てのファイルシステムが POSIX 準拠ではない点に注意すること。
-.SH 返り値
-成功した場合、書き込まれたバイト数が返される (ゼロは何も書き込まれなかったことを示す)。 エラーならば \-1 が返され、\fIerrno\fP
-が適切に設定される。
-
-\fIcount\fP が 0 で、 \fIfd\fP が通常のファイル (regular file) を参照している場合、 \fBwrite\fP()
-は後述のエラーのいずれかを検出した場合、失敗を返すことがある。 エラーが検出されなかった場合は、 0 を返し、他に何の影響も与えない。 \fIcount\fP
-が 0 で、 \fIfd\fP が通常のファイル以外のファイルを参照している場合、 その結果は規定されていない。
-.SH エラー
-.TP 
-\fBEAGAIN\fP
-ファイルディスクリプター \fIfd\fP がソケット以外のファイルを参照していて、 非停止 (nonblocking) モード
-(\fBO_NONBLOCK\fP)  に設定されており、書き込みを行うと停止する状況にある。
-.TP 
-\fBEAGAIN\fP または \fBEWOULDBLOCK\fP
-.\" Actually EAGAIN on Linux
-ファイルディスクリプター \fIfd\fP がソケットを参照していて、非停止 (nonblocking) モード (\fBO_NONBLOCK\fP)
-に設定されており、書き込みを行うと停止する状況にある。 POSIX.1\-2001 は、この場合にどちらのエラーを返すことも認めており、 これら 2
-つの定数が同じ値を持つことも求めていない。 したがって、移植性が必要なアプリケーションでは、両方の可能性を 確認すべきである。
-.TP 
-\fBEBADF\fP
-\fIfd\fP が有効なファイルディスクリプターでないか書き込みのためにオープン (open) されていない。
-.TP 
-\fBEDESTADDRREQ\fP
-\fIfd\fP が、 \fBconnect\fP(2)  を使って通信相手のアドレスが設定されていないデータグラムソケットを 参照している。
-.TP 
-\fBEDQUOT\fP
-\fIfd\fP が参照するファイルを含むファイルシステムのディスクブロックのユーザークォータの上限に達している。
-.TP 
-\fBEFAULT\fP
-\fIbuf\fP がアクセス可能なアドレス空間の外にある。
-.TP 
-\fBEFBIG\fP
-実装定義の最大ファイルサイズまたはプロセスのファイルサイズ制限を 超えてファイルに書き込もうとした。
-または許可されたオフセット値の限界を超えた先の位置に 書き込もうとした。
-.TP 
-\fBEINTR\fP
-何のデータも書かない間にシグナルにより割り込まれた (interrupt)。 \fBsignal\fP(7)  参照。
-.TP 
-\fBEINVAL\fP
-\fIfd\fP が書き込みが不適切なオブジェクトを参照している。 もしくは、ファイルが \fBO_DIRECT\fP フラグを指定してオープンされているが、
-\fIbuf\fP に指定されたアドレス、 \fIcount\fP に指定された値、 現在のファイルオフセットのいずれかの アラインメントが不適切である。
-.TP 
-\fBEIO\fP
-inode の修正中に低レべル (low\-level) I/O エラーが発生した。
-.TP 
-\fBENOSPC\fP
-\fIfd\fP によって参照されるファイルを含むデバイス (device) に十分な空きがない。
-.TP 
-\fBEPERM\fP
-操作が file seal により禁止されている。 \fBfcntl\fP(2)  参照。
-.TP 
-\fBEPIPE\fP
-\fIfd\fP がパイプ (pipe) かソケット (socket) に接続されており、 その反対側 (読み込み側) がクローズ (close)
-されている。 これが発生した場合には、書き込みを行なうプロセスは \fBSIGPIPE\fP シグナル (signal)も受ける。
-(したがって、プログラムがこのシグナルを捕獲 (catch)、停止 (block)、無視 (ignore)  した場合のみ、write
-の返り値を参照できる。)
-.PP
-\fIfd\fP に接続されたオブジェクトによっては、他のエラーが起こるかもしれない。
-.SH 準拠
-.\" SVr4 documents additional error
-.\" conditions EDEADLK, ENOLCK, ENOLNK, ENOSR, ENXIO, or ERANGE.
-SVr4, 4.3BSD, POSIX.1\-2001.
-
-SVr4 では write が割り込まれると、データが書き込まれる直前ではなく、 その時点で \fBEINTR\fP が返る。
-.SH 注意
-\fBwrite\fP()  が成功して返ってきても、データがディスクに記録されたことを 保証するものではない。
-実際、データのためのスペースが確保されたことすら保証されないという バグっぽい実装もある。 これを確実にする唯一の方法は、 全てのデータを write
-した後に \fBfsync\fP(2)  を呼び出すことである。
-
-\fBwrite\fP()  が 1 バイトも書き込まないうちにシグナルハンドラーにより割り込まれた場合、 \fBwrite\fP()  はエラー \fBEINTR\fP
-で失敗する。 1バイトでも書き込んだ後で割り込まれた場合には、 \fBwrite\fP()  は成功し、書き込んだバイト数を返す。
-.SH バグ
-POSIX.1\-2008/SUSv4 セクション XSI 2.9.7 ("Thread Interactions with Regular File
-Operations") によると、
-
-.RS 4
-以下のすべての関数では、 通常ファイルもしくはシンボリックリンクに対する操作では POSIX.1\-2008
-で規定された効果が互いにアトミックに行われなければならない: ...
-.RE
-
-.\" http://thread.gmane.org/gmane.linux.kernel/1649458
-.\"    From: Michael Kerrisk (man-pages <mtk.manpages <at> gmail.com>
-.\"    Subject: Update of file offset on write() etc. is non-atomic with I/O
-.\"    Date: 2014-02-17 15:41:37 GMT
-.\"    Newsgroups: gmane.linux.kernel, gmane.linux.file-systems
-.\" commit 9c225f2655e36a470c4f58dbbc99244c5fc7f2d4
-.\"    Author: Linus Torvalds <torvalds@linux-foundation.org>
-.\"    Date:   Mon Mar 3 09:36:58 2014 -0800
-.\"
-.\"        vfs: atomic f_pos accesses as per POSIX
-この後に書かれている API の中に \fBwrite\fP() と \fBwritev\fP(2) である。 スレッド(やプロセス)
-間でアトミックに適用することが求められる効果の一つとして、 ファイルオフセットの更新がある。 しかしながら、 バージョン 3.14 より前の Linux
-では、 この限りではない。 オープンファイル記述 (open file description) を共有する 2 つのプロセスが同時に
-\fBwrite\fP() (や \fBwritev\fP(2)) を実行した場合、 この I/O 操作ではファイルオフセットの更新に関してはアトミックではなく、
-2 つのプロセスから出力されるデータブロックが (間違って) 重なる可能性がある。 この問題は Linux 3.14 で修正された。
-.SH 関連項目
-\fBclose\fP(2), \fBfcntl\fP(2), \fBfsync\fP(2), \fBioctl\fP(2), \fBlseek\fP(2), \fBopen\fP(2),
-\fBpwrite\fP(2), \fBread\fP(2), \fBselect\fP(2), \fBwritev\fP(2), \fBfwrite\fP(3)
-.SH この文書について
-この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
-である。プロジェクトの説明とバグ報告に関する情報は
-http://www.kernel.org/doc/man\-pages/ に書かれている。