Debian Codegraph @

po/ar/man3/pthread_setschedparam.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
6 msgid ""
7 msgstr ""
8 "Project-Id-Version: manpages-l10n 4.30.2\n"
9 "POT-Creation-Date: 2026-06-05 06:38+0200\n"
10 "PO-Revision-Date: 2026-06-06 08:55+0400\n"
11 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
12 "Language-Team: Arabic <[email protected]>\n"
13 "Language: ar\n"
14 "MIME-Version: 1.0\n"
15 "Content-Type: text/plain; charset=UTF-8\n"
16 "Content-Transfer-Encoding: 8bit\n"
17 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&"
18 " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
19 "X-Generator: Lokalize 23.08.5\n"
20
21 #. type: TH
22 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
23 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
24 #, no-wrap
25 msgid "pthread_setschedparam"
26 msgstr "pthread_setschedparam"
27
28 #. type: TH
29 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
30 #: opensuse-tumbleweed
31 #, no-wrap
32 msgid "2025-09-21"
33 msgstr "21 سبتمبر 2025"
34
35 #. type: TH
36 #: archlinux debian-unstable
37 #, no-wrap
38 msgid "Linux man-pages 6.18"
39 msgstr "صفحات دليل لينكس 6.18"
40
41 #. type: SH
42 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
43 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
44 #, no-wrap
45 msgid "NAME"
46 msgstr "الاسم"
47
48 #. type: Plain text
49 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
50 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
51 msgid ""
52 "pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and "
53 "parameters of a thread"
54 msgstr ""
55 "pthread_setschedparam, pthread_getschedparam - ضبط/الحصول على سياسة الجدولة "
56 "ومعاملات خيط"
57
58 #. type: SH
59 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
60 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
61 #, no-wrap
62 msgid "LIBRARY"
63 msgstr "المكتبة"
64
65 #. type: Plain text
66 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
67 #: opensuse-leap-16-1 opensuse-tumbleweed
68 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
69 msgstr "مكتبة مسالك POSIX (I<libpthread>،\\ I<-lpthread>)"
70
71 #. type: SH
72 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
73 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
74 #, no-wrap
75 msgid "SYNOPSIS"
76 msgstr "موجز"
77
78 #. type: Plain text
79 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
80 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
81 #, no-wrap
82 msgid "B<#include E<lt>pthread.hE<gt>>\n"
83 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
84
85 #. type: Plain text
86 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
87 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
88 #, no-wrap
89 msgid ""
90 "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
91 "B< const struct sched_param *>I<param>B<);>\n"
92 "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *restrict >I<policy"
93 ">B<,>\n"
94 "B< struct sched_param *restrict >I<param>B<);>\n"
95 msgstr ""
96 "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
97 "B< const struct sched_param *>I<param>B<);>\n"
98 "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *restrict >I<policy"
99 ">B<,>\n"
100 "B< struct sched_param *restrict >I<param>B<);>\n"
101
102 #. type: SH
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 #, no-wrap
106 msgid "DESCRIPTION"
107 msgstr "الوصف"
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 B<pthread_setschedparam>() function sets the scheduling policy and "
114 "parameters of the thread I<thread>."
115 msgstr ""
116 "تضبط الدالة B<pthread_setschedparam>() سياسة الجدولة ومعاملات الخيط "
117 "I<thread>."
118
119 #. FIXME . pthread_setschedparam() places no restriction on the policy,
120 #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
121 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013
122 #. type: Plain text
123 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
124 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
125 msgid ""
126 "I<policy> specifies the new scheduling policy for I<thread>. The supported "
127 "values for I<policy>, and their semantics, are described in B<sched>(7)."
128 msgstr ""
129 "يحدد I<policy> سياسة الجدولة الجديدة لـ I<thread>. القيم المدعومة لـ "
130 "I<policy> ودلالاتها موصوفة في B<sched>(7)."
131
132 #. type: Plain text
133 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
134 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
135 msgid ""
136 "The structure pointed to by I<param> specifies the new scheduling parameters "
137 "for I<thread>. Scheduling parameters are maintained in the following "
138 "structure:"
139 msgstr ""
140 "تحدد البنية المشار إليها بـ I<param> معاملات الجدولة الجديدة لـ I<thread>. "
141 "تُحتفظ معاملات الجدولة في البنية التالية:"
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 #, no-wrap
147 msgid ""
148 "struct sched_param {\n"
149 " int sched_priority; /* Scheduling priority */\n"
150 "};\n"
151 msgstr ""
152 "struct sched_param {\n"
153 " int sched_priority; /* أولوية الجدولة */\n"
154 "};\n"
155
156 #. type: Plain text
157 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
158 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
159 msgid ""
160 "As can be seen, only one scheduling parameter is supported. For details of "
161 "the permitted ranges for scheduling priorities in each scheduling policy, "
162 "see B<sched>(7)."
163 msgstr ""
164 "كما هو موضح، يُدعم معامل جدولة واحد فقط. لتفاصيل النطاقات المسموح بها "
165 "لأولويات الجدولة في كل سياسة جدولة، انظر B<sched>(7)."
166
167 #. #-#-#-#-# archlinux: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
168 #. FIXME . nptl/pthread_setschedparam.c has the following
169 #. /* If the thread should have higher priority because of some
170 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
171 #. Eventually (perhaps after writing the mutexattr pages), we
172 #. may want to add something on the topic to this page.
173 #. type: Plain text
174 #. #-#-#-#-# debian-trixie: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
175 #. FIXME . nptl/pthread_setschedparam.c has the following
176 #. /* If the thread should have higher priority because of some
177 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
178 #. Eventually (perhaps after writing the mutexattr pages), we
179 #. may want to add something on the topic to this page.
180 #. type: Plain text
181 #. #-#-#-#-# debian-unstable: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
182 #. FIXME . nptl/pthread_setschedparam.c has the following
183 #. /* If the thread should have higher priority because of some
184 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
185 #. Eventually (perhaps after writing the mutexattr pages), we
186 #. may want to add something on the topic to this page.
187 #. type: Plain text
188 #. #-#-#-#-# fedora-44: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
189 #. FIXME . nptl/pthread_setschedparam.c has the following
190 #. /* If the thread should have higher priority because of some
191 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
192 #. Eventually (perhaps after writing the mutexattr pages), we
193 #. may want to add something on the topic to this page.
194 #. type: Plain text
195 #. #-#-#-#-# fedora-rawhide: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
196 #. FIXME . nptl/pthread_setschedparam.c has the following
197 #. /* If the thread should have higher priority because of some
198 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
199 #. Eventually (perhaps after writing the mutexattr pages), we
200 #. may want to add something on the topic to this page.
201 #. type: Plain text
202 #. #-#-#-#-# mageia-cauldron: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
203 #. FIXME . nptl/pthread_setschedparam.c has the following
204 #. /* If the thread should have higher priority because of some
205 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
206 #. Eventually (perhaps after writing the mutexattr pages), we
207 #. may want to add something on the topic to this page.
208 #. type: Plain text
209 #. #-#-#-#-# opensuse-leap-16-1: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
210 #. FIXME . nptl/pthread_setschedparam.c has the following
211 #. /* If the thread should have higher priority because of some
212 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
213 #. Eventually (perhaps after writing the mutexattr pages), we
214 #. may want to add something on the topic to this page.
215 #. type: Plain text
216 #. #-#-#-#-# opensuse-tumbleweed: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
217 #. FIXME . nptl/pthread_setschedparam.c has the following
218 #. /* If the thread should have higher priority because of some
219 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
220 #. Eventually (perhaps after writing the mutexattr pages), we
221 #. may want to add something on the topic to this page.
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 "The B<pthread_getschedparam>() function returns the scheduling policy and "
227 "parameters of the thread I<thread>, in the buffers pointed to by I<policy> "
228 "and I<param>, respectively. The returned priority value is that set by the "
229 "most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or "
230 "B<pthread_create>(3) call that affected I<thread>. The returned priority "
231 "does not reflect any temporary priority adjustments as a result of calls to "
232 "any priority inheritance or priority ceiling functions (see, for example, "
233 "B<pthread_mutexattr_setprioceiling>(3) and "
234 "B<pthread_mutexattr_setprotocol>(3))."
235 msgstr ""
236 "تُرجع الدالة B<pthread_getschedparam>() سياسة الجدولة ومعاملات الخيط "
237 "I<thread>، في المخازن المؤقتة المشار إليها بـ I<policy> و I<param>، على "
238 "التوالي. قيمة الأولوية المُرجعة هي تلك التي ضُبطت بواسطة أحدث استدعاء لـ "
239 "B<pthread_setschedparam>() أو B<pthread_setschedprio>(3) أو "
240 "B<pthread_create>(3) الذي أثر على I<thread>. لا تعكس الأولوية المُرجعة أي "
241 "تعديلات مؤقتة في الأولوية نتيجة استدعاءات لدوال وراثة الأولوية أو سقف "
242 "الأولوية (انظر، على سبيل المثال، B<pthread_mutexattr_setprioceiling>(3) و "
243 "B<pthread_mutexattr_setprotocol>(3))."
244
245 #. type: SH
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 #, no-wrap
249 msgid "RETURN VALUE"
250 msgstr "قيمة الإرجاع"
251
252 #. type: Plain text
253 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
254 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
255 msgid ""
256 "On success, these functions return 0; on error, they return a nonzero error "
257 "number. If B<pthread_setschedparam>() fails, the scheduling policy and "
258 "parameters of I<thread> are not changed."
259 msgstr ""
260 "عند النجاح، تُرجع هاتان الدالتان 0؛ عند الخطأ، تُرجعان رقم خطأ غير صفري. إذا "
261 "فشلت B<pthread_setschedparam>()، لا تُغير سياسة الجدولة ومعاملات I<thread>."
262
263 #. type: SH
264 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
265 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
266 #, no-wrap
267 msgid "ERRORS"
268 msgstr "الأخطاء"
269
270 #. type: Plain text
271 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
272 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
273 msgid "Both of these functions can fail with the following error:"
274 msgstr "يمكن أن تفشل كلتا الدالتين مع الخطأ التالي:"
275
276 #. type: TP
277 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
278 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
279 #, no-wrap
280 msgid "B<ESRCH>"
281 msgstr "B<ESRCH>"
282
283 #. type: Plain text
284 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
285 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
286 msgid "No thread with the ID I<thread> could be found."
287 msgstr "تعذر العثور على أي خيط بالمعرف I<thread>."
288
289 #. type: Plain text
290 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
291 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
292 msgid ""
293 "B<pthread_setschedparam>() may additionally fail with the following errors:"
294 msgstr ""
295 "قد تفشل B<pthread_setschedparam>() بالإضافة إلى ذلك مع الأخطاء التالية:"
296
297 #. type: TP
298 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
299 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
300 #, no-wrap
301 msgid "B<EINVAL>"
302 msgstr "B<EINVAL>"
303
304 #. type: Plain text
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 msgid ""
308 "I<policy> is not a recognized policy, or I<param> does not make sense for "
309 "the I<policy>."
310 msgstr ""
311 "I<policy> ليست سياسة معروفة، أو I<param> غير منطقي بالنسبة لـ I<policy>."
312
313 #. type: TP
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 #, no-wrap
317 msgid "B<EPERM>"
318 msgstr "B<EPERM>"
319
320 #. type: Plain text
321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
323 msgid ""
324 "The caller does not have appropriate privileges to set the specified "
325 "scheduling policy and parameters."
326 msgstr ""
327 "لا يمتلك المستدعي الصلاحيات المناسبة لضبط سياسة الجدولة والمعاملات المحددة."
328
329 #. type: Plain text
330 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
331 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
332 msgid ""
333 "POSIX.1 also documents an B<ENOTSUP> (\"attempt was made to set the policy "
334 "or scheduling parameters to an unsupported value\") error for "
335 "B<pthread_setschedparam>()."
336 msgstr ""
337 "يُوثق POSIX.1 أيضًا خطأ B<ENOTSUP> (\"جرت محاولة لضبط السياسة أو معاملات "
338 "الجدولة إلى قيمة غير مدعومة\") لـ B<pthread_setschedparam>()."
339
340 #. type: SH
341 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
342 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
343 #, no-wrap
344 msgid "ATTRIBUTES"
345 msgstr "السمات"
346
347 #. type: Plain text
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 msgid ""
351 "For an explanation of the terms used in this section, see B<attributes>(7)."
352 msgstr ""
353 "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B<attributes>(7)."
354
355 #. type: tbl table
356 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
357 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
358 #, no-wrap
359 msgid "Interface"
360 msgstr "الواجهة"
361
362 #. type: tbl table
363 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
364 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
365 #, no-wrap
366 msgid "Attribute"
367 msgstr "السمة"
368
369 #. type: tbl table
370 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
371 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
372 #, no-wrap
373 msgid "Value"
374 msgstr "القيمة"
375
376 #. type: tbl table
377 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
378 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
379 #, no-wrap
380 msgid ".na\n"
381 msgstr ".na\n"
382
383 #. type: tbl table
384 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
385 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
386 #, no-wrap
387 msgid ".nh\n"
388 msgstr ".nh\n"
389
390 #. type: tbl table
391 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
392 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
393 #, no-wrap
394 msgid ""
395 "B<pthread_setschedparam>(),\n"
396 "B<pthread_getschedparam>()"
397 msgstr ""
398 "B<pthread_setschedparam>(),\n"
399 "B<pthread_getschedparam>()"
400
401 #. type: tbl table
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 #, no-wrap
405 msgid "Thread safety"
406 msgstr "سلامة الخيوط"
407
408 #. type: tbl table
409 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
410 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
411 #, no-wrap
412 msgid "MT-Safe"
413 msgstr "MT-Safe"
414
415 #. type: SH
416 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
417 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
418 #, no-wrap
419 msgid "STANDARDS"
420 msgstr "المعايير"
421
422 #. type: Plain text
423 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
424 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
425 msgid "POSIX.1-2008."
426 msgstr "POSIX.1-2008."
427
428 #. type: SH
429 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
430 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
431 #, no-wrap
432 msgid "HISTORY"
433 msgstr "التاريخ"
434
435 #. type: Plain text
436 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
437 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
438 msgid "glibc 2.0 POSIX.1-2001."
439 msgstr "glibc 2.0 POSIX.1-2001."
440
441 #. type: SH
442 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
443 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
444 #, no-wrap
445 msgid "NOTES"
446 msgstr "ملاحظات"
447
448 #. type: Plain text
449 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
450 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
451 msgid ""
452 "For a description of the permissions required to, and the effect of, "
453 "changing a thread's scheduling policy and priority, and details of the "
454 "permitted ranges for priorities in each scheduling policy, see B<sched>(7)."
455 msgstr ""
456 "للحصول على وصف للصلاحيات المطلوبة لتغيير سياسة جدولة خيط وأولويته، وتأثير "
457 "ذلك، وتفاصيل النطاقات المسموح بها للأولويات في كل سياسة جدولة، انظر "
458 "B<sched>(7)."
459
460 #. type: SH
461 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
462 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
463 #, no-wrap
464 msgid "EXAMPLES"
465 msgstr "أمثلة"
466
467 #. type: Plain text
468 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
469 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
470 msgid ""
471 "The program below demonstrates the use of B<pthread_setschedparam>() and "
472 "B<pthread_getschedparam>(), as well as the use of a number of other "
473 "scheduling-related pthreads functions."
474 msgstr ""
475 "يوضح البرنامج أدناه استخدام B<pthread_setschedparam>() و "
476 "B<pthread_getschedparam>()، بالإضافة إلى استخدام عدد من دوال pthreads الأخرى "
477 "المتعلقة بالجدولة."
478
479 #. type: Plain text
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 msgid ""
483 "In the following run, the main thread sets its scheduling policy to "
484 "B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes "
485 "object with a scheduling policy attribute of B<SCHED_RR> and a scheduling "
486 "priority attribute of 20. The program then sets (using "
487 "B<pthread_attr_setinheritsched>(3)) the inherit scheduler attribute of the "
488 "thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, meaning that threads "
489 "created using this attributes object should take their scheduling attributes "
490 "from the thread attributes object. The program then creates a thread using "
491 "the thread attributes object, and that thread displays its scheduling policy "
492 "and priority."
493 msgstr ""
494 "في التشغيل التالي، يضبط الخيط الرئيسي سياسة الجدولة الخاصة به إلى "
495 "B<SCHED_FIFO> بأولوية 10، ويُهيئ كائن سمات خيط بسمة سياسة جدولة B<SCHED_RR> "
496 "وسمة أولوية جدولة 20. ثم يضبط البرنامج (باستخدام "
497 "B<pthread_attr_setinheritsched>(3)) سمة وراثة الجدولة لكائن سمات الخيط إلى "
498 "B<PTHREAD_EXPLICIT_SCHED>، مما يعني أن الخيوط المُنشأة باستخدام كائن السمات "
499 "هذا يجب أن تأخذ سمات الجدولة الخاصة بها من كائن سمات الخيط. ثم ينشئ "
500 "البرنامج خيطًا باستخدام كائن سمات الخيط، ويعرض ذلك الخيط سياسة الجدولة "
501 "والأولوية الخاصة به."
502
503 #. type: Plain text
504 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
505 #: opensuse-tumbleweed
506 #, no-wrap
507 msgid ""
508 "$B< su>; # Need privilege to set real-time scheduling policies\n"
509 "Password:\n"
510 "#B< ./a.out -mf10 -ar20 -i e>;\n"
511 "Scheduler settings of main thread\n"
512 " policy=SCHED_FIFO, priority=10\n"
513 "\\&\n"
514 "Scheduler settings in \\[aq]attr\\[aq]\n"
515 " policy=SCHED_RR, priority=20\n"
516 " inheritsched is EXPLICIT\n"
517 "\\&\n"
518 "Scheduler attributes of new thread\n"
519 " policy=SCHED_RR, priority=20\n"
520 msgstr ""
521 "$B< su>; # Need privilege to set real-time scheduling policies\n"
522 "Password:\n"
523 "#B< ./a.out -mf10 -ar20 -i e>;\n"
524 "Scheduler settings of main thread\n"
525 " policy=SCHED_FIFO, priority=10\n"
526 "\\&\n"
527 "Scheduler settings in \\[aq]attr\\[aq]\n"
528 " policy=SCHED_RR, priority=20\n"
529 " inheritsched is EXPLICIT\n"
530 "\\&\n"
531 "Scheduler attributes of new thread\n"
532 " policy=SCHED_RR, priority=20\n"
533
534 #. type: Plain text
535 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
536 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
537 msgid ""
538 "In the above output, one can see that the scheduling policy and priority "
539 "were taken from the values specified in the thread attributes object."
540 msgstr ""
541 "في المخرجات أعلاه، يمكن رؤية أن سياسة الجدولة والأولوية أُخذت من القيم "
542 "المحددة في كائن سمات الخيط."
543
544 #. type: Plain text
545 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
546 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
547 msgid ""
548 "The next run is the same as the previous, except that the inherit scheduler "
549 "attribute is set to B<PTHREAD_INHERIT_SCHED>, meaning that threads created "
550 "using the thread attributes object should ignore the scheduling attributes "
551 "specified in the attributes object and instead take their scheduling "
552 "attributes from the creating thread."
553 msgstr ""
554 "التشغيل التالي هو نفسه السابق، باستثناء أن سمة وراثة الجدولة ضُبطت إلى "
555 "B<PTHREAD_INHERIT_SCHED>، مما يعني أن الخيوط المُنشأة باستخدام كائن سمات "
556 "الخيط يجب أن تتجاهل سمات الجدولة المحددة في كائن السمات وتأخذ بدلاً من ذلك "
557 "سمات الجدولة الخاصة بها من الخيط المُنشئ."
558
559 #. type: Plain text
560 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
561 #: opensuse-tumbleweed
562 #, no-wrap
563 msgid ""
564 "#B< ./a.out -mf10 -ar20 -i i>;\n"
565 "Scheduler settings of main thread\n"
566 " policy=SCHED_FIFO, priority=10\n"
567 "\\&\n"
568 "Scheduler settings in \\[aq]attr\\[aq]\n"
569 " policy=SCHED_RR, priority=20\n"
570 " inheritsched is INHERIT\n"
571 "\\&\n"
572 "Scheduler attributes of new thread\n"
573 " policy=SCHED_FIFO, priority=10\n"
574 msgstr ""
575 "#B< ./a.out -mf10 -ar20 -i i>;\n"
576 "Scheduler settings of main thread\n"
577 " policy=SCHED_FIFO, priority=10\n"
578 "\\&\n"
579 "Scheduler settings in \\[aq]attr\\[aq]\n"
580 " policy=SCHED_RR, priority=20\n"
581 " inheritsched is INHERIT\n"
582 "\\&\n"
583 "Scheduler attributes of new thread\n"
584 " policy=SCHED_FIFO, priority=10\n"
585
586 #. type: Plain text
587 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
588 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
589 msgid ""
590 "In the above output, one can see that the scheduling policy and priority "
591 "were taken from the creating thread, rather than the thread attributes "
592 "object."
593 msgstr ""
594 "في المخرجات أعلاه، يمكن رؤية أن سياسة الجدولة والأولوية أُخذت من الخيط "
595 "المنشئ، وليس من كائن سمات الخيط."
596
597 #. type: Plain text
598 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
599 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
600 #| msgid ""
601 #| "Note that if we had omitted the I<-i\\~i> option, the output would have "
602 #| "been the same, since B<PTHREAD_INHERIT_SCHED> is the default for the "
603 #| "inherit scheduler attribute."
604 msgid ""
605 "Note that if we had omitted the I<-i\\ i> option, the output would have been "
606 "the same, since B<PTHREAD_INHERIT_SCHED> is the default for the inherit "
607 "scheduler attribute."
608 msgstr ""
609 "لاحظ أنه لو حذفنا الخيار I<-i\\ i>، لكان المخرج نفسه، لأن "
610 "B<PTHREAD_INHERIT_SCHED> هو المبدئي لسمة الجدولة الموروثة."
611
612 #. type: SS
613 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
614 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
615 #, no-wrap
616 msgid "Program source"
617 msgstr "مصدر البرنامج"
618
619 #. type: Plain text
620 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
621 #: opensuse-tumbleweed
622 #, no-wrap
623 msgid ""
624 "/* pthreads_sched_test.c */\n"
625 "\\&\n"
626 "#include E<lt>err.hE<gt>\n"
627 "#include E<lt>errno.hE<gt>\n"
628 "#include E<lt>pthread.hE<gt>\n"
629 "#include E<lt>stdio.hE<gt>\n"
630 "#include E<lt>stdlib.hE<gt>\n"
631 "#include E<lt>unistd.hE<gt>\n"
632 "\\&\n"
633 "[[noreturn]]\n"
634 "static void\n"
635 "usage(char *prog_name, char *msg)\n"
636 "{\n"
637 " if (msg != NULL)\n"
638 " fputs(msg, stderr);\n"
639 "\\&\n"
640 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
641 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
642 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
643 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
644 " in\\[rs]n\");\n"
645 " fpe(\" thread attributes object\\[rs]n\");\n"
646 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
647 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
648 " fpe(\" r SCHED_RR\\[rs]n\");\n"
649 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
650 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
651 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
652 " fpe(\" \\[aq]explicit\\[aq] or"
653 " \\[aq]inherit\\[aq]\\[rs]n\");\n"
654 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
655 " on\\[rs]n\");\n"
656 " fpe(\" main thread before pthread_create()"
657 " call\\[rs]n\");\n"
658 " exit(EXIT_FAILURE);\n"
659 "}\n"
660 "\\&\n"
661 "static int\n"
662 "get_policy(char p, int *policy)\n"
663 "{\n"
664 " switch (p) {\n"
665 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
666 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
667 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
668 " default: return 0;\n"
669 " }\n"
670 "}\n"
671 "\\&\n"
672 "static void\n"
673 "display_sched_attr(int policy, const struct sched_param *param)\n"
674 "{\n"
675 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
676 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
677 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
678 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
679 " \"???\",\n"
680 " param-E<gt>sched_priority);\n"
681 "}\n"
682 "\\&\n"
683 "static void\n"
684 "display_thread_sched_attr(char *msg)\n"
685 "{\n"
686 " int policy, s;\n"
687 " struct sched_param param;\n"
688 "\\&\n"
689 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
690 " if (s != 0)\n"
691 " errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n"
692 "\\&\n"
693 " printf(\"%s\\[rs]n\", msg);\n"
694 " display_sched_attr(policy, &param);\n"
695 "}\n"
696 "\\&\n"
697 "static void *\n"
698 "thread_start(void *arg)\n"
699 "{\n"
700 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
701 "\\&\n"
702 " return NULL;\n"
703 "}\n"
704 "\\&\n"
705 "int\n"
706 "main(int argc, char *argv[])\n"
707 "{\n"
708 " int s, opt, inheritsched, use_null_attrib, policy;\n"
709 " pthread_t thread;\n"
710 " pthread_attr_t attr;\n"
711 " pthread_attr_t *attrp;\n"
712 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
713 " struct sched_param param;\n"
714 "\\&\n"
715 " /* Process command-line options. */\n"
716 "\\&\n"
717 " use_null_attrib = 0;\n"
718 " attr_sched_str = NULL;\n"
719 " main_sched_str = NULL;\n"
720 " inheritsched_str = NULL;\n"
721 "\\&\n"
722 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
723 " switch (opt) {\n"
724 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
725 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
726 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
727 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
728 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
729 " }\n"
730 " }\n"
731 "\\&\n"
732 " if (use_null_attrib\n"
733 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
734 " {\n"
735 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
736 " }\n"
737 "\\&\n"
738 " /* Optionally set scheduling attributes of main thread,\n"
739 " and display the attributes. */\n"
740 "\\&\n"
741 " if (main_sched_str != NULL) {\n"
742 " if (!get_policy(main_sched_str[0], &policy))\n"
743 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
744 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
745 "\\&\n"
746 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
747 " if (s != 0)\n"
748 " errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n"
749 " }\n"
750 "\\&\n"
751 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
752 " printf(\"\\[rs]n\");\n"
753 "\\&\n"
754 " /* Initialize thread attributes object according to options. */\n"
755 "\\&\n"
756 " attrp = NULL;\n"
757 "\\&\n"
758 " if (!use_null_attrib) {\n"
759 " s = pthread_attr_init(&attr);\n"
760 " if (s != 0)\n"
761 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
762 " attrp = &attr;\n"
763 " }\n"
764 "\\&\n"
765 " if (inheritsched_str != NULL) {\n"
766 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
767 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
768 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
769 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
770 " else\n"
771 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or"
772 " \\[aq]i\\[aq]\\[rs]n\");\n"
773 "\\&\n"
774 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
775 " if (s != 0)\n"
776 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
777 " }\n"
778 "\\&\n"
779 " if (attr_sched_str != NULL) {\n"
780 " if (!get_policy(attr_sched_str[0], &policy))\n"
781 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
782 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
783 "\\&\n"
784 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
785 " if (s != 0)\n"
786 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n"
787 " s = pthread_attr_setschedparam(&attr, &param);\n"
788 " if (s != 0)\n"
789 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n"
790 " }\n"
791 "\\&\n"
792 " /* If we initialized a thread attributes object, display\n"
793 " the scheduling attributes that were set in the object. */\n"
794 "\\&\n"
795 " if (attrp != NULL) {\n"
796 " s = pthread_attr_getschedparam(&attr, &param);\n"
797 " if (s != 0)\n"
798 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
799 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
800 " if (s != 0)\n"
801 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
802 "\\&\n"
803 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
804 " display_sched_attr(policy, &param);\n"
805 "\\&\n"
806 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
807 " printf(\" inheritsched is %s\\[rs]n\",\n"
808 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
809 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
810 " \"???\");\n"
811 " printf(\"\\[rs]n\");\n"
812 " }\n"
813 "\\&\n"
814 " /* Create a thread that will display its scheduling attributes. */\n"
815 "\\&\n"
816 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
817 " if (s != 0)\n"
818 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
819 "\\&\n"
820 " /* Destroy unneeded thread attributes object. */\n"
821 "\\&\n"
822 " if (!use_null_attrib) {\n"
823 " s = pthread_attr_destroy(&attr);\n"
824 " if (s != 0)\n"
825 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
826 " }\n"
827 "\\&\n"
828 " s = pthread_join(thread, NULL);\n"
829 " if (s != 0)\n"
830 " errc(EXIT_FAILURE, s, \"pthread_join\");\n"
831 "\\&\n"
832 " exit(EXIT_SUCCESS);\n"
833 "}\n"
834 msgstr ""
835 "/* pthreads_sched_test.c */\n"
836 "\\&\n"
837 "#include E<lt>err.hE<gt>\n"
838 "#include E<lt>errno.hE<gt>\n"
839 "#include E<lt>pthread.hE<gt>\n"
840 "#include E<lt>stdio.hE<gt>\n"
841 "#include E<lt>stdlib.hE<gt>\n"
842 "#include E<lt>unistd.hE<gt>\n"
843 "\\&\n"
844 "[[noreturn]]\n"
845 "static void\n"
846 "usage(char *prog_name, char *msg)\n"
847 "{\n"
848 " if (msg != NULL)\n"
849 " fputs(msg, stderr);\n"
850 "\\&\n"
851 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
852 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
853 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
854 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
855 " in\\[rs]n\");\n"
856 " fpe(\" thread attributes object\\[rs]n\");\n"
857 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
858 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
859 " fpe(\" r SCHED_RR\\[rs]n\");\n"
860 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
861 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
862 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
863 " fpe(\" \\[aq]explicit\\[aq] or"
864 " \\[aq]inherit\\[aq]\\[rs]n\");\n"
865 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
866 " on\\[rs]n\");\n"
867 " fpe(\" main thread before pthread_create()"
868 " call\\[rs]n\");\n"
869 " exit(EXIT_FAILURE);\n"
870 "}\n"
871 "\\&\n"
872 "static int\n"
873 "get_policy(char p, int *policy)\n"
874 "{\n"
875 " switch (p) {\n"
876 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
877 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
878 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
879 " default: return 0;\n"
880 " }\n"
881 "}\n"
882 "\\&\n"
883 "static void\n"
884 "display_sched_attr(int policy, const struct sched_param *param)\n"
885 "{\n"
886 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
887 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
888 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
889 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
890 " \"???\",\n"
891 " param-E<gt>sched_priority);\n"
892 "}\n"
893 "\\&\n"
894 "static void\n"
895 "display_thread_sched_attr(char *msg)\n"
896 "{\n"
897 " int policy, s;\n"
898 " struct sched_param param;\n"
899 "\\&\n"
900 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
901 " if (s != 0)\n"
902 " errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n"
903 "\\&\n"
904 " printf(\"%s\\[rs]n\", msg);\n"
905 " display_sched_attr(policy, &param);\n"
906 "}\n"
907 "\\&\n"
908 "static void *\n"
909 "thread_start(void *arg)\n"
910 "{\n"
911 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
912 "\\&\n"
913 " return NULL;\n"
914 "}\n"
915 "\\&\n"
916 "int\n"
917 "main(int argc, char *argv[])\n"
918 "{\n"
919 " int s, opt, inheritsched, use_null_attrib, policy;\n"
920 " pthread_t thread;\n"
921 " pthread_attr_t attr;\n"
922 " pthread_attr_t *attrp;\n"
923 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
924 " struct sched_param param;\n"
925 "\\&\n"
926 " /* Process command-line options. */\n"
927 "\\&\n"
928 " use_null_attrib = 0;\n"
929 " attr_sched_str = NULL;\n"
930 " main_sched_str = NULL;\n"
931 " inheritsched_str = NULL;\n"
932 "\\&\n"
933 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
934 " switch (opt) {\n"
935 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
936 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
937 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
938 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
939 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
940 " }\n"
941 " }\n"
942 "\\&\n"
943 " if (use_null_attrib\n"
944 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
945 " {\n"
946 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
947 " }\n"
948 "\\&\n"
949 " /* Optionally set scheduling attributes of main thread,\n"
950 " and display the attributes. */\n"
951 "\\&\n"
952 " if (main_sched_str != NULL) {\n"
953 " if (!get_policy(main_sched_str[0], &policy))\n"
954 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
955 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
956 "\\&\n"
957 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
958 " if (s != 0)\n"
959 " errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n"
960 " }\n"
961 "\\&\n"
962 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
963 " printf(\"\\[rs]n\");\n"
964 "\\&\n"
965 " /* Initialize thread attributes object according to options. */\n"
966 "\\&\n"
967 " attrp = NULL;\n"
968 "\\&\n"
969 " if (!use_null_attrib) {\n"
970 " s = pthread_attr_init(&attr);\n"
971 " if (s != 0)\n"
972 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
973 " attrp = &attr;\n"
974 " }\n"
975 "\\&\n"
976 " if (inheritsched_str != NULL) {\n"
977 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
978 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
979 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
980 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
981 " else\n"
982 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or"
983 " \\[aq]i\\[aq]\\[rs]n\");\n"
984 "\\&\n"
985 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
986 " if (s != 0)\n"
987 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
988 " }\n"
989 "\\&\n"
990 " if (attr_sched_str != NULL) {\n"
991 " if (!get_policy(attr_sched_str[0], &policy))\n"
992 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
993 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
994 "\\&\n"
995 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
996 " if (s != 0)\n"
997 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n"
998 " s = pthread_attr_setschedparam(&attr, &param);\n"
999 " if (s != 0)\n"
1000 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n"
1001 " }\n"
1002 "\\&\n"
1003 " /* If we initialized a thread attributes object, display\n"
1004 " the scheduling attributes that were set in the object. */\n"
1005 "\\&\n"
1006 " if (attrp != NULL) {\n"
1007 " s = pthread_attr_getschedparam(&attr, &param);\n"
1008 " if (s != 0)\n"
1009 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
1010 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
1011 " if (s != 0)\n"
1012 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
1013 "\\&\n"
1014 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
1015 " display_sched_attr(policy, &param);\n"
1016 "\\&\n"
1017 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
1018 " printf(\" inheritsched is %s\\[rs]n\",\n"
1019 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
1020 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
1021 " \"???\");\n"
1022 " printf(\"\\[rs]n\");\n"
1023 " }\n"
1024 "\\&\n"
1025 " /* Create a thread that will display its scheduling attributes. */\n"
1026 "\\&\n"
1027 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
1028 " if (s != 0)\n"
1029 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
1030 "\\&\n"
1031 " /* Destroy unneeded thread attributes object. */\n"
1032 "\\&\n"
1033 " if (!use_null_attrib) {\n"
1034 " s = pthread_attr_destroy(&attr);\n"
1035 " if (s != 0)\n"
1036 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
1037 " }\n"
1038 "\\&\n"
1039 " s = pthread_join(thread, NULL);\n"
1040 " if (s != 0)\n"
1041 " errc(EXIT_FAILURE, s, \"pthread_join\");\n"
1042 "\\&\n"
1043 " exit(EXIT_SUCCESS);\n"
1044 "}\n"
1045
1046 #. SRC END
1047 #. type: SH
1048 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1049 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1050 #, no-wrap
1051 msgid "SEE ALSO"
1052 msgstr "انظر أيضًا"
1053
1054 #. type: Plain text
1055 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1056 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1057 msgid ""
1058 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
1059 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
1060 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
1061 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
1062 msgstr ""
1063 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
1064 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
1065 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
1066 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
1067
1068 #. type: TH
1069 #: debian-trixie
1070 #, no-wrap
1071 msgid "2024-06-15"
1072 msgstr "15 يونيو 2024"
1073
1074 #. type: TH
1075 #: debian-trixie
1076 #, no-wrap
1077 msgid "Linux man-pages 6.9.1"
1078 msgstr "صفحات دليل لينكس 6.9.1"
1079
1080 #. type: Plain text
1081 #: debian-trixie
1082 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
1083 msgstr "مكتبة مسالك POSIX (I<libpthread>، I<-lpthread>)"
1084
1085 #. type: Plain text
1086 #: debian-trixie fedora-44 fedora-rawhide
1087 #, no-wrap
1088 msgid ""
1089 "$ B<su> # Need privilege to set real-time scheduling policies\n"
1090 "Password:\n"
1091 "# B<./a.out -mf10 -ar20 -i e>\n"
1092 "Scheduler settings of main thread\n"
1093 " policy=SCHED_FIFO, priority=10\n"
1094 "\\&\n"
1095 "Scheduler settings in \\[aq]attr\\[aq]\n"
1096 " policy=SCHED_RR, priority=20\n"
1097 " inheritsched is EXPLICIT\n"
1098 "\\&\n"
1099 "Scheduler attributes of new thread\n"
1100 " policy=SCHED_RR, priority=20\n"
1101 msgstr ""
1102 "$ B<su> # Need privilege to set real-time scheduling policies\n"
1103 "Password:\n"
1104 "# B<./a.out -mf10 -ar20 -i e>\n"
1105 "Scheduler settings of main thread\n"
1106 " policy=SCHED_FIFO, priority=10\n"
1107 "\\&\n"
1108 "Scheduler settings in \\[aq]attr\\[aq]\n"
1109 " policy=SCHED_RR, priority=20\n"
1110 " inheritsched is EXPLICIT\n"
1111 "\\&\n"
1112 "Scheduler attributes of new thread\n"
1113 " policy=SCHED_RR, priority=20\n"
1114
1115 #. type: Plain text
1116 #: debian-trixie fedora-44 fedora-rawhide
1117 #, no-wrap
1118 msgid ""
1119 "# B<./a.out -mf10 -ar20 -i i>\n"
1120 "Scheduler settings of main thread\n"
1121 " policy=SCHED_FIFO, priority=10\n"
1122 "\\&\n"
1123 "Scheduler settings in \\[aq]attr\\[aq]\n"
1124 " policy=SCHED_RR, priority=20\n"
1125 " inheritsched is INHERIT\n"
1126 "\\&\n"
1127 "Scheduler attributes of new thread\n"
1128 " policy=SCHED_FIFO, priority=10\n"
1129 msgstr ""
1130 "# B<./a.out -mf10 -ar20 -i i>\n"
1131 "Scheduler settings of main thread\n"
1132 " policy=SCHED_FIFO, priority=10\n"
1133 "\\&\n"
1134 "Scheduler settings in \\[aq]attr\\[aq]\n"
1135 " policy=SCHED_RR, priority=20\n"
1136 " inheritsched is INHERIT\n"
1137 "\\&\n"
1138 "Scheduler attributes of new thread\n"
1139 " policy=SCHED_FIFO, priority=10\n"
1140
1141 #. type: Plain text
1142 #: debian-trixie fedora-44 fedora-rawhide
1143 #, no-wrap
1144 msgid ""
1145 "/* pthreads_sched_test.c */\n"
1146 "\\&\n"
1147 "#include E<lt>errno.hE<gt>\n"
1148 "#include E<lt>pthread.hE<gt>\n"
1149 "#include E<lt>stdio.hE<gt>\n"
1150 "#include E<lt>stdlib.hE<gt>\n"
1151 "#include E<lt>unistd.hE<gt>\n"
1152 "\\&\n"
1153 "#define handle_error_en(en, msg) \\[rs]\n"
1154 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1155 "\\&\n"
1156 "[[noreturn]]\n"
1157 "static void\n"
1158 "usage(char *prog_name, char *msg)\n"
1159 "{\n"
1160 " if (msg != NULL)\n"
1161 " fputs(msg, stderr);\n"
1162 "\\&\n"
1163 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
1164 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
1165 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
1166 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
1167 " in\\[rs]n\");\n"
1168 " fpe(\" thread attributes object\\[rs]n\");\n"
1169 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
1170 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
1171 " fpe(\" r SCHED_RR\\[rs]n\");\n"
1172 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
1173 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
1174 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
1175 " fpe(\" \\[aq]explicit\\[aq] or"
1176 " \\[aq]inherit\\[aq]\\[rs]n\");\n"
1177 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
1178 " on\\[rs]n\");\n"
1179 " fpe(\" main thread before pthread_create()"
1180 " call\\[rs]n\");\n"
1181 " exit(EXIT_FAILURE);\n"
1182 "}\n"
1183 "\\&\n"
1184 "static int\n"
1185 "get_policy(char p, int *policy)\n"
1186 "{\n"
1187 " switch (p) {\n"
1188 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
1189 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
1190 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
1191 " default: return 0;\n"
1192 " }\n"
1193 "}\n"
1194 "\\&\n"
1195 "static void\n"
1196 "display_sched_attr(int policy, const struct sched_param *param)\n"
1197 "{\n"
1198 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
1199 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
1200 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
1201 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
1202 " \"???\",\n"
1203 " param-E<gt>sched_priority);\n"
1204 "}\n"
1205 "\\&\n"
1206 "static void\n"
1207 "display_thread_sched_attr(char *msg)\n"
1208 "{\n"
1209 " int policy, s;\n"
1210 " struct sched_param param;\n"
1211 "\\&\n"
1212 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
1213 " if (s != 0)\n"
1214 " handle_error_en(s, \"pthread_getschedparam\");\n"
1215 "\\&\n"
1216 " printf(\"%s\\[rs]n\", msg);\n"
1217 " display_sched_attr(policy, &param);\n"
1218 "}\n"
1219 "\\&\n"
1220 "static void *\n"
1221 "thread_start(void *arg)\n"
1222 "{\n"
1223 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
1224 "\\&\n"
1225 " return NULL;\n"
1226 "}\n"
1227 "\\&\n"
1228 "int\n"
1229 "main(int argc, char *argv[])\n"
1230 "{\n"
1231 " int s, opt, inheritsched, use_null_attrib, policy;\n"
1232 " pthread_t thread;\n"
1233 " pthread_attr_t attr;\n"
1234 " pthread_attr_t *attrp;\n"
1235 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
1236 " struct sched_param param;\n"
1237 "\\&\n"
1238 " /* Process command-line options. */\n"
1239 "\\&\n"
1240 " use_null_attrib = 0;\n"
1241 " attr_sched_str = NULL;\n"
1242 " main_sched_str = NULL;\n"
1243 " inheritsched_str = NULL;\n"
1244 "\\&\n"
1245 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
1246 " switch (opt) {\n"
1247 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
1248 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
1249 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
1250 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
1251 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
1252 " }\n"
1253 " }\n"
1254 "\\&\n"
1255 " if (use_null_attrib\n"
1256 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
1257 " {\n"
1258 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
1259 " }\n"
1260 "\\&\n"
1261 " /* Optionally set scheduling attributes of main thread,\n"
1262 " and display the attributes. */\n"
1263 "\\&\n"
1264 " if (main_sched_str != NULL) {\n"
1265 " if (!get_policy(main_sched_str[0], &policy))\n"
1266 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
1267 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
1268 "\\&\n"
1269 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
1270 " if (s != 0)\n"
1271 " handle_error_en(s, \"pthread_setschedparam\");\n"
1272 " }\n"
1273 "\\&\n"
1274 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
1275 " printf(\"\\[rs]n\");\n"
1276 "\\&\n"
1277 " /* Initialize thread attributes object according to options. */\n"
1278 "\\&\n"
1279 " attrp = NULL;\n"
1280 "\\&\n"
1281 " if (!use_null_attrib) {\n"
1282 " s = pthread_attr_init(&attr);\n"
1283 " if (s != 0)\n"
1284 " handle_error_en(s, \"pthread_attr_init\");\n"
1285 " attrp = &attr;\n"
1286 " }\n"
1287 "\\&\n"
1288 " if (inheritsched_str != NULL) {\n"
1289 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
1290 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
1291 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
1292 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
1293 " else\n"
1294 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or"
1295 " \\[aq]i\\[aq]\\[rs]n\");\n"
1296 "\\&\n"
1297 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
1298 " if (s != 0)\n"
1299 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
1300 " }\n"
1301 "\\&\n"
1302 " if (attr_sched_str != NULL) {\n"
1303 " if (!get_policy(attr_sched_str[0], &policy))\n"
1304 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
1305 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
1306 "\\&\n"
1307 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
1308 " if (s != 0)\n"
1309 " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
1310 " s = pthread_attr_setschedparam(&attr, &param);\n"
1311 " if (s != 0)\n"
1312 " handle_error_en(s, \"pthread_attr_setschedparam\");\n"
1313 " }\n"
1314 "\\&\n"
1315 " /* If we initialized a thread attributes object, display\n"
1316 " the scheduling attributes that were set in the object. */\n"
1317 "\\&\n"
1318 " if (attrp != NULL) {\n"
1319 " s = pthread_attr_getschedparam(&attr, &param);\n"
1320 " if (s != 0)\n"
1321 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
1322 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
1323 " if (s != 0)\n"
1324 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
1325 "\\&\n"
1326 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
1327 " display_sched_attr(policy, &param);\n"
1328 "\\&\n"
1329 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
1330 " printf(\" inheritsched is %s\\[rs]n\",\n"
1331 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
1332 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
1333 " \"???\");\n"
1334 " printf(\"\\[rs]n\");\n"
1335 " }\n"
1336 "\\&\n"
1337 " /* Create a thread that will display its scheduling attributes. */\n"
1338 "\\&\n"
1339 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
1340 " if (s != 0)\n"
1341 " handle_error_en(s, \"pthread_create\");\n"
1342 "\\&\n"
1343 " /* Destroy unneeded thread attributes object. */\n"
1344 "\\&\n"
1345 " if (!use_null_attrib) {\n"
1346 " s = pthread_attr_destroy(&attr);\n"
1347 " if (s != 0)\n"
1348 " handle_error_en(s, \"pthread_attr_destroy\");\n"
1349 " }\n"
1350 "\\&\n"
1351 " s = pthread_join(thread, NULL);\n"
1352 " if (s != 0)\n"
1353 " handle_error_en(s, \"pthread_join\");\n"
1354 "\\&\n"
1355 " exit(EXIT_SUCCESS);\n"
1356 "}\n"
1357 msgstr ""
1358 "/* pthreads_sched_test.c */\n"
1359 "\\&\n"
1360 "#include E<lt>errno.hE<gt>\n"
1361 "#include E<lt>pthread.hE<gt>\n"
1362 "#include E<lt>stdio.hE<gt>\n"
1363 "#include E<lt>stdlib.hE<gt>\n"
1364 "#include E<lt>unistd.hE<gt>\n"
1365 "\\&\n"
1366 "#define handle_error_en(en, msg) \\[rs]\n"
1367 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1368 "\\&\n"
1369 "[[noreturn]]\n"
1370 "static void\n"
1371 "usage(char *prog_name, char *msg)\n"
1372 "{\n"
1373 " if (msg != NULL)\n"
1374 " fputs(msg, stderr);\n"
1375 "\\&\n"
1376 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
1377 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
1378 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
1379 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
1380 " in\\[rs]n\");\n"
1381 " fpe(\" thread attributes object\\[rs]n\");\n"
1382 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
1383 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
1384 " fpe(\" r SCHED_RR\\[rs]n\");\n"
1385 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
1386 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
1387 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
1388 " fpe(\" \\[aq]explicit\\[aq] or"
1389 " \\[aq]inherit\\[aq]\\[rs]n\");\n"
1390 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority"
1391 " on\\[rs]n\");\n"
1392 " fpe(\" main thread before pthread_create()"
1393 " call\\[rs]n\");\n"
1394 " exit(EXIT_FAILURE);\n"
1395 "}\n"
1396 "\\&\n"
1397 "static int\n"
1398 "get_policy(char p, int *policy)\n"
1399 "{\n"
1400 " switch (p) {\n"
1401 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
1402 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
1403 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
1404 " default: return 0;\n"
1405 " }\n"
1406 "}\n"
1407 "\\&\n"
1408 "static void\n"
1409 "display_sched_attr(int policy, const struct sched_param *param)\n"
1410 "{\n"
1411 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
1412 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
1413 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
1414 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
1415 " \"???\",\n"
1416 " param-E<gt>sched_priority);\n"
1417 "}\n"
1418 "\\&\n"
1419 "static void\n"
1420 "display_thread_sched_attr(char *msg)\n"
1421 "{\n"
1422 " int policy, s;\n"
1423 " struct sched_param param;\n"
1424 "\\&\n"
1425 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
1426 " if (s != 0)\n"
1427 " handle_error_en(s, \"pthread_getschedparam\");\n"
1428 "\\&\n"
1429 " printf(\"%s\\[rs]n\", msg);\n"
1430 " display_sched_attr(policy, &param);\n"
1431 "}\n"
1432 "\\&\n"
1433 "static void *\n"
1434 "thread_start(void *arg)\n"
1435 "{\n"
1436 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
1437 "\\&\n"
1438 " return NULL;\n"
1439 "}\n"
1440 "\\&\n"
1441 "int\n"
1442 "main(int argc, char *argv[])\n"
1443 "{\n"
1444 " int s, opt, inheritsched, use_null_attrib, policy;\n"
1445 " pthread_t thread;\n"
1446 " pthread_attr_t attr;\n"
1447 " pthread_attr_t *attrp;\n"
1448 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
1449 " struct sched_param param;\n"
1450 "\\&\n"
1451 " /* Process command-line options. */\n"
1452 "\\&\n"
1453 " use_null_attrib = 0;\n"
1454 " attr_sched_str = NULL;\n"
1455 " main_sched_str = NULL;\n"
1456 " inheritsched_str = NULL;\n"
1457 "\\&\n"
1458 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
1459 " switch (opt) {\n"
1460 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
1461 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
1462 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
1463 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
1464 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
1465 " }\n"
1466 " }\n"
1467 "\\&\n"
1468 " if (use_null_attrib\n"
1469 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
1470 " {\n"
1471 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
1472 " }\n"
1473 "\\&\n"
1474 " /* Optionally set scheduling attributes of main thread,\n"
1475 " and display the attributes. */\n"
1476 "\\&\n"
1477 " if (main_sched_str != NULL) {\n"
1478 " if (!get_policy(main_sched_str[0], &policy))\n"
1479 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
1480 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
1481 "\\&\n"
1482 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
1483 " if (s != 0)\n"
1484 " handle_error_en(s, \"pthread_setschedparam\");\n"
1485 " }\n"
1486 "\\&\n"
1487 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
1488 " printf(\"\\[rs]n\");\n"
1489 "\\&\n"
1490 " /* Initialize thread attributes object according to options. */\n"
1491 "\\&\n"
1492 " attrp = NULL;\n"
1493 "\\&\n"
1494 " if (!use_null_attrib) {\n"
1495 " s = pthread_attr_init(&attr);\n"
1496 " if (s != 0)\n"
1497 " handle_error_en(s, \"pthread_attr_init\");\n"
1498 " attrp = &attr;\n"
1499 " }\n"
1500 "\\&\n"
1501 " if (inheritsched_str != NULL) {\n"
1502 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
1503 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
1504 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
1505 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
1506 " else\n"
1507 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or"
1508 " \\[aq]i\\[aq]\\[rs]n\");\n"
1509 "\\&\n"
1510 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
1511 " if (s != 0)\n"
1512 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
1513 " }\n"
1514 "\\&\n"
1515 " if (attr_sched_str != NULL) {\n"
1516 " if (!get_policy(attr_sched_str[0], &policy))\n"
1517 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
1518 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
1519 "\\&\n"
1520 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
1521 " if (s != 0)\n"
1522 " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
1523 " s = pthread_attr_setschedparam(&attr, &param);\n"
1524 " if (s != 0)\n"
1525 " handle_error_en(s, \"pthread_attr_setschedparam\");\n"
1526 " }\n"
1527 "\\&\n"
1528 " /* If we initialized a thread attributes object, display\n"
1529 " the scheduling attributes that were set in the object. */\n"
1530 "\\&\n"
1531 " if (attrp != NULL) {\n"
1532 " s = pthread_attr_getschedparam(&attr, &param);\n"
1533 " if (s != 0)\n"
1534 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
1535 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
1536 " if (s != 0)\n"
1537 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
1538 "\\&\n"
1539 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
1540 " display_sched_attr(policy, &param);\n"
1541 "\\&\n"
1542 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
1543 " printf(\" inheritsched is %s\\[rs]n\",\n"
1544 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
1545 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
1546 " \"???\");\n"
1547 " printf(\"\\[rs]n\");\n"
1548 " }\n"
1549 "\\&\n"
1550 " /* Create a thread that will display its scheduling attributes. */\n"
1551 "\\&\n"
1552 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
1553 " if (s != 0)\n"
1554 " handle_error_en(s, \"pthread_create\");\n"
1555 "\\&\n"
1556 " /* Destroy unneeded thread attributes object. */\n"
1557 "\\&\n"
1558 " if (!use_null_attrib) {\n"
1559 " s = pthread_attr_destroy(&attr);\n"
1560 " if (s != 0)\n"
1561 " handle_error_en(s, \"pthread_attr_destroy\");\n"
1562 " }\n"
1563 "\\&\n"
1564 " s = pthread_join(thread, NULL);\n"
1565 " if (s != 0)\n"
1566 " handle_error_en(s, \"pthread_join\");\n"
1567 "\\&\n"
1568 " exit(EXIT_SUCCESS);\n"
1569 "}\n"
1570
1571 #. type: TH
1572 #: fedora-44 fedora-rawhide
1573 #, no-wrap
1574 msgid "2024-07-23"
1575 msgstr "23 يوليو 2024"
1576
1577 #. type: TH
1578 #: fedora-44 fedora-rawhide
1579 #, no-wrap
1580 msgid "Linux man-pages 6.13"
1581 msgstr "صفحات دليل لينكس 6.13"
1582
1583 #. type: TH
1584 #: mageia-cauldron
1585 #, no-wrap
1586 msgid "Linux man-pages 6.17"
1587 msgstr "صفحات دليل لينكس 6.17"
1588
1589 #. type: TH
1590 #: opensuse-leap-16-1 opensuse-tumbleweed
1591 #, no-wrap
1592 msgid "Linux man-pages (unreleased)"
1593 msgstr "صفحات دليل لينكس (لم تصدر بعد)"
1594