Debian Codegraph @

po/ar/man3/pthread_attr_init.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:38+0200\n"
9 "PO-Revision-Date: 2026-06-02 19:35+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 "pthread_attr_init"
25 msgstr "pthread_attr_init"
26
27 #. type: TH
28 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
29 #: opensuse-tumbleweed
30 #, no-wrap
31 msgid "2025-09-21"
32 msgstr "21 سبتمبر 2025"
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 ""
51 "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread "
52 "attributes object"
53 msgstr "pthread_attr_init, pthread_attr_destroy - تهيئة وتدمير كائن سمات الخيط"
54
55 #. type: SH
56 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
57 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
58 #, no-wrap
59 msgid "LIBRARY"
60 msgstr "المكتبة"
61
62 #. type: Plain text
63 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
64 #: opensuse-leap-16-1 opensuse-tumbleweed
65 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
66 msgstr "مكتبة مسالك POSIX (I<libpthread>،\\ I<-lpthread>)"
67
68 #. type: SH
69 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
70 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
71 #, no-wrap
72 msgid "SYNOPSIS"
73 msgstr "موجز"
74
75 #. type: Plain text
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid "B<#include E<lt>pthread.hE<gt>>\n"
80 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
81
82 #. type: Plain text
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid ""
87 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
88 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
89 msgstr ""
90 "B<int pthread_attr_init(pthread_attr_t *>I<attr>B<);>\n"
91 "B<int pthread_attr_destroy(pthread_attr_t *>I<attr>B<);>\n"
92
93 #. type: SH
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 #, no-wrap
97 msgid "DESCRIPTION"
98 msgstr "الوصف"
99
100 #. type: Plain text
101 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
102 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
103 msgid ""
104 "The B<pthread_attr_init>() function initializes the thread attributes "
105 "object pointed to by I<attr> with default attribute values. After this "
106 "call, individual attributes of the object can be set using various related "
107 "functions (listed under SEE ALSO), and then the object can be used in one or "
108 "more B<pthread_create>(3) calls that create threads."
109 msgstr ""
110 "الدالة B<pthread_attr_init>() تهيئ كائن سمات الخيط المشار إليه بواسطة "
111 "I<attr> بقيم سمات مبدئية. بعد هذه الاستدعاء، يمكن تعيين سمات فردية للكائن "
112 "باستخدام دوال ذات صلة متنوعة (مدرجة تحت انظر أيضًا)، ثم يمكن استخدام الكائن "
113 "في استدعاء واحد أو أكثر من B<pthread_create>(3) التي تنشئ خيوطًا."
114
115 #. type: Plain text
116 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
117 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
118 msgid ""
119 "Calling B<pthread_attr_init>() on a thread attributes object that has "
120 "already been initialized results in undefined behavior."
121 msgstr ""
122 "استدعاء B<pthread_attr_init>() على كائن سمات خيط سبق تهيئته يؤدي إلى سلوك "
123 "غير محدد."
124
125 #. type: Plain text
126 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
127 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
128 msgid ""
129 "When a thread attributes object is no longer required, it should be "
130 "destroyed using the B<pthread_attr_destroy>() function. Destroying a "
131 "thread attributes object has no effect on threads that were created using "
132 "that object."
133 msgstr ""
134 "عندما لا يعود كائن سمات الخيط مطلوبًا، يجب تدميره باستخدام الدالة "
135 "B<pthread_attr_destroy>(). تدمير كائن سمات الخيط لا يؤثر على الخيوط التي "
136 "أُنشئت باستخدام ذلك الكائن."
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 "Once a thread attributes object has been destroyed, it can be reinitialized "
143 "using B<pthread_attr_init>(). Any other use of a destroyed thread "
144 "attributes object has undefined results."
145 msgstr ""
146 "بمجرد تدمير كائن سمات الخيط، يمكن إعادة تهيئته باستخدام "
147 "B<pthread_attr_init>(). أي استخدام آخر لكائن سمات خيط مدمر يؤدي إلى نتائج "
148 "غير محددة."
149
150 #. type: SH
151 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
152 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
153 #, no-wrap
154 msgid "RETURN VALUE"
155 msgstr "قيمة الإرجاع"
156
157 #. type: Plain text
158 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
159 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
160 msgid ""
161 "On success, these functions return 0; on error, they return a nonzero error "
162 "number."
163 msgstr ""
164 "عند النجاح، تُعيد هذه الدوال القيمة 0؛ وعند الخطأ، تُعيد رقم خطأ غير صفري."
165
166 #. type: SH
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 #, no-wrap
170 msgid "ERRORS"
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 "POSIX.1 documents an B<ENOMEM> error for B<pthread_attr_init>(); on Linux "
178 "these functions always succeed (but portable and future-proof applications "
179 "should nevertheless handle a possible error return)."
180 msgstr ""
181 "يُوثق POSIX.1 خطأ B<ENOMEM> لـ B<pthread_attr_init>()؛ على لينكس تنجح هذه "
182 "الدوال دائمًا (لكن التطبيقات المحمولة والمقاومة للمستقبل يجب مع ذلك معالجة "
183 "إرجاع خطأ محتمل)."
184
185 #. type: SH
186 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
187 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
188 #, no-wrap
189 msgid "ATTRIBUTES"
190 msgstr "السمات"
191
192 #. type: Plain text
193 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
194 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
195 msgid ""
196 "For an explanation of the terms used in this section, see B<attributes>(7)."
197 msgstr ""
198 "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)."
199
200 #. type: tbl table
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 #, no-wrap
204 msgid "Interface"
205 msgstr "الواجهة"
206
207 #. type: tbl table
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 #, no-wrap
211 msgid "Attribute"
212 msgstr "السمة"
213
214 #. type: tbl table
215 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
216 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
217 #, no-wrap
218 msgid "Value"
219 msgstr "القيمة"
220
221 #. type: tbl table
222 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
223 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
224 #, no-wrap
225 msgid ".na\n"
226 msgstr ".na\n"
227
228 #. type: tbl table
229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
231 #, no-wrap
232 msgid ".nh\n"
233 msgstr ".nh\n"
234
235 #. type: tbl table
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 #, no-wrap
239 msgid ""
240 "B<pthread_attr_init>(),\n"
241 "B<pthread_attr_destroy>()"
242 msgstr ""
243 "B<pthread_attr_init>(),\n"
244 "B<pthread_attr_destroy>()"
245
246 #. type: tbl table
247 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
248 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
249 #, no-wrap
250 msgid "Thread safety"
251 msgstr "سلامة الخيوط"
252
253 #. type: tbl table
254 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
255 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
256 #, no-wrap
257 msgid "MT-Safe"
258 msgstr "MT-Safe"
259
260 #. type: SH
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 #, no-wrap
264 msgid "STANDARDS"
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 "POSIX.1-2008."
271 msgstr "POSIX.1-2008."
272
273 #. type: SH
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 #, no-wrap
277 msgid "HISTORY"
278 msgstr "التاريخ"
279
280 #. type: Plain text
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 msgid "POSIX.1-2001."
284 msgstr "POSIX.1-2001."
285
286 #. type: SH
287 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
288 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
289 #, no-wrap
290 msgid "NOTES"
291 msgstr "ملاحظات"
292
293 #. type: Plain text
294 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
295 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
296 msgid ""
297 "The I<pthread_attr_t> type should be treated as opaque: any access to the "
298 "object other than via pthreads functions is nonportable and produces "
299 "undefined results."
300 msgstr ""
301 "يجب معاملة النوع I<pthread_attr_t> على أنه معتم: أي وصول إلى الكائن بخلاف "
302 "دوال pthreads غير محمول وينتج نتائج غير محددة."
303
304 #. type: SH
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 #, no-wrap
308 msgid "EXAMPLES"
309 msgstr "أمثلة"
310
311 #. type: Plain text
312 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
313 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
314 msgid ""
315 "The program below optionally makes use of B<pthread_attr_init>() and "
316 "various related functions to initialize a thread attributes object that is "
317 "used to create a single thread. Once created, the thread uses the "
318 "B<pthread_getattr_np>(3) function (a nonstandard GNU extension) to retrieve "
319 "the thread's attributes, and then displays those attributes."
320 msgstr ""
321 "البرنامج أدناه يستخدم اختياريًا B<pthread_attr_init>() ودوال ذات صلة متنوعة "
322 "لتهيئة كائن سمات خيط يُستخدم لإنشاء خيط واحد. بمجرد الإنشاء، يستخدم الخيط "
323 "الدالة B<pthread_getattr_np>(3) (إضافة GNU غير قياسية) لاسترداد سمات الخيط، "
324 "ثم يعرض تلك السمات."
325
326 #. type: Plain text
327 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
328 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
329 msgid ""
330 "If the program is run with no command-line argument, then it passes NULL as "
331 "the I<attr> argument of B<pthread_create>(3), so that the thread is created "
332 "with default attributes. Running the program on Linux/x86-32 with the NPTL "
333 "threading implementation, we see the following:"
334 msgstr ""
335 "إذا شُغّل البرنامج بدون وسيط سطر أوامر، فإنه يمرر NULL كوسيط I<attr> لـ "
336 "B<pthread_create>(3)، بحيث يُنشأ الخيط بسمات مبدئية. بتشغيل البرنامج على "
337 "Linux/x86-32 مع تطبيق خيوط NPTL، نرى ما يلي:"
338
339 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
340 #. type: Plain text
341 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
342 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
343 #, no-wrap
344 msgid ""
345 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
346 "unlimited\n"
347 "$B< ./a.out>\n"
348 "Thread attributes:\n"
349 " Detach state = PTHREAD_CREATE_JOINABLE\n"
350 " Scope = PTHREAD_SCOPE_SYSTEM\n"
351 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
352 " Scheduling policy = SCHED_OTHER\n"
353 " Scheduling priority = 0\n"
354 " Guard size = 4096 bytes\n"
355 " Stack address = 0x40196000\n"
356 " Stack size = 0x201000 bytes\n"
357 msgstr ""
358 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
359 "unlimited\n"
360 "$B< ./a.out>\n"
361 "Thread attributes:\n"
362 " Detach state = PTHREAD_CREATE_JOINABLE\n"
363 " Scope = PTHREAD_SCOPE_SYSTEM\n"
364 " Inherit scheduler = PTHREAD_INHERIT_SCHED\n"
365 " Scheduling policy = SCHED_OTHER\n"
366 " Scheduling priority = 0\n"
367 " Guard size = 4096 bytes\n"
368 " Stack address = 0x40196000\n"
369 " Stack size = 0x201000 bytes\n"
370
371 #. type: Plain text
372 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
373 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
374 msgid ""
375 "When we supply a stack size as a command-line argument, the program "
376 "initializes a thread attributes object, sets various attributes in that "
377 "object, and passes a pointer to the object in the call to "
378 "B<pthread_create>(3). Running the program on Linux/x86-32 with the NPTL "
379 "threading implementation, we see the following:"
380 msgstr ""
381 "عندما نقدم حجم المكدس كوسيط سطر أوامر، يهيئ البرنامج كائن سمات خيط، ويضبط "
382 "سمات متنوعة في ذلك الكائن، ويمرر مؤشرًا إلى الكائن في استدعاء "
383 "B<pthread_create>(3). بتشغيل البرنامج على Linux/x86-32 مع تطبيق خيوط NPTL، "
384 "نرى ما يلي:"
385
386 #. Results from glibc 2.8, SUSE 11.0; Oct 2008
387 #. type: Plain text
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid ""
392 "$B< ./a.out 0x3000000>\n"
393 "posix_memalign() allocated at 0x40197000\n"
394 "Thread attributes:\n"
395 " Detach state = PTHREAD_CREATE_DETACHED\n"
396 " Scope = PTHREAD_SCOPE_SYSTEM\n"
397 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
398 " Scheduling policy = SCHED_OTHER\n"
399 " Scheduling priority = 0\n"
400 " Guard size = 0 bytes\n"
401 " Stack address = 0x40197000\n"
402 " Stack size = 0x3000000 bytes\n"
403 msgstr ""
404 "$B< ./a.out 0x3000000>\n"
405 "posix_memalign() allocated at 0x40197000\n"
406 "Thread attributes:\n"
407 " Detach state = PTHREAD_CREATE_DETACHED\n"
408 " Scope = PTHREAD_SCOPE_SYSTEM\n"
409 " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n"
410 " Scheduling policy = SCHED_OTHER\n"
411 " Scheduling priority = 0\n"
412 " Guard size = 0 bytes\n"
413 " Stack address = 0x40197000\n"
414 " Stack size = 0x3000000 bytes\n"
415
416 #. type: SS
417 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
418 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
419 #, no-wrap
420 msgid "Program source"
421 msgstr "مصدر البرنامج"
422
423 #. type: Plain text
424 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
425 #: opensuse-tumbleweed
426 #, no-wrap
427 msgid ""
428 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
429 "#include E<lt>err.hE<gt>\n"
430 "#include E<lt>errno.hE<gt>\n"
431 "#include E<lt>pthread.hE<gt>\n"
432 "#include E<lt>stdio.hE<gt>\n"
433 "#include E<lt>stdlib.hE<gt>\n"
434 "#include E<lt>unistd.hE<gt>\n"
435 "\\&\n"
436 "static void\n"
437 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
438 "{\n"
439 " int s, i;\n"
440 " size_t v;\n"
441 " void *stkaddr;\n"
442 " struct sched_param sp;\n"
443 "\\&\n"
444 " s = pthread_attr_getdetachstate(attr, &i);\n"
445 " if (s != 0)\n"
446 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
447 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
448 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
449 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
450 " \"???\");\n"
451 "\\&\n"
452 " s = pthread_attr_getscope(attr, &i);\n"
453 " if (s != 0)\n"
454 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
455 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
456 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
457 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
458 " \"???\");\n"
459 "\\&\n"
460 " s = pthread_attr_getinheritsched(attr, &i);\n"
461 " if (s != 0)\n"
462 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
463 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
464 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
465 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
466 " \"???\");\n"
467 "\\&\n"
468 " s = pthread_attr_getschedpolicy(attr, &i);\n"
469 " if (s != 0)\n"
470 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
471 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
472 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
473 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
474 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
475 " \"???\");\n"
476 "\\&\n"
477 " s = pthread_attr_getschedparam(attr, &sp);\n"
478 " if (s != 0)\n"
479 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
480 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
481 "\\&\n"
482 " s = pthread_attr_getguardsize(attr, &v);\n"
483 " if (s != 0)\n"
484 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
485 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
486 "\\&\n"
487 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
488 " if (s != 0)\n"
489 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
490 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
491 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
492 "}\n"
493 "\\&\n"
494 "static void *\n"
495 "thread_start(void *arg)\n"
496 "{\n"
497 " int s;\n"
498 " pthread_attr_t gattr;\n"
499 "\\&\n"
500 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
501 " retrieves the attributes of the thread specified in its\n"
502 " first argument. */\n"
503 "\\&\n"
504 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
505 " if (s != 0)\n"
506 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
507 "\\&\n"
508 " printf(\"Thread attributes:\\[rs]n\");\n"
509 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
510 "\\&\n"
511 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
512 "}\n"
513 "\\&\n"
514 "int\n"
515 "main(int argc, char *argv[])\n"
516 "{\n"
517 " pthread_t thr;\n"
518 " pthread_attr_t attr;\n"
519 " pthread_attr_t *attrp; /* NULL or &attr */\n"
520 " int s;\n"
521 "\\&\n"
522 " attrp = NULL;\n"
523 "\\&\n"
524 " /* If a command-line argument was supplied, use it to set the\n"
525 " stack-size attribute and set a few other thread attributes,\n"
526 " and set attrp pointing to thread attributes object. */\n"
527 "\\&\n"
528 " if (argc E<gt> 1) {\n"
529 " size_t stack_size;\n"
530 " void *sp;\n"
531 "\\&\n"
532 " attrp = &attr;\n"
533 "\\&\n"
534 " s = pthread_attr_init(&attr);\n"
535 " if (s != 0)\n"
536 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
537 "\\&\n"
538 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
539 " if (s != 0)\n"
540 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
541 "\\&\n"
542 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
543 " if (s != 0)\n"
544 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
545 "\\&\n"
546 " stack_size = strtoul(argv[1], NULL, 0);\n"
547 "\\&\n"
548 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
549 " if (s != 0)\n"
550 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
551 "\\&\n"
552 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
553 "\\&\n"
554 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
555 " if (s != 0)\n"
556 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
557 " }\n"
558 "\\&\n"
559 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
560 " if (s != 0)\n"
561 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
562 "\\&\n"
563 " if (attrp != NULL) {\n"
564 " s = pthread_attr_destroy(attrp);\n"
565 " if (s != 0)\n"
566 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
567 " }\n"
568 "\\&\n"
569 " pause(); /* Terminates when other thread calls exit() */\n"
570 "}\n"
571 msgstr ""
572 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
573 "#include E<lt>err.hE<gt>\n"
574 "#include E<lt>errno.hE<gt>\n"
575 "#include E<lt>pthread.hE<gt>\n"
576 "#include E<lt>stdio.hE<gt>\n"
577 "#include E<lt>stdlib.hE<gt>\n"
578 "#include E<lt>unistd.hE<gt>\n"
579 "\\&\n"
580 "static void\n"
581 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
582 "{\n"
583 " int s, i;\n"
584 " size_t v;\n"
585 " void *stkaddr;\n"
586 " struct sched_param sp;\n"
587 "\\&\n"
588 " s = pthread_attr_getdetachstate(attr, &i);\n"
589 " if (s != 0)\n"
590 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
591 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
592 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
593 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
594 " \"???\");\n"
595 "\\&\n"
596 " s = pthread_attr_getscope(attr, &i);\n"
597 " if (s != 0)\n"
598 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
599 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
600 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
601 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
602 " \"???\");\n"
603 "\\&\n"
604 " s = pthread_attr_getinheritsched(attr, &i);\n"
605 " if (s != 0)\n"
606 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
607 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
608 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
609 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
610 " \"???\");\n"
611 "\\&\n"
612 " s = pthread_attr_getschedpolicy(attr, &i);\n"
613 " if (s != 0)\n"
614 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
615 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
616 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
617 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
618 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
619 " \"???\");\n"
620 "\\&\n"
621 " s = pthread_attr_getschedparam(attr, &sp);\n"
622 " if (s != 0)\n"
623 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
624 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
625 "\\&\n"
626 " s = pthread_attr_getguardsize(attr, &v);\n"
627 " if (s != 0)\n"
628 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
629 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
630 "\\&\n"
631 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
632 " if (s != 0)\n"
633 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
634 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
635 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
636 "}\n"
637 "\\&\n"
638 "static void *\n"
639 "thread_start(void *arg)\n"
640 "{\n"
641 " int s;\n"
642 " pthread_attr_t gattr;\n"
643 "\\&\n"
644 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
645 " retrieves the attributes of the thread specified in its\n"
646 " first argument. */\n"
647 "\\&\n"
648 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
649 " if (s != 0)\n"
650 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
651 "\\&\n"
652 " printf(\"Thread attributes:\\[rs]n\");\n"
653 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
654 "\\&\n"
655 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
656 "}\n"
657 "\\&\n"
658 "int\n"
659 "main(int argc, char *argv[])\n"
660 "{\n"
661 " pthread_t thr;\n"
662 " pthread_attr_t attr;\n"
663 " pthread_attr_t *attrp; /* NULL or &attr */\n"
664 " int s;\n"
665 "\\&\n"
666 " attrp = NULL;\n"
667 "\\&\n"
668 " /* If a command-line argument was supplied, use it to set the\n"
669 " stack-size attribute and set a few other thread attributes,\n"
670 " and set attrp pointing to thread attributes object. */\n"
671 "\\&\n"
672 " if (argc E<gt> 1) {\n"
673 " size_t stack_size;\n"
674 " void *sp;\n"
675 "\\&\n"
676 " attrp = &attr;\n"
677 "\\&\n"
678 " s = pthread_attr_init(&attr);\n"
679 " if (s != 0)\n"
680 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
681 "\\&\n"
682 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
683 " if (s != 0)\n"
684 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
685 "\\&\n"
686 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
687 " if (s != 0)\n"
688 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
689 "\\&\n"
690 " stack_size = strtoul(argv[1], NULL, 0);\n"
691 "\\&\n"
692 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
693 " if (s != 0)\n"
694 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
695 "\\&\n"
696 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
697 "\\&\n"
698 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
699 " if (s != 0)\n"
700 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
701 " }\n"
702 "\\&\n"
703 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
704 " if (s != 0)\n"
705 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
706 "\\&\n"
707 " if (attrp != NULL) {\n"
708 " s = pthread_attr_destroy(attrp);\n"
709 " if (s != 0)\n"
710 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
711 " }\n"
712 "\\&\n"
713 " pause(); /* Terminates when other thread calls exit() */\n"
714 "}\n"
715
716 #. SRC END
717 #. type: SH
718 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
719 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
720 #, no-wrap
721 msgid "SEE ALSO"
722 msgstr "انظر أيضًا"
723
724 #. type: Plain text
725 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
726 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
727 msgid ""
728 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
729 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
730 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
731 "B<pthread_attr_setscope>(3), B<pthread_attr_setsigmask_np>(3), "
732 "B<pthread_attr_setstack>(3), B<pthread_attr_setstackaddr>(3), "
733 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), "
734 "B<pthread_getattr_np>(3), B<pthread_setattr_default_np>(3), B<pthreads>(7)"
735 msgstr ""
736 "B<pthread_attr_setaffinity_np>(3), B<pthread_attr_setdetachstate>(3), "
737 "B<pthread_attr_setguardsize>(3), B<pthread_attr_setinheritsched>(3), "
738 "B<pthread_attr_setschedparam>(3), B<pthread_attr_setschedpolicy>(3), "
739 "B<pthread_attr_setscope>(3), B<pthread_attr_setsigmask_np>(3), "
740 "B<pthread_attr_setstack>(3), B<pthread_attr_setstackaddr>(3), "
741 "B<pthread_attr_setstacksize>(3), B<pthread_create>(3), "
742 "B<pthread_getattr_np>(3), B<pthread_setattr_default_np>(3), B<pthreads>(7)"
743
744 #. type: TH
745 #: debian-trixie
746 #, no-wrap
747 msgid "2024-06-15"
748 msgstr "15 يونيو 2024"
749
750 #. type: TH
751 #: debian-trixie
752 #, no-wrap
753 msgid "Linux man-pages 6.9.1"
754 msgstr "صفحات دليل لينكس 6.9.1"
755
756 #. type: Plain text
757 #: debian-trixie
758 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
759 msgstr "مكتبة مسالك POSIX (I<libpthread>، I<-lpthread>)"
760
761 #. type: Plain text
762 #: debian-trixie fedora-44 fedora-rawhide
763 #, no-wrap
764 msgid ""
765 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
766 "#include E<lt>err.hE<gt>\n"
767 "#include E<lt>errno.hE<gt>\n"
768 "#include E<lt>pthread.hE<gt>\n"
769 "#include E<lt>stdio.hE<gt>\n"
770 "#include E<lt>stdlib.hE<gt>\n"
771 "#include E<lt>unistd.hE<gt>\n"
772 "\\&\n"
773 "static void\n"
774 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
775 "{\n"
776 " int s, i;\n"
777 " size_t v;\n"
778 " void *stkaddr;\n"
779 " struct sched_param sp;\n"
780 "\\&\n"
781 " s = pthread_attr_getdetachstate(attr, &i);\n"
782 " if (s != 0)\n"
783 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
784 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
785 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
786 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
787 " \"???\");\n"
788 "\\&\n"
789 " s = pthread_attr_getscope(attr, &i);\n"
790 " if (s != 0)\n"
791 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
792 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
793 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
794 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
795 " \"???\");\n"
796 "\\&\n"
797 " s = pthread_attr_getinheritsched(attr, &i);\n"
798 " if (s != 0)\n"
799 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
800 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
801 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
802 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
803 " \"???\");\n"
804 "\\&\n"
805 " s = pthread_attr_getschedpolicy(attr, &i);\n"
806 " if (s != 0)\n"
807 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
808 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
809 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
810 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
811 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
812 " \"???\");\n"
813 "\\&\n"
814 " s = pthread_attr_getschedparam(attr, &sp);\n"
815 " if (s != 0)\n"
816 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
817 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
818 "\\&\n"
819 " s = pthread_attr_getguardsize(attr, &v);\n"
820 " if (s != 0)\n"
821 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
822 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
823 "\\&\n"
824 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
825 " if (s != 0)\n"
826 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
827 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
828 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
829 "}\n"
830 "\\&\n"
831 "static void *\n"
832 "thread_start(void *arg)\n"
833 "{\n"
834 " int s;\n"
835 " pthread_attr_t gattr;\n"
836 "\\&\n"
837 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
838 " retrieves the attributes of the thread specified in its\n"
839 " first argument. */\n"
840 "\\&\n"
841 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
842 " if (s != 0)\n"
843 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
844 "\\&\n"
845 " printf(\"Thread attributes:\\[rs]n\");\n"
846 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
847 "\\&\n"
848 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
849 "}\n"
850 "\\&\n"
851 "int\n"
852 "main(int argc, char *argv[])\n"
853 "{\n"
854 " pthread_t thr;\n"
855 " pthread_attr_t attr;\n"
856 " pthread_attr_t *attrp; /* NULL or &attr */\n"
857 " int s;\n"
858 "\\&\n"
859 " attrp = NULL;\n"
860 "\\&\n"
861 " /* If a command-line argument was supplied, use it to set the\n"
862 " stack-size attribute and set a few other thread attributes,\n"
863 " and set attrp pointing to thread attributes object. */\n"
864 "\\&\n"
865 " if (argc E<gt> 1) {\n"
866 " size_t stack_size;\n"
867 " void *sp;\n"
868 "\\&\n"
869 " attrp = &attr;\n"
870 "\\&\n"
871 " s = pthread_attr_init(&attr);\n"
872 " if (s != 0)\n"
873 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
874 "\\&\n"
875 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
876 " if (s != 0)\n"
877 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
878 "\\&\n"
879 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
880 " if (s != 0)\n"
881 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
882 "\\&\n"
883 " stack_size = strtoul(argv[1], NULL, 0);\n"
884 "\\&\n"
885 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
886 " if (s != 0)\n"
887 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
888 "\\&\n"
889 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
890 "\\&\n"
891 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
892 " if (s != 0)\n"
893 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
894 " }\n"
895 "\\&\n"
896 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
897 " if (s != 0)\n"
898 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
899 "\\&\n"
900 " if (attrp != NULL) {\n"
901 " s = pthread_attr_destroy(attrp);\n"
902 " if (s != 0)\n"
903 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
904 " }\n"
905 "\\&\n"
906 " pause(); /* Terminates when other thread calls exit() */\n"
907 "}\n"
908 msgstr ""
909 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
910 "#include E<lt>err.hE<gt>\n"
911 "#include E<lt>errno.hE<gt>\n"
912 "#include E<lt>pthread.hE<gt>\n"
913 "#include E<lt>stdio.hE<gt>\n"
914 "#include E<lt>stdlib.hE<gt>\n"
915 "#include E<lt>unistd.hE<gt>\n"
916 "\\&\n"
917 "static void\n"
918 "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n"
919 "{\n"
920 " int s, i;\n"
921 " size_t v;\n"
922 " void *stkaddr;\n"
923 " struct sched_param sp;\n"
924 "\\&\n"
925 " s = pthread_attr_getdetachstate(attr, &i);\n"
926 " if (s != 0)\n"
927 " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n"
928 " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n"
929 " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n"
930 " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n"
931 " \"???\");\n"
932 "\\&\n"
933 " s = pthread_attr_getscope(attr, &i);\n"
934 " if (s != 0)\n"
935 " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n"
936 " printf(\"%sScope = %s\\[rs]n\", prefix,\n"
937 " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n"
938 " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n"
939 " \"???\");\n"
940 "\\&\n"
941 " s = pthread_attr_getinheritsched(attr, &i);\n"
942 " if (s != 0)\n"
943 " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n"
944 " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n"
945 " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n"
946 " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n"
947 " \"???\");\n"
948 "\\&\n"
949 " s = pthread_attr_getschedpolicy(attr, &i);\n"
950 " if (s != 0)\n"
951 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
952 " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n"
953 " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
954 " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
955 " (i == SCHED_RR) ? \"SCHED_RR\" :\n"
956 " \"???\");\n"
957 "\\&\n"
958 " s = pthread_attr_getschedparam(attr, &sp);\n"
959 " if (s != 0)\n"
960 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
961 " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n"
962 "\\&\n"
963 " s = pthread_attr_getguardsize(attr, &v);\n"
964 " if (s != 0)\n"
965 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
966 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n"
967 "\\&\n"
968 " s = pthread_attr_getstack(attr, &stkaddr, &v);\n"
969 " if (s != 0)\n"
970 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
971 " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n"
972 " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n"
973 "}\n"
974 "\\&\n"
975 "static void *\n"
976 "thread_start(void *arg)\n"
977 "{\n"
978 " int s;\n"
979 " pthread_attr_t gattr;\n"
980 "\\&\n"
981 " /* pthread_getattr_np() is a non-standard GNU extension that\n"
982 " retrieves the attributes of the thread specified in its\n"
983 " first argument. */\n"
984 "\\&\n"
985 " s = pthread_getattr_np(pthread_self(), &gattr);\n"
986 " if (s != 0)\n"
987 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
988 "\\&\n"
989 " printf(\"Thread attributes:\\[rs]n\");\n"
990 " display_pthread_attr(&gattr, \"\\[rs]t\");\n"
991 "\\&\n"
992 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
993 "}\n"
994 "\\&\n"
995 "int\n"
996 "main(int argc, char *argv[])\n"
997 "{\n"
998 " pthread_t thr;\n"
999 " pthread_attr_t attr;\n"
1000 " pthread_attr_t *attrp; /* NULL or &attr */\n"
1001 " int s;\n"
1002 "\\&\n"
1003 " attrp = NULL;\n"
1004 "\\&\n"
1005 " /* If a command-line argument was supplied, use it to set the\n"
1006 " stack-size attribute and set a few other thread attributes,\n"
1007 " and set attrp pointing to thread attributes object. */\n"
1008 "\\&\n"
1009 " if (argc E<gt> 1) {\n"
1010 " size_t stack_size;\n"
1011 " void *sp;\n"
1012 "\\&\n"
1013 " attrp = &attr;\n"
1014 "\\&\n"
1015 " s = pthread_attr_init(&attr);\n"
1016 " if (s != 0)\n"
1017 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
1018 "\\&\n"
1019 " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n"
1020 " if (s != 0)\n"
1021 " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n"
1022 "\\&\n"
1023 " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n"
1024 " if (s != 0)\n"
1025 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
1026 "\\&\n"
1027 " stack_size = strtoul(argv[1], NULL, 0);\n"
1028 "\\&\n"
1029 " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n"
1030 " if (s != 0)\n"
1031 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
1032 "\\&\n"
1033 " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n"
1034 "\\&\n"
1035 " s = pthread_attr_setstack(&attr, sp, stack_size);\n"
1036 " if (s != 0)\n"
1037 " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n"
1038 " }\n"
1039 "\\&\n"
1040 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
1041 " if (s != 0)\n"
1042 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
1043 "\\&\n"
1044 " if (attrp != NULL) {\n"
1045 " s = pthread_attr_destroy(attrp);\n"
1046 " if (s != 0)\n"
1047 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
1048 " }\n"
1049 "\\&\n"
1050 " pause(); /* Terminates when other thread calls exit() */\n"
1051 "}\n"
1052
1053 #. type: TH
1054 #: fedora-44 fedora-rawhide
1055 #, no-wrap
1056 msgid "2024-07-23"
1057 msgstr "23 يوليو 2024"
1058
1059 #. type: TH
1060 #: fedora-44 fedora-rawhide
1061 #, no-wrap
1062 msgid "Linux man-pages 6.13"
1063 msgstr "صفحات دليل لينكس 6.13"
1064
1065 #. type: TH
1066 #: mageia-cauldron
1067 #, no-wrap
1068 msgid "Linux man-pages 6.17"
1069 msgstr "صفحات دليل لينكس 6.17"
1070
1071 #. type: TH
1072 #: opensuse-leap-16-1 opensuse-tumbleweed
1073 #, no-wrap
1074 msgid "Linux man-pages (unreleased)"
1075 msgstr "صفحات دليل لينكس (لم تصدر بعد)"