OSDN Git Service

(split) LDP: draft snapshot generated from latest ja.po files.
[linuxjm/LDP_man-pages.git] / draft / man3 / mq_notify.3
index 16167c5..accc173 100644 (file)
@@ -1,4 +1,4 @@
-'\" t
+.\" t
 .\" Hey Emacs! This file is -*- nroff -*- source.
 .\"
 .\" Copyright (C) 2006 Michael Kerrisk <mtk.manpages@gmail.com>
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
 .\"
-.\" Japanese Version Copyright (c) 2006 Akihiro MOTOKI all rights reserved.
-.\" Translated 2006-07-31, Akihiro MOTOKI <amotoki@dd.iij4u.or.jp>
-.\" Updated 2010-04-18, Akihiro MOTOKI, LDP v3.24
-.\" Updated 2010-10-27, Akihiro Motoki, LDP v3.29
+.\"*******************************************************************
 .\"
-.TH MQ_NOTIFY 3 2010-10-04 "Linux" "Linux Programmer's Manual"
-.\"O .SH NAME
+.\" This file was generated with po4a. Translate the source file.
+.\"
+.\"*******************************************************************
+.TH MQ_NOTIFY 3 2010\-10\-04 Linux "Linux Programmer's Manual"
 .SH 名前
-.\"O mq_notify \- register for notification when a message is available
 mq_notify \- メッセージ到着時に通知を行うよう登録する
-.\"O .SH SYNOPSIS
 .SH 書式
 .nf
-.B #include <mqueue.h>
+\fB#include <mqueue.h>\fP
 .sp
-.BI "int mq_notify(mqd_t " mqdes ", const struct sigevent *" notification );
+\fBint mq_notify(mqd_t \fP\fImqdes\fP\fB, const struct sigevent *\fP\fInotification\fP\fB);\fP
 .fi
 .sp
-.\"O Link with \fI\-lrt\fP.
 \fI\-lrt\fP でリンクする。
-.\"O .SH DESCRIPTION
 .SH 説明
-.\"O .BR mq_notify ()
-.\"O allows the calling process to register or unregister for delivery of
-.\"O an asynchronous notification when a new message arrives on
-.\"O the empty message queue referred to by the descriptor
-.\"O .IR mqdes .
-.BR mq_notify ()
-を使うと、ディスクリプタ
-.I mqdes
-で参照される空のメッセージキューに新しくメッセージが到着した時に
-非同期の通知 (notification) の配送が行われるように登録したり、
-その解除を行ったりできる。
+\fBmq_notify\fP()  を使うと、ディスクリプタ \fImqdes\fP で参照される空のメッセージキューに新しくメッセージが到着した時に
+非同期の通知 (notification) の配送が行われるように登録したり、 その解除を行ったりできる。
 
-.\"O The
-.\"O .I sevp
-.\"O argument is a pointer to a
-.\"O .I sigevent
-.\"O structure.
-.\"O For the definition and general details of this structure, see
-.\"O .BR sigevent (7).
-.I sevp
-引き数は
-.I sigevent
-構造体へのポインタである。
-この構造体の定義と一般的な詳細については
-.BR sigevent (7)
+\fIsevp\fP 引き数は \fIsigevent\fP 構造体へのポインタである。 この構造体の定義と一般的な詳細については \fBsigevent\fP(7)
 を参照。
 .PP
-.\"O If
-.\"O .I sevp
-.\"O is a non-NULL pointer, then
-.\"O .BR mq_notify ()
-.\"O registers the calling process to receive message notification.
-.I sevp
-が NULL でないポインタであれば、
-.BR mq_notify ()
-はメッセージ通知を受け取るように呼び出し元のプロセスを登録する。
-.\"O The
-.\"O .I sigev_notify
-.\"O field of the
-.\"O .I sigevent
-.\"O structure to which
-.\"O .I sevp
-.\"O points specifies how notification is to be performed.
-.\"O This field has one of the following values:
-.I sevp
-が指す
-.I sigevent
-構造体の
-.I sigev_notify
-フィールドは、どのような通知を行うのかを指定する。
+\fIsevp\fP が NULL でないポインタであれば、 \fBmq_notify\fP()  はメッセージ通知を受け取るように呼び出し元のプロセスを登録する。
+\fIsevp\fP が指す \fIsigevent\fP 構造体の \fIsigev_notify\fP フィールドは、どのような通知を行うのかを指定する。
 このフィールドは以下の値のいずれかを持つ。
-.TP
-.B SIGEV_NONE
-.\"O A "null" notification: the calling process is registered as the target
-.\"O for notification, but when a message arrives, no notification is sent.
-「空の (null)」の通知: 呼び出し元のプロセスを通知の宛先として登録するが、
-実際にはメッセージが到着した時に通知は送られない。
+.TP 
+\fBSIGEV_NONE\fP
 .\" When is SIGEV_NONE useful?
-.TP
-.B SIGEV_SIGNAL
-.\"O Notify the process by sending the signal specified in
-.\"O .IR sigev_signo .
-.\"O See
-.\"O .BR sigevent (7)
-.\"O for general details.
-.I sigev_signo
-で指定されたシグナルを送って、プロセスに通知する。
-一般的な詳細については
-.BR sigevent (7)
-を参照。
-.\"O The
-.\"O .I si_code
-.\"O field of the
-.\"O .I siginfo_t
-.\"O structure will be set to
-.\"O .BR SI_MESGQ .
-.I siginfo_t
-構造体の
-.I si_code
-フィールドには
-.B SI_MESGQ
-が設定される。
-.\"O In addition,
+「空の (null)」の通知: 呼び出し元のプロセスを通知の宛先として登録するが、 実際にはメッセージが到着した時に通知は送られない。
+.TP 
+\fBSIGEV_SIGNAL\fP
 .\" I don't know of other implementations that set
 .\" si_pid and si_uid -- MTK
-.\"O .I si_pid
-.\"O will be set to the PID of the process that sent the message, and
-.\"O .I si_uid
-.\"O will be set to the real user ID of the sending process.
-さらに、
-.I si_pid
-にはメッセージを送信したプロセスの PID が、
-.I si_uid
-には送信プロセスの実ユーザ ID が設定される。
-.TP
-.B SIGEV_THREAD
-.\"O Upon message delivery, invoke
-.\"O .I sigev_notify_function
-.\"O as if it were the start function of a new thread.
-.\"O See
-.\"O .BR sigevent (7)
-.\"O for details.
-メッセージの配送時には、
-.I sigev_notify_function
-があたかも新しいスレッドの開始関数であるかのように起動される。
-詳細は
-.BR sigevent (7)
-を参照。
+\fIsigev_signo\fP で指定されたシグナルを送って、プロセスに通知する。 一般的な詳細については \fBsigevent\fP(7)  を参照。
+\fIsiginfo_t\fP 構造体の \fIsi_code\fP フィールドには \fBSI_MESGQ\fP が設定される。 さらに、 \fIsi_pid\fP
+にはメッセージを送信したプロセスの PID が、 \fIsi_uid\fP には送信プロセスの実ユーザ ID が設定される。
+.TP 
+\fBSIGEV_THREAD\fP
+メッセージの配送時には、 \fIsigev_notify_function\fP があたかも新しいスレッドの開始関数であるかのように起動される。 詳細は
+\fBsigevent\fP(7)  を参照。
 .PP
-.\"O Only one process can be registered to receive notification
-.\"O from a message queue.
-一つのメッセージキューから通知を受信するように登録できるプロセスは
-一つだけである。
+一つのメッセージキューから通知を受信するように登録できるプロセスは 一つだけである。
 
-.\"O If
-.\"O .I sevp
-.\"O is NULL, and the calling process is currently registered to receive
-.\"O notifications for this message queue, then the registration is removed;
-.\"O another process can then register to receive a message notification
-.\"O for this queue.
-.I sevp
-が NULL で、かつ呼び出し元のプロセスがこのメッセージキューからの
-通知を受信するに現在登録している場合、登録を削除する。
-これ以降、別のプロセスがこのメッセージキューから通知を受信するように
-登録できるようになる。
+\fIsevp\fP が NULL で、かつ呼び出し元のプロセスがこのメッセージキューからの 通知を受信するに現在登録している場合、登録を削除する。
+これ以降、別のプロセスがこのメッセージキューから通知を受信するように 登録できるようになる。
 
-.\"O Message notification only occurs when a new message arrives and
-.\"O the queue was previously empty.
-.\"O If the queue was not empty at the time
-.\"O .BR mq_notify ()
-.\"O was called, then a notification will only occur after
-.\"O the queue is emptied and a new message arrives.
-メッセージ通知は、それまで空のキューに新しいメッセージが到着した
-場合にのみ行われる。
-.BR mq_notify ()
-が呼び出された時にそのキューが空でない場合、
-そのキューが空になり、その後新しいメッセージが到着した時に
-初めて通知が行われることになる。
+メッセージ通知は、それまで空のキューに新しいメッセージが到着した 場合にのみ行われる。 \fBmq_notify\fP()
+が呼び出された時にそのキューが空でない場合、 そのキューが空になり、その後新しいメッセージが到着した時に 初めて通知が行われることになる。
 
-.\"O If another process or thread is waiting to read a message
-.\"O from an empty queue using
-.\"O .BR mq_receive (3),
-.\"O then any message notification registration is ignored:
-.\"O the message is delivered to the process or thread calling
-.\"O .BR mq_receive (3),
-.\"O and the message notification registration remains in effect.
-別のプロセスやスレッドが
-.BR mq_receive (3)
-を使って、空のキューからメッセージの読み出しを待っている場合、
-メッセージ通知の登録は全て無視される。
-メッセージは
-.BR mq_receive (3)
-を呼び出しているプロセスやスレッドに配送され、
+別のプロセスやスレッドが \fBmq_receive\fP(3)  を使って、空のキューからメッセージの読み出しを待っている場合、
+メッセージ通知の登録は全て無視される。 メッセージは \fBmq_receive\fP(3)  を呼び出しているプロセスやスレッドに配送され、
 メッセージ通知の登録は効力を持ったままとなる。
 
-.\"O Notification occurs once: after a notification is delivered,
-.\"O the notification registration is removed,
-.\"O and another process can register for message notification.
-.\"O If the notified process wishes to receive the next notification,
-.\"O it can use
-.\"O .BR mq_notify ()
-.\"O to request a further notification.
-.\"O This should be done before emptying all unread messages from the queue.
-.\"O (Placing the queue in nonblocking mode is useful for emptying
-.\"O the queue of messages without blocking once it is empty.)
-通知は一度だけ行われる。通知が送られた後は、通知要求の登録は削除され、
-別のプロセスがメッセージ通知を受信するように登録できるようになる。
-通知を受けたプロセスが次の通知も受信したい場合は、
-.BR mq_notify ()
-を使ってその後の通知も受けるように要求することができる。
-.BR mq_notify ()
-を再度呼び出すのは、読み出していないメッセージを全部読み出して
-キューが空になる前にすべきである
-(キューからのメッセージ読み出しをキューが空になった時に
-停止 (block) せずに行うには、キューを非停止モード (non-blocking mode)
-に設定しておくとよい)。
-.\"O .SH RETURN VALUE
+通知は一度だけ行われる。通知が送られた後は、通知要求の登録は削除され、 別のプロセスがメッセージ通知を受信するように登録できるようになる。
+通知を受けたプロセスが次の通知も受信したい場合は、 \fBmq_notify\fP()  を使ってその後の通知も受けるように要求することができる。
+\fBmq_notify\fP()  を再度呼び出すのは、読み出していないメッセージを全部読み出して キューが空になる前にすべきである
+(キューからのメッセージ読み出しをキューが空になった時に 停止 (block) せずに行うには、キューを非停止モード (non\-blocking
+mode)  に設定しておくとよい)。
 .SH 返り値
-.\"O On success
-.\"O .BR mq_notify ()
-.\"O returns 0; on error, \-1 is returned, with
-.\"O .I errno
-.\"O set to indicate the error.
-成功すると、
-.BR mq_notify ()
-は 0 を返す。エラーの場合、\-1 を返し、
-.I errno
-をエラーを示す値に設定する。
-.\"O .SH ERRORS
+成功すると、 \fBmq_notify\fP()  は 0 を返す。エラーの場合、\-1 を返し、 \fIerrno\fP をエラーを示す値に設定する。
 .SH エラー
-.TP
-.B EBADF
-.\"O The descriptor specified in
-.\"O .I mqdes
-.\"O is invalid.
-.I mqdes
-に指定されたディスクリプタが不正である。
-.TP
-.B EBUSY
-.\"O Another process has already registered to receive notification
-.\"O for this message queue.
-別のプロセスがすでに
-このメッセージキューに対する通知を受信するように登録している。
-.TP
-.B EINVAL
-.\"O .I sevp\->sigev_notify
-.\"O is not one of the permitted values; or
-.\"O .I sevp\->sigev_notify
-.\"O is
-.\"O .B SIGEV_SIGNAL
-.\"O and
-.\"O .I sevp\->sigev_signo
-.\"O is not a valid signal number.
-.I sevp\->sigev_notify
-が許可された値のいずれでもない。もしくは
-.I sevp\->sigev_notify
-が
-.B SIGEV_SIGNAL
-だが
-.I sevp\->sigev_signo
-が有効なシグナル番号ではない。
-.TP
-.B ENOMEM
-.\"O Insufficient memory.
-必要なメモリがなかった。
+.TP 
+\fBEBADF\fP
+\fImqdes\fP に指定されたディスクリプタが不正である。
+.TP 
+\fBEBUSY\fP
+別のプロセスがすでに このメッセージキューに対する通知を受信するように登録している。
+.TP 
+\fBEINVAL\fP
+\fIsevp\->sigev_notify\fP が許可された値のいずれでもない。もしくは \fIsevp\->sigev_notify\fP が
+\fBSIGEV_SIGNAL\fP だが \fIsevp\->sigev_signo\fP が有効なシグナル番号ではない。
+.TP 
+\fBENOMEM\fP
+十分なメモリがない。
 .PP
-.\"O POSIX.1-2008 says that an implementation
-.\"O .I may
-.\"O generate an
-.\"O .B EINVAL
-.\"O .\" Linux does not do this
-.\"O error if
-.\"O .I sevp
-.\"O is NULL, and the caller is not currently registered to receive
-.\"O notifications for the queue
-.\"O .IR mqdes .
-POSIX.1-2008 では、
-.I sevp
-が NULL で、呼び出し元のプロセスがキュー
-.I mqdes
-に関する通知を受信するように登録されていない場合、エラー
-.B EINVAL
-を生成するような実装を行っても「よい」ことになっている。
-.\" Linux の実装では EINVAL は生成されない
-.\"O .SH CONFORMING TO
+.\" Linux does not do this
+POSIX.1\-2008 では、 \fIsevp\fP が NULL で、呼び出し元のプロセスがキュー \fImqdes\fP
+に関する通知を受信するように登録されていない場合、エラー \fBEINVAL\fP を生成するような実装を行っても「よい」ことになっている。
 .SH 準拠
-POSIX.1-2001.
-.\"O .SH EXAMPLE
+POSIX.1\-2001.
 .SH 例
-.\"O The following program registers a notification request for the
-.\"O message queue named in its command-line argument.
-.\"O Notification is performed by creating a thread.
-.\"O The thread executes a function which reads one message from the
-.\"O queue and then terminates the process.
-以下のプログラムは、
-コマンドライン引き数で指定された名前のメッセージキューへの
-通知要求を登録し、通知はスレッドの作成によって行われる。
-そのスレッドは、そのキューからメッセージを一つ読み出してから、
-プロセスを終了する関数を実行する。
+以下のプログラムは、 コマンドライン引き数で指定された名前のメッセージキューへの 通知要求を登録し、通知はスレッドの作成によって行われる。
+そのスレッドは、そのキューからメッセージを一つ読み出してから、 プロセスを終了する関数を実行する。
 .nf
 
 #include <pthread.h>
@@ -312,10 +115,9 @@ POSIX.1-2001.
 #include <stdlib.h>
 #include <unistd.h>
 
-#define handle_error(msg) \\
+#define handle_error(msg) \e
     do { perror(msg); exit(EXIT_FAILURE); } while (0)
 
-.\"O static void                     /* Thread start function */
 static void                     /* スレッド開始関数 */
 tfunc(union sigval sv)
 {
@@ -324,7 +126,6 @@ tfunc(union sigval sv)
     void *buf;
     mqd_t mqdes = *((mqd_t *) sv.sival_ptr);
 
-.\"O     /* Determine max. msg size; allocate buffer to receive msg */
     /* 最大メッセージサイズを決定し、
        メッセージ受信用のバッファを確保する */
 
@@ -338,9 +139,8 @@ tfunc(union sigval sv)
     if (nr == \-1)
         handle_error("mq_receive");
 
-    printf("Read %ld bytes from MQ\\n", (long) nr);
+    printf("Read %ld bytes from MQ\en", (long) nr);
     free(buf);
-.\"O     exit(EXIT_SUCCESS);         /* Terminate the process */
     exit(EXIT_SUCCESS);         /* プロセスを終了する */
 }
 
@@ -351,7 +151,7 @@ main(int argc, char *argv[])
     struct sigevent sev;
 
     if (argc != 2) {
-       fprintf(stderr, "Usage: %s <mq-name>\\n", argv[0]);
+       fprintf(stderr, "Usage: %s <mq\-name>\en", argv[0]);
        exit(EXIT_FAILURE);
     }
 
@@ -362,22 +162,13 @@ main(int argc, char *argv[])
     sev.sigev_notify = SIGEV_THREAD;
     sev.sigev_notify_function = tfunc;
     sev.sigev_notify_attributes = NULL;
-.\"O     sev.sigev_value.sival_ptr = &mqdes;   /* Arg. to thread func. */
     sev.sigev_value.sival_ptr = &mqdes;   /* スレッド関数に渡す引き数 */
     if (mq_notify(mqdes, &sev) == \-1)
         handle_error("mq_notify");
 
-.\"O     pause();    /* Process will be terminated by thread function */
     pause();    /* プロセスはスレッド関数により終了される */
 }
 .fi
-.\"O .SH "SEE ALSO"
 .SH 関連項目
-.BR mq_close (3),
-.BR mq_getattr (3),
-.BR mq_open (3),
-.BR mq_receive (3),
-.BR mq_send (3),
-.BR mq_unlink (3),
-.BR mq_overview (7),
-.BR sigevent (7)
+\fBmq_close\fP(3), \fBmq_getattr\fP(3), \fBmq_open\fP(3), \fBmq_receive\fP(3),
+\fBmq_send\fP(3), \fBmq_unlink\fP(3), \fBmq_overview\fP(7), \fBsigevent\fP(7)