Debian Codegraph @

templates/man3/mq_notify.3.pot

raw
1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5 #
6 #, fuzzy
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2026-06-05 06:31+0200\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <[email protected]>\n"
14 "Language: \n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18
19 #. type: TH
20 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
21 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
22 #, no-wrap
23 msgid "mq_notify"
24 msgstr ""
25
26 #. type: TH
27 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
28 #: opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-08"
31 msgstr ""
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr ""
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr ""
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid "mq_notify - register for notification when a message is available"
50 msgstr ""
51
52 #. type: SH
53 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
54 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
55 #, no-wrap
56 msgid "LIBRARY"
57 msgstr ""
58
59 #. type: Plain text
60 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
61 #: opensuse-leap-16-1 opensuse-tumbleweed
62 msgid "Real-time library (I<librt>,\\ I<-lrt>)"
63 msgstr ""
64
65 #. type: SH
66 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
67 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
68 #, no-wrap
69 msgid "SYNOPSIS"
70 msgstr ""
71
72 #. type: Plain text
73 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
74 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
75 #, no-wrap
76 msgid ""
77 "B<#include E<lt>mqueue.hE<gt>>\n"
78 "B<#include E<lt>signal.hE<gt> >/* Definition of SIGEV_* constants */\n"
79 msgstr ""
80
81 #. type: Plain text
82 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
83 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
84 #, no-wrap
85 msgid "B<int mq_notify(mqd_t >I<mqdes>B<, const struct sigevent *>I<sevp>B<);>\n"
86 msgstr ""
87
88 #. type: SH
89 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
90 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
91 #, no-wrap
92 msgid "DESCRIPTION"
93 msgstr ""
94
95 #. type: Plain text
96 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
97 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
98 msgid ""
99 "B<mq_notify>() allows the calling process to register or unregister for "
100 "delivery of an asynchronous notification when a new message arrives on the "
101 "empty message queue referred to by the message queue descriptor I<mqdes>."
102 msgstr ""
103
104 #. type: Plain text
105 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
106 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
107 msgid ""
108 "The I<sevp> argument is a pointer to a I<sigevent> structure. For the "
109 "definition and general details of this structure, see B<sigevent>(3type)."
110 msgstr ""
111
112 #. type: Plain text
113 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
114 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
115 msgid ""
116 "If I<sevp> is a non-null pointer, then B<mq_notify>() registers the calling "
117 "process to receive message notification. The I<sigev_notify> field of the "
118 "I<sigevent> structure to which I<sevp> points specifies how notification is "
119 "to be performed. This field has one of the following values:"
120 msgstr ""
121
122 #. type: TP
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 #, no-wrap
126 msgid "B<SIGEV_NONE>"
127 msgstr ""
128
129 #. When is SIGEV_NONE useful?
130 #. type: Plain text
131 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
132 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
133 msgid ""
134 "A \"null\" notification: the calling process is registered as the target for "
135 "notification, but when a message arrives, no notification is sent."
136 msgstr ""
137
138 #. type: TP
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 #, no-wrap
142 msgid "B<SIGEV_SIGNAL>"
143 msgstr ""
144
145 #. I don't know of other implementations that set
146 #. si_pid and si_uid -- MTK
147 #. type: Plain text
148 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
149 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
150 msgid ""
151 "Notify the process by sending the signal specified in I<sigev_signo>. See "
152 "B<sigevent>(3type) for general details. The I<si_code> field of the "
153 "I<siginfo_t> structure will be set to B<SI_MESGQ>. In addition, I<si_pid> "
154 "will be set to the PID of the process that sent the message, and I<si_uid> "
155 "will be set to the real user ID of the sending process."
156 msgstr ""
157
158 #. type: TP
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 #, no-wrap
162 msgid "B<SIGEV_THREAD>"
163 msgstr ""
164
165 #. type: Plain text
166 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
167 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
168 msgid ""
169 "Upon message delivery, invoke I<sigev_notify_function> as if it were the "
170 "start function of a new thread. See B<sigevent>(3type) for details."
171 msgstr ""
172
173 #. type: Plain text
174 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
175 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
176 msgid ""
177 "Only one process can be registered to receive notification from a message "
178 "queue."
179 msgstr ""
180
181 #. type: Plain text
182 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
183 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
184 msgid ""
185 "If I<sevp> is NULL, and the calling process is currently registered to "
186 "receive notifications for this message queue, then the registration is "
187 "removed; another process can then register to receive a message notification "
188 "for this queue."
189 msgstr ""
190
191 #. type: Plain text
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 msgid ""
195 "Message notification occurs only when a new message arrives and the queue "
196 "was previously empty. If the queue was not empty at the time "
197 "B<mq_notify>() was called, then a notification will occur only after the "
198 "queue is emptied and a new message arrives."
199 msgstr ""
200
201 #. type: Plain text
202 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
203 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
204 msgid ""
205 "If another process or thread is waiting to read a message from an empty "
206 "queue using B<mq_receive>(3), then any message notification registration is "
207 "ignored: the message is delivered to the process or thread calling "
208 "B<mq_receive>(3), and the message notification registration remains in "
209 "effect."
210 msgstr ""
211
212 #. type: Plain text
213 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
214 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
215 msgid ""
216 "Notification occurs once: after a notification is delivered, the "
217 "notification registration is removed, and another process can register for "
218 "message notification. If the notified process wishes to receive the next "
219 "notification, it can use B<mq_notify>() to request a further notification. "
220 "This should be done before emptying all unread messages from the queue. "
221 "(Placing the queue in nonblocking mode is useful for emptying the queue of "
222 "messages without blocking once it is empty.)"
223 msgstr ""
224
225 #. type: SH
226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
228 #, no-wrap
229 msgid "RETURN VALUE"
230 msgstr ""
231
232 #. type: Plain text
233 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
234 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
235 msgid ""
236 "On success B<mq_notify>() returns 0; on error, -1 is returned, with "
237 "I<errno> set to indicate the error."
238 msgstr ""
239
240 #. type: SH
241 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
242 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
243 #, no-wrap
244 msgid "ERRORS"
245 msgstr ""
246
247 #. type: TP
248 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
249 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
250 #, no-wrap
251 msgid "B<EBADF>"
252 msgstr ""
253
254 #. type: Plain text
255 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
256 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
257 msgid "The message queue descriptor specified in I<mqdes> is invalid."
258 msgstr ""
259
260 #. type: TP
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 #, no-wrap
264 msgid "B<EBUSY>"
265 msgstr ""
266
267 #. type: Plain text
268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
270 msgid ""
271 "Another process has already registered to receive notification for this "
272 "message queue."
273 msgstr ""
274
275 #. type: TP
276 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
277 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
278 #, no-wrap
279 msgid "B<EINVAL>"
280 msgstr ""
281
282 #. type: Plain text
283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
285 msgid ""
286 "I<sevp-E<gt>sigev_notify> is not one of the permitted values; or I<sevp-"
287 "E<gt>sigev_notify> is B<SIGEV_SIGNAL> and I<sevp-E<gt>sigev_signo> is not a "
288 "valid signal number."
289 msgstr ""
290
291 #. type: TP
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 #, no-wrap
295 msgid "B<ENOMEM>"
296 msgstr ""
297
298 #. type: Plain text
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 msgid "Insufficient memory."
302 msgstr ""
303
304 #. Linux does not do this
305 #. type: Plain text
306 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
307 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
308 msgid ""
309 "POSIX.1-2008 says that an implementation I<may> generate an B<EINVAL> error "
310 "if I<sevp> is NULL, and the caller is not currently registered to receive "
311 "notifications for the queue I<mqdes>."
312 msgstr ""
313
314 #. type: SH
315 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
316 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
317 #, no-wrap
318 msgid "ATTRIBUTES"
319 msgstr ""
320
321 #. type: Plain text
322 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
323 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
324 msgid ""
325 "For an explanation of the terms used in this section, see B<attributes>(7)."
326 msgstr ""
327
328 #. type: tbl table
329 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
330 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
331 #, no-wrap
332 msgid "Interface"
333 msgstr ""
334
335 #. type: tbl table
336 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
337 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
338 #, no-wrap
339 msgid "Attribute"
340 msgstr ""
341
342 #. type: tbl table
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 #, no-wrap
346 msgid "Value"
347 msgstr ""
348
349 #. type: tbl table
350 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
351 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
352 #, no-wrap
353 msgid ".na\n"
354 msgstr ""
355
356 #. type: tbl table
357 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
358 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
359 #, no-wrap
360 msgid ".nh\n"
361 msgstr ""
362
363 #. type: tbl table
364 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
365 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
366 #, no-wrap
367 msgid "B<mq_notify>()"
368 msgstr ""
369
370 #. type: tbl table
371 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
372 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
373 #, no-wrap
374 msgid "Thread safety"
375 msgstr ""
376
377 #. type: tbl table
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid "MT-Safe"
382 msgstr ""
383
384 #. type: SH
385 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
386 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
387 #, no-wrap
388 msgid "VERSIONS"
389 msgstr ""
390
391 #. type: SS
392 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
393 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
394 #, no-wrap
395 msgid "C library/kernel differences"
396 msgstr ""
397
398 #. type: Plain text
399 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
400 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
401 msgid ""
402 "In the glibc implementation, the B<mq_notify>() library function is "
403 "implemented on top of the system call of the same name. When I<sevp> is "
404 "NULL, or specifies a notification mechanism other than B<SIGEV_THREAD>, the "
405 "library function directly invokes the system call. For B<SIGEV_THREAD>, "
406 "much of the implementation resides within the library, rather than the "
407 "kernel. (This is necessarily so, since the thread involved in handling the "
408 "notification is one that must be managed by the C library POSIX threads "
409 "implementation.) The implementation involves the use of a raw "
410 "B<netlink>(7) socket and creates a new thread for each notification that is "
411 "delivered to the process."
412 msgstr ""
413
414 #. type: SH
415 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
416 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
417 #, no-wrap
418 msgid "STANDARDS"
419 msgstr ""
420
421 #. type: Plain text
422 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
423 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
424 msgid "POSIX.1-2008."
425 msgstr ""
426
427 #. type: SH
428 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
429 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
430 #, no-wrap
431 msgid "HISTORY"
432 msgstr ""
433
434 #. type: Plain text
435 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
436 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
437 msgid "POSIX.1-2001."
438 msgstr ""
439
440 #. type: SH
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 #, no-wrap
444 msgid "EXAMPLES"
445 msgstr ""
446
447 #. type: Plain text
448 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
449 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
450 msgid ""
451 "The following program registers a notification request for the message queue "
452 "named in its command-line argument. Notification is performed by creating a "
453 "thread. The thread executes a function which reads one message from the "
454 "queue and then terminates the process."
455 msgstr ""
456
457 #. type: SS
458 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
459 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
460 #, no-wrap
461 msgid "Program source"
462 msgstr ""
463
464 #. type: Plain text
465 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
466 #: opensuse-tumbleweed
467 #, no-wrap
468 msgid ""
469 "#include E<lt>err.hE<gt>\n"
470 "#include E<lt>mqueue.hE<gt>\n"
471 "#include E<lt>pthread.hE<gt>\n"
472 "#include E<lt>signal.hE<gt>\n"
473 "#include E<lt>stdio.hE<gt>\n"
474 "#include E<lt>stdlib.hE<gt>\n"
475 "#include E<lt>unistd.hE<gt>\n"
476 "\\&\n"
477 "static void /* Thread start function */\n"
478 "tfunc(union sigval sv)\n"
479 "{\n"
480 " struct mq_attr attr;\n"
481 " ssize_t nr;\n"
482 " void *buf;\n"
483 " mqd_t mqdes = *((mqd_t *) sv.sival_ptr);\n"
484 "\\&\n"
485 " /* Determine max.\\& msg size; allocate buffer to receive msg */\n"
486 "\\&\n"
487 " if (mq_getattr(mqdes, &attr) == -1)\n"
488 " err(EXIT_FAILURE, \"mq_getattr\");\n"
489 " buf = malloc(attr.mq_msgsize);\n"
490 " if (buf == NULL)\n"
491 " err(EXIT_FAILURE, \"malloc\");\n"
492 "\\&\n"
493 " nr = mq_receive(mqdes, buf, attr.mq_msgsize, NULL);\n"
494 " if (nr == -1)\n"
495 " err(EXIT_FAILURE, \"mq_receive\");\n"
496 "\\&\n"
497 " printf(\"Read %zd bytes from MQ\\[rs]n\", nr);\n"
498 " free(buf);\n"
499 " exit(EXIT_SUCCESS); /* Terminate the process */\n"
500 "}\n"
501 "\\&\n"
502 "int\n"
503 "main(int argc, char *argv[])\n"
504 "{\n"
505 " mqd_t mqdes;\n"
506 " struct sigevent sev;\n"
507 "\\&\n"
508 " if (argc != 2) {\n"
509 " fprintf(stderr, \"Usage: %s E<lt>mq-nameE<gt>\\[rs]n\", argv[0]);\n"
510 " exit(EXIT_FAILURE);\n"
511 " }\n"
512 "\\&\n"
513 " mqdes = mq_open(argv[1], O_RDONLY);\n"
514 " if (mqdes == (mqd_t) -1)\n"
515 " err(EXIT_FAILURE, \"mq_open\");\n"
516 "\\&\n"
517 " sev.sigev_notify = SIGEV_THREAD;\n"
518 " sev.sigev_notify_function = tfunc;\n"
519 " sev.sigev_notify_attributes = NULL;\n"
520 " sev.sigev_value.sival_ptr = &mqdes; /* Arg.\\& to thread func. */\n"
521 " if (mq_notify(mqdes, &sev) == -1)\n"
522 " err(EXIT_FAILURE, \"mq_notify\");\n"
523 "\\&\n"
524 " pause(); /* Process will be terminated by thread function */\n"
525 "}\n"
526 msgstr ""
527
528 #. SRC END
529 #. type: SH
530 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
531 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
532 #, no-wrap
533 msgid "SEE ALSO"
534 msgstr ""
535
536 #. type: Plain text
537 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
538 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
539 msgid ""
540 "B<mq_close>(3), B<mq_getattr>(3), B<mq_open>(3), B<mq_receive>(3), "
541 "B<mq_send>(3), B<mq_unlink>(3), B<mq_overview>(7), B<sigevent>(3type)"
542 msgstr ""
543
544 #. type: TH
545 #: debian-trixie
546 #, no-wrap
547 msgid "2024-06-15"
548 msgstr ""
549
550 #. type: TH
551 #: debian-trixie
552 #, no-wrap
553 msgid "Linux man-pages 6.9.1"
554 msgstr ""
555
556 #. type: Plain text
557 #: debian-trixie
558 msgid "Real-time library (I<librt>, I<-lrt>)"
559 msgstr ""
560
561 #. type: Plain text
562 #: debian-trixie fedora-44 fedora-rawhide
563 #, no-wrap
564 msgid ""
565 "#include E<lt>mqueue.hE<gt>\n"
566 "#include E<lt>pthread.hE<gt>\n"
567 "#include E<lt>signal.hE<gt>\n"
568 "#include E<lt>stdio.hE<gt>\n"
569 "#include E<lt>stdlib.hE<gt>\n"
570 "#include E<lt>unistd.hE<gt>\n"
571 "\\&\n"
572 "#define handle_error(msg) \\[rs]\n"
573 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
574 "\\&\n"
575 "static void /* Thread start function */\n"
576 "tfunc(union sigval sv)\n"
577 "{\n"
578 " struct mq_attr attr;\n"
579 " ssize_t nr;\n"
580 " void *buf;\n"
581 " mqd_t mqdes = *((mqd_t *) sv.sival_ptr);\n"
582 "\\&\n"
583 " /* Determine max. msg size; allocate buffer to receive msg */\n"
584 "\\&\n"
585 " if (mq_getattr(mqdes, &attr) == -1)\n"
586 " handle_error(\"mq_getattr\");\n"
587 " buf = malloc(attr.mq_msgsize);\n"
588 " if (buf == NULL)\n"
589 " handle_error(\"malloc\");\n"
590 "\\&\n"
591 " nr = mq_receive(mqdes, buf, attr.mq_msgsize, NULL);\n"
592 " if (nr == -1)\n"
593 " handle_error(\"mq_receive\");\n"
594 "\\&\n"
595 " printf(\"Read %zd bytes from MQ\\[rs]n\", nr);\n"
596 " free(buf);\n"
597 " exit(EXIT_SUCCESS); /* Terminate the process */\n"
598 "}\n"
599 "\\&\n"
600 "int\n"
601 "main(int argc, char *argv[])\n"
602 "{\n"
603 " mqd_t mqdes;\n"
604 " struct sigevent sev;\n"
605 "\\&\n"
606 " if (argc != 2) {\n"
607 " fprintf(stderr, \"Usage: %s E<lt>mq-nameE<gt>\\[rs]n\", argv[0]);\n"
608 " exit(EXIT_FAILURE);\n"
609 " }\n"
610 "\\&\n"
611 " mqdes = mq_open(argv[1], O_RDONLY);\n"
612 " if (mqdes == (mqd_t) -1)\n"
613 " handle_error(\"mq_open\");\n"
614 "\\&\n"
615 " sev.sigev_notify = SIGEV_THREAD;\n"
616 " sev.sigev_notify_function = tfunc;\n"
617 " sev.sigev_notify_attributes = NULL;\n"
618 " sev.sigev_value.sival_ptr = &mqdes; /* Arg. to thread func. */\n"
619 " if (mq_notify(mqdes, &sev) == -1)\n"
620 " handle_error(\"mq_notify\");\n"
621 "\\&\n"
622 " pause(); /* Process will be terminated by thread function */\n"
623 "}\n"
624 msgstr ""
625
626 #. type: TH
627 #: fedora-44 fedora-rawhide
628 #, no-wrap
629 msgid "2024-07-23"
630 msgstr ""
631
632 #. type: TH
633 #: fedora-44 fedora-rawhide
634 #, no-wrap
635 msgid "Linux man-pages 6.13"
636 msgstr ""
637
638 #. type: TH
639 #: mageia-cauldron
640 #, no-wrap
641 msgid "Linux man-pages 6.17"
642 msgstr ""
643
644 #. type: TH
645 #: opensuse-leap-16-1 opensuse-tumbleweed
646 #, no-wrap
647 msgid "Linux man-pages (unreleased)"
648 msgstr ""