Debian Codegraph @

po/ar/man3/sem_wait.3.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5 msgid ""
6 msgstr ""
7 "Project-Id-Version: manpages-l10n 4.30.2\n"
8 "POT-Creation-Date: 2026-06-05 06:42+0200\n"
9 "PO-Revision-Date: 2026-06-03 18:13+0400\n"
10 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
11 "Language-Team: Arabic <[email protected]>\n"
12 "Language: ar\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
17 "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
18 "X-Generator: Lokalize 23.08.5\n"
19
20 #. type: TH
21 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
22 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
23 #, no-wrap
24 msgid "sem_wait"
25 msgstr "sem_wait"
26
27 #. type: TH
28 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
29 #: opensuse-tumbleweed
30 #, no-wrap
31 msgid "2026-02-08"
32 msgstr "8 فبراير 2026"
33
34 #. type: TH
35 #: archlinux debian-unstable
36 #, no-wrap
37 msgid "Linux man-pages 6.18"
38 msgstr "صفحات دليل لينكس 6.18"
39
40 #. type: SH
41 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
42 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
43 #, no-wrap
44 msgid "NAME"
45 msgstr "الاسم"
46
47 #. type: Plain text
48 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
49 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
50 msgid "sem_wait, sem_timedwait, sem_trywait - lock a semaphore"
51 msgstr "sem_wait, sem_timedwait, sem_trywait - قفل كمية"
52
53 #. type: SH
54 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
55 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
56 #, no-wrap
57 msgid "LIBRARY"
58 msgstr "المكتبة"
59
60 #. type: Plain text
61 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
62 #: opensuse-leap-16-1 opensuse-tumbleweed
63 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
64 msgstr "مكتبة مسالك POSIX (I<libpthread>،\\ I<-lpthread>)"
65
66 #. type: SH
67 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
68 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
69 #, no-wrap
70 msgid "SYNOPSIS"
71 msgstr "موجز"
72
73 #. type: Plain text
74 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
75 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
76 #, no-wrap
77 msgid "B<#include E<lt>semaphore.hE<gt>>\n"
78 msgstr "B<#include E<lt>semaphore.hE<gt>>\n"
79
80 #. type: Plain text
81 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
82 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
83 #, no-wrap
84 msgid ""
85 "B<int sem_wait(sem_t *>I<sem>B<);>\n"
86 "B<int sem_trywait(sem_t *>I<sem>B<);>\n"
87 "B<int sem_timedwait(sem_t *restrict >I<sem>B<,>\n"
88 "B< const struct timespec *restrict >I<abs_timeout>B<);>\n"
89 msgstr ""
90 "B<int sem_wait(sem_t *>I<sem>B<);>\n"
91 "B<int sem_trywait(sem_t *>I<sem>B<);>\n"
92 "B<int sem_timedwait(sem_t *restrict >I<sem>B<,>\n"
93 "B< const struct timespec *restrict >I<abs_timeout>B<);>\n"
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 "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
100 msgstr ""
101 "متطلبات ماكروات اختبار الميزات لـ glibc (انظر B<feature_test_macros>(7)):"
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 msgid "B<sem_timedwait>():"
107 msgstr "B<sem_timedwait>():"
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 #, no-wrap
113 msgid " _POSIX_C_SOURCE E<gt>= 200112L\n"
114 msgstr " _POSIX_C_SOURCE E<gt>= 200112L\n"
115
116 #. type: SH
117 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
118 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
119 #, no-wrap
120 msgid "DESCRIPTION"
121 msgstr "الوصف"
122
123 #. type: Plain text
124 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
125 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
126 msgid ""
127 "B<sem_wait>() decrements (locks) the semaphore pointed to by I<sem>. If "
128 "the semaphore's value is greater than zero, then the decrement proceeds, and "
129 "the function returns, immediately. If the semaphore currently has the value "
130 "zero, then the call blocks until either it becomes possible to perform the "
131 "decrement (i.e., the semaphore value rises above zero), or a signal handler "
132 "interrupts the call."
133 msgstr ""
134 "B<sem_wait>() تُنقص (تقفل) الكمية المشار إليها بواسطة I<sem>. إذا كانت قيمة "
135 "الكمية أكبر من الصفر، فإن النقص يجري، وتعود الدالة فورًا. إذا كانت الكمية "
136 "حاليًا قيمتها صفر، فإن الاستدعاء يُحجب حتى يصبح من الممكن إجراء النقص (أي "
137 "ترتفع قيمة الكمية فوق الصفر)، أو يقاطع معالج إشارة الاستدعاء."
138
139 #. type: Plain text
140 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
141 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
142 msgid ""
143 "B<sem_trywait>() is the same as B<sem_wait>(), except that if the decrement "
144 "cannot be immediately performed, then call returns an error (I<errno> set to "
145 "B<EAGAIN>) instead of blocking."
146 msgstr ""
147 "B<sem_trywait>() هي نفس B<sem_wait>()، باستثناء أنه إذا تعذر إجراء النقص "
148 "فورًا، فإن الاستدعاء يُرجع خطأ (I<errno> مضبوط على B<EAGAIN>) بدلاً من الحجب."
149
150 #. type: Plain text
151 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
152 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
153 msgid ""
154 "B<sem_timedwait>() is the same as B<sem_wait>(), except that I<abs_timeout> "
155 "specifies a limit on the amount of time that the call should block if the "
156 "decrement cannot be immediately performed. The I<abs_timeout> argument "
157 "points to a B<timespec>(3) structure that specifies an absolute timeout in "
158 "seconds and nanoseconds since the Epoch, 1970-01-01 00:00:00 +0000 (UTC)."
159 msgstr ""
160 "B<sem_timedwait>() هي نفس B<sem_wait>()، باستثناء أن I<abs_timeout> يُحدد "
161 "حدًا لمقدار الوقت الذي يجب أن يُحجب فيه الاستدعاء إذا تعذر إجراء النقص فورًا. "
162 "وسيطة I<abs_timeout> تُشير إلى بنية B<timespec>(3) التي تُحدد مهلة مطلقة "
163 "بالثواني والنانوثواني منذ العصر، 1970-01-01 00:00:00 +0000 (UTC)."
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 "If the timeout has already expired by the time of the call, and the "
170 "semaphore could not be locked immediately, then B<sem_timedwait>() fails "
171 "with a timeout error (I<errno> set to B<ETIMEDOUT>)."
172 msgstr ""
173 "إذا كانت المهلة قد انتهت بالفعل بحلول وقت الاستدعاء، ولم يمكن قفل الكمية "
174 "فورًا، فإن B<sem_timedwait>() تفشل مع خطأ مهلة (I<errno> مضبوط على "
175 "B<ETIMEDOUT>)."
176
177 #. type: Plain text
178 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
179 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
180 msgid ""
181 "If the operation can be performed immediately, then B<sem_timedwait>() "
182 "never fails with a timeout error, regardless of the value of "
183 "I<abs_timeout>. Furthermore, the validity of I<abs_timeout> is not checked "
184 "in this case."
185 msgstr ""
186 "إذا أمكن إجراء العملية فورًا، فإن B<sem_timedwait>() لا تفشل أبدًا مع خطأ "
187 "مهلة، بغض النظر عن قيمة I<abs_timeout>. علاوة على ذلك، لا يُفحص صحة "
188 "I<abs_timeout> في هذه الحالة."
189
190 #. type: SH
191 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
192 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
193 #, no-wrap
194 msgid "RETURN VALUE"
195 msgstr "قيمة الإرجاع"
196
197 #. type: Plain text
198 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
199 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
200 msgid ""
201 "All of these functions return 0 on success; on error, the value of the "
202 "semaphore is left unchanged, -1 is returned, and I<errno> is set to indicate "
203 "the error."
204 msgstr ""
205 "كل هذه الدوال تُرجع 0 عند النجاح؛ عند الخطأ، تُترك قيمة الكمية دون تغيير، "
206 "وتُعاد -1، ويُضبط I<errno> للإشارة إلى الخطأ."
207
208 #. type: SH
209 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
210 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
211 #, no-wrap
212 msgid "ERRORS"
213 msgstr "الأخطاء"
214
215 #. type: TP
216 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
217 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
218 #, no-wrap
219 msgid "B<EAGAIN>"
220 msgstr "B<EAGAIN>"
221
222 #. type: Plain text
223 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
224 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
225 msgid ""
226 "(B<sem_trywait>()) The operation could not be performed without blocking (i."
227 "e., the semaphore currently has the value zero)."
228 msgstr ""
229 "(B<sem_trywait>()) تعذر إجراء العملية دون حجب (أي الكمية حاليًا قيمتها صفر)."
230
231 #. type: TP
232 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
233 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
234 #, no-wrap
235 msgid "B<EINTR>"
236 msgstr "B<EINTR>"
237
238 #. type: Plain text
239 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
240 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
241 msgid "The call was interrupted by a signal handler; see B<signal>(7)."
242 msgstr "قُطع الاستدعاء بواسطة معالج إشارات؛ انظر B<signal>(7)."
243
244 #. type: TP
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 #, no-wrap
248 msgid "B<EINVAL>"
249 msgstr "B<EINVAL>"
250
251 #. type: Plain text
252 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
253 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
254 msgid "I<sem> is not a valid semaphore."
255 msgstr "I<sem> ليس إشارة (semaphore) صالحة."
256
257 #. type: Plain text
258 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
259 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
260 msgid ""
261 "(B<sem_timedwait>()) The value of I<abs_timeout.tv_nsecs> is less than 0, "
262 "or greater than or equal to 1000 million."
263 msgstr ""
264 "(B<sem_timedwait>()) قيمة I<abs_timeout.tv_nsecs> أقل من 0، أو أكبر من أو "
265 "تساوي 1000 مليون."
266
267 #. type: TP
268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
270 #, no-wrap
271 msgid "B<ETIMEDOUT>"
272 msgstr "B<ETIMEDOUT>"
273
274 #. POSIX.1-2001 also allows EDEADLK -- "A deadlock condition
275 #. was detected", but this does not occur on Linux(?).
276 #. type: Plain text
277 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
278 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
279 msgid ""
280 "(B<sem_timedwait>()) The call timed out before the semaphore could be "
281 "locked."
282 msgstr "(B<sem_timedwait>()) انتهت مهلة الاستدعاء قبل أن يمكن قفل الكمية."
283
284 #. type: SH
285 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
286 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
287 #, no-wrap
288 msgid "ATTRIBUTES"
289 msgstr "السمات"
290
291 #. type: Plain text
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 msgid ""
295 "For an explanation of the terms used in this section, see B<attributes>(7)."
296 msgstr ""
297 "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)."
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 "Interface"
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 "Attribute"
311 msgstr "السمة"
312
313 #. type: tbl table
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 #, no-wrap
317 msgid "Value"
318 msgstr "القيمة"
319
320 #. type: tbl table
321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
323 #, no-wrap
324 msgid ".na\n"
325 msgstr ".na\n"
326
327 #. type: tbl table
328 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
329 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
330 #, no-wrap
331 msgid ".nh\n"
332 msgstr ".nh\n"
333
334 #. type: tbl table
335 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
336 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
337 #, no-wrap
338 msgid ""
339 "B<sem_wait>(),\n"
340 "B<sem_trywait>(),\n"
341 "B<sem_timedwait>()"
342 msgstr ""
343 "B<sem_wait>(),\n"
344 "B<sem_trywait>(),\n"
345 "B<sem_timedwait>()"
346
347 #. type: tbl table
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 #, no-wrap
351 msgid "Thread safety"
352 msgstr "سلامة الخيوط"
353
354 #. type: tbl table
355 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
356 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
357 #, no-wrap
358 msgid "MT-Safe"
359 msgstr "MT-Safe"
360
361 #. type: SH
362 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
363 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
364 #, no-wrap
365 msgid "STANDARDS"
366 msgstr "المعايير"
367
368 #. type: Plain text
369 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
370 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
371 msgid "POSIX.1-2008."
372 msgstr "POSIX.1-2008."
373
374 #. type: SH
375 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
376 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
377 #, no-wrap
378 msgid "HISTORY"
379 msgstr "التاريخ"
380
381 #. type: Plain text
382 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
383 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
384 msgid "POSIX.1-2001."
385 msgstr "POSIX.1-2001."
386
387 #. type: SH
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid "EXAMPLES"
392 msgstr "أمثلة"
393
394 #. type: Plain text
395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
397 msgid ""
398 "The (somewhat trivial) program shown below operates on an unnamed "
399 "semaphore. The program expects two command-line arguments. The first "
400 "argument specifies a seconds value that is used to set an alarm timer to "
401 "generate a B<SIGALRM> signal. This handler performs a B<sem_post>(3) to "
402 "increment the semaphore that is being waited on in I<main()> using "
403 "B<sem_timedwait>(). The second command-line argument specifies the length "
404 "of the timeout, in seconds, for B<sem_timedwait>(). The following shows "
405 "what happens on two different runs of the program:"
406 msgstr ""
407 "البرنامج (التافه نوعًا ما) الموضح أدناه يعمل على كمية غير مسماة. يتوقع "
408 "البرنامج وسيطتين لسطر الأوامر. تحدد الوسيطة الأولى قيمة ثوانٍ تُستخدم لضبط "
409 "مؤقت إنذار لتوليد إشارة B<SIGALRM>. يُنفذ هذا المعالج B<sem_post>(3) لزيادة "
410 "الكمية التي يُنتظر عليها في I<main()> باستخدام B<sem_timedwait>(). تحدد "
411 "وسيطة سطر الأوامر الثانية طول المهلة، بالثواني، لـ B<sem_timedwait>(). يُظهر "
412 "التالي ما يحدث في تشغيلين مختلفين للبرنامج:"
413
414 #. type: Plain text
415 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
416 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
417 #, no-wrap
418 msgid ""
419 "$B< ./a.out 2 3>\n"
420 "About to call sem_timedwait()\n"
421 "sem_post() from handler\n"
422 "sem_timedwait() succeeded\n"
423 "$B< ./a.out 2 1>\n"
424 "About to call sem_timedwait()\n"
425 "sem_timedwait() timed out\n"
426 msgstr ""
427 "$B< ./a.out 2 3>\n"
428 "About to call sem_timedwait()\n"
429 "sem_post() from handler\n"
430 "sem_timedwait() succeeded\n"
431 "$B< ./a.out 2 1>\n"
432 "About to call sem_timedwait()\n"
433 "sem_timedwait() timed out\n"
434
435 #. type: SS
436 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
437 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
438 #, no-wrap
439 msgid "Program source"
440 msgstr "مصدر البرنامج"
441
442 #. type: Plain text
443 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
444 #: opensuse-tumbleweed
445 #, no-wrap
446 msgid ""
447 "#include E<lt>err.hE<gt>\n"
448 "#include E<lt>errno.hE<gt>\n"
449 "#include E<lt>semaphore.hE<gt>\n"
450 "#include E<lt>signal.hE<gt>\n"
451 "#include E<lt>stdio.hE<gt>\n"
452 "#include E<lt>stdlib.hE<gt>\n"
453 "#include E<lt>time.hE<gt>\n"
454 "#include E<lt>unistd.hE<gt>\n"
455 "\\&\n"
456 "#include E<lt>assert.hE<gt>\n"
457 "\\&\n"
458 "sem_t sem;\n"
459 "\\&\n"
460 "static void\n"
461 "handler(int sig)\n"
462 "{\n"
463 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
464 " if (sem_post(&sem) == -1) {\n"
465 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
466 " _exit(EXIT_FAILURE);\n"
467 " }\n"
468 "}\n"
469 "\\&\n"
470 "int\n"
471 "main(int argc, char *argv[])\n"
472 "{\n"
473 " struct sigaction sa;\n"
474 " struct timespec ts;\n"
475 " int s;\n"
476 "\\&\n"
477 " if (argc != 3) {\n"
478 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
479 " argv[0]);\n"
480 " exit(EXIT_FAILURE);\n"
481 " }\n"
482 "\\&\n"
483 " if (sem_init(&sem, 0, 0) == -1)\n"
484 " err(EXIT_FAILURE, \"sem_init\");\n"
485 "\\&\n"
486 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
487 "\\&\n"
488 " sa.sa_handler = handler;\n"
489 " sigemptyset(&sa.sa_mask);\n"
490 " sa.sa_flags = 0;\n"
491 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
492 " err(EXIT_FAILURE, \"sigaction\");\n"
493 "\\&\n"
494 " alarm(atoi(argv[1]));\n"
495 "\\&\n"
496 " /* Calculate relative interval as current time plus\n"
497 " number of seconds given argv[2]. */\n"
498 "\\&\n"
499 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
500 " err(EXIT_FAILURE, \"clock_gettime\");\n"
501 "\\&\n"
502 " ts.tv_sec += atoi(argv[2]);\n"
503 "\\&\n"
504 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
505 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
506 " continue; /* Restart if interrupted by handler. */\n"
507 "\\&\n"
508 " /* Check what happened. */\n"
509 "\\&\n"
510 " if (s == -1) {\n"
511 " if (errno == ETIMEDOUT)\n"
512 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
513 " else\n"
514 " perror(\"sem_timedwait\");\n"
515 " } else\n"
516 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
517 "\\&\n"
518 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
519 "}\n"
520 msgstr ""
521 "#include E<lt>err.hE<gt>\n"
522 "#include E<lt>errno.hE<gt>\n"
523 "#include E<lt>semaphore.hE<gt>\n"
524 "#include E<lt>signal.hE<gt>\n"
525 "#include E<lt>stdio.hE<gt>\n"
526 "#include E<lt>stdlib.hE<gt>\n"
527 "#include E<lt>time.hE<gt>\n"
528 "#include E<lt>unistd.hE<gt>\n"
529 "\\&\n"
530 "#include E<lt>assert.hE<gt>\n"
531 "\\&\n"
532 "sem_t sem;\n"
533 "\\&\n"
534 "static void\n"
535 "handler(int sig)\n"
536 "{\n"
537 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
538 " if (sem_post(&sem) == -1) {\n"
539 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
540 " _exit(EXIT_FAILURE);\n"
541 " }\n"
542 "}\n"
543 "\\&\n"
544 "int\n"
545 "main(int argc, char *argv[])\n"
546 "{\n"
547 " struct sigaction sa;\n"
548 " struct timespec ts;\n"
549 " int s;\n"
550 "\\&\n"
551 " if (argc != 3) {\n"
552 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
553 " argv[0]);\n"
554 " exit(EXIT_FAILURE);\n"
555 " }\n"
556 "\\&\n"
557 " if (sem_init(&sem, 0, 0) == -1)\n"
558 " err(EXIT_FAILURE, \"sem_init\");\n"
559 "\\&\n"
560 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
561 "\\&\n"
562 " sa.sa_handler = handler;\n"
563 " sigemptyset(&sa.sa_mask);\n"
564 " sa.sa_flags = 0;\n"
565 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
566 " err(EXIT_FAILURE, \"sigaction\");\n"
567 "\\&\n"
568 " alarm(atoi(argv[1]));\n"
569 "\\&\n"
570 " /* Calculate relative interval as current time plus\n"
571 " number of seconds given argv[2]. */\n"
572 "\\&\n"
573 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
574 " err(EXIT_FAILURE, \"clock_gettime\");\n"
575 "\\&\n"
576 " ts.tv_sec += atoi(argv[2]);\n"
577 "\\&\n"
578 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
579 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
580 " continue; /* Restart if interrupted by handler. */\n"
581 "\\&\n"
582 " /* Check what happened. */\n"
583 "\\&\n"
584 " if (s == -1) {\n"
585 " if (errno == ETIMEDOUT)\n"
586 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
587 " else\n"
588 " perror(\"sem_timedwait\");\n"
589 " } else\n"
590 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
591 "\\&\n"
592 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
593 "}\n"
594
595 #. SRC END
596 #. type: SH
597 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
598 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
599 #, no-wrap
600 msgid "SEE ALSO"
601 msgstr "انظر أيضًا"
602
603 #. type: Plain text
604 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
605 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
606 msgid ""
607 "B<clock_gettime>(2), B<sem_getvalue>(3), B<sem_post>(3), B<timespec>(3), "
608 "B<sem_overview>(7), B<time>(7)"
609 msgstr ""
610 "B<clock_gettime>(2), B<sem_getvalue>(3), B<sem_post>(3), B<timespec>(3), "
611 "B<sem_overview>(7), B<time>(7)"
612
613 #. type: TH
614 #: debian-trixie
615 #, no-wrap
616 msgid "2024-06-15"
617 msgstr "15 يونيو 2024"
618
619 #. type: TH
620 #: debian-trixie
621 #, no-wrap
622 msgid "Linux man-pages 6.9.1"
623 msgstr "صفحات دليل لينكس 6.9.1"
624
625 #. type: Plain text
626 #: debian-trixie
627 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
628 msgstr "مكتبة مسالك POSIX (I<libpthread>، I<-lpthread>)"
629
630 #. type: Plain text
631 #: debian-trixie fedora-44 fedora-rawhide
632 #, no-wrap
633 msgid ""
634 "#include E<lt>errno.hE<gt>\n"
635 "#include E<lt>semaphore.hE<gt>\n"
636 "#include E<lt>signal.hE<gt>\n"
637 "#include E<lt>stdio.hE<gt>\n"
638 "#include E<lt>stdlib.hE<gt>\n"
639 "#include E<lt>time.hE<gt>\n"
640 "#include E<lt>unistd.hE<gt>\n"
641 "\\&\n"
642 "#include E<lt>assert.hE<gt>\n"
643 "\\&\n"
644 "sem_t sem;\n"
645 "\\&\n"
646 "#define handle_error(msg) \\[rs]\n"
647 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
648 "\\&\n"
649 "static void\n"
650 "handler(int sig)\n"
651 "{\n"
652 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
653 " if (sem_post(&sem) == -1) {\n"
654 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
655 " _exit(EXIT_FAILURE);\n"
656 " }\n"
657 "}\n"
658 "\\&\n"
659 "int\n"
660 "main(int argc, char *argv[])\n"
661 "{\n"
662 " struct sigaction sa;\n"
663 " struct timespec ts;\n"
664 " int s;\n"
665 "\\&\n"
666 " if (argc != 3) {\n"
667 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
668 " argv[0]);\n"
669 " exit(EXIT_FAILURE);\n"
670 " }\n"
671 "\\&\n"
672 " if (sem_init(&sem, 0, 0) == -1)\n"
673 " handle_error(\"sem_init\");\n"
674 "\\&\n"
675 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
676 "\\&\n"
677 " sa.sa_handler = handler;\n"
678 " sigemptyset(&sa.sa_mask);\n"
679 " sa.sa_flags = 0;\n"
680 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
681 " handle_error(\"sigaction\");\n"
682 "\\&\n"
683 " alarm(atoi(argv[1]));\n"
684 "\\&\n"
685 " /* Calculate relative interval as current time plus\n"
686 " number of seconds given argv[2]. */\n"
687 "\\&\n"
688 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
689 " handle_error(\"clock_gettime\");\n"
690 "\\&\n"
691 " ts.tv_sec += atoi(argv[2]);\n"
692 "\\&\n"
693 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
694 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
695 " continue; /* Restart if interrupted by handler. */\n"
696 "\\&\n"
697 " /* Check what happened. */\n"
698 "\\&\n"
699 " if (s == -1) {\n"
700 " if (errno == ETIMEDOUT)\n"
701 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
702 " else\n"
703 " perror(\"sem_timedwait\");\n"
704 " } else\n"
705 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
706 "\\&\n"
707 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
708 "}\n"
709 msgstr ""
710 "#include E<lt>errno.hE<gt>\n"
711 "#include E<lt>semaphore.hE<gt>\n"
712 "#include E<lt>signal.hE<gt>\n"
713 "#include E<lt>stdio.hE<gt>\n"
714 "#include E<lt>stdlib.hE<gt>\n"
715 "#include E<lt>time.hE<gt>\n"
716 "#include E<lt>unistd.hE<gt>\n"
717 "\\&\n"
718 "#include E<lt>assert.hE<gt>\n"
719 "\\&\n"
720 "sem_t sem;\n"
721 "\\&\n"
722 "#define handle_error(msg) \\[rs]\n"
723 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
724 "\\&\n"
725 "static void\n"
726 "handler(int sig)\n"
727 "{\n"
728 " write(STDOUT_FILENO, \"sem_post() from handler\\[rs]n\", 24);\n"
729 " if (sem_post(&sem) == -1) {\n"
730 " write(STDERR_FILENO, \"sem_post() failed\\[rs]n\", 18);\n"
731 " _exit(EXIT_FAILURE);\n"
732 " }\n"
733 "}\n"
734 "\\&\n"
735 "int\n"
736 "main(int argc, char *argv[])\n"
737 "{\n"
738 " struct sigaction sa;\n"
739 " struct timespec ts;\n"
740 " int s;\n"
741 "\\&\n"
742 " if (argc != 3) {\n"
743 " fprintf(stderr, \"Usage: %s E<lt>alarm-secsE<gt> E<lt>wait-secsE<gt>\\[rs]n\",\n"
744 " argv[0]);\n"
745 " exit(EXIT_FAILURE);\n"
746 " }\n"
747 "\\&\n"
748 " if (sem_init(&sem, 0, 0) == -1)\n"
749 " handle_error(\"sem_init\");\n"
750 "\\&\n"
751 " /* Establish SIGALRM handler; set alarm timer using argv[1]. */\n"
752 "\\&\n"
753 " sa.sa_handler = handler;\n"
754 " sigemptyset(&sa.sa_mask);\n"
755 " sa.sa_flags = 0;\n"
756 " if (sigaction(SIGALRM, &sa, NULL) == -1)\n"
757 " handle_error(\"sigaction\");\n"
758 "\\&\n"
759 " alarm(atoi(argv[1]));\n"
760 "\\&\n"
761 " /* Calculate relative interval as current time plus\n"
762 " number of seconds given argv[2]. */\n"
763 "\\&\n"
764 " if (clock_gettime(CLOCK_REALTIME, &ts) == -1)\n"
765 " handle_error(\"clock_gettime\");\n"
766 "\\&\n"
767 " ts.tv_sec += atoi(argv[2]);\n"
768 "\\&\n"
769 " printf(\"%s() about to call sem_timedwait()\\[rs]n\", __func__);\n"
770 " while ((s = sem_timedwait(&sem, &ts)) == -1 && errno == EINTR)\n"
771 " continue; /* Restart if interrupted by handler. */\n"
772 "\\&\n"
773 " /* Check what happened. */\n"
774 "\\&\n"
775 " if (s == -1) {\n"
776 " if (errno == ETIMEDOUT)\n"
777 " printf(\"sem_timedwait() timed out\\[rs]n\");\n"
778 " else\n"
779 " perror(\"sem_timedwait\");\n"
780 " } else\n"
781 " printf(\"sem_timedwait() succeeded\\[rs]n\");\n"
782 "\\&\n"
783 " exit((s == 0) ? EXIT_SUCCESS : EXIT_FAILURE);\n"
784 "}\n"
785
786 #. type: TH
787 #: fedora-44 fedora-rawhide
788 #, no-wrap
789 msgid "2024-07-23"
790 msgstr "23 يوليو 2024"
791
792 #. type: TH
793 #: fedora-44 fedora-rawhide
794 #, no-wrap
795 msgid "Linux man-pages 6.13"
796 msgstr "صفحات دليل لينكس 6.13"
797
798 #. type: TH
799 #: mageia-cauldron
800 #, no-wrap
801 msgid "Linux man-pages 6.17"
802 msgstr "صفحات دليل لينكس 6.17"
803
804 #. type: TH
805 #: opensuse-leap-16-1 opensuse-tumbleweed
806 #, no-wrap
807 msgid "Linux man-pages (unreleased)"
808 msgstr "صفحات دليل لينكس (لم تصدر بعد)"