OSDN Git Service

Update README
[linuxjm/LDP_man-pages.git] / draft / man3 / flockfile.3
index aacb8a0..2681606 100644 (file)
@@ -1,5 +1,6 @@
 .\" Copyright (C) 2001 Andries Brouwer <aeb@cwi.nl>.
 .\"
+.\" %%%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.
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
+.\"
+.\"*******************************************************************
+.\"
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
 .\"
 .\" Japanese Version Copyright (c) 2001 Yuichi SATO
 .\"         all rights reserved.
 .\" Translated Sun Nov  4 14:09:45 2001
 .\"         by Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
 .\"
-.\"WORD:       lockcount       ¥í¥Ã¥¯¿ô
-.\"WORD:       owner thread    ½êÍ­¼Ô¥¹¥ì¥Ã¥É
-.\"
-.TH FLOCKFILE 3  2008-08-29 "" "Linux Programmer's Manual"
-.\"O .SH NAME
-.\"O flockfile, ftrylockfile, funlockfile \- lock FILE for stdio
-.SH Ì¾Á°
-flockfile, ftrylockfile, funlockfile \- É¸½àÆþ½ÐÎÏ FILE ¤Î¥í¥Ã¥¯¤ò¹Ô¤¦
-.\"O .SH SYNOPSIS
-.SH ½ñ¼°
+.TH FLOCKFILE 3 2014\-08\-19 "" "Linux Programmer's Manual"
+.SH 名前
+flockfile, ftrylockfile, funlockfile \- 標準入出力 FILE のロックを行う
+.SH 書式
 .nf
-.B #include <stdio.h>
+\fB#include <stdio.h>\fP
 .sp
-.BI "void flockfile(FILE *" filehandle );
+\fBvoid flockfile(FILE *\fP\fIfilehandle\fP\fB);\fP
 .br
-.BI "int ftrylockfile(FILE *" filehandle );
+\fBint ftrylockfile(FILE *\fP\fIfilehandle\fP\fB);\fP
 .br
-.BI "void funlockfile(FILE *" filehandle );
+\fBvoid funlockfile(FILE *\fP\fIfilehandle\fP\fB);\fP
 .fi
 .sp
 .in -4n
-.\"O Feature Test Macro Requirements for glibc (see
-.\"O .BR feature_test_macros (7)):
-glibc ¸þ¤±¤Îµ¡Ç½¸¡ºº¥Þ¥¯¥í¤ÎÍ×·ï
-.RB ( feature_test_macros (7)
-»²¾È):
+glibc 向けの機能検査マクロの要件 (\fBfeature_test_macros\fP(7)  参照):
 .in
 .ad l
 .sp
-.\"O All functions shown above:
-¾åµ­¤ÎÁ´¤Æ¤Î´Ø¿ô:
-_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE ||
-_SVID_SOURCE || _POSIX_SOURCE
+上記の全ての関数:
+.RS 4
+_POSIX_C_SOURCE\ >=\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE
+|| _POSIX_SOURCE
+.RE
 .ad b
-.\"O .SH DESCRIPTION
-.SH ÀâÌÀ
-.\"O The stdio functions are thread-safe.
-.\"O This is achieved by assigning
-.\"O to each
-.\"O .I FILE
-.\"O object a lockcount and (if the lockcount is nonzero)
-.\"O an owning thread.
-ɸ½àÆþ½ÐÎÏ´Ø¿ô¤Ï¥¹¥ì¥Ã¥É¥»¡¼¥Õ¤Ç¤¢¤ë¡£¤³¤ì¤Ï¡¢³Æ
-.I FILE
-¥ª¥Ö¥¸¥§¥¯¥È¤ËÂФ·¡¢¥í¥Ã¥¯¿ô (lockcount) ¤È
-(¥í¥Ã¥¯¿ô¤¬ 0 ¤Ç¤Ê¤¤¾ì¹ç¤Ï) ½êÍ­¼Ô¥¹¥ì¥Ã¥É (owner thread)
-¤ò´ÉÍý¤¹¤ë¤³¤È¤Ç¼Â¸½¤µ¤ì¤ë¡£
-.\"O For each library call, these functions wait until the
-.\"O .I FILE
-.\"O object
-.\"O is no longer locked by a different thread, then lock it, do the
-.\"O requested I/O, and unlock the object again.
-¥é¥¤¥Ö¥é¥ê¤Î¸Æ¤Ó½Ð¤·¤¬¹Ô¤ï¤ì¤ëËè¤Ë¡¢É¸½àÆþ½ÐÎÏ´Ø¿ô¤Ï
-.I FILE
-¥ª¥Ö¥¸¥§¥¯¥È¤¬Â¾¤Î¥¹¥ì¥Ã¥É¤Ë¤è¤Ã¤Æ¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤Ê¤¤¾õÂ֤ˤʤë¤Þ¤ÇÂÔ¤Á¡¢
-.I FILE
-¥ª¥Ö¥¸¥§¥¯¥È¤ò¥í¥Ã¥¯¤·¡¢Í׵ᤵ¤ì¤ÆÆþ½ÐÎϤò¹Ô¤¤¡¢
-¥ª¥Ö¥¸¥§¥¯¥È¤Î¥í¥Ã¥¯¤ò²ò½ü¤¹¤ë¡£
+.SH 説明
+標準入出力関数はスレッドセーフである。これは、各 \fIFILE\fP オブジェクトに対し、ロック数 (lockcount) と (ロック数が 0
+でない場合は) 所有者スレッド (owner thread)  を管理することで実現される。 ライブラリの呼び出しが行われる毎に、標準入出力関数は
+\fIFILE\fP オブジェクトが他のスレッドによってロックされていない状態になるまで待ち、 \fIFILE\fP
+オブジェクトをロックし、要求されて入出力を行い、 オブジェクトのロックを解除する。
 .LP
-.\"O (Note: this locking has nothing to do with the file locking done
-.\"O by functions like
-.\"O .BR flock (2)
-.\"O and
-.\"O .BR lockf (3).)
-(Ãí: ¤³¤Î¥í¥Ã¥¯¤Ï¡¢
-.BR flock (2)
-¤ä
-.BR lockf (3)
-¤È¤¤¤Ã¤¿´Ø¿ô¤¬¹Ô¤¦¥í¥Ã¥¯¤È¤ÏÁ´¤¯Ìµ´Ø·¸¤Ç¤¢¤ë¡£)
+(注: このロックは、 \fBflock\fP(2)  や \fBlockf\fP(3)  といった関数が行うロックとは全く無関係である。)
 .LP
-.\"O All this is invisible to the C-programmer, but there may be two
-.\"O reasons to wish for more detailed control.
-.\"O On the one hand, maybe
-.\"O a series of I/O actions by one thread belongs together, and should
-.\"O not be interrupted by the I/O of some other thread.
-.\"O On the other hand, maybe the locking overhead should be avoided
-.\"O for greater efficiency.
-¤³¤ì¤é¤Î¤³¤È¤Ï¤¹¤Ù¤Æ C ¥×¥í¥°¥é¥Þ¤Ë¤Ï¸«¤¨¤Ê¤¤Éôʬ¤Ç¹Ô¤ï¤ì¤ë¤¬¡¢
-¤è¤êºÙ¤«¤¤À©¸æ¤¬¤Ç¤­¤¿Êý¤¬¤è¤¤Íýͳ¤¬2¤Ä¤¢¤ë¤À¤í¤¦¡£°ì¤Ä¤Ï¡¢°ì¤Ä¤Î¥¹¥ì¥Ã¥É¤¬
-¹Ô¤¦°ìÏ¢¤ÎÆþ½ÐÎÏÆ°ºî¤Ï°ì½ï¤Ë¹Ô¤ï¤ì¡¢Â¾¤Î¥¹¥ì¥Ã¥É¤ÎÆþ½ÐÎϤˤè¤Ã¤ÆÃæÃǤµ¤ì¤Ê¤¤
-Êý¤¬¤è¤¤¤È¤¤¤¦¤³¤È¤Ç¤¢¤í¤¦¡£¤â¤¦°ì¤Ä¤Ï¡¢¸úΨ¤òÂ礭¤¯¾å¤²¤ë¤¿¤á¤Ë¤Ï
-¥í¥Ã¥¯¤Î¥ª¡¼¥Ð¥Ø¥Ã¥É¤òÈò¤±¤ëɬÍפ¬¤¢¤ë¤È¤¤¤¦¤³¤È¤Ç¤¢¤í¤¦¡£
+これらのことはすべて C プログラマには見えない部分で行われるが、 より細かい制御ができた方がよい理由が2つあるだろう。一つは、一つのスレッドが
+行う一連の入出力動作は一緒に行われ、他のスレッドの入出力によって中断されない 方がよいということであろう。もう一つは、効率を大きく上げるためには
+ロックのオーバヘッドを避ける必要があるということであろう。
 .LP
-.\"O To this end, a thread can explicitly lock the
-.\"O .I FILE
-.\"O object,
-.\"O then do its series of I/O actions, then unlock.
-.\"O This prevents
-.\"O other threads from coming in between.
-.\"O If the reason for doing
-.\"O this was to achieve greater efficiency, one does the I/O with
-.\"O the nonlocking versions of the stdio functions: with
-.\"O .BR getc_unlocked (3)
-.\"O and
-.\"O .BR putc_unlocked (3)
-.\"O instead of
-.\"O .BR getc (3)
-.\"O and
-.\"O .BR putc (3).
-¤³¤ÎÌÜŪ¤ò¼Â¸½¤¹¤ë¤¿¤á¤Ë¡¢
-.I FILE
-¥ª¥Ö¥¸¥§¥¯¥È¤Î¥í¥Ã¥¯¡¢°ìÏ¢¤ÎÆþ½ÐÎÏÆ°ºî¤Î¼Â¹Ô¡¢
-¥í¥Ã¥¯¤Î²ò½ü¤ò¥¹¥ì¥Ã¥É¤¬ÌÀ¼¨Åª¤Ë»Ø¼¨¤¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
-¤³¤ì¤Ë¤è¤ê¡¢Â¾¤Î¥¹¥ì¥Ã¥É¤¬ÅÓÃæ¤ÇÆþ½ÐÎϤò¹Ô¤¦¤Î¤òËɻߤ¹¤ë¡£
-¤³¤Î¤è¤¦¤Ê¤³¤È¤ò¹Ô¤¦Íýͳ¤¬¸úΨ¤Î¸þ¾å¤Ç¤¢¤ë¤Ê¤é¤Ð¡¢
-¥í¥Ã¥¯¤ò¹Ô¤ï¤Ê¤¤¥Ð¡¼¥¸¥ç¥ó¤Îɸ½àÆþ½ÐÎÏ´Ø¿ô¤ò»È¤¦¤³¤È¤â¤Ç¤­¤ë¡£
-Î㤨¤Ð¡¢
-.BR getc (3)
-¤ä
-.BR putc (3)
-¤ÎÂå¤ï¤ê¤Ë
-.BR getc_unlocked (3)
-¤ä
-.BR putc_unlocked (3)
-¤ò»ÈÍѤ¹¤ë¡£
+この目的を実現するために、 \fIFILE\fP オブジェクトのロック、一連の入出力動作の実行、 ロックの解除をスレッドが明示的に指示することができる。
+これにより、他のスレッドが途中で入出力を行うのを防止する。 このようなことを行う理由が効率の向上であるならば、
+ロックを行わないバージョンの標準入出力関数を使うこともできる。 例えば、 \fBgetc\fP(3)  や \fBputc\fP(3)  の代わりに
+\fBgetc_unlocked\fP(3)  や \fBputc_unlocked\fP(3)  を使用する。
 .LP
-.\"O The
-.\"O .BR flockfile ()
-.\"O function waits for \fI*filehandle\fP to be
-.\"O no longer locked by a different thread, then makes the
-.\"O current thread owner of \fI*filehandle\fP, and increments
-.\"O the lockcount.
-.BR flockfile ()
-´Ø¿ô¤Ï¡¢\fI*filehandle\fP ¤¬Â¾¤Î¥¹¥ì¥Ã¥É¤Ë¥í¥Ã¥¯¤µ¤ì¤Æ¤¤¤Ê
-¤¤¾õÂ֤ˤʤë¤Þ¤ÇÂԤ俤ΤÁ¡¢¸½ºß¤Î¥¹¥ì¥Ã¥É¤ò \fI*filehandle\fP ¤Î¥ª¡¼¥Ê¤ËÀß
-Äꤷ¡¢¥í¥Ã¥¯¿ô¤ò²Ã»»¤¹¤ë¡£
+\fBflockfile\fP()  関数は、\fI*filehandle\fP が他のスレッドにロックされていな い状態になるまで待ったのち、現在のスレッドを
+\fI*filehandle\fP のオーナに設 定し、ロック数を加算する。
 .LP
-.\"O The
-.\"O .BR funlockfile ()
-.\"O function decrements the lock count.
-.BR funlockfile ()
-´Ø¿ô¤Ï¡¢¥í¥Ã¥¯¿ô¤ò¸º»»¤¹¤ë¡£
+\fBfunlockfile\fP()  関数は、ロック数を減算する。
 .LP
-.\"O The
-.\"O .BR ftrylockfile ()
-.\"O function is a nonblocking version
-.\"O of
-.\"O .BR flockfile ().
-.\"O It does nothing in case some other thread
-.\"O owns \fI*filehandle\fP, and it obtains ownership and increments
-.\"O the lockcount otherwise.
-.BR ftrylockfile ()
-´Ø¿ô¤Ï
-.BR flockfile ()
-¤Î¥Ö¥í¥Ã¥­¥ó¥°¤ò¹Ô¤ï¤Ê¤¤
-¥Ð¡¼¥¸¥ç¥ó¤Ç¤¢¤ë¡£Â¾¤Î¥¹¥ì¥Ã¥É¤¬ \fI*filehandle\fP ¤ò¥í¥Ã¥¯¤·¤Æ¤¤¤ë»þ¤Ï
-²¿¤â¹Ô¤ï¤º¡¢¤½¤¦¤Ç¤Ê¤¤¾ì¹ç¤Ï \fI*filehandle\fP ¤Î½êÍ­¸¢¤ò³ÍÆÀ¤·¡¢
-¥í¥Ã¥¯¿ô¤ò²Ã»»¤¹¤ë¡£
-.\"O .SH "RETURN VALUE"
-.SH ÊÖ¤êÃÍ
-.\"O The
-.\"O .BR ftrylockfile ()
-.\"O function returns zero for success
-.\"O (the lock was obtained), and nonzero for failure.
-.BR ftrylockfile ()
-´Ø¿ô¤Ï¥í¥Ã¥¯¤ËÀ®¸ù¤¹¤ë¤È 0 ¤òÊÖ¤·¡¢
-¼ºÇÔ¤·¤¿¾ì¹ç¤Ï 0 °Ê³°¤ÎÃͤòÊÖ¤¹¡£
-.\"O .SH ERRORS
-.\"O None.
-.SH ¥¨¥é¡¼
-¤Ê¤·¡£
-.\"O .SH "CONFORMING TO"
-.SH ½àµò
-POSIX.1-2001.
-.\"O .SH AVAILABILITY
-.SH ²ÄÍÑÀ­
-.\"O These functions are available when
-.\"O .B _POSIX_THREAD_SAFE_FUNCTIONS
-.\"O is defined.
-.\"O They are in libc since libc 5.1.1 and in glibc
-.\"O since glibc 2.0.
-.B _POSIX_THREAD_SAFE_FUNCTIONS
-¤¬ÄêµÁ¤µ¤ì¤Æ¤¤¤ë¤È¤­¤Ë¤³¤ì¤é¤Î´Ø¿ô¤ò»ÈÍѤ¹¤ë¤³¤È¤¬¤Ç¤­¤ë¡£
-5.1.1 °Ê¹ß¤Î libc ¤È 2.0 °Ê¹ß¤Î glibc ¤Ë¸ºß¤¹¤ë¡£
-.\"O .SH "SEE ALSO"
-.SH ´ØÏ¢¹àÌÜ
-.BR unlocked_stdio (3)
+\fBftrylockfile\fP()  関数は \fBflockfile\fP()  のブロッキングを行わない バージョンである。他のスレッドが
+\fI*filehandle\fP をロックしている時は 何も行わず、そうでない場合は \fI*filehandle\fP の所有権を獲得し、 ロック数を加算する。
+.SH 返り値
+\fBftrylockfile\fP()  関数はロックに成功すると 0 を返し、 失敗した場合は 0 以外の値を返す。
+.SH エラー
+なし。
+.SH 属性
+.SS "マルチスレッディング (pthreads(7) 参照)"
+関数 \fBflockfile\fP(), \fBftrylockfile\fP(), \fBfunlockfile\fP() はスレッドセーフである。
+.SH 準拠
+POSIX.1\-2001.
+.SH 可用性
+\fB_POSIX_THREAD_SAFE_FUNCTIONS\fP が定義されているときにこれらの関数を使用することができる。
+.SH 関連項目
+\fBunlocked_stdio\fP(3)
+.SH この文書について
+この man ページは Linux \fIman\-pages\fP プロジェクトのリリース 3.79 の一部
+である。プロジェクトの説明とバグ報告に関する情報は
+http://www.kernel.org/doc/man\-pages/ に書かれている。