# Arabic translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # زايد السعيدي , 2026. msgid "" msgstr "" "Project-Id-Version: manpages-l10n 4.30.2\n" "POT-Creation-Date: 2026-06-05 06:38+0200\n" "PO-Revision-Date: 2026-06-06 08:55+0400\n" "Last-Translator: Zayed Al-Saidi \n" "Language-Team: Arabic \n" "Language: ar\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 &&" " n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n" "X-Generator: Lokalize 23.08.5\n" #. type: TH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "pthread_setschedparam" msgstr "pthread_setschedparam" #. type: TH #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "2025-09-21" msgstr "21 سبتمبر 2025" #. type: TH #: archlinux debian-unstable #, no-wrap msgid "Linux man-pages 6.18" msgstr "صفحات دليل لينكس 6.18" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "الاسم" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and " "parameters of a thread" msgstr "" "pthread_setschedparam, pthread_getschedparam - ضبط/الحصول على سياسة الجدولة " "ومعاملات خيط" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "المكتبة" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "POSIX threads library (I,\\ I<-lpthread>)" msgstr "مكتبة مسالك POSIX (I،\\ I<-lpthread>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "موجز" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B<#include Epthread.hE>\n" msgstr "B<#include Epthread.hE>\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "BIB<, int >IB<,>\n" "B< const struct sched_param *>IB<);>\n" "BIB<, int *restrict >IB<,>\n" "B< struct sched_param *restrict >IB<);>\n" msgstr "" "BIB<, int >IB<,>\n" "B< const struct sched_param *>IB<);>\n" "BIB<, int *restrict >IB<,>\n" "B< struct sched_param *restrict >IB<);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "الوصف" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function sets the scheduling policy and " "parameters of the thread I." msgstr "" "تضبط الدالة B() سياسة الجدولة ومعاملات الخيط " "I." #. FIXME . pthread_setschedparam() places no restriction on the policy, #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I specifies the new scheduling policy for I. The supported " "values for I, and their semantics, are described in B(7)." msgstr "" "يحدد I سياسة الجدولة الجديدة لـ I. القيم المدعومة لـ " "I ودلالاتها موصوفة في B(7)." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The structure pointed to by I specifies the new scheduling parameters " "for I. Scheduling parameters are maintained in the following " "structure:" msgstr "" "تحدد البنية المشار إليها بـ I معاملات الجدولة الجديدة لـ I. " "تُحتفظ معاملات الجدولة في البنية التالية:" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "struct sched_param {\n" " int sched_priority; /* Scheduling priority */\n" "};\n" msgstr "" "struct sched_param {\n" " int sched_priority; /* أولوية الجدولة */\n" "};\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "As can be seen, only one scheduling parameter is supported. For details of " "the permitted ranges for scheduling priorities in each scheduling policy, " "see B(7)." msgstr "" "كما هو موضح، يُدعم معامل جدولة واحد فقط. لتفاصيل النطاقات المسموح بها " "لأولويات الجدولة في كل سياسة جدولة، انظر B(7)." #. #-#-#-#-# archlinux: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# debian-trixie: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# debian-unstable: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# fedora-44: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# fedora-rawhide: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# mageia-cauldron: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# opensuse-leap-16-1: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# #. FIXME . nptl/pthread_setschedparam.c has the following #. /* If the thread should have higher priority because of some #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */ #. Eventually (perhaps after writing the mutexattr pages), we #. may want to add something on the topic to this page. #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function returns the scheduling policy and " "parameters of the thread I, in the buffers pointed to by I " "and I, respectively. The returned priority value is that set by the " "most recent B(), B(3), or " "B(3) call that affected I. The returned priority " "does not reflect any temporary priority adjustments as a result of calls to " "any priority inheritance or priority ceiling functions (see, for example, " "B(3) and " "B(3))." msgstr "" "تُرجع الدالة B() سياسة الجدولة ومعاملات الخيط " "I، في المخازن المؤقتة المشار إليها بـ I و I، على " "التوالي. قيمة الأولوية المُرجعة هي تلك التي ضُبطت بواسطة أحدث استدعاء لـ " "B() أو B(3) أو " "B(3) الذي أثر على I. لا تعكس الأولوية المُرجعة أي " "تعديلات مؤقتة في الأولوية نتيجة استدعاءات لدوال وراثة الأولوية أو سقف " "الأولوية (انظر، على سبيل المثال، B(3) و " "B(3))." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "قيمة الإرجاع" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On success, these functions return 0; on error, they return a nonzero error " "number. If B() fails, the scheduling policy and " "parameters of I are not changed." msgstr "" "عند النجاح، تُرجع هاتان الدالتان 0؛ عند الخطأ، تُرجعان رقم خطأ غير صفري. إذا " "فشلت B()، لا تُغير سياسة الجدولة ومعاملات I." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "الأخطاء" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "Both of these functions can fail with the following error:" msgstr "يمكن أن تفشل كلتا الدالتين مع الخطأ التالي:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "No thread with the ID I could be found." msgstr "تعذر العثور على أي خيط بالمعرف I." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B() may additionally fail with the following errors:" msgstr "" "قد تفشل B() بالإضافة إلى ذلك مع الأخطاء التالية:" #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "I is not a recognized policy, or I does not make sense for " "the I." msgstr "" "I ليست سياسة معروفة، أو I غير منطقي بالنسبة لـ I." #. type: TP #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The caller does not have appropriate privileges to set the specified " "scheduling policy and parameters." msgstr "" "لا يمتلك المستدعي الصلاحيات المناسبة لضبط سياسة الجدولة والمعاملات المحددة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "POSIX.1 also documents an B (\"attempt was made to set the policy " "or scheduling parameters to an unsupported value\") error for " "B()." msgstr "" "يُوثق POSIX.1 أيضًا خطأ B (\"جرت محاولة لضبط السياسة أو معاملات " "الجدولة إلى قيمة غير مدعومة\") لـ B()." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "السمات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "" "للاطلاع على شرح للمصطلحات المستخدمة في هذا القسم، انظر B(7)." #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "الواجهة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "السمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "القيمة" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "B(),\n" "B()" msgstr "" "B(),\n" "B()" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "سلامة الخيوط" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "المعايير" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "POSIX.1-2008." msgstr "POSIX.1-2008." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "التاريخ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "glibc 2.0 POSIX.1-2001." msgstr "glibc 2.0 POSIX.1-2001." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ملاحظات" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For a description of the permissions required to, and the effect of, " "changing a thread's scheduling policy and priority, and details of the " "permitted ranges for priorities in each scheduling policy, see B(7)." msgstr "" "للحصول على وصف للصلاحيات المطلوبة لتغيير سياسة جدولة خيط وأولويته، وتأثير " "ذلك، وتفاصيل النطاقات المسموح بها للأولويات في كل سياسة جدولة، انظر " "B(7)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "أمثلة" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below demonstrates the use of B() and " "B(), as well as the use of a number of other " "scheduling-related pthreads functions." msgstr "" "يوضح البرنامج أدناه استخدام B() و " "B()، بالإضافة إلى استخدام عدد من دوال pthreads الأخرى " "المتعلقة بالجدولة." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In the following run, the main thread sets its scheduling policy to " "B with a priority of 10, and initializes a thread attributes " "object with a scheduling policy attribute of B and a scheduling " "priority attribute of 20. The program then sets (using " "B(3)) the inherit scheduler attribute of the " "thread attributes object to B, meaning that threads " "created using this attributes object should take their scheduling attributes " "from the thread attributes object. The program then creates a thread using " "the thread attributes object, and that thread displays its scheduling policy " "and priority." msgstr "" "في التشغيل التالي، يضبط الخيط الرئيسي سياسة الجدولة الخاصة به إلى " "B بأولوية 10، ويُهيئ كائن سمات خيط بسمة سياسة جدولة B " "وسمة أولوية جدولة 20. ثم يضبط البرنامج (باستخدام " "B(3)) سمة وراثة الجدولة لكائن سمات الخيط إلى " "B، مما يعني أن الخيوط المُنشأة باستخدام كائن السمات " "هذا يجب أن تأخذ سمات الجدولة الخاصة بها من كائن سمات الخيط. ثم ينشئ " "البرنامج خيطًا باستخدام كائن سمات الخيط، ويعرض ذلك الخيط سياسة الجدولة " "والأولوية الخاصة به." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "$B< su>; # Need privilege to set real-time scheduling policies\n" "Password:\n" "#B< ./a.out -mf10 -ar20 -i e>;\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is EXPLICIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_RR, priority=20\n" msgstr "" "$B< su>; # Need privilege to set real-time scheduling policies\n" "Password:\n" "#B< ./a.out -mf10 -ar20 -i e>;\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is EXPLICIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_RR, priority=20\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In the above output, one can see that the scheduling policy and priority " "were taken from the values specified in the thread attributes object." msgstr "" "في المخرجات أعلاه، يمكن رؤية أن سياسة الجدولة والأولوية أُخذت من القيم " "المحددة في كائن سمات الخيط." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The next run is the same as the previous, except that the inherit scheduler " "attribute is set to B, meaning that threads created " "using the thread attributes object should ignore the scheduling attributes " "specified in the attributes object and instead take their scheduling " "attributes from the creating thread." msgstr "" "التشغيل التالي هو نفسه السابق، باستثناء أن سمة وراثة الجدولة ضُبطت إلى " "B، مما يعني أن الخيوط المُنشأة باستخدام كائن سمات " "الخيط يجب أن تتجاهل سمات الجدولة المحددة في كائن السمات وتأخذ بدلاً من ذلك " "سمات الجدولة الخاصة بها من الخيط المُنشئ." #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#B< ./a.out -mf10 -ar20 -i i>;\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is INHERIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_FIFO, priority=10\n" msgstr "" "#B< ./a.out -mf10 -ar20 -i i>;\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is INHERIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_FIFO, priority=10\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "In the above output, one can see that the scheduling policy and priority " "were taken from the creating thread, rather than the thread attributes " "object." msgstr "" "في المخرجات أعلاه، يمكن رؤية أن سياسة الجدولة والأولوية أُخذت من الخيط " "المنشئ، وليس من كائن سمات الخيط." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #| msgid "" #| "Note that if we had omitted the I<-i\\~i> option, the output would have " #| "been the same, since B is the default for the " #| "inherit scheduler attribute." msgid "" "Note that if we had omitted the I<-i\\ i> option, the output would have been " "the same, since B is the default for the inherit " "scheduler attribute." msgstr "" "لاحظ أنه لو حذفنا الخيار I<-i\\ i>، لكان المخرج نفسه، لأن " "B هو المبدئي لسمة الجدولة الموروثة." #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "مصدر البرنامج" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "/* pthreads_sched_test.c */\n" "\\&\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "[[noreturn]]\n" "static void\n" "usage(char *prog_name, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" "\\&\n" " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" " fprintf(stderr, \"Options are:\\[rs]n\");\n" "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" " fpe(\"-aEpolicyEEprioE Set scheduling policy and priority" " in\\[rs]n\");\n" " fpe(\" thread attributes object\\[rs]n\");\n" " fpe(\" EpolicyE can be\\[rs]n\");\n" " fpe(\" f SCHED_FIFO\\[rs]n\");\n" " fpe(\" r SCHED_RR\\[rs]n\");\n" " fpe(\" o SCHED_OTHER\\[rs]n\");\n" " fpe(\"-A Use default thread attributes object\\[rs]n\");\n" " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" " fpe(\" \\[aq]explicit\\[aq] or" " \\[aq]inherit\\[aq]\\[rs]n\");\n" " fpe(\"-mEpolicyEEprioE Set scheduling policy and priority" " on\\[rs]n\");\n" " fpe(\" main thread before pthread_create()" " call\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" "}\n" "\\&\n" "static int\n" "get_policy(char p, int *policy)\n" "{\n" " switch (p) {\n" " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" " default: return 0;\n" " }\n" "}\n" "\\&\n" "static void\n" "display_sched_attr(int policy, const struct sched_param *param)\n" "{\n" " printf(\" policy=%s, priority=%d\\[rs]n\",\n" " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (policy == SCHED_RR) ? \"SCHED_RR\" :\n" " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " \"???\",\n" " param-Esched_priority);\n" "}\n" "\\&\n" "static void\n" "display_thread_sched_attr(char *msg)\n" "{\n" " int policy, s;\n" " struct sched_param param;\n" "\\&\n" " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n" "\\&\n" " printf(\"%s\\[rs]n\", msg);\n" " display_sched_attr(policy, ¶m);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" "\\&\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt, inheritsched, use_null_attrib, policy;\n" " pthread_t thread;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp;\n" " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" " struct sched_param param;\n" "\\&\n" " /* Process command-line options. */\n" "\\&\n" " use_null_attrib = 0;\n" " attr_sched_str = NULL;\n" " main_sched_str = NULL;\n" " inheritsched_str = NULL;\n" "\\&\n" " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" " }\n" " }\n" "\\&\n" " if (use_null_attrib\n" " && (inheritsched_str != NULL || attr_sched_str != NULL))\n" " {\n" " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" " }\n" "\\&\n" " /* Optionally set scheduling attributes of main thread,\n" " and display the attributes. */\n" "\\&\n" " if (main_sched_str != NULL) {\n" " if (!get_policy(main_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n" " }\n" "\\&\n" " display_thread_sched_attr(\"Scheduler settings of main thread\");\n" " printf(\"\\[rs]n\");\n" "\\&\n" " /* Initialize thread attributes object according to options. */\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" " attrp = &attr;\n" " }\n" "\\&\n" " if (inheritsched_str != NULL) {\n" " if (inheritsched_str[0] == \\[aq]e\\[aq])\n" " inheritsched = PTHREAD_EXPLICIT_SCHED;\n" " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" " inheritsched = PTHREAD_INHERIT_SCHED;\n" " else\n" " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or" " \\[aq]i\\[aq]\\[rs]n\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, inheritsched);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n" " }\n" "\\&\n" " if (attr_sched_str != NULL) {\n" " if (!get_policy(attr_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_attr_setschedpolicy(&attr, policy);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n" " s = pthread_attr_setschedparam(&attr, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n" " }\n" "\\&\n" " /* If we initialized a thread attributes object, display\n" " the scheduling attributes that were set in the object. */\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_getschedparam(&attr, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n" " s = pthread_attr_getschedpolicy(&attr, &policy);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n" "\\&\n" " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" " display_sched_attr(policy, ¶m);\n" "\\&\n" " pthread_attr_getinheritsched(&attr, &inheritsched);\n" " printf(\" inheritsched is %s\\[rs]n\",\n" " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" " \"???\");\n" " printf(\"\\[rs]n\");\n" " }\n" "\\&\n" " /* Create a thread that will display its scheduling attributes. */\n" "\\&\n" " s = pthread_create(&thread, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" "\\&\n" " /* Destroy unneeded thread attributes object. */\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " s = pthread_join(thread, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_join\");\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* pthreads_sched_test.c */\n" "\\&\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "[[noreturn]]\n" "static void\n" "usage(char *prog_name, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" "\\&\n" " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" " fprintf(stderr, \"Options are:\\[rs]n\");\n" "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" " fpe(\"-aEpolicyEEprioE Set scheduling policy and priority" " in\\[rs]n\");\n" " fpe(\" thread attributes object\\[rs]n\");\n" " fpe(\" EpolicyE can be\\[rs]n\");\n" " fpe(\" f SCHED_FIFO\\[rs]n\");\n" " fpe(\" r SCHED_RR\\[rs]n\");\n" " fpe(\" o SCHED_OTHER\\[rs]n\");\n" " fpe(\"-A Use default thread attributes object\\[rs]n\");\n" " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" " fpe(\" \\[aq]explicit\\[aq] or" " \\[aq]inherit\\[aq]\\[rs]n\");\n" " fpe(\"-mEpolicyEEprioE Set scheduling policy and priority" " on\\[rs]n\");\n" " fpe(\" main thread before pthread_create()" " call\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" "}\n" "\\&\n" "static int\n" "get_policy(char p, int *policy)\n" "{\n" " switch (p) {\n" " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" " default: return 0;\n" " }\n" "}\n" "\\&\n" "static void\n" "display_sched_attr(int policy, const struct sched_param *param)\n" "{\n" " printf(\" policy=%s, priority=%d\\[rs]n\",\n" " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (policy == SCHED_RR) ? \"SCHED_RR\" :\n" " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " \"???\",\n" " param-Esched_priority);\n" "}\n" "\\&\n" "static void\n" "display_thread_sched_attr(char *msg)\n" "{\n" " int policy, s;\n" " struct sched_param param;\n" "\\&\n" " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n" "\\&\n" " printf(\"%s\\[rs]n\", msg);\n" " display_sched_attr(policy, ¶m);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" "\\&\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt, inheritsched, use_null_attrib, policy;\n" " pthread_t thread;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp;\n" " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" " struct sched_param param;\n" "\\&\n" " /* Process command-line options. */\n" "\\&\n" " use_null_attrib = 0;\n" " attr_sched_str = NULL;\n" " main_sched_str = NULL;\n" " inheritsched_str = NULL;\n" "\\&\n" " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" " }\n" " }\n" "\\&\n" " if (use_null_attrib\n" " && (inheritsched_str != NULL || attr_sched_str != NULL))\n" " {\n" " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" " }\n" "\\&\n" " /* Optionally set scheduling attributes of main thread,\n" " and display the attributes. */\n" "\\&\n" " if (main_sched_str != NULL) {\n" " if (!get_policy(main_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n" " }\n" "\\&\n" " display_thread_sched_attr(\"Scheduler settings of main thread\");\n" " printf(\"\\[rs]n\");\n" "\\&\n" " /* Initialize thread attributes object according to options. */\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" " attrp = &attr;\n" " }\n" "\\&\n" " if (inheritsched_str != NULL) {\n" " if (inheritsched_str[0] == \\[aq]e\\[aq])\n" " inheritsched = PTHREAD_EXPLICIT_SCHED;\n" " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" " inheritsched = PTHREAD_INHERIT_SCHED;\n" " else\n" " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or" " \\[aq]i\\[aq]\\[rs]n\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, inheritsched);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n" " }\n" "\\&\n" " if (attr_sched_str != NULL) {\n" " if (!get_policy(attr_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_attr_setschedpolicy(&attr, policy);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n" " s = pthread_attr_setschedparam(&attr, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n" " }\n" "\\&\n" " /* If we initialized a thread attributes object, display\n" " the scheduling attributes that were set in the object. */\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_getschedparam(&attr, ¶m);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n" " s = pthread_attr_getschedpolicy(&attr, &policy);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n" "\\&\n" " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" " display_sched_attr(policy, ¶m);\n" "\\&\n" " pthread_attr_getinheritsched(&attr, &inheritsched);\n" " printf(\" inheritsched is %s\\[rs]n\",\n" " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" " \"???\");\n" " printf(\"\\[rs]n\");\n" " }\n" "\\&\n" " /* Create a thread that will display its scheduling attributes. */\n" "\\&\n" " s = pthread_create(&thread, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" "\\&\n" " /* Destroy unneeded thread attributes object. */\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " s = pthread_join(thread, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_join\");\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "انظر أيضًا" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "B(2), B(2), B(3), " "B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(7), B(7)" msgstr "" "B(2), B(2), B(3), " "B(3), B(3), " "B(3), B(3), B(3), " "B(3), B(7), B(7)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 يونيو 2024" #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "صفحات دليل لينكس 6.9.1" #. type: Plain text #: debian-trixie msgid "POSIX threads library (I, I<-lpthread>)" msgstr "مكتبة مسالك POSIX (I، I<-lpthread>)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "$ B # Need privilege to set real-time scheduling policies\n" "Password:\n" "# B<./a.out -mf10 -ar20 -i e>\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is EXPLICIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_RR, priority=20\n" msgstr "" "$ B # Need privilege to set real-time scheduling policies\n" "Password:\n" "# B<./a.out -mf10 -ar20 -i e>\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is EXPLICIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_RR, priority=20\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "# B<./a.out -mf10 -ar20 -i i>\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is INHERIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_FIFO, priority=10\n" msgstr "" "# B<./a.out -mf10 -ar20 -i i>\n" "Scheduler settings of main thread\n" " policy=SCHED_FIFO, priority=10\n" "\\&\n" "Scheduler settings in \\[aq]attr\\[aq]\n" " policy=SCHED_RR, priority=20\n" " inheritsched is INHERIT\n" "\\&\n" "Scheduler attributes of new thread\n" " policy=SCHED_FIFO, priority=10\n" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "/* pthreads_sched_test.c */\n" "\\&\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\[rs]\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "[[noreturn]]\n" "static void\n" "usage(char *prog_name, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" "\\&\n" " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" " fprintf(stderr, \"Options are:\\[rs]n\");\n" "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" " fpe(\"-aEpolicyEEprioE Set scheduling policy and priority" " in\\[rs]n\");\n" " fpe(\" thread attributes object\\[rs]n\");\n" " fpe(\" EpolicyE can be\\[rs]n\");\n" " fpe(\" f SCHED_FIFO\\[rs]n\");\n" " fpe(\" r SCHED_RR\\[rs]n\");\n" " fpe(\" o SCHED_OTHER\\[rs]n\");\n" " fpe(\"-A Use default thread attributes object\\[rs]n\");\n" " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" " fpe(\" \\[aq]explicit\\[aq] or" " \\[aq]inherit\\[aq]\\[rs]n\");\n" " fpe(\"-mEpolicyEEprioE Set scheduling policy and priority" " on\\[rs]n\");\n" " fpe(\" main thread before pthread_create()" " call\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" "}\n" "\\&\n" "static int\n" "get_policy(char p, int *policy)\n" "{\n" " switch (p) {\n" " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" " default: return 0;\n" " }\n" "}\n" "\\&\n" "static void\n" "display_sched_attr(int policy, const struct sched_param *param)\n" "{\n" " printf(\" policy=%s, priority=%d\\[rs]n\",\n" " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (policy == SCHED_RR) ? \"SCHED_RR\" :\n" " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " \"???\",\n" " param-Esched_priority);\n" "}\n" "\\&\n" "static void\n" "display_thread_sched_attr(char *msg)\n" "{\n" " int policy, s;\n" " struct sched_param param;\n" "\\&\n" " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getschedparam\");\n" "\\&\n" " printf(\"%s\\[rs]n\", msg);\n" " display_sched_attr(policy, ¶m);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" "\\&\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt, inheritsched, use_null_attrib, policy;\n" " pthread_t thread;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp;\n" " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" " struct sched_param param;\n" "\\&\n" " /* Process command-line options. */\n" "\\&\n" " use_null_attrib = 0;\n" " attr_sched_str = NULL;\n" " main_sched_str = NULL;\n" " inheritsched_str = NULL;\n" "\\&\n" " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" " }\n" " }\n" "\\&\n" " if (use_null_attrib\n" " && (inheritsched_str != NULL || attr_sched_str != NULL))\n" " {\n" " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" " }\n" "\\&\n" " /* Optionally set scheduling attributes of main thread,\n" " and display the attributes. */\n" "\\&\n" " if (main_sched_str != NULL) {\n" " if (!get_policy(main_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setschedparam\");\n" " }\n" "\\&\n" " display_thread_sched_attr(\"Scheduler settings of main thread\");\n" " printf(\"\\[rs]n\");\n" "\\&\n" " /* Initialize thread attributes object according to options. */\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" " attrp = &attr;\n" " }\n" "\\&\n" " if (inheritsched_str != NULL) {\n" " if (inheritsched_str[0] == \\[aq]e\\[aq])\n" " inheritsched = PTHREAD_EXPLICIT_SCHED;\n" " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" " inheritsched = PTHREAD_INHERIT_SCHED;\n" " else\n" " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or" " \\[aq]i\\[aq]\\[rs]n\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, inheritsched);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setinheritsched\");\n" " }\n" "\\&\n" " if (attr_sched_str != NULL) {\n" " if (!get_policy(attr_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_attr_setschedpolicy(&attr, policy);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n" " s = pthread_attr_setschedparam(&attr, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setschedparam\");\n" " }\n" "\\&\n" " /* If we initialized a thread attributes object, display\n" " the scheduling attributes that were set in the object. */\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_getschedparam(&attr, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedparam\");\n" " s = pthread_attr_getschedpolicy(&attr, &policy);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n" "\\&\n" " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" " display_sched_attr(policy, ¶m);\n" "\\&\n" " pthread_attr_getinheritsched(&attr, &inheritsched);\n" " printf(\" inheritsched is %s\\[rs]n\",\n" " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" " \"???\");\n" " printf(\"\\[rs]n\");\n" " }\n" "\\&\n" " /* Create a thread that will display its scheduling attributes. */\n" "\\&\n" " s = pthread_create(&thread, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" "\\&\n" " /* Destroy unneeded thread attributes object. */\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " s = pthread_join(thread, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" "/* pthreads_sched_test.c */\n" "\\&\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "#define handle_error_en(en, msg) \\[rs]\n" " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" "\\&\n" "[[noreturn]]\n" "static void\n" "usage(char *prog_name, char *msg)\n" "{\n" " if (msg != NULL)\n" " fputs(msg, stderr);\n" "\\&\n" " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n" " fprintf(stderr, \"Options are:\\[rs]n\");\n" "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n" " fpe(\"-aEpolicyEEprioE Set scheduling policy and priority" " in\\[rs]n\");\n" " fpe(\" thread attributes object\\[rs]n\");\n" " fpe(\" EpolicyE can be\\[rs]n\");\n" " fpe(\" f SCHED_FIFO\\[rs]n\");\n" " fpe(\" r SCHED_RR\\[rs]n\");\n" " fpe(\" o SCHED_OTHER\\[rs]n\");\n" " fpe(\"-A Use default thread attributes object\\[rs]n\");\n" " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n" " fpe(\" \\[aq]explicit\\[aq] or" " \\[aq]inherit\\[aq]\\[rs]n\");\n" " fpe(\"-mEpolicyEEprioE Set scheduling policy and priority" " on\\[rs]n\");\n" " fpe(\" main thread before pthread_create()" " call\\[rs]n\");\n" " exit(EXIT_FAILURE);\n" "}\n" "\\&\n" "static int\n" "get_policy(char p, int *policy)\n" "{\n" " switch (p) {\n" " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n" " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n" " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n" " default: return 0;\n" " }\n" "}\n" "\\&\n" "static void\n" "display_sched_attr(int policy, const struct sched_param *param)\n" "{\n" " printf(\" policy=%s, priority=%d\\[rs]n\",\n" " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (policy == SCHED_RR) ? \"SCHED_RR\" :\n" " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " \"???\",\n" " param-Esched_priority);\n" "}\n" "\\&\n" "static void\n" "display_thread_sched_attr(char *msg)\n" "{\n" " int policy, s;\n" " struct sched_param param;\n" "\\&\n" " s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_getschedparam\");\n" "\\&\n" " printf(\"%s\\[rs]n\", msg);\n" " display_sched_attr(policy, ¶m);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" "\\&\n" " return NULL;\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s, opt, inheritsched, use_null_attrib, policy;\n" " pthread_t thread;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp;\n" " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n" " struct sched_param param;\n" "\\&\n" " /* Process command-line options. */\n" "\\&\n" " use_null_attrib = 0;\n" " attr_sched_str = NULL;\n" " main_sched_str = NULL;\n" " inheritsched_str = NULL;\n" "\\&\n" " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" " switch (opt) {\n" " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n" " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n" " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n" " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n" " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n" " }\n" " }\n" "\\&\n" " if (use_null_attrib\n" " && (inheritsched_str != NULL || attr_sched_str != NULL))\n" " {\n" " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n" " }\n" "\\&\n" " /* Optionally set scheduling attributes of main thread,\n" " and display the attributes. */\n" "\\&\n" " if (main_sched_str != NULL) {\n" " if (!get_policy(main_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n" " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_setschedparam\");\n" " }\n" "\\&\n" " display_thread_sched_attr(\"Scheduler settings of main thread\");\n" " printf(\"\\[rs]n\");\n" "\\&\n" " /* Initialize thread attributes object according to options. */\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_init\");\n" " attrp = &attr;\n" " }\n" "\\&\n" " if (inheritsched_str != NULL) {\n" " if (inheritsched_str[0] == \\[aq]e\\[aq])\n" " inheritsched = PTHREAD_EXPLICIT_SCHED;\n" " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n" " inheritsched = PTHREAD_INHERIT_SCHED;\n" " else\n" " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or" " \\[aq]i\\[aq]\\[rs]n\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, inheritsched);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setinheritsched\");\n" " }\n" "\\&\n" " if (attr_sched_str != NULL) {\n" " if (!get_policy(attr_sched_str[0], &policy))\n" " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n" " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" "\\&\n" " s = pthread_attr_setschedpolicy(&attr, policy);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n" " s = pthread_attr_setschedparam(&attr, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_setschedparam\");\n" " }\n" "\\&\n" " /* If we initialized a thread attributes object, display\n" " the scheduling attributes that were set in the object. */\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_getschedparam(&attr, ¶m);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedparam\");\n" " s = pthread_attr_getschedpolicy(&attr, &policy);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n" "\\&\n" " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n" " display_sched_attr(policy, ¶m);\n" "\\&\n" " pthread_attr_getinheritsched(&attr, &inheritsched);\n" " printf(\" inheritsched is %s\\[rs]n\",\n" " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" " \"???\");\n" " printf(\"\\[rs]n\");\n" " }\n" "\\&\n" " /* Create a thread that will display its scheduling attributes. */\n" "\\&\n" " s = pthread_create(&thread, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_create\");\n" "\\&\n" " /* Destroy unneeded thread attributes object. */\n" "\\&\n" " if (!use_null_attrib) {\n" " s = pthread_attr_destroy(&attr);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " s = pthread_join(thread, NULL);\n" " if (s != 0)\n" " handle_error_en(s, \"pthread_join\");\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-07-23" msgstr "23 يوليو 2024" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "صفحات دليل لينكس 6.13" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "صفحات دليل لينكس 6.17" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "صفحات دليل لينكس (لم تصدر بعد)"