diff options
Diffstat (limited to 'po/ru/man3/pthread_setschedparam.3.po')
-rw-r--r-- | po/ru/man3/pthread_setschedparam.3.po | 1807 |
1 files changed, 1807 insertions, 0 deletions
diff --git a/po/ru/man3/pthread_setschedparam.3.po b/po/ru/man3/pthread_setschedparam.3.po new file mode 100644 index 00000000..23750eb3 --- /dev/null +++ b/po/ru/man3/pthread_setschedparam.3.po @@ -0,0 +1,1807 @@ +# Russian translation of manpages +# This file is distributed under the same license as the manpages-l10n package. +# Copyright © of this file: +# Alexey, 2016. +# Azamat Hackimov <azamat.hackimov@gmail.com>, 2014-2017. +# kogamatranslator49 <r.podarov@yandex.ru>, 2015. +# Kogan, Darima <silverdk99@gmail.com>, 2014. +# Max Is <ismax799@gmail.com>, 2016. +# Yuri Kozlov <yuray@komyakino.ru>, 2011-2019. +# Иван Павлов <pavia00@gmail.com>, 2017. +msgid "" +msgstr "" +"Project-Id-Version: manpages-l10n\n" +"POT-Creation-Date: 2024-03-01 17:05+0100\n" +"PO-Revision-Date: 2019-10-12 08:58+0300\n" +"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n" +"Language-Team: Russian <man-pages-ru-talks@lists.sourceforge.net>\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " +"(n%100>=11 && n%100<=14)? 2 : 3);\n" +"X-Generator: Lokalize 2.0\n" + +#. type: TH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy, no-wrap +#| msgid "See B<pthread_setschedparam>(3)." +msgid "pthread_setschedparam" +msgstr "Смотрите B<pthread_setschedparam>(3)." + +#. type: TH +#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "2023-10-31" +msgstr "31 октября 2023 г." + +#. type: TH +#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "Linux man-pages 6.06" +msgstr "Linux man-pages 6.06" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "NAME" +msgstr "ИМЯ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "LIBRARY" +msgstr "" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "POSIX threads library (I<libpthread>, I<-lpthread>)" +msgstr "" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "SYNOPSIS" +msgstr "СИНТАКСИС" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "B<#include E<lt>pthread.hE<gt>>\n" +msgstr "B<#include E<lt>pthread.hE<gt>>\n" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy, no-wrap +#| msgid "" +#| "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n" +#| "B< const struct sched_param *>I<param>B<);>\n" +#| "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n" +#| "B< struct sched_param *>I<param>B<);>\n" +msgid "" +"B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n" +"B< const struct sched_param *>I<param>B<);>\n" +"B<int pthread_getschedparam(pthread_t >I<thread>B<, int *restrict >I<policy>B<,>\n" +"B< struct sched_param *restrict >I<param>B<);>\n" +msgstr "" +"B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n" +"B< const struct sched_param *>I<param>B<);>\n" +"B<int pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n" +"B< struct sched_param *>I<param>B<);>\n" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "DESCRIPTION" +msgstr "ОПИСАНИЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The B<pthread_setschedparam>() function sets the scheduling policy and " +"parameters of the thread I<thread>." +msgstr "" +"Функция B<pthread_setschedparam>() назначает параметры и алгоритм " +"планирования нити I<thread>." + +#. 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"I<policy> specifies the new scheduling policy for I<thread>. The supported " +"values for I<policy>, and their semantics, are described in B<sched>(7)." +msgstr "" +"В I<policy> указывается новый алгоритм планирования I<thread>. " +"Поддерживаемые значения I<policy> и их семантика описана в B<sched>(7)." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The structure pointed to by I<param> specifies the new scheduling parameters " +"for I<thread>. Scheduling parameters are maintained in the following " +"structure:" +msgstr "" +"Структура, на которую указывает I<param> определяет новые параметры " +"планирования I<thread>. Параметры планирования хранятся в структуре " +"следующего вида:" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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<sched>(7)." +msgstr "" +"Из той структуры видно, что поддерживается только один параметр. Подробности " +"о разрешённых диапазонах планируемых приоритетов для каждого алгоритма " +"планирования смотрите в B<sched>(7)." + +#. 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The B<pthread_getschedparam>() function returns the scheduling policy and " +"parameters of the thread I<thread>, in the buffers pointed to by I<policy> " +"and I<param>, respectively. The returned priority value is that set by the " +"most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or " +"B<pthread_create>(3) call that affected I<thread>. 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<pthread_mutexattr_setprioceiling>(3) and " +"B<pthread_mutexattr_setprotocol>(3))." +msgstr "" +"Функция B<pthread_getschedparam>() возвращает параметры и алгоритм " +"планирования нити I<thread> в буфер, указанный I<policy> и I<param>, " +"соответственно. Возвращаемое значение приоритета совпадает с заданным с " +"помощью последнего вызова B<pthread_setschedparam>(), " +"B<pthread_setschedprio>(3) или B<pthread_create>(3), относящегося к " +"I<thread>. Возвращаемые приоритет не отражает каких-либо временных подстроек " +"приоритета в результате вызовов функций наследования приоритета или потолка " +"(например, смотрите B<pthread_mutexattr_setprioceiling>(3) и " +"B<pthread_mutexattr_setprotocol>(3))." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "RETURN VALUE" +msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"On success, these functions return 0; on error, they return a nonzero error " +"number. If B<pthread_setschedparam>() fails, the scheduling policy and " +"parameters of I<thread> are not changed." +msgstr "" +"При успешном выполнении эти функции возвращают 0; при ошибке возвращается " +"ненулевой номер ошибки. Если B<pthread_setschedparam>() завершается ошибкой, " +"то параметры и алгоритм планирования I<thread> не изменяется." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "ERRORS" +msgstr "ОШИБКИ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "Both of these functions can fail with the following error:" +msgstr "Это функции могут завершиться со следующей ошибкой:" + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "B<ESRCH>" +msgstr "B<ESRCH>" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "No thread with the ID I<thread> could be found." +msgstr "Нить с идентификатором I<thread> не найдена." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"B<pthread_setschedparam>() may additionally fail with the following errors:" +msgstr "" +"Функция B<pthread_setschedparam>() может также завершиться со следующими " +"ошибками:" + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "B<EINVAL>" +msgstr "B<EINVAL>" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"I<policy> is not a recognized policy, or I<param> does not make sense for " +"the I<policy>." +msgstr "" +"Неизвестное значение I<policy> или значение I<param> не имеет смысла для " +"I<policy>." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "B<EPERM>" +msgstr "B<EPERM>" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The caller does not have appropriate privileges to set the specified " +"scheduling policy and parameters." +msgstr "" +"Вызывающий не имеет соответствующих прав для установки указанного алгоритма " +"планирования и параметров." + +#. #-#-#-#-# archlinux: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# debian-bookworm: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. .SH VERSIONS +#. Available since glibc 2.0 +#. type: Plain text +#. #-#-#-#-# debian-unstable: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# fedora-40: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# fedora-rawhide: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# mageia-cauldron: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# opensuse-leap-15-6: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#. #-#-#-#-# opensuse-tumbleweed: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-# +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"POSIX.1 also documents an B<ENOTSUP> (\"attempt was made to set the policy " +"or scheduling parameters to an unsupported value\") error for " +"B<pthread_setschedparam>()." +msgstr "" +"Для B<pthread_setschedparam>() в POSIX.1 также описана необязательная ошибка " +"B<ENOTSUP> («попытка изменить параметры и алгоритм планирования на не " +"поддерживаемое значение»)." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "ATTRIBUTES" +msgstr "АТРИБУТЫ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"For an explanation of the terms used in this section, see B<attributes>(7)." +msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)." + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Interface" +msgstr "Интерфейс" + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Attribute" +msgstr "Атрибут" + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Value" +msgstr "Значение" + +#. type: tbl table +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed +#, no-wrap +msgid ".na\n" +msgstr ".na\n" + +#. type: tbl table +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed +#, no-wrap +msgid ".nh\n" +msgstr ".nh\n" + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "" +"B<pthread_setschedparam>(),\n" +"B<pthread_getschedparam>()" +msgstr "" +"B<pthread_setschedparam>(),\n" +"B<pthread_getschedparam>()" + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Thread safety" +msgstr "Безвредность в нитях" + +#. type: tbl table +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "MT-Safe" +msgstr "MT-Safe" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "STANDARDS" +msgstr "СТАНДАРТЫ" + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-leap-15-6 opensuse-tumbleweed +msgid "POSIX.1-2008." +msgstr "POSIX.1-2008." + +#. type: SH +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "HISTORY" +msgstr "ИСТОРИЯ" + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "glibc 2.1. C99, POSIX.1-2001." +msgid "glibc 2.0 POSIX.1-2001." +msgstr "glibc 2.1. C99, POSIX.1-2001." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "NOTES" +msgstr "ЗАМЕЧАНИЯ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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<sched>(7)." +msgstr "" +"Список требуемых прав, результат, изменение алгоритма и приоритета " +"планирования нити и подробности разрешённых диапазонов приоритетов для " +"каждого алгоритма планирования смотрите в B<sched>(7)." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "EXAMPLES" +msgstr "ПРИМЕРЫ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The program below demonstrates the use of B<pthread_setschedparam>() and " +"B<pthread_getschedparam>(), as well as the use of a number of other " +"scheduling-related pthreads functions." +msgstr "" +"Представленная ниже программа показывает использование " +"B<pthread_setschedparam>() и B<pthread_getschedparam>(), а также других " +"относящихся к планированию функций программного интерфейса pthreads." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"In the following run, the main thread sets its scheduling policy to " +"B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes " +"object with a scheduling policy attribute of B<SCHED_RR> and a scheduling " +"priority attribute of 20. The program then sets (using " +"B<pthread_attr_setinheritsched>(3)) the inherit scheduler attribute of the " +"thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, 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<SCHED_FIFO> с приоритетом 10, и инициализирует объект атрибутов нити с " +"атрибутом алгоритма планирования B<SCHED_RR> и атрибутом приоритета " +"планирования 20. Затем программа изменяет (с помощью " +"B<pthread_attr_setinheritsched>(3)) атрибут наследования планировщика в " +"объекте атрибутов нити на B<PTHREAD_EXPLICIT_SCHED>, из-за чего создаваемые " +"с использованием данного объекта атрибутов нити получат значения атрибуты " +"планирования из объекта атрибутов нити. Затем программа создаёт нить с " +"учётом объекта атрибутов нити, после чего эта нить выводит значения своего " +"алгоритма и приоритета планирования." + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed +#, fuzzy, 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" +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> # требуются права для назначения алгоритмов\n" +" планирования реального времени\n" +"Пароль:\n" +"# B<./a.out -mf10 -ar20 -i e>\n" +"Настройки планировщика главной нити\n" +" алгоритм=SCHED_FIFO, приоритет=10\n" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The next run is the same as the previous, except that the inherit scheduler " +"attribute is set to B<PTHREAD_INHERIT_SCHED>, 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<PTHREAD_INHERIT_SCHED>, то есть создаваемые с " +"использованием объекта атрибутов нити игнорируют значения параметров и " +"алгоритм планирования, заданные в объекте атрибутов нити, и берут их от " +"создавшей нити." + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: 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 "" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 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-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "Note that if we had omitted the I<-i\\ i> option, the output would have " +#| "been the same, since B<PTHREAD_INHERIT_SCHED> 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<PTHREAD_INHERIT_SCHED> is the default for the inherit " +"scheduler attribute." +msgstr "" +"Заметим, чти если не указать параметр I<-i\\ i>, то вывод будет тем же " +"самым, так как B<PTHREAD_INHERIT_SCHED> является значением по умолчанию для " +"атрибута наследования планировщика." + +#. type: SS +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Program source" +msgstr "Исходный код программы" + +#. type: Plain text +#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "" +"/* pthreads_sched_test.c */\n" +"\\&\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>pthread.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"#define handle_error_en(en, msg) \\e\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]\\en\", prog_name);\n" +" fprintf(stderr, \"Options are:\\en\");\n" +"#define fpe(msg) fprintf(stderr, \"\\et%s\", msg) /* Shorter */\n" +" fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n" +" fpe(\" thread attributes object\\en\");\n" +" fpe(\" E<lt>policyE<gt> can be\\en\");\n" +" fpe(\" f SCHED_FIFO\\en\");\n" +" fpe(\" r SCHED_RR\\en\");\n" +" fpe(\" o SCHED_OTHER\\en\");\n" +" fpe(\"-A Use default thread attributes object\\en\");\n" +" fpe(\"-i {e|i} Set inherit scheduler attribute to\\en\");\n" +" fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\en\");\n" +" fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n" +" fpe(\" main thread before pthread_create() call\\en\");\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\\en\",\n" +" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" +" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" +" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" +" \"???\",\n" +" param-E<gt>sched_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\\en\", 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\\en\");\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\\en\");\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)\\en\");\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(\"\\en\");\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]\\en\");\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)\\en\");\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]\\en\");\n" +" display_sched_attr(policy, ¶m);\n" +"\\&\n" +" pthread_attr_getinheritsched(&attr, &inheritsched);\n" +" printf(\" inheritsched is %s\\en\",\n" +" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" +" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" +" \"???\");\n" +" printf(\"\\en\");\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 "" + +#. SRC END +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "SEE ALSO" +msgstr "СМ. ТАКЖЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), " +"B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), " +"B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), " +"B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)" +msgstr "" +"B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), " +"B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), " +"B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), " +"B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)" + +#. type: TH +#: debian-bookworm +#, no-wrap +msgid "2023-02-05" +msgstr "5 февраля 2023 г." + +#. type: TH +#: debian-bookworm +#, no-wrap +msgid "Linux man-pages 6.03" +msgstr "Linux man-pages 6.03" + +#. type: Plain text +#: debian-bookworm +msgid "POSIX.1-2001, POSIX.1-2008." +msgstr "POSIX.1-2001, POSIX.1-2008." + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, 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" +msgstr "" +"$ B<su> # требуются права для назначения алгоритмов\n" +" планирования реального времени\n" +"Пароль:\n" +"# B<./a.out -mf10 -ar20 -i e>\n" +"Настройки планировщика главной нити\n" +" алгоритм=SCHED_FIFO, приоритет=10\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| "Scheduler settings in \\(aqattr\\(aq\n" +#| " policy=SCHED_RR, priority=20\n" +#| " inheritsched is EXPLICIT\n" +msgid "" +"Scheduler settings in \\[aq]attr\\[aq]\n" +" policy=SCHED_RR, priority=20\n" +" inheritsched is EXPLICIT\n" +msgstr "" +"Настройки планировщика в \\(aqattr\\(aq\n" +" алгоритм=SCHED_RR, приоритет=20\n" +" наследование планировщика ЯВНОЕ\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"Scheduler attributes of new thread\n" +" policy=SCHED_RR, priority=20\n" +msgstr "" +"Атрибуты планировщика в новой нити\n" +" алгоритм=SCHED_RR, приоритет=20\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"# B<./a.out -mf10 -ar20 -i i>\n" +"Scheduler settings of main thread\n" +" policy=SCHED_FIFO, priority=10\n" +msgstr "" +"# B<./a.out -mf10 -ar20 -i i>\n" +"Настройки планировщика главной нити\n" +" алгоритм=SCHED_FIFO, приоритет=10\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| "Scheduler settings in \\(aqattr\\(aq\n" +#| " policy=SCHED_RR, priority=20\n" +#| " inheritsched is INHERIT\n" +msgid "" +"Scheduler settings in \\[aq]attr\\[aq]\n" +" policy=SCHED_RR, priority=20\n" +" inheritsched is INHERIT\n" +msgstr "" +"Настройки планировщика в \\(aqattr\\(aq\n" +" алгоритм=SCHED_RR, приоритет=20\n" +" наследование планировщика ВКЛЮЧЕНО\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"Scheduler attributes of new thread\n" +" policy=SCHED_FIFO, priority=10\n" +msgstr "" +"Атрибуты планировщика в новой нити\n" +" алгоритм=SCHED_FIFO, приоритет=10\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "/* pthreads_sched_test.c */\n" +msgstr "/* pthreads_sched_test.c */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>pthread.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +msgstr "" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>pthread.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#define handle_error_en(en, msg) \\e\n" +" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" +msgstr "" +"#define handle_error_en(en, msg) \\e\n" +" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static void\n" +"usage(char *prog_name, char *msg)\n" +"{\n" +" if (msg != NULL)\n" +" fputs(msg, stderr);\n" +msgstr "" +"static void\n" +"usage(char *prog_name, char *msg)\n" +"{\n" +" if (msg != NULL)\n" +" fputs(msg, stderr);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " fprintf(stderr, \"Usage: %s [options]\\en\", prog_name);\n" +#| " fprintf(stderr, \"Options are:\\en\");\n" +#| "#define fpe(msg) fprintf(stderr, \"\\et%s\", msg); /* Shorter */\n" +#| " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n" +#| " fpe(\" thread attributes object\\en\");\n" +#| " fpe(\" E<lt>policyE<gt> can be\\en\");\n" +#| " fpe(\" f SCHED_FIFO\\en\");\n" +#| " fpe(\" r SCHED_RR\\en\");\n" +#| " fpe(\" o SCHED_OTHER\\en\");\n" +#| " fpe(\"-A Use default thread attributes object\\en\");\n" +#| " fpe(\"-i {e|i} Set inherit scheduler attribute to\\en\");\n" +#| " fpe(\" \\(aqexplicit\\(aq or \\(aqinherit\\(aq\\en\");\n" +#| " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n" +#| " fpe(\" main thread before pthread_create() call\\en\");\n" +#| " exit(EXIT_FAILURE);\n" +#| "}\n" +msgid "" +" fprintf(stderr, \"Usage: %s [options]\\en\", prog_name);\n" +" fprintf(stderr, \"Options are:\\en\");\n" +"#define fpe(msg) fprintf(stderr, \"\\et%s\", msg) /* Shorter */\n" +" fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n" +" fpe(\" thread attributes object\\en\");\n" +" fpe(\" E<lt>policyE<gt> can be\\en\");\n" +" fpe(\" f SCHED_FIFO\\en\");\n" +" fpe(\" r SCHED_RR\\en\");\n" +" fpe(\" o SCHED_OTHER\\en\");\n" +" fpe(\"-A Use default thread attributes object\\en\");\n" +" fpe(\"-i {e|i} Set inherit scheduler attribute to\\en\");\n" +" fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\en\");\n" +" fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n" +" fpe(\" main thread before pthread_create() call\\en\");\n" +" exit(EXIT_FAILURE);\n" +"}\n" +msgstr "" +" fprintf(stderr, \"Использование: %s [параметры]\\en\", prog_name);\n" +" fprintf(stderr, \"Параметры:\\en\");\n" +"#define fpe(msg) fprintf(stderr, \"\\et%s\", msg); /* для краткости */\n" +" fpe(\"-aE<lt>алгоритмE<gt>E<lt>приоритетE<gt> Алгоритм и приоритет планирования\\en\");\n" +" fpe(\" объекте атрибутов нити\\en\");\n" +" fpe(\" значения для E<lt>алгоритмE<gt>:\\en\");\n" +" fpe(\" f SCHED_FIFO\\en\");\n" +" fpe(\" r SCHED_RR\\en\");\n" +" fpe(\" o SCHED_OTHER\\en\");\n" +" fpe(\"-A Исп. объект атрибутов нити по умолчанию\\en\");\n" +" fpe(\"-i {e|i} Атрибут наследования планировщика\\en\");\n" +" fpe(\" \\(aqявный\\(aq or \\(aqунаследованный\\(aq\\en\");\n" +" fpe(\"-mE<lt>алгоритмE<gt>E<lt>приоритетE<gt> Алгоритм и приоритет планирования\\en\");\n" +" fpe(\" главной нити перед вызовом pthread_create()\\en\");\n" +" exit(EXIT_FAILURE);\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| "static int\n" +#| "get_policy(char p, int *policy)\n" +#| "{\n" +#| " switch (p) {\n" +#| " case \\(aqf\\(aq: *policy = SCHED_FIFO; return 1;\n" +#| " case \\(aqr\\(aq: *policy = SCHED_RR; return 1;\n" +#| " case \\(aqo\\(aq: *policy = SCHED_OTHER; return 1;\n" +#| " default: return 0;\n" +#| " }\n" +#| "}\n" +msgid "" +"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" +msgstr "" +"static int\n" +"get_policy(char p, int *policy)\n" +"{\n" +" switch (p) {\n" +" case \\(aqf\\(aq: *policy = SCHED_FIFO; return 1;\n" +" case \\(aqr\\(aq: *policy = SCHED_RR; return 1;\n" +" case \\(aqo\\(aq: *policy = SCHED_OTHER; return 1;\n" +" default: return 0;\n" +" }\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| "static void\n" +#| "display_sched_attr(int policy, struct sched_param *param)\n" +#| "{\n" +#| " printf(\" policy=%s, priority=%d\\en\",\n" +#| " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" +#| " (policy == SCHED_RR) ? \"SCHED_RR\" :\n" +#| " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" +#| " \"???\",\n" +#| " param-E<gt>sched_priority);\n" +#| "}\n" +msgid "" +"static void\n" +"display_sched_attr(int policy, struct sched_param *param)\n" +"{\n" +" printf(\" policy=%s, priority=%d\\en\",\n" +" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" +" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" +" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" +" \"???\",\n" +" param-E<gt>sched_priority);\n" +"}\n" +msgstr "" +"static void\n" +"display_sched_attr(int policy, struct sched_param *param)\n" +"{\n" +" printf(\" алгоритм=%s, приоритет=%d\\en\",\n" +" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" +" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" +" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" +" \"???\",\n" +" param-E<gt>sched_priority);\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static void\n" +"display_thread_sched_attr(char *msg)\n" +"{\n" +" int policy, s;\n" +" struct sched_param param;\n" +msgstr "" +"static void\n" +"display_thread_sched_attr(char *msg)\n" +"{\n" +" int policy, s;\n" +" struct sched_param param;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_getschedparam\");\n" +msgstr "" +" s = pthread_getschedparam(pthread_self(), &policy, ¶m);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_getschedparam\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" printf(\"%s\\en\", msg);\n" +" display_sched_attr(policy, ¶m);\n" +"}\n" +msgstr "" +" printf(\"%s\\en\", msg);\n" +" display_sched_attr(policy, ¶m);\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static void *\n" +"thread_start(void *arg)\n" +"{\n" +" display_thread_sched_attr(\"Scheduler attributes of new thread\");\n" +msgstr "" +"static void *\n" +"thread_start(void *arg)\n" +"{\n" +" display_thread_sched_attr(\"Атрибуты планировщика в новой нити\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" return NULL;\n" +"}\n" +msgstr "" +" return NULL;\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"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" +msgstr "" +"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" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid " /* Process command-line options */\n" +msgid " /* Process command-line options. */\n" +msgstr " /* обработка параметров командной строки */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" use_null_attrib = 0;\n" +" attr_sched_str = NULL;\n" +" main_sched_str = NULL;\n" +" inheritsched_str = NULL;\n" +msgstr "" +" use_null_attrib = 0;\n" +" attr_sched_str = NULL;\n" +" main_sched_str = NULL;\n" +" inheritsched_str = NULL;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" +#| " switch (opt) {\n" +#| " case \\(aqa\\(aq: attr_sched_str = optarg; break;\n" +#| " case \\(aqA\\(aq: use_null_attrib = 1; break;\n" +#| " case \\(aqi\\(aq: inheritsched_str = optarg; break;\n" +#| " case \\(aqm\\(aq: main_sched_str = optarg; break;\n" +#| " default: usage(argv[0], \"Unrecognized option\\en\");\n" +#| " }\n" +#| " }\n" +msgid "" +" 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\\en\");\n" +" }\n" +" }\n" +msgstr "" +" while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n" +" switch (opt) {\n" +" case \\(aqa\\(aq: attr_sched_str = optarg; break;\n" +" case \\(aqA\\(aq: use_null_attrib = 1; break;\n" +" case \\(aqi\\(aq: inheritsched_str = optarg; break;\n" +" case \\(aqm\\(aq: main_sched_str = optarg; break;\n" +" default: usage(argv[0], \"Неизвестный параметр\\en\");\n" +" }\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " if (use_null_attrib &&\n" +#| " (inheritsched_str != NULL || attr_sched_str != NULL))\n" +#| " usage(argv[0], \"Can\\(aqt specify -A with -i or -a\\en\");\n" +msgid "" +" 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\\en\");\n" +" }\n" +msgstr "" +" if (use_null_attrib &&\n" +" (inheritsched_str != NULL || attr_sched_str != NULL))\n" +" usage(argv[0], \"Нельзя указывать -A вместе с -i или -a\\en\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " /* Optionally set scheduling attributes of main thread,\n" +#| " and display the attributes */\n" +msgid "" +" /* Optionally set scheduling attributes of main thread,\n" +" and display the attributes. */\n" +msgstr "" +" /* необязательная установка атрибутов планирования главной нити\n" +" вывод этих атрибутов */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (main_sched_str != NULL) {\n" +" if (!get_policy(main_sched_str[0], &policy))\n" +" usage(argv[0], \"Bad policy for main thread (-m)\\en\");\n" +" param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" +msgstr "" +" if (main_sched_str != NULL) {\n" +" if (!get_policy(main_sched_str[0], &policy))\n" +" usage(argv[0], \"Некоррект. алгоритм для главной нити (-m)\\en\");\n" +" param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_setschedparam\");\n" +" }\n" +msgstr "" +" s = pthread_setschedparam(pthread_self(), policy, ¶m);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_setschedparam\");\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" display_thread_sched_attr(\"Scheduler settings of main thread\");\n" +" printf(\"\\en\");\n" +msgstr "" +" display_thread_sched_attr(\"Настройки планировщика главной нити\");\n" +" printf(\"\\en\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid " /* Initialize thread attributes object according to options */\n" +msgid " /* Initialize thread attributes object according to options. */\n" +msgstr " /* инициализация объекта атрибутов нити согласно параметрам */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " attrp = NULL;\n" +msgstr " attrp = NULL;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" 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" +msgstr "" +" 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" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " if (inheritsched_str != NULL) {\n" +#| " if (inheritsched_str[0] == \\(aqe\\(aq)\n" +#| " inheritsched = PTHREAD_EXPLICIT_SCHED;\n" +#| " else if (inheritsched_str[0] == \\(aqi\\(aq)\n" +#| " inheritsched = PTHREAD_INHERIT_SCHED;\n" +#| " else\n" +#| " usage(argv[0], \"Value for -i must be \\(aqe\\(aq or \\(aqi\\(aq\\en\");\n" +msgid "" +" 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]\\en\");\n" +msgstr "" +" if (inheritsched_str != NULL) {\n" +" if (inheritsched_str[0] == \\(aqe\\(aq)\n" +" inheritsched = PTHREAD_EXPLICIT_SCHED;\n" +" else if (inheritsched_str[0] == \\(aqi\\(aq)\n" +" inheritsched = PTHREAD_INHERIT_SCHED;\n" +" else\n" +" usage(argv[0], \"Значение -i должно быть \\(aqe\\(aq или \\(aqi\\(aq\\en\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" s = pthread_attr_setinheritsched(&attr, inheritsched);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_attr_setinheritsched\");\n" +" }\n" +msgstr "" +" s = pthread_attr_setinheritsched(&attr, inheritsched);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_attr_setinheritsched\");\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " if (attr_sched_str != NULL) {\n" +#| " if (!get_policy(attr_sched_str[0], &policy))\n" +#| " usage(argv[0],\n" +#| " \"Bad policy for \\(aqattr\\(aq (-a)\\en\");\n" +#| " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" +msgid "" +" 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)\\en\");\n" +" param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" +msgstr "" +" if (attr_sched_str != NULL) {\n" +" if (!get_policy(attr_sched_str[0], &policy))\n" +" usage(argv[0],\n" +" \"Некорректный алгоритм для \\(aqattr\\(aq (-a)\\en\");\n" +" param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" 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" +msgstr "" +" 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" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " /* If we initialized a thread attributes object, display\n" +#| " the scheduling attributes that were set in the object */\n" +msgid "" +" /* If we initialized a thread attributes object, display\n" +" the scheduling attributes that were set in the object. */\n" +msgstr "" +" /* если мы инициализируем объект атрибутов нити, то покажем\n" +" атрибуты планирования, установленные в объекте */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" 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" +msgstr "" +" 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" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " printf(\"Scheduler settings in \\(aqattr\\(aq\\en\");\n" +#| " display_sched_attr(policy, ¶m);\n" +msgid "" +" printf(\"Scheduler settings in \\[aq]attr\\[aq]\\en\");\n" +" display_sched_attr(policy, ¶m);\n" +msgstr "" +" printf(\"Настройки планировщика в \\(aqattr\\(aq\\en\");\n" +" display_sched_attr(policy, ¶m);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid "" +#| " s = pthread_attr_getinheritsched(&attr, &inheritsched);\n" +#| " printf(\" inheritsched is %s\\en\",\n" +#| " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" +#| " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" +#| " \"???\");\n" +#| " printf(\"\\en\");\n" +#| " }\n" +msgid "" +" pthread_attr_getinheritsched(&attr, &inheritsched);\n" +" printf(\" inheritsched is %s\\en\",\n" +" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" +" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" +" \"???\");\n" +" printf(\"\\en\");\n" +" }\n" +msgstr "" +" s = pthread_attr_getinheritsched(&attr, &inheritsched);\n" +" printf(\" наследование планировщика %s\\en\",\n" +" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"ВКЛЮЧЕНО\" :\n" +" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"ЯВНОЕ\" :\n" +" \"???\");\n" +" printf(\"\\en\");\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid " /* Create a thread that will display its scheduling attributes */\n" +msgid " /* Create a thread that will display its scheduling attributes. */\n" +msgstr " /* создаём нить, которая покажет свои атрибуты планирования */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" s = pthread_create(&thread, attrp, &thread_start, NULL);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_create\");\n" +msgstr "" +" s = pthread_create(&thread, attrp, &thread_start, NULL);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_create\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, fuzzy, no-wrap +#| msgid " /* Destroy unneeded thread attributes object */\n" +msgid " /* Destroy unneeded thread attributes object. */\n" +msgstr " /* уничтожаем ненужный объект атрибутов нити */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (!use_null_attrib) {\n" +" s = pthread_attr_destroy(&attr);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_attr_destroy\");\n" +" }\n" +msgstr "" +" if (!use_null_attrib) {\n" +" s = pthread_attr_destroy(&attr);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_attr_destroy\");\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" s = pthread_join(thread, NULL);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_join\");\n" +msgstr "" +" s = pthread_join(thread, NULL);\n" +" if (s != 0)\n" +" handle_error_en(s, \"pthread_join\");\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" +" exit(EXIT_SUCCESS);\n" +"}\n" + +#. type: TH +#: debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "2023-07-20" +msgstr "20 июля 2023 г." + +#. type: TH +#: debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "Linux man-pages 6.05.01" +msgstr "Linux man-pages 6.05.01" + +#. type: Plain text +#: debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "" +"/* pthreads_sched_test.c */\n" +"\\&\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>pthread.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"#define handle_error_en(en, msg) \\e\n" +" do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n" +"\\&\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]\\en\", prog_name);\n" +" fprintf(stderr, \"Options are:\\en\");\n" +"#define fpe(msg) fprintf(stderr, \"\\et%s\", msg) /* Shorter */\n" +" fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\en\");\n" +" fpe(\" thread attributes object\\en\");\n" +" fpe(\" E<lt>policyE<gt> can be\\en\");\n" +" fpe(\" f SCHED_FIFO\\en\");\n" +" fpe(\" r SCHED_RR\\en\");\n" +" fpe(\" o SCHED_OTHER\\en\");\n" +" fpe(\"-A Use default thread attributes object\\en\");\n" +" fpe(\"-i {e|i} Set inherit scheduler attribute to\\en\");\n" +" fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\en\");\n" +" fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\en\");\n" +" fpe(\" main thread before pthread_create() call\\en\");\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, struct sched_param *param)\n" +"{\n" +" printf(\" policy=%s, priority=%d\\en\",\n" +" (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" +" (policy == SCHED_RR) ? \"SCHED_RR\" :\n" +" (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" +" \"???\",\n" +" param-E<gt>sched_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\\en\", 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\\en\");\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\\en\");\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)\\en\");\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(\"\\en\");\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]\\en\");\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)\\en\");\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]\\en\");\n" +" display_sched_attr(policy, ¶m);\n" +"\\&\n" +" pthread_attr_getinheritsched(&attr, &inheritsched);\n" +" printf(\" inheritsched is %s\\en\",\n" +" (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n" +" (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n" +" \"???\");\n" +" printf(\"\\en\");\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 "" + +#. type: TH +#: opensuse-leap-15-6 +#, no-wrap +msgid "2023-03-30" +msgstr "30 марта 2023 г." + +#. type: TH +#: opensuse-leap-15-6 +#, no-wrap +msgid "Linux man-pages 6.04" +msgstr "Linux man-pages 6.04" |