Debian Codegraph @

po/ar/man3/pthread_getattr_np.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:39+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_getattr_np"
25 msgstr "pthread_getattr_np"
26
27 #. type: TH
28 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
29 #: opensuse-tumbleweed
30 #, no-wrap
31 msgid "2025-09-25"
32 msgstr "25 سبتمبر 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 "pthread_getattr_np - get attributes of created thread"
51 msgstr "pthread_getattr_np - الحصول على سمات الخيط المُنشأ"
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 ""
78 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
79 "B<#include E<lt>pthread.hE<gt>>\n"
80 msgstr ""
81 "B<#define _GNU_SOURCE> /* انظر feature_test_macros(7) */\n"
82 "B<#include E<lt>pthread.hE<gt>>\n"
83
84 #. type: Plain text
85 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
86 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
87 #, no-wrap
88 msgid "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
89 msgstr "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
90
91 #. type: SH
92 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
93 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
94 #, no-wrap
95 msgid "DESCRIPTION"
96 msgstr "الوصف"
97
98 #. type: Plain text
99 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
100 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
101 msgid ""
102 "The B<pthread_getattr_np>() function initializes the thread attributes "
103 "object referred to by I<attr> so that it contains actual attribute values "
104 "describing the running thread I<thread>."
105 msgstr ""
106 "الدالة B<pthread_getattr_np>() تُهيئ كائن سمات الخيط المشار إليه بواسطة "
107 "I<attr> بحيث يحتوي على قيم السمات الفعلية التي تصف الخيط الجاري I<thread>."
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 msgid ""
113 "The returned attribute values may differ from the corresponding attribute "
114 "values passed in the I<attr> object that was used to create the thread using "
115 "B<pthread_create>(3). In particular, the following attributes may differ:"
116 msgstr ""
117 "قد تختلف قيم السمات المُرجعة عن قيم السمات المُقابلة المُمررة في كائن I<attr> "
118 "الذي استُخدم لإنشاء الخيط باستخدام B<pthread_create>(3). على وجه الخصوص، قد "
119 "تختلف السمات التالية:"
120
121 #. type: IP
122 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
123 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
124 #, no-wrap
125 msgid "\\[bu]"
126 msgstr "\\[bu]"
127
128 #. type: Plain text
129 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
130 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
131 msgid ""
132 "the detach state, since a joinable thread may have detached itself after "
133 "creation;"
134 msgstr "حالة الفصل، حيث قد يفصل الخيط القابل للانضمام نفسه بعد الإنشاء؛"
135
136 #. type: Plain text
137 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
138 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
139 msgid ""
140 "the stack size, which the implementation may align to a suitable boundary."
141 msgstr "حجم المكدس، والذي قد تُحاذيه التطبيقات إلى حد مناسب."
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid ""
147 "and the guard size, which the implementation may round upward to a multiple "
148 "of the page size, or ignore (i.e., treat as 0), if the application is "
149 "allocating its own stack."
150 msgstr ""
151 "وحجم الحارس، والذي قد تُقرّبه التطبيقات لأعلى إلى مضاعف حجم الصفحة، أو تتجاهله "
152 "(أي تعامله كـ 0)، إذا كان التطبيق يخصص مكدسه الخاص."
153
154 #. type: Plain text
155 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
156 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
157 msgid ""
158 "Furthermore, if the stack address attribute was not set in the thread "
159 "attributes object used to create the thread, then the returned thread "
160 "attributes object will report the actual stack address that the "
161 "implementation selected for the thread."
162 msgstr ""
163 "علاوة على ذلك، إذا لم تُضبط سمة عنوان المكدس في كائن سمات الخيط المستخدم "
164 "لإنشاء الخيط، فإن كائن سمات الخيط المُعاد سيُبلغ عن عنوان المكدس الفعلي الذي "
165 "اختارته التطبيقات للخيط."
166
167 #. type: Plain text
168 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
169 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
170 msgid ""
171 "When the thread attributes object returned by B<pthread_getattr_np>() is no "
172 "longer required, it should be destroyed using B<pthread_attr_destroy>(3)."
173 msgstr ""
174 "عندما لا يعود كائن سمات الخيط المُعاد بواسطة B<pthread_getattr_np>() مطلوبًا، "
175 "يجب تدميره باستخدام B<pthread_attr_destroy>(3)."
176
177 #. type: SH
178 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
179 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
180 #, no-wrap
181 msgid "RETURN VALUE"
182 msgstr "قيمة الإرجاع"
183
184 #. type: Plain text
185 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
186 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
187 msgid ""
188 "On success, this function returns 0; on error, it returns a nonzero error "
189 "number."
190 msgstr "عند النجاح، تعيد هذه الدالة 0؛ وعند حدوث خطأ، تعيد رقم خطأ غير صفري."
191
192 #. type: SH
193 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
194 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
195 #, no-wrap
196 msgid "ERRORS"
197 msgstr "الأخطاء"
198
199 #. type: TP
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 #, no-wrap
203 msgid "B<ENOMEM>"
204 msgstr "B<ENOMEM>"
205
206 #. Can happen (but unlikely) while trying to allocate memory for cpuset
207 #. type: Plain text
208 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
209 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
210 msgid "Insufficient memory."
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 ""
217 "In addition, if I<thread> refers to the main thread, then "
218 "B<pthread_getattr_np>() can fail because of errors from various underlying "
219 "calls: B<fopen>(3), if I</proc/self/maps> can't be opened; and "
220 "B<getrlimit>(2), if the B<RLIMIT_STACK> resource limit is not supported."
221 msgstr ""
222 "بالإضافة إلى ذلك، إذا كان I<thread> يشير إلى الخيط الرئيسي، فقد تفشل "
223 "B<pthread_getattr_np>() بسبب أخطاء من استدعاءات أساسية متنوعة: B<fopen>(3)، "
224 "إذا تعذر فتح I</proc/self/maps>؛ و B<getrlimit>(2)، إذا لم يكن حد المورد "
225 "B<RLIMIT_STACK> مدعومًا."
226
227 #. type: SH
228 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
229 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
230 #, no-wrap
231 msgid "ATTRIBUTES"
232 msgstr "السمات"
233
234 #. type: Plain text
235 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
236 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
237 msgid ""
238 "For an explanation of the terms used in this section, see B<attributes>(7)."
239 msgstr ""
240 "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)."
241
242 #. type: tbl table
243 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
244 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
245 #, no-wrap
246 msgid "Interface"
247 msgstr "الواجهة"
248
249 #. type: tbl table
250 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
251 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
252 #, no-wrap
253 msgid "Attribute"
254 msgstr "السمة"
255
256 #. type: tbl table
257 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
258 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
259 #, no-wrap
260 msgid "Value"
261 msgstr "القيمة"
262
263 #. type: tbl table
264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
266 #, no-wrap
267 msgid ".na\n"
268 msgstr ".na\n"
269
270 #. type: tbl table
271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
273 #, no-wrap
274 msgid ".nh\n"
275 msgstr ".nh\n"
276
277 #. type: tbl table
278 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
279 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
280 #, no-wrap
281 msgid "B<pthread_getattr_np>()"
282 msgstr "B<pthread_getattr_np>()"
283
284 #. type: tbl table
285 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
286 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
287 #, no-wrap
288 msgid "Thread safety"
289 msgstr "سلامة الخيوط"
290
291 #. type: tbl table
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 #, no-wrap
295 msgid "MT-Safe"
296 msgstr "MT-Safe"
297
298 #. type: SH
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 #, no-wrap
302 msgid "STANDARDS"
303 msgstr "المعايير"
304
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 "GNU; hence the suffix \"_np\" (nonportable) in the name."
309 msgstr "جنو؛ ومن هنا جاءت اللاحقة \"_np\" (غير محمول) في الاسم."
310
311 #. type: SH
312 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
313 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
314 #, no-wrap
315 msgid "HISTORY"
316 msgstr "التاريخ"
317
318 #. type: Plain text
319 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
320 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
321 msgid "glibc 2.2.3."
322 msgstr "glibc 2.2.3."
323
324 #. type: SH
325 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
326 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
327 #, no-wrap
328 msgid "EXAMPLES"
329 msgstr "أمثلة"
330
331 #. type: Plain text
332 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
333 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
334 msgid ""
335 "The program below demonstrates the use of B<pthread_getattr_np>(). The "
336 "program creates a thread that then uses B<pthread_getattr_np>() to retrieve "
337 "and display its guard size, stack address, and stack size attributes. "
338 "Command-line arguments can be used to set these attributes to values other "
339 "than the default when creating the thread. The shell sessions below "
340 "demonstrate the use of the program."
341 msgstr ""
342 "البرنامج أدناه يوضح استخدام B<pthread_getattr_np>(). يُنشئ البرنامج خيطًا "
343 "يستخدم بعد ذلك B<pthread_getattr_np>() لاسترداد وعرض سمات حجم الحارس وعنوان "
344 "المكدس وحجم المكدس الخاصة به. يمكن استخدام وسائط سطر الأوامر لضبط هذه السمات "
345 "على قيم غير المبدئية عند إنشاء الخيط. جلسات الصدفة أدناه توضح استخدام "
346 "البرنامج."
347
348 #. type: Plain text
349 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
350 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
351 msgid ""
352 "In the first run, on an x86-32 system, a thread is created using default "
353 "attributes:"
354 msgstr "في التشغيل الأول، على نظام x86-32، يُنشأ خيط باستخدام السمات المبدئية:"
355
356 #. type: Plain text
357 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
358 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
359 #, no-wrap
360 msgid ""
361 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
362 "unlimited\n"
363 "$B< ./a.out>\n"
364 "Attributes of created thread:\n"
365 " Guard size = 4096 bytes\n"
366 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
367 " Stack size = 0x201000 (2101248) bytes\n"
368 msgstr ""
369 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
370 "unlimited\n"
371 "$B< ./a.out>\n"
372 "Attributes of created thread:\n"
373 " Guard size = 4096 bytes\n"
374 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
375 " Stack size = 0x201000 (2101248) bytes\n"
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 msgid ""
381 "In the following run, we see that if a guard size is specified, it is "
382 "rounded up to the next multiple of the system page size (4096 bytes on "
383 "x86-32):"
384 msgstr ""
385 "في التشغيل التالي، نرى أنه إذا حُدد حجم حارس، يُقرّب لأعلى إلى المضاعف التالي "
386 "لحجم صفحة النظام (4096 بايت على x86-32):"
387
388 #. type: Plain text
389 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
390 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
391 #, no-wrap
392 msgid ""
393 "$B< ./a.out -g 4097>\n"
394 "Thread attributes object after initializations:\n"
395 " Guard size = 4097 bytes\n"
396 " Stack address = (nil)\n"
397 " Stack size = 0x0 (0) bytes\n"
398 "\\&\n"
399 "Attributes of created thread:\n"
400 " Guard size = 8192 bytes\n"
401 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
402 " Stack size = 0x201000 (2101248) bytes\n"
403 msgstr ""
404 "$B< ./a.out -g 4097>\n"
405 "Thread attributes object after initializations:\n"
406 " Guard size = 4097 bytes\n"
407 " Stack address = (nil)\n"
408 " Stack size = 0x0 (0) bytes\n"
409 "\\&\n"
410 "Attributes of created thread:\n"
411 " Guard size = 8192 bytes\n"
412 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
413 " Stack size = 0x201000 (2101248) bytes\n"
414
415 #. type: Plain text
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 msgid ""
419 "In the last run, the program manually allocates a stack for the thread. In "
420 "this case, the guard size attribute is ignored."
421 msgstr ""
422 "في التشغيل الأخير، يخصص البرنامج يدويًا مكدسًا للخيط. في هذه الحالة، تُتجاهل "
423 "سمة حجم الحارس."
424
425 #. type: Plain text
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 #, no-wrap
429 msgid ""
430 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
431 "Allocated thread stack at 0x804d000\n"
432 "\\&\n"
433 "Thread attributes object after initializations:\n"
434 " Guard size = 4096 bytes\n"
435 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
436 " Stack size = 0x8000 (32768) bytes\n"
437 "\\&\n"
438 "Attributes of created thread:\n"
439 " Guard size = 0 bytes\n"
440 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
441 " Stack size = 0x8000 (32768) bytes\n"
442 msgstr ""
443 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
444 "Allocated thread stack at 0x804d000\n"
445 "\\&\n"
446 "Thread attributes object after initializations:\n"
447 " Guard size = 4096 bytes\n"
448 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
449 " Stack size = 0x8000 (32768) bytes\n"
450 "\\&\n"
451 "Attributes of created thread:\n"
452 " Guard size = 0 bytes\n"
453 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
454 " Stack size = 0x8000 (32768) bytes\n"
455
456 #. type: SS
457 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
458 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
459 #, no-wrap
460 msgid "Program source"
461 msgstr "مصدر البرنامج"
462
463 #. type: Plain text
464 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
465 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
466 #, no-wrap
467 msgid ""
468 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
469 "#include E<lt>err.hE<gt>\n"
470 "#include E<lt>errno.hE<gt>\n"
471 "#include E<lt>pthread.hE<gt>\n"
472 "#include E<lt>stdio.hE<gt>\n"
473 "#include E<lt>stdlib.hE<gt>\n"
474 "#include E<lt>unistd.hE<gt>\n"
475 "\\&\n"
476 "static void\n"
477 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
478 "{\n"
479 " int s;\n"
480 " size_t stack_size, guard_size;\n"
481 " void *stack_addr;\n"
482 "\\&\n"
483 " s = pthread_attr_getguardsize(attr, &guard_size);\n"
484 " if (s != 0)\n"
485 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
486 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, guard_size);\n"
487 "\\&\n"
488 " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
489 " if (s != 0)\n"
490 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
491 " printf(\"%sStack address = %p\", prefix, stack_addr);\n"
492 " if (stack_size E<gt> 0)\n"
493 " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
494 " printf(\"\\[rs]n\");\n"
495 " printf(\"%sStack size = %#zx (%zu) bytes\\[rs]n\",\n"
496 " prefix, stack_size, stack_size);\n"
497 "}\n"
498 "\\&\n"
499 "static void\n"
500 "display_thread_attributes(pthread_t thread, char *prefix)\n"
501 "{\n"
502 " int s;\n"
503 " pthread_attr_t attr;\n"
504 "\\&\n"
505 " s = pthread_getattr_np(thread, &attr);\n"
506 " if (s != 0)\n"
507 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
508 "\\&\n"
509 " display_stack_related_attributes(&attr, prefix);\n"
510 "\\&\n"
511 " s = pthread_attr_destroy(&attr);\n"
512 " if (s != 0)\n"
513 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
514 "}\n"
515 "\\&\n"
516 "static void * /* Start function for thread we create */\n"
517 "thread_start(void *arg)\n"
518 "{\n"
519 " printf(\"Attributes of created thread:\\[rs]n\");\n"
520 " display_thread_attributes(pthread_self(), \"\\[rs]t\");\n"
521 "\\&\n"
522 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
523 "}\n"
524 "\\&\n"
525 "static void\n"
526 "usage(char *pname, char *msg)\n"
527 "{\n"
528 " if (msg != NULL)\n"
529 " fputs(msg, stderr);\n"
530 " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
531 " \" [-g guard-size]\\[rs]n\", pname);\n"
532 " fprintf(stderr, \"\\[rs]t\\[rs]t-a means program should allocate stack\\[rs]n\");\n"
533 " exit(EXIT_FAILURE);\n"
534 "}\n"
535 "\\&\n"
536 "static pthread_attr_t * /* Get thread attributes from command line */\n"
537 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
538 " pthread_attr_t *attrp)\n"
539 "{\n"
540 " int s, opt, allocate_stack;\n"
541 " size_t stack_size, guard_size;\n"
542 " void *stack_addr;\n"
543 " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n"
544 " a thread attributes object */\n"
545 " allocate_stack = 0;\n"
546 " stack_size = -1;\n"
547 " guard_size = -1;\n"
548 "\\&\n"
549 " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
550 " switch (opt) {\n"
551 " case \\[aq]a\\[aq]: allocate_stack = 1; break;\n"
552 " case \\[aq]g\\[aq]: guard_size = strtoul(optarg, NULL, 0); break;\n"
553 " case \\[aq]s\\[aq]: stack_size = strtoul(optarg, NULL, 0); break;\n"
554 " default: usage(argv[0], NULL);\n"
555 " }\n"
556 " }\n"
557 "\\&\n"
558 " if (allocate_stack && stack_size == -1)\n"
559 " usage(argv[0], \"Specifying -a without -s makes no sense\\[rs]n\");\n"
560 "\\&\n"
561 " if (argc E<gt> optind)\n"
562 " usage(argv[0], \"Extraneous command-line arguments\\[rs]n\");\n"
563 "\\&\n"
564 " if (stack_size != -1 || guard_size E<gt> 0) {\n"
565 " ret_attrp = attrp;\n"
566 "\\&\n"
567 " s = pthread_attr_init(attrp);\n"
568 " if (s != 0)\n"
569 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
570 " }\n"
571 "\\&\n"
572 " if (stack_size != -1) {\n"
573 " if (!allocate_stack) {\n"
574 " s = pthread_attr_setstacksize(attrp, stack_size);\n"
575 " if (s != 0)\n"
576 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
577 " } else {\n"
578 " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
579 " stack_size);\n"
580 " if (s != 0)\n"
581 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
582 " printf(\"Allocated thread stack at %p\\[rs]n\\[rs]n\", stack_addr);\n"
583 "\\&\n"
584 " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
585 " if (s != 0)\n"
586 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
587 " }\n"
588 " }\n"
589 "\\&\n"
590 " if (guard_size != -1) {\n"
591 " s = pthread_attr_setguardsize(attrp, guard_size);\n"
592 " if (s != 0)\n"
593 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
594 " }\n"
595 "\\&\n"
596 " return ret_attrp;\n"
597 "}\n"
598 "\\&\n"
599 "int\n"
600 "main(int argc, char *argv[])\n"
601 "{\n"
602 " int s;\n"
603 " pthread_t thr;\n"
604 " pthread_attr_t attr;\n"
605 " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n"
606 " a thread attributes object */\n"
607 "\\&\n"
608 " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
609 "\\&\n"
610 " if (attrp != NULL) {\n"
611 " printf(\"Thread attributes object after initializations:\\[rs]n\");\n"
612 " display_stack_related_attributes(attrp, \"\\[rs]t\");\n"
613 " printf(\"\\[rs]n\");\n"
614 " }\n"
615 "\\&\n"
616 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
617 " if (s != 0)\n"
618 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
619 "\\&\n"
620 " if (attrp != NULL) {\n"
621 " s = pthread_attr_destroy(attrp);\n"
622 " if (s != 0)\n"
623 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
624 " }\n"
625 "\\&\n"
626 " pause(); /* Terminates when other thread calls exit() */\n"
627 "}\n"
628 msgstr ""
629 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
630 "#include E<lt>err.hE<gt>\n"
631 "#include E<lt>errno.hE<gt>\n"
632 "#include E<lt>pthread.hE<gt>\n"
633 "#include E<lt>stdio.hE<gt>\n"
634 "#include E<lt>stdlib.hE<gt>\n"
635 "#include E<lt>unistd.hE<gt>\n"
636 "\\&\n"
637 "static void\n"
638 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
639 "{\n"
640 " int s;\n"
641 " size_t stack_size, guard_size;\n"
642 " void *stack_addr;\n"
643 "\\&\n"
644 " s = pthread_attr_getguardsize(attr, &guard_size);\n"
645 " if (s != 0)\n"
646 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
647 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, guard_size);\n"
648 "\\&\n"
649 " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
650 " if (s != 0)\n"
651 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
652 " printf(\"%sStack address = %p\", prefix, stack_addr);\n"
653 " if (stack_size E<gt> 0)\n"
654 " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
655 " printf(\"\\[rs]n\");\n"
656 " printf(\"%sStack size = %#zx (%zu) bytes\\[rs]n\",\n"
657 " prefix, stack_size, stack_size);\n"
658 "}\n"
659 "\\&\n"
660 "static void\n"
661 "display_thread_attributes(pthread_t thread, char *prefix)\n"
662 "{\n"
663 " int s;\n"
664 " pthread_attr_t attr;\n"
665 "\\&\n"
666 " s = pthread_getattr_np(thread, &attr);\n"
667 " if (s != 0)\n"
668 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
669 "\\&\n"
670 " display_stack_related_attributes(&attr, prefix);\n"
671 "\\&\n"
672 " s = pthread_attr_destroy(&attr);\n"
673 " if (s != 0)\n"
674 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
675 "}\n"
676 "\\&\n"
677 "static void * /* Start function for thread we create */\n"
678 "thread_start(void *arg)\n"
679 "{\n"
680 " printf(\"Attributes of created thread:\\[rs]n\");\n"
681 " display_thread_attributes(pthread_self(), \"\\[rs]t\");\n"
682 "\\&\n"
683 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
684 "}\n"
685 "\\&\n"
686 "static void\n"
687 "usage(char *pname, char *msg)\n"
688 "{\n"
689 " if (msg != NULL)\n"
690 " fputs(msg, stderr);\n"
691 " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
692 " \" [-g guard-size]\\[rs]n\", pname);\n"
693 " fprintf(stderr, \"\\[rs]t\\[rs]t-a means program should allocate stack\\[rs]n\");\n"
694 " exit(EXIT_FAILURE);\n"
695 "}\n"
696 "\\&\n"
697 "static pthread_attr_t * /* Get thread attributes from command line */\n"
698 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
699 " pthread_attr_t *attrp)\n"
700 "{\n"
701 " int s, opt, allocate_stack;\n"
702 " size_t stack_size, guard_size;\n"
703 " void *stack_addr;\n"
704 " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n"
705 " a thread attributes object */\n"
706 " allocate_stack = 0;\n"
707 " stack_size = -1;\n"
708 " guard_size = -1;\n"
709 "\\&\n"
710 " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
711 " switch (opt) {\n"
712 " case \\[aq]a\\[aq]: allocate_stack = 1; break;\n"
713 " case \\[aq]g\\[aq]: guard_size = strtoul(optarg, NULL, 0); break;\n"
714 " case \\[aq]s\\[aq]: stack_size = strtoul(optarg, NULL, 0); break;\n"
715 " default: usage(argv[0], NULL);\n"
716 " }\n"
717 " }\n"
718 "\\&\n"
719 " if (allocate_stack && stack_size == -1)\n"
720 " usage(argv[0], \"Specifying -a without -s makes no sense\\[rs]n\");\n"
721 "\\&\n"
722 " if (argc E<gt> optind)\n"
723 " usage(argv[0], \"Extraneous command-line arguments\\[rs]n\");\n"
724 "\\&\n"
725 " if (stack_size != -1 || guard_size E<gt> 0) {\n"
726 " ret_attrp = attrp;\n"
727 "\\&\n"
728 " s = pthread_attr_init(attrp);\n"
729 " if (s != 0)\n"
730 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
731 " }\n"
732 "\\&\n"
733 " if (stack_size != -1) {\n"
734 " if (!allocate_stack) {\n"
735 " s = pthread_attr_setstacksize(attrp, stack_size);\n"
736 " if (s != 0)\n"
737 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
738 " } else {\n"
739 " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
740 " stack_size);\n"
741 " if (s != 0)\n"
742 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
743 " printf(\"Allocated thread stack at %p\\[rs]n\\[rs]n\", stack_addr);\n"
744 "\\&\n"
745 " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
746 " if (s != 0)\n"
747 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
748 " }\n"
749 " }\n"
750 "\\&\n"
751 " if (guard_size != -1) {\n"
752 " s = pthread_attr_setguardsize(attrp, guard_size);\n"
753 " if (s != 0)\n"
754 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
755 " }\n"
756 "\\&\n"
757 " return ret_attrp;\n"
758 "}\n"
759 "\\&\n"
760 "int\n"
761 "main(int argc, char *argv[])\n"
762 "{\n"
763 " int s;\n"
764 " pthread_t thr;\n"
765 " pthread_attr_t attr;\n"
766 " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n"
767 " a thread attributes object */\n"
768 "\\&\n"
769 " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
770 "\\&\n"
771 " if (attrp != NULL) {\n"
772 " printf(\"Thread attributes object after initializations:\\[rs]n\");\n"
773 " display_stack_related_attributes(attrp, \"\\[rs]t\");\n"
774 " printf(\"\\[rs]n\");\n"
775 " }\n"
776 "\\&\n"
777 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
778 " if (s != 0)\n"
779 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
780 "\\&\n"
781 " if (attrp != NULL) {\n"
782 " s = pthread_attr_destroy(attrp);\n"
783 " if (s != 0)\n"
784 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
785 " }\n"
786 "\\&\n"
787 " pause(); /* Terminates when other thread calls exit() */\n"
788 "}\n"
789
790 #. SRC END
791 #. type: SH
792 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
793 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
794 #, no-wrap
795 msgid "SEE ALSO"
796 msgstr "انظر أيضًا"
797
798 #. type: Plain text
799 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
800 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
801 msgid ""
802 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
803 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
804 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
805 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
806 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
807 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
808 msgstr ""
809 "B<pthread_attr_getaffinity_np>(3)، B<pthread_attr_getdetachstate>(3)، "
810 "B<pthread_attr_getguardsize>(3)، B<pthread_attr_getinheritsched>(3)، "
811 "B<pthread_attr_getschedparam>(3)، B<pthread_attr_getschedpolicy>(3)، "
812 "B<pthread_attr_getscope>(3)، B<pthread_attr_getstack>(3)، "
813 "B<pthread_attr_getstackaddr>(3)، B<pthread_attr_getstacksize>(3)، "
814 "B<pthread_attr_init>(3)، B<pthread_create>(3)، B<pthreads>(7)"
815
816 #. type: TH
817 #: debian-trixie
818 #, no-wrap
819 msgid "2024-06-15"
820 msgstr "15 يونيو 2024"
821
822 #. type: TH
823 #: debian-trixie
824 #, no-wrap
825 msgid "Linux man-pages 6.9.1"
826 msgstr "صفحات دليل لينكس 6.9.1"
827
828 #. type: Plain text
829 #: debian-trixie
830 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
831 msgstr "مكتبة مسالك POSIX (I<libpthread>، I<-lpthread>)"
832
833 #. type: TH
834 #: fedora-44 fedora-rawhide
835 #, no-wrap
836 msgid "2024-07-23"
837 msgstr "23 يوليو 2024"
838
839 #. type: TH
840 #: fedora-44 fedora-rawhide
841 #, no-wrap
842 msgid "Linux man-pages 6.13"
843 msgstr "صفحات دليل لينكس 6.13"
844
845 #. type: TH
846 #: mageia-cauldron
847 #, no-wrap
848 msgid "Linux man-pages 6.17"
849 msgstr "صفحات دليل لينكس 6.17"
850
851 #. type: TH
852 #: opensuse-leap-16-1 opensuse-tumbleweed
853 #, no-wrap
854 msgid "Linux man-pages (unreleased)"
855 msgstr "صفحات دليل لينكس (لم تصدر بعد)"