diff options
Diffstat (limited to 'man7/mq_overview.7')
-rw-r--r-- | man7/mq_overview.7 | 94 |
1 files changed, 48 insertions, 46 deletions
diff --git a/man7/mq_overview.7 b/man7/mq_overview.7 index 51ad14d3a..02121f95b 100644 --- a/man7/mq_overview.7 +++ b/man7/mq_overview.7 @@ -10,13 +10,14 @@ mq_overview \- overview of POSIX message queues POSIX message queues allow processes to exchange data in the form of messages. This API is distinct from that provided by System V message queues -.RB ( msgget (2), -.BR msgsnd (2), -.BR msgrcv (2), +\%(\c +.MR msgget 2 , +.MR msgsnd 2 , +.MR msgrcv 2 , etc.), but provides similar functionality. .P Message queues are created and opened using -.BR mq_open (3); +.MR mq_open 3 ; this function returns a .I message queue descriptor .RI ( mqd_t ), @@ -28,30 +29,30 @@ that is, a null-terminated string of up to (i.e., 255) characters consisting of an initial slash, followed by one or more characters, none of which are slashes. Two processes can operate on the same queue by passing the same name to -.BR mq_open (3). +.MR mq_open 3 . .P Messages are transferred to and from a queue using -.BR mq_send (3) +.MR mq_send 3 and -.BR mq_receive (3). +.MR mq_receive 3 . When a process has finished using the queue, it closes it using -.BR mq_close (3), +.MR mq_close 3 , and when the queue is no longer required, it can be deleted using -.BR mq_unlink (3). +.MR mq_unlink 3 . Queue attributes can be retrieved and (in some cases) modified using -.BR mq_getattr (3) +.MR mq_getattr 3 and -.BR mq_setattr (3). +.MR mq_setattr 3 . A process can request asynchronous notification of the arrival of a message on a previously empty queue using -.BR mq_notify (3). +.MR mq_notify 3 . .P A message queue descriptor is a reference to an .I "open message queue description" (see -.BR open (2)). +.MR open 2 ). After a -.BR fork (2), +.MR fork 2 , a child inherits copies of its parent's message queue descriptors, and these descriptors refer to the same open message queue descriptions as the corresponding message queue descriptors in the parent. @@ -108,7 +109,7 @@ This option is enabled by default. .SS Persistence POSIX message queues have kernel persistence: if not removed by -.BR mq_unlink (3), +.MR mq_unlink 3 , a message queue will exist until the system is shut down. .SS Linking Programs using the POSIX message queue API must be compiled with @@ -124,7 +125,7 @@ the default attributes for new message queues: This file defines the value used for a new queue's .I mq_maxmsg setting when the queue is created with a call to -.BR mq_open (3) +.MR mq_open 3 where .I attr is specified as NULL. @@ -150,7 +151,7 @@ maximum number of messages in a queue. This value acts as a ceiling on the .I attr\->mq_maxmsg argument given to -.BR mq_open (3). +.MR mq_open 3 . The default value for .I msg_max is 10. @@ -185,7 +186,7 @@ Since Linux 3.5: This file defines the value used for a new queue's .I mq_msgsize setting when the queue is created with a call to -.BR mq_open (3) +.MR mq_open 3 where .I attr is specified as NULL. @@ -214,7 +215,7 @@ maximum message size. This value acts as a ceiling on the .I attr\->mq_msgsize argument given to -.BR mq_open (3). +.MR mq_open 3 . The default value for .I msgsize_max is 8192 bytes. @@ -258,7 +259,7 @@ The resource limit, which places a limit on the amount of space that can be consumed by all of the message queues belonging to a process's real user ID, is described in -.BR getrlimit (2). +.MR getrlimit 2 . .SS Mounting the message queue filesystem On Linux, message queues are created in a virtual filesystem. (Other implementations may also provide such a feature, @@ -278,9 +279,9 @@ The sticky bit is automatically enabled on the mount directory. After the filesystem has been mounted, the message queues on the system can be viewed and manipulated using the commands usually used for files (e.g., -.BR ls (1) +.MR ls 1 and -.BR rm (1)). +.MR rm 1 ). .P The contents of each file in the directory consist of a single line containing information about the queue: @@ -299,7 +300,7 @@ Number of bytes of data in all messages in the queue (but see BUGS). .TP .B NOTIFY_PID If this is nonzero, then the process with this PID has used -.BR mq_notify (3) +.MR mq_notify 3 to register for asynchronous message notification, and the remaining fields describe how notification occurs. .TP @@ -320,25 +321,26 @@ Signal number to be used for On Linux, a message queue descriptor is actually a file descriptor. (POSIX does not require such an implementation.) This means that a message queue descriptor can be monitored using -.BR select (2), -.BR poll (2), +.MR select 2 , +.MR poll 2 , or -.BR epoll (7). +.MR epoll 7 . This is not portable. .P The close-on-exec flag (see -.BR open (2)) +.MR open 2 ) is automatically set on the file descriptor returned by -.BR mq_open (2). +.MR mq_open 2 . .SS IPC namespaces For a discussion of the interaction of POSIX message queue objects and IPC namespaces, see -.BR ipc_namespaces (7). +.MR ipc_namespaces 7 . .SH NOTES System V message queues -.RB ( msgget (2), -.BR msgsnd (2), -.BR msgrcv (2), +\%(\c +.MR msgget 2 , +.MR msgsnd 2 , +.MR msgrcv 2 , etc.) are an older API for exchanging messages between processes. POSIX message queues provide a better designed interface than System V message queues; @@ -372,18 +374,18 @@ so that the count once more included just the bytes of user data in messages in the queue. .SH EXAMPLES An example of the use of various message queue functions is shown in -.BR mq_notify (3). +.MR mq_notify 3 . .SH SEE ALSO -.BR getrlimit (2), -.BR mq_getsetattr (2), -.BR poll (2), -.BR select (2), -.BR mq_close (3), -.BR mq_getattr (3), -.BR mq_notify (3), -.BR mq_open (3), -.BR mq_receive (3), -.BR mq_send (3), -.BR mq_unlink (3), -.BR epoll (7), -.BR namespaces (7) +.MR getrlimit 2 , +.MR mq_getsetattr 2 , +.MR poll 2 , +.MR select 2 , +.MR mq_close 3 , +.MR mq_getattr 3 , +.MR mq_notify 3 , +.MR mq_open 3 , +.MR mq_receive 3 , +.MR mq_send 3 , +.MR mq_unlink 3 , +.MR epoll 7 , +.MR namespaces 7 |