OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man2 / flock.2
index bcbcefa..0e2ec10 100644 (file)
@@ -1,3 +1,4 @@
+
 .\" Hey Emacs! This file is -*- nroff -*- source.
 .\"
 .\" Copyright 1993 Rickard E. Faith (faith@cs.unc.edu) and
 .\"
 .\" FIXME: Maybe document LOCK_MAND, LOCK_RW, LOCK_READ, LOCK_WRITE
 .\"        which only have effect for SAMBA.
+.\"*******************************************************************
 .\"
-.\" Japanese Version Copyright (c) 1996 Takeshi Ueno
-.\"         all rights reserved.
-.\" Translated 1996-07-03, Takeshi Ueno <tueno@vio.co.jp>
-.\" Modified 1997-12-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Modified 1999-08-14, HANATAKA Shinya <hanataka@abyss.rim.or.jp>
-.\" Modified 2002-09-24, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Modified 2005-02-26, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2005-09-06, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
+.\" This file was generated with po4a. Translate the source file.
 .\"
-.TH FLOCK 2 2009-07-25 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
-.\"O flock \- apply or remove an advisory lock on an open file
+.\"*******************************************************************
+.TH FLOCK 2 2009\-07\-25 Linux "Linux Programmer's Manual"
 .SH 名前
 flock \- オープンされたファイルに対するアドバイザリ・ロックの適用、解除を行う
-.\"O .SH SYNOPSIS
 .SH 書式
-.B #include <sys/file.h>
+\fB#include <sys/file.h>\fP
 .sp
-.BI "int flock(int " fd ", int " operation );
-.\"O .SH DESCRIPTION
+\fBint flock(int \fP\fIfd\fP\fB, int \fP\fIoperation\fP\fB);\fP
 .SH 説明
-.\"O Apply or remove an advisory lock on the open file specified by
-.\"O .IR fd .
-.\"O The argument
-.\"O .I operation
-.\"O is one of the following:
-オープンされたファイルにアドバイザリ・ロック (advisory lock) の適用
-や解除を行う。
-ファイルは
-.I fd
-で指定する。引き数
-.I operation
-には以下のいずれか一つを指定する:
+オープンされたファイルにアドバイザリ・ロック (advisory lock) の適用 や解除を行う。 ファイルは \fIfd\fP で指定する。引き数
+\fIoperation\fP には以下のいずれか一つを指定する:
 .RS 4
-.TP 9
-.B LOCK_SH
-.\"O Place a shared lock.
-.\"O More than one process may hold a shared lock for a given file
-.\"O at a given time.
-共有ロックを適用する。 指定したファイルに対して、
-一つ以上のプロセスが同時に共有ロックを保持することができる。
-.TP
-.B LOCK_EX
-.\"O Place an exclusive lock.
-.\"O Only one process may hold an exclusive lock for a given
-.\"O file at a given time.
-排他ロックを適用する。  指定したファイルに対して、
-ただ一つのプロセスだけが同時に排他ロックを保持することができる。
-.TP
-.B LOCK_UN
-.\"O Remove an existing lock held by this process.
+.TP  9
+\fBLOCK_SH\fP
+共有ロックを適用する。 指定したファイルに対して、 一つ以上のプロセスが同時に共有ロックを保持することができる。
+.TP 
+\fBLOCK_EX\fP
+排他ロックを適用する。 指定したファイルに対して、 ただ一つのプロセスだけが同時に排他ロックを保持することができる。
+.TP 
+\fBLOCK_UN\fP
 このプロセスが保持している既存のロックを解除する。
 .RE
 .PP
-.\"O A call to
-.\"O .BR flock ()
-.\"O may block if an incompatible lock is held by another process.
-.\"O To make a nonblocking request, include
-.\"O .B LOCK_NB
-.\"O (by ORing)
-.\"O with any of the above operations.
-.BR flock ()
-を呼び出したときに、指定したロック種別と異なるロックが別プロセスによって
-保持されていると、
-.BR flock ()
-は停止 (block) されることがある。
-非停止 (nonblocking) タイプの要求を行うためには、
-上記の操作 (operation) に
-.B LOCK_NB
-を論理和の形で指定する。
+\fBflock\fP()  を呼び出したときに、指定したロック種別と異なるロックが別プロセスによって 保持されていると、 \fBflock\fP()  は停止
+(block) されることがある。 非停止 (nonblocking) タイプの要求を行うためには、 上記の操作 (operation) に
+\fBLOCK_NB\fP を論理和の形で指定する。
 
-.\"O A single file may not simultaneously have both shared and exclusive locks.
 一つのファイルに共有ロックと排他ロックを同時に設定することはできない。
 
-.\"O Locks created by
-.\"O .BR flock ()
-.\"O are associated with an open file table entry.
-.\"O This means that duplicate file descriptors (created by, for example,
-.\"O .BR fork (2)
-.\"O or
-.\"O .BR dup (2))
-.\"O refer to the same lock, and this lock may be modified
-.\"O or released using any of these descriptors.
-.BR flock ()
-によって作られるロックは、
-オープンされたファイルのテーブル・エントリと関連付けられる。
-したがって、ファイル・ディスクリプタの複製
-.RB ( fork (2)
-や
-.BR dup (2)
-などにより作成される) は同じロックを参照し、
-これらのファイル・ディスクリプタのどれを使っても
-このロックを変更したり解放したりできる。
-.\"O Furthermore, the lock is released either by an explicit
-.\"O .B LOCK_UN
-.\"O operation on any of these duplicate descriptors, or when all
-.\"O such descriptors have been closed.
-また、ロックの解放は、
-上記の複数のファイル・ディスクリプタのいずれかに対して
-明示的に
-.B LOCK_UN
-操作を指示した場合か、これらのファイル・ディスクリプタがすべて
+\fBflock\fP()  によって作られるロックは、 オープンされたファイルのテーブル・エントリと関連付けられる。
+したがって、ファイル・ディスクリプタの複製 (\fBfork\fP(2)  や \fBdup\fP(2)  などにより作成される) は同じロックを参照し、
+これらのファイル・ディスクリプタのどれを使っても このロックを変更したり解放したりできる。 また、ロックの解放は、
+上記の複数のファイル・ディスクリプタのいずれかに対して 明示的に \fBLOCK_UN\fP 操作を指示した場合か、これらのファイル・ディスクリプタがすべて
 閉じられた場合に行われる。
 
-.\"O If a process uses
-.\"O .BR open (2)
-.\"O (or similar) to obtain more than one descriptor for the same file,
-.\"O these descriptors are treated independently by
-.\"O .BR flock ().
-.\"O An attempt to lock the file using one of these file descriptors
-.\"O may be denied by a lock that the calling process has
-.\"O already placed via another descriptor.
-あるプロセスが
-.BR open (2)
-(もしくは同様の方法) を使って同じファイルに対して
-複数のディスクリプタを取得した場合、
-.BR flock ()
-はこれら複数のディスクリプタを各々独立のものとして扱う。
-これらのファイル・ディスクリプタの一つを使ってファイルをロックしようと
-した際、そのロック要求は、呼び出し元のプロセスがそのファイルの別の
-ディスクリプタ経由ですでに設定しているロックによって拒否される場合がある。
+あるプロセスが \fBopen\fP(2)  (もしくは同様の方法) を使って同じファイルに対して 複数のディスクリプタを取得した場合、 \fBflock\fP()
+はこれら複数のディスクリプタを各々独立のものとして扱う。 これらのファイル・ディスクリプタの一つを使ってファイルをロックしようと
+した際、そのロック要求は、呼び出し元のプロセスがそのファイルの別の ディスクリプタ経由ですでに設定しているロックによって拒否される場合がある。
 
-.\"O A process may only hold one type of lock (shared or exclusive)
-.\"O on a file.
-.\"O Subsequent
-.\"O .BR flock ()
-.\"O calls on an already locked file will convert an existing lock to the new
-.\"O lock mode.
-一つのプロセスは、一つのファイルに対して (共有ロックと排他ロックのうち)
-いずれか一種類のロックしか設定できない。
-既にロックされたファイルに対して
-.BR flock ()
-を呼び出すと、既存のロックを新しいロックモードに変更することになる。
+一つのプロセスは、一つのファイルに対して (共有ロックと排他ロックのうち)  いずれか一種類のロックしか設定できない。 既にロックされたファイルに対して
+\fBflock\fP()  を呼び出すと、既存のロックを新しいロックモードに変更することになる。
 
-.\"O Locks created by
-.\"O .BR flock ()
-.\"O are preserved across an
-.\"O .BR execve (2).
-.BR flock ()
-により作成されたロックは
-.BR execve (2)
-の前後で保存される。
+\fBflock\fP()  により作成されたロックは \fBexecve\fP(2)  の前後で保存される。
 
-.\"O A shared or exclusive lock can be placed on a file regardless of the
-.\"O mode in which the file was opened.
-共有ロックも排他ロックも、ファイルがどのモードでオープンされたかに
-関係なく適用することができる。
-.\"O .SH "RETURN VALUE"
+共有ロックも排他ロックも、ファイルがどのモードでオープンされたかに 関係なく適用することができる。
 .SH 返り値
-.\"O On success, zero is returned.
-.\"O On error, \-1 is returned, and
-.\"O .I errno
-.\"O is set appropriately.
-成功の場合、0 が返される。エラーの場合は、\-1 が返され、
-.I errno
-に適切な値が設定される。
-.\"O .SH ERRORS
+成功した場合は 0 が返される。エラーの場合は \-1 が返され、 \fIerrno\fP が適切に設定される。
 .SH エラー
-.TP
-.B EBADF
-.\"O .I fd
-.\"O is not an open file descriptor.
-.I fd
-がオープンされたファイル・ディスクリプタではない。
-.TP
-.B EINTR
-.\"O While waiting to acquire a lock, the call was interrupted by
-.\"O delivery of a signal caught by a handler; see
-.\"O .BR signal (7).
-ロックの獲得を待っている間に、ハンドラにより捕捉されたシグナルを
-受信し、
-.BR flock ()
-が中断された。
-.BR signal (7)
-参照。
-.TP
-.B EINVAL
-.\"O .I operation
-.\"O is invalid.
-.I oepration
-が無効である。
-.TP
-.B ENOLCK
-.\"O The kernel ran out of memory for allocating lock records.
+.TP 
+\fBEBADF\fP
+\fIfd\fP がオープンされたファイル・ディスクリプタではない。
+.TP 
+\fBEINTR\fP
+ロックの獲得を待っている間に、ハンドラにより捕捉されたシグナルを 受信し、 \fBflock\fP()  が中断された。 \fBsignal\fP(7)  参照。
+.TP 
+\fBEINVAL\fP
+\fIoepration\fP が無効である。
+.TP 
+\fBENOLCK\fP
 ロック・レコードを割り当てるためのメモリが不足している。
-.TP
-.B EWOULDBLOCK
-.\"O The file is locked and the
-.\"O .B LOCK_NB
-.\"O flag was selected.
-指定したファイルがロックされており、
-.B LOCK_NB
-フラグが指定されている。
-.\"O .SH "CONFORMING TO"
+.TP 
+\fBEWOULDBLOCK\fP
+指定したファイルがロックされており、 \fBLOCK_NB\fP フラグが指定されている。
 .SH 準拠
-.\"O 4.4BSD (the
-.\"O .BR flock ()
-.\"O call first appeared in 4.2BSD).
-4.4BSD
-.RB ( flock ()
-コールは 4.2BSD で最初に登場した)。
-.\"O A version of
-.\"O .BR flock (),
-.\"O possibly implemented in terms of
-.\"O .BR fcntl (2),
-.\"O appears on most UNIX systems.
-.BR fcntl (2)
-で実装されているものなどを含めると、
-.BR flock ()
-の機能はほとんどの UNIX システムで実装されている。
-.\"O .SH NOTES
+4.4BSD (\fBflock\fP()  コールは 4.2BSD で最初に登場した)。 \fBfcntl\fP(2)  で実装されているものなどを含めると、
+\fBflock\fP()  の機能はほとんどの UNIX システムで実装されている。
 .SH 注意
-.\"O .BR flock ()
-.\"O does not lock files over NFS.
-.\"O Use
-.\"O .BR fcntl (2)
-.\"O instead: that does work over NFS, given a sufficiently recent version of
-.\"O Linux and a server which supports locking.
-.BR flock ()
-は NFS 上のファイルのロックをしない。代わりに
-.BR fcntl (2)
-を使用すること。これにより、十分に新しいバージョンの Linux と、ロック機能を
-サポートした NFS サーバを使用することにより、NFS 上でロックができる。
+\fBflock\fP()  は NFS 上のファイルのロックをしない。代わりに \fBfcntl\fP(2)
+を使用すること。これにより、十分に新しいバージョンの Linux と、ロック機能を サポートした NFS サーバを使用することにより、NFS
+上でロックができる。
 .PP
-.\"O Since kernel 2.0,
-.\"O .BR flock ()
-.\"O is implemented as a system call in its own right rather
-.\"O than being emulated in the GNU C library as a call to
-.\"O .BR fcntl (2).
-kernel 2.0 以降では、
-.BR flock ()
-は、GNU C ライブラリでの
-.BR fcntl (2)
-を呼び出してのエミュレーションではなく、
-それ自体がシステムコールとして実装されている。
-.\"O This yields true BSD semantics:
-.\"O there is no interaction between the types of lock
-.\"O placed by
-.\"O .BR flock ()
-.\"O and
-.\"O .BR fcntl (2),
-.\"O and
-.\"O .BR flock ()
-.\"O does not detect deadlock.
-これにより正真正銘の BSD での動作が達成される:
-.BR flock ()
-と
-.BR fcntl (2)
-で適用されるロックの種別には相互作用がなくなり、
-.BR flock ()
+kernel 2.0 以降では、 \fBflock\fP()  は、GNU C ライブラリでの \fBfcntl\fP(2)
+を呼び出してのエミュレーションではなく、 それ自体がシステムコールとして実装されている。 これにより正真正銘の BSD での動作が達成される:
+\fBflock\fP()  と \fBfcntl\fP(2)  で適用されるロックの種別には相互作用がなくなり、 \fBflock\fP()
 がデッドロックを検出しなくなる。
 .PP
-.\"O .BR flock ()
-.\"O places advisory locks only; given suitable permissions on a file,
-.\"O a process is free to ignore the use of
-.\"O .BR flock ()
-.\"O and perform I/O on the file.
-.BR flock ()
-アドバイザリ・ロックだけを適用する。したがって、ファイルに適切なアクセス権を
-付与していれば、プロセスは
-.BR flock ()
+\fBflock\fP()  アドバイザリ・ロックだけを適用する。したがって、ファイルに適切なアクセス権を 付与していれば、プロセスは \fBflock\fP()
 の使用に無視して、ファイルへの入出力を行うことができる。
 .PP
-.\"O .BR flock ()
-.\"O and
-.\"O .BR fcntl (2)
-.\"O locks have different semantics with respect to forked processes and
-.\"O .BR dup (2).
-.BR flock ()
-と
-.BR fcntl (2)
-は fork されたプロセスと
-.BR dup (2)
-で違った動作をする。
-.\"O On systems that implement
-.\"O .BR flock ()
-.\"O using
-.\"O .BR fcntl (2),
-.\"O the semantics of
-.\"O .BR flock ()
-.\"O will be different from those described in this manual page.
-.BR flock ()
-を
-.BR fcntl (2)
-を使って実装しているシステムでは、
-.BR flock ()
+\fBflock\fP()  と \fBfcntl\fP(2)  は fork されたプロセスと \fBdup\fP(2)  で違った動作をする。 \fBflock\fP()
+を \fBfcntl\fP(2)  を使って実装しているシステムでは、 \fBflock\fP()
 の動作はこのマニュアル・ページに記載されているものとは違うだろう。
 .PP
-.\"O Converting a lock
-.\"O (shared to exclusive, or vice versa) is not guaranteed to be atomic:
-.\"O the existing lock is first removed, and then a new lock is established.
-.\"O Between these two steps,
-.\"O a pending lock request by another process may be granted,
-.\"O with the result that the conversion either blocks, or fails if
-.\"O .B LOCK_NB
-.\"O was specified.
-.\"O (This is the original BSD behavior,
-.\"O and occurs on many other implementations.)
-.\"O .\" Kernel 2.5.21 changed things a little: during lock conversion
-.\"O .\" it is now the highest priority process that will get the lock -- mtk
-ロックの変換 (共有ロックから排他ロックへ、もしくはその反対) がアトミックに
-行われることは保証されていない: 既存のロックがまず削除され、それから新しい
-ロックが設定される。この 2つのステップの間に、他のプロセスからの処理待ちの
-ロック要求が認められるかもしれず、結果として変換は停止 (block) したり、
-.RB ( LOCK_NB
-が指定された場合には) 失敗したりする。
+.\" Kernel 2.5.21 changed things a little: during lock conversion
+.\" it is now the highest priority process that will get the lock -- mtk
+ロックの変換 (共有ロックから排他ロックへ、もしくはその反対) がアトミックに 行われることは保証されていない:
+既存のロックがまず削除され、それから新しい ロックが設定される。この 2つのステップの間に、他のプロセスからの処理待ちの
+ロック要求が認められるかもしれず、結果として変換は停止 (block) したり、 (\fBLOCK_NB\fP が指定された場合には) 失敗したりする。
 (これは元々の BSD の動作であり、多くの他の実装でも起こる。)
-.\" カーネル 2.5.21 で少し動作が変更された: ロック変換の最中は
-.\" そのロックを行おうとしているプロセスが最高優先となる -- mtk
-.\"O .SH "SEE ALSO"
 .SH 関連項目
-.BR close (2),
-.BR dup (2),
-.BR execve (2),
-.BR fcntl (2),
-.BR fork (2),
-.BR open (2),
-.BR lockf (3)
+\fBclose\fP(2), \fBdup\fP(2), \fBexecve\fP(2), \fBfcntl\fP(2), \fBfork\fP(2), \fBopen\fP(2),
+\fBlockf\fP(3)
 
-.\"O See also
-.\"O .I Documentation/filesystem/locks.txt
-.\"O in the kernel source
-.\"O .RI ( Documentation/locks.txt
-.\"O in older kernels).
-カーネルソース内の
-.I Documentation/filesystem/locks.txt
-(以前のカーネルでは
-.IR Documentation/locks.txt )
-も参照のこと。
+カーネルソース内の \fIDocumentation/filesystem/locks.txt\fP (以前のカーネルでは
+\fIDocumentation/locks.txt\fP)  も参照のこと。