Debian Codegraph @

templates/man3/sem_wait.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:42+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 "sem_wait"
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 "sem_wait, sem_timedwait, sem_trywait - lock a semaphore"
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 "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
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 "B<#include E<lt>semaphore.hE<gt>>\n"
77 msgstr ""
78
79 #. type: Plain text
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid ""
84 "B<int sem_wait(sem_t *>I<sem>B<);>\n"
85 "B<int sem_trywait(sem_t *>I<sem>B<);>\n"
86 "B<int sem_timedwait(sem_t *restrict >I<sem>B<,>\n"
87 "B< const struct timespec *restrict >I<abs_timeout>B<);>\n"
88 msgstr ""
89
90 #. type: Plain text
91 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
92 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
93 msgid ""
94 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
95 msgstr ""
96
97 #. type: Plain text
98 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
99 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
100 msgid "B<sem_timedwait>():"
101 msgstr ""
102
103 #. type: Plain text
104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
106 #, no-wrap
107 msgid " _POSIX_C_SOURCE E<gt>= 200112L\n"
108 msgstr ""
109
110 #. type: SH
111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
113 #, no-wrap
114 msgid "DESCRIPTION"
115 msgstr ""
116
117 #. type: Plain text
118 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
119 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
120 msgid ""
121 "B<sem_wait>() decrements (locks) the semaphore pointed to by I<sem>. If "
122 "the semaphore's value is greater than zero, then the decrement proceeds, and "
123 "the function returns, immediately. If the semaphore currently has the value "
124 "zero, then the call blocks until either it becomes possible to perform the "
125 "decrement (i.e., the semaphore value rises above zero), or a signal handler "
126 "interrupts the call."
127 msgstr ""
128
129 #. type: Plain text
130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
132 msgid ""
133 "B<sem_trywait>() is the same as B<sem_wait>(), except that if the decrement "
134 "cannot be immediately performed, then call returns an error (I<errno> set to "
135 "B<EAGAIN>) instead of blocking."
136 msgstr ""
137
138 #. type: Plain text
139 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
140 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
141 msgid ""
142 "B<sem_timedwait>() is the same as B<sem_wait>(), except that I<abs_timeout> "
143 "specifies a limit on the amount of time that the call should block if the "
144 "decrement cannot be immediately performed. The I<abs_timeout> argument "
145 "points to a B<timespec>(3) structure that specifies an absolute timeout in "
146 "seconds and nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC)."
147 msgstr ""
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "If the timeout has already expired by the time of the call, and the "
154 "semaphore could not be locked immediately, then B<sem_timedwait>() fails "
155 "with a timeout error (I<errno> set to B<ETIMEDOUT>)."
156 msgstr ""
157
158 #. type: Plain text
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 msgid ""
162 "If the operation can be performed immediately, then B<sem_timedwait>() "
163 "never fails with a timeout error, regardless of the value of "
164 "I<abs_timeout>. Furthermore, the validity of I<abs_timeout> is not checked "
165 "in this case."
166 msgstr ""
167
168 #. type: SH
169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
171 #, no-wrap
172 msgid "RETURN VALUE"
173 msgstr ""
174
175 #. type: Plain text
176 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
177 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
178 msgid ""
179 "All of these functions return 0 on success; on error, the value of the "
180 "semaphore is left unchanged, -1 is returned, and I<errno> is set to indicate "
181 "the error."
182 msgstr ""
183
184 #. type: SH
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 #, no-wrap
188 msgid "ERRORS"
189 msgstr ""
190
191 #. type: TP
192 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
193 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
194 #, no-wrap
195 msgid "B<EAGAIN>"
196 msgstr ""
197
198 #. type: Plain text
199 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
200 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
201 msgid ""
202 "(B<sem_trywait>()) The operation could not be performed without blocking "
203 "(i.e., the semaphore currently has the value zero)."
204 msgstr ""
205
206 #. type: TP
207 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
208 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
209 #, no-wrap
210 msgid "B<EINTR>"
211 msgstr ""
212
213 #. type: Plain text
214 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
215 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
216 msgid "The call was interrupted by a signal handler; see B<signal>(7)."
217 msgstr ""
218
219 #. type: TP
220 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
221 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
222 #, no-wrap
223 msgid "B<EINVAL>"
224 msgstr ""
225
226 #. type: Plain text
227 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
228 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
229 msgid "I<sem> is not a valid semaphore."
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 "(B<sem_timedwait>()) The value of I<abs_timeout.tv_nsecs> is less than 0, "
237 "or greater than or equal to 1000 million."
238 msgstr ""
239
240 #. type: TP
241 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
242 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
243 #, no-wrap
244 msgid "B<ETIMEDOUT>"
245 msgstr ""
246
247 #. POSIX.1-2001 also allows EDEADLK -- "A deadlock condition
248 #. was detected", but this does not occur on Linux(?).
249 #. type: Plain text
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 msgid ""
253 "(B<sem_timedwait>()) The call timed out before the semaphore could be "
254 "locked."
255 msgstr ""
256
257 #. type: SH
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 #, no-wrap
261 msgid "ATTRIBUTES"
262 msgstr ""
263
264 #. type: Plain text
265 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
266 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
267 msgid ""
268 "For an explanation of the terms used in this section, see B<attributes>(7)."
269 msgstr ""
270
271 #. type: tbl table
272 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
273 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
274 #, no-wrap
275 msgid "Interface"
276 msgstr ""
277
278 #. type: tbl table
279 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
280 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
281 #, no-wrap
282 msgid "Attribute"
283 msgstr ""
284
285 #. type: tbl table
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 #, no-wrap
289 msgid "Value"
290 msgstr ""
291
292 #. type: tbl table
293 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
294 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
295 #, no-wrap
296 msgid ".na\n"
297 msgstr ""
298
299 #. type: tbl table
300 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
301 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
302 #, no-wrap
303 msgid ".nh\n"
304 msgstr ""
305
306 #. type: tbl table
307 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
308 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
309 #, no-wrap
310 msgid ""
311 "B<sem_wait>(),\n"
312 "B<sem_trywait>(),\n"
313 "B<sem_timedwait>()"
314 msgstr ""
315
316 #. type: tbl table
317 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
318 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
319 #, no-wrap
320 msgid "Thread safety"
321 msgstr ""
322
323 #. type: tbl table
324 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
325 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
326 #, no-wrap
327 msgid "MT-Safe"
328 msgstr ""
329
330 #. type: SH
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid "STANDARDS"
335 msgstr ""
336
337 #. type: Plain text
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 msgid "POSIX.1-2008."
341 msgstr ""
342
343 #. type: SH
344 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
345 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
346 #, no-wrap
347 msgid "HISTORY"
348 msgstr ""
349
350 #. type: Plain text
351 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
352 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
353 msgid "POSIX.1-2001."
354 msgstr ""
355
356 #. type: SH
357 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
358 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
359 #, no-wrap
360 msgid "EXAMPLES"
361 msgstr ""
362
363 #. type: Plain text
364 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
365 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
366 msgid ""
367 "The (somewhat trivial) program shown below operates on an unnamed "
368 "semaphore. The program expects two command-line arguments. The first "
369 "argument specifies a seconds value that is used to set an alarm timer to "
370 "generate a B<SIGALRM> signal. This handler performs a B<sem_post>(3) to "
371 "increment the semaphore that is being waited on in I<main()> using "
372 "B<sem_timedwait>(). The second command-line argument specifies the length "
373 "of the timeout, in seconds, for B<sem_timedwait>(). The following shows "
374 "what happens on two different runs of the program:"
375 msgstr ""
376
377 #. type: Plain text
378 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
379 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
380 #, no-wrap
381 msgid ""
382 "$B< ./a.out 2 3>\n"
383 "About to call sem_timedwait()\n"
384 "sem_post() from handler\n"
385 "sem_timedwait() succeeded\n"
386 "$B< ./a.out 2 1>\n"
387 "About to call sem_timedwait()\n"
388 "sem_timedwait() timed out\n"
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 "Program source"
396 msgstr ""
397
398 #. type: Plain text
399 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
400 #: opensuse-tumbleweed
401 #, no-wrap
402 msgid ""
403 "#include E<lt>err.hE<gt>\n"
404 "#include E<lt>errno.hE<gt>\n"
405 "#include E<lt>semaphore.hE<gt>\n"
406 "#include E<lt>signal.hE<gt>\n"
407 "#include E<lt>stdio.hE<gt>\n"
408 "#include E<lt>stdlib.hE<gt>\n"
409 "#include E<lt>time.hE<gt>\n"
410 "#include E<lt>unistd.hE<gt>\n"
411 "\\&\n"
412 "#include E<lt>assert.hE<gt>\n"
413 "\\&\n"
414 "sem_t sem;\n"
415 "\\&\n"
416 "static void\n"
417 "handler(int sig)\n"
418 "{\n"
419 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
420 " if (sem_post(&sem) == -1) {\n"
421 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
422 " _exit(EXIT_FAILURE);\n"
423 " }\n"
424 "}\n"
425 "\\&\n"
426 "int\n"
427 "main(int argc, char *argv[])\n"
428 "{\n"
429 " struct sigaction sa;\n"
430 " struct timespec ts;\n"
431 " int s;\n"
432 "\\&\n"
433 " if (argc != 3) {\n"
434 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
435 " argv[0]);\n"
436 " exit(EXIT_FAILURE);\n"
437 " }\n"
438 "\\&\n"
439 " if (sem_init(&sem, 0, 0) == -1)\n"
440 " err(EXIT_FAILURE, \"sem_init\");\n"
441 "\\&\n"
442 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
443 "\\&\n"
444 " sa.sa_handler = handler;\n"
445 " sigemptyset(&sa.sa_mask);\n"
446 " sa.sa_flags = 0;\n"
447 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
448 " err(EXIT_FAILURE, \"sigaction\");\n"
449 "\\&\n"
450 " alarm(atoi(argv[1]));\n"
451 "\\&\n"
452 " /* Calculate relative interval as current time plus\n"
453 " number of seconds given argv[2]. */\n"
454 "\\&\n"
455 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
456 " err(EXIT_FAILURE, \"clock_gettime\");\n"
457 "\\&\n"
458 " ts.tv_sec += atoi(argv[2]);\n"
459 "\\&\n"
460 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
461 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
462 " continue; /* Restart if interrupted by handler. */\n"
463 "\\&\n"
464 " /* Check what happened. */\n"
465 "\\&\n"
466 " if (s == -1) {\n"
467 " if (errno == ETIMEDOUT)\n"
468 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
469 " else\n"
470 " perror(\"sem_timedwait\");\n"
471 " } else\n"
472 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
473 "\\&\n"
474 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
475 "}\n"
476 msgstr ""
477
478 #. SRC END
479 #. type: SH
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 #, no-wrap
483 msgid "SEE ALSO"
484 msgstr ""
485
486 #. type: Plain text
487 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
488 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
489 msgid ""
490 "B<clock_gettime>(2), B<sem_getvalue>(3), B<sem_post>(3), B<timespec>(3), "
491 "B<sem_overview>(7), B<time>(7)"
492 msgstr ""
493
494 #. type: TH
495 #: debian-trixie
496 #, no-wrap
497 msgid "2024-06-15"
498 msgstr ""
499
500 #. type: TH
501 #: debian-trixie
502 #, no-wrap
503 msgid "Linux man-pages 6.9.1"
504 msgstr ""
505
506 #. type: Plain text
507 #: debian-trixie
508 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
509 msgstr ""
510
511 #. type: Plain text
512 #: debian-trixie fedora-44 fedora-rawhide
513 #, no-wrap
514 msgid ""
515 "#include E<lt>errno.hE<gt>\n"
516 "#include E<lt>semaphore.hE<gt>\n"
517 "#include E<lt>signal.hE<gt>\n"
518 "#include E<lt>stdio.hE<gt>\n"
519 "#include E<lt>stdlib.hE<gt>\n"
520 "#include E<lt>time.hE<gt>\n"
521 "#include E<lt>unistd.hE<gt>\n"
522 "\\&\n"
523 "#include E<lt>assert.hE<gt>\n"
524 "\\&\n"
525 "sem_t sem;\n"
526 "\\&\n"
527 "#define handle_error(msg) \\[rs]\n"
528 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
529 "\\&\n"
530 "static void\n"
531 "handler(int sig)\n"
532 "{\n"
533 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
534 " if (sem_post(&sem) == -1) {\n"
535 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
536 " _exit(EXIT_FAILURE);\n"
537 " }\n"
538 "}\n"
539 "\\&\n"
540 "int\n"
541 "main(int argc, char *argv[])\n"
542 "{\n"
543 " struct sigaction sa;\n"
544 " struct timespec ts;\n"
545 " int s;\n"
546 "\\&\n"
547 " if (argc != 3) {\n"
548 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
549 " argv[0]);\n"
550 " exit(EXIT_FAILURE);\n"
551 " }\n"
552 "\\&\n"
553 " if (sem_init(&sem, 0, 0) == -1)\n"
554 " handle_error(\"sem_init\");\n"
555 "\\&\n"
556 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
557 "\\&\n"
558 " sa.sa_handler = handler;\n"
559 " sigemptyset(&sa.sa_mask);\n"
560 " sa.sa_flags = 0;\n"
561 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
562 " handle_error(\"sigaction\");\n"
563 "\\&\n"
564 " alarm(atoi(argv[1]));\n"
565 "\\&\n"
566 " /* Calculate relative interval as current time plus\n"
567 " number of seconds given argv[2]. */\n"
568 "\\&\n"
569 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
570 " handle_error(\"clock_gettime\");\n"
571 "\\&\n"
572 " ts.tv_sec += atoi(argv[2]);\n"
573 "\\&\n"
574 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
575 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
576 " continue; /* Restart if interrupted by handler. */\n"
577 "\\&\n"
578 " /* Check what happened. */\n"
579 "\\&\n"
580 " if (s == -1) {\n"
581 " if (errno == ETIMEDOUT)\n"
582 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
583 " else\n"
584 " perror(\"sem_timedwait\");\n"
585 " } else\n"
586 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
587 "\\&\n"
588 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
589 "}\n"
590 msgstr ""
591
592 #. type: TH
593 #: fedora-44 fedora-rawhide
594 #, no-wrap
595 msgid "2024-07-23"
596 msgstr ""
597
598 #. type: TH
599 #: fedora-44 fedora-rawhide
600 #, no-wrap
601 msgid "Linux man-pages 6.13"
602 msgstr ""
603
604 #. type: TH
605 #: mageia-cauldron
606 #, no-wrap
607 msgid "Linux man-pages 6.17"
608 msgstr ""
609
610 #. type: TH
611 #: opensuse-leap-16-1 opensuse-tumbleweed
612 #, no-wrap
613 msgid "Linux man-pages (unreleased)"
614 msgstr ""