Debian Codegraph @

po/ru/man3/pthread_setschedparam.3.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Alexey, 2016.
5 # Azamat Hackimov <[email protected]>, 2014-2017.
6 # kogamatranslator49 <[email protected]>, 2015.
7 # Darima Kogan <[email protected]>, 2014.
8 # Max Is <[email protected]>, 2016.
9 # Yuri Kozlov <[email protected]>, 2011-2019.
10 # Иван Павлов <[email protected]>, 2017.
11 msgid ""
12 msgstr ""
13 "Project-Id-Version: manpages-l10n\n"
14 "POT-Creation-Date: 2026-06-05 06:38+0200\n"
15 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
16 "Last-Translator: Yuri Kozlov <[email protected]>\n"
17 "Language-Team: Russian <[email protected]>\n"
18 "Language: ru\n"
19 "MIME-Version: 1.0\n"
20 "Content-Type: text/plain; charset=UTF-8\n"
21 "Content-Transfer-Encoding: 8bit\n"
22 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
23 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
24 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
25 "X-Generator: Lokalize 2.0\n"
26
27 #. type: TH
28 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
29 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
30 #, fuzzy, no-wrap
31 #| msgid "See B<pthread_setschedparam>(3)."
32 msgid "pthread_setschedparam"
33 msgstr "Смотрите B<pthread_setschedparam>(3)."
34
35 #. type: TH
36 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
37 #: opensuse-tumbleweed
38 #, no-wrap
39 msgid "2025-09-21"
40 msgstr "21 сентября 2025 г."
41
42 #. type: TH
43 #: archlinux debian-unstable
44 #, fuzzy, no-wrap
45 #| msgid "Linux man-pages 6.17"
46 msgid "Linux man-pages 6.18"
47 msgstr "Справочные страницы Linux 6.17"
48
49 #. type: SH
50 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
51 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
52 #, no-wrap
53 msgid "NAME"
54 msgstr "НАИМЕНОВАНИЕ"
55
56 #. type: Plain text
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 msgid ""
60 "pthread_setschedparam, pthread_getschedparam - set/get scheduling policy and "
61 "parameters of a thread"
62 msgstr ""
63 "pthread_setschedparam, pthread_getschedparam - изменяет/возвращает параметры "
64 "и алгоритм планирования нити"
65
66 #. type: SH
67 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
68 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
69 #, no-wrap
70 msgid "LIBRARY"
71 msgstr "БИБЛИОТЕКА"
72
73 #. type: Plain text
74 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
75 #: opensuse-leap-16-1 opensuse-tumbleweed
76 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
77 msgstr "Библиотека потоков POSIX (I<libpthread>,\\ I<-lpthread>)"
78
79 #. type: SH
80 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
81 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
82 #, no-wrap
83 msgid "SYNOPSIS"
84 msgstr "СИНТАКСИС"
85
86 #. type: Plain text
87 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
88 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
89 #, no-wrap
90 msgid "B<#include E<lt>pthread.hE<gt>>\n"
91 msgstr "B<#include E<lt>pthread.hE<gt>>\n"
92
93 #. type: Plain text
94 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
95 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
96 #, fuzzy, no-wrap
97 #| msgid ""
98 #| "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
99 #| "B< const struct sched_param *>I<param>B<);>\n"
100 #| "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n"
101 #| "B< struct sched_param *>I<param>B<);>\n"
102 msgid ""
103 "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
104 "B< const struct sched_param *>I<param>B<);>\n"
105 "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *restrict >I<policy>B<,>\n"
106 "B< struct sched_param *restrict >I<param>B<);>\n"
107 msgstr ""
108 "B<int pthread_setschedparam(pthread_t >I<thread>B<, int >I<policy>B<,>\n"
109 "B< const struct sched_param *>I<param>B<);>\n"
110 "B<int pthread_getschedparam(pthread_t >I<thread>B<, int *>I<policy>B<,>\n"
111 "B< struct sched_param *>I<param>B<);>\n"
112
113 #. type: SH
114 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
115 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
116 #, no-wrap
117 msgid "DESCRIPTION"
118 msgstr "ОПИСАНИЕ"
119
120 #. type: Plain text
121 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
122 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
123 msgid ""
124 "The B<pthread_setschedparam>() function sets the scheduling policy and "
125 "parameters of the thread I<thread>."
126 msgstr ""
127 "Функция B<pthread_setschedparam>() назначает параметры и алгоритм "
128 "планирования нити I<thread>."
129
130 #. FIXME . pthread_setschedparam() places no restriction on the policy,
131 #. but pthread_attr_setschedpolicy() restricts policy to RR/FIFO/OTHER
132 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7013
133 #. type: Plain text
134 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
135 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
136 msgid ""
137 "I<policy> specifies the new scheduling policy for I<thread>. The supported "
138 "values for I<policy>, and their semantics, are described in B<sched>(7)."
139 msgstr ""
140 "В I<policy> указывается новый алгоритм планирования I<thread>. "
141 "Поддерживаемые значения I<policy> и их семантика описана в B<sched>(7)."
142
143 #. type: Plain text
144 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
145 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
146 msgid ""
147 "The structure pointed to by I<param> specifies the new scheduling parameters "
148 "for I<thread>. Scheduling parameters are maintained in the following "
149 "structure:"
150 msgstr ""
151 "Структура, на которую указывает I<param> определяет новые параметры "
152 "планирования I<thread>. Параметры планирования хранятся в структуре "
153 "следующего вида:"
154
155 #. type: Plain text
156 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
157 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
158 #, no-wrap
159 msgid ""
160 "struct sched_param {\n"
161 " int sched_priority; /* Scheduling priority */\n"
162 "};\n"
163 msgstr ""
164 "struct sched_param {\n"
165 " int sched_priority; /* планируемый приоритет */\n"
166 "};\n"
167
168 #. type: Plain text
169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
171 msgid ""
172 "As can be seen, only one scheduling parameter is supported. For details of "
173 "the permitted ranges for scheduling priorities in each scheduling policy, "
174 "see B<sched>(7)."
175 msgstr ""
176 "Из той структуры видно, что поддерживается только один параметр. Подробности "
177 "о разрешённых диапазонах планируемых приоритетов для каждого алгоритма "
178 "планирования смотрите в B<sched>(7)."
179
180 #. #-#-#-#-# archlinux: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
181 #. FIXME . nptl/pthread_setschedparam.c has the following
182 #. /* If the thread should have higher priority because of some
183 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
184 #. Eventually (perhaps after writing the mutexattr pages), we
185 #. may want to add something on the topic to this page.
186 #. type: Plain text
187 #. #-#-#-#-# debian-trixie: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
188 #. FIXME . nptl/pthread_setschedparam.c has the following
189 #. /* If the thread should have higher priority because of some
190 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
191 #. Eventually (perhaps after writing the mutexattr pages), we
192 #. may want to add something on the topic to this page.
193 #. type: Plain text
194 #. #-#-#-#-# debian-unstable: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
195 #. FIXME . nptl/pthread_setschedparam.c has the following
196 #. /* If the thread should have higher priority because of some
197 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
198 #. Eventually (perhaps after writing the mutexattr pages), we
199 #. may want to add something on the topic to this page.
200 #. type: Plain text
201 #. #-#-#-#-# fedora-44: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
202 #. FIXME . nptl/pthread_setschedparam.c has the following
203 #. /* If the thread should have higher priority because of some
204 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
205 #. Eventually (perhaps after writing the mutexattr pages), we
206 #. may want to add something on the topic to this page.
207 #. type: Plain text
208 #. #-#-#-#-# fedora-rawhide: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
209 #. FIXME . nptl/pthread_setschedparam.c has the following
210 #. /* If the thread should have higher priority because of some
211 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
212 #. Eventually (perhaps after writing the mutexattr pages), we
213 #. may want to add something on the topic to this page.
214 #. type: Plain text
215 #. #-#-#-#-# mageia-cauldron: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
216 #. FIXME . nptl/pthread_setschedparam.c has the following
217 #. /* If the thread should have higher priority because of some
218 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
219 #. Eventually (perhaps after writing the mutexattr pages), we
220 #. may want to add something on the topic to this page.
221 #. type: Plain text
222 #. #-#-#-#-# opensuse-leap-16-1: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
223 #. FIXME . nptl/pthread_setschedparam.c has the following
224 #. /* If the thread should have higher priority because of some
225 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
226 #. Eventually (perhaps after writing the mutexattr pages), we
227 #. may want to add something on the topic to this page.
228 #. type: Plain text
229 #. #-#-#-#-# opensuse-tumbleweed: pthread_setschedparam.3.pot (PACKAGE VERSION) #-#-#-#-#
230 #. FIXME . nptl/pthread_setschedparam.c has the following
231 #. /* If the thread should have higher priority because of some
232 #. PTHREAD_PRIO_PROTECT mutexes it holds, adjust the priority. */
233 #. Eventually (perhaps after writing the mutexattr pages), we
234 #. may want to add something on the topic to this page.
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid ""
239 "The B<pthread_getschedparam>() function returns the scheduling policy and "
240 "parameters of the thread I<thread>, in the buffers pointed to by I<policy> "
241 "and I<param>, respectively. The returned priority value is that set by the "
242 "most recent B<pthread_setschedparam>(), B<pthread_setschedprio>(3), or "
243 "B<pthread_create>(3) call that affected I<thread>. The returned priority "
244 "does not reflect any temporary priority adjustments as a result of calls to "
245 "any priority inheritance or priority ceiling functions (see, for example, "
246 "B<pthread_mutexattr_setprioceiling>(3) and "
247 "B<pthread_mutexattr_setprotocol>(3))."
248 msgstr ""
249 "Функция B<pthread_getschedparam>() возвращает параметры и алгоритм "
250 "планирования нити I<thread> в буфер, указанный I<policy> и I<param>, "
251 "соответственно. Возвращаемое значение приоритета совпадает с заданным с "
252 "помощью последнего вызова B<pthread_setschedparam>(), "
253 "B<pthread_setschedprio>(3) или B<pthread_create>(3), относящегося к "
254 "I<thread>. Возвращаемые приоритет не отражает каких-либо временных подстроек "
255 "приоритета в результате вызовов функций наследования приоритета или потолка "
256 "(например, смотрите B<pthread_mutexattr_setprioceiling>(3) и "
257 "B<pthread_mutexattr_setprotocol>(3))."
258
259 #. type: SH
260 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
261 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
262 #, no-wrap
263 msgid "RETURN VALUE"
264 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
265
266 #. type: Plain text
267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
269 msgid ""
270 "On success, these functions return 0; on error, they return a nonzero error "
271 "number. If B<pthread_setschedparam>() fails, the scheduling policy and "
272 "parameters of I<thread> are not changed."
273 msgstr ""
274 "При успешном выполнении эти функции возвращают 0; при ошибке возвращается "
275 "ненулевой номер ошибки. Если B<pthread_setschedparam>() завершается ошибкой, "
276 "то параметры и алгоритм планирования I<thread> не изменяется."
277
278 #. type: SH
279 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
280 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
281 #, no-wrap
282 msgid "ERRORS"
283 msgstr "ОШИБКИ"
284
285 #. type: Plain text
286 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
287 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
288 msgid "Both of these functions can fail with the following error:"
289 msgstr "Это функции могут завершиться со следующей ошибкой:"
290
291 #. type: TP
292 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
293 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
294 #, no-wrap
295 msgid "B<ESRCH>"
296 msgstr "B<ESRCH>"
297
298 #. type: Plain text
299 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
300 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
301 msgid "No thread with the ID I<thread> could be found."
302 msgstr "Нить с идентификатором I<thread> не найдена."
303
304 #. type: Plain text
305 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
306 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
307 msgid ""
308 "B<pthread_setschedparam>() may additionally fail with the following errors:"
309 msgstr ""
310 "Функция B<pthread_setschedparam>() может также завершиться со следующими "
311 "ошибками:"
312
313 #. type: TP
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 #, no-wrap
317 msgid "B<EINVAL>"
318 msgstr "B<EINVAL>"
319
320 #. type: Plain text
321 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
322 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
323 msgid ""
324 "I<policy> is not a recognized policy, or I<param> does not make sense for "
325 "the I<policy>."
326 msgstr ""
327 "Неизвестное значение I<policy> или значение I<param> не имеет смысла для "
328 "I<policy>."
329
330 #. type: TP
331 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
332 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
333 #, no-wrap
334 msgid "B<EPERM>"
335 msgstr "B<EPERM>"
336
337 #. type: Plain text
338 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
339 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
340 msgid ""
341 "The caller does not have appropriate privileges to set the specified "
342 "scheduling policy and parameters."
343 msgstr ""
344 "Вызывающий не имеет соответствующих прав для установки указанного алгоритма "
345 "планирования и параметров."
346
347 #. type: Plain text
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 msgid ""
351 "POSIX.1 also documents an B<ENOTSUP> (\"attempt was made to set the policy "
352 "or scheduling parameters to an unsupported value\") error for "
353 "B<pthread_setschedparam>()."
354 msgstr ""
355 "Для B<pthread_setschedparam>() в POSIX.1 также описана необязательная ошибка "
356 "B<ENOTSUP> («попытка изменить параметры и алгоритм планирования на не "
357 "поддерживаемое значение»)."
358
359 #. type: SH
360 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
361 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
362 #, no-wrap
363 msgid "ATTRIBUTES"
364 msgstr "АТРИБУТЫ"
365
366 #. type: Plain text
367 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
368 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
369 msgid ""
370 "For an explanation of the terms used in this section, see B<attributes>(7)."
371 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
372
373 #. type: tbl table
374 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
375 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
376 #, no-wrap
377 msgid "Interface"
378 msgstr "Интерфейс"
379
380 #. type: tbl table
381 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
382 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
383 #, no-wrap
384 msgid "Attribute"
385 msgstr "Атрибут"
386
387 #. type: tbl table
388 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
389 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
390 #, no-wrap
391 msgid "Value"
392 msgstr "Значение"
393
394 #. type: tbl table
395 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
396 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
397 #, no-wrap
398 msgid ".na\n"
399 msgstr ".na\n"
400
401 #. type: tbl table
402 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
403 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
404 #, no-wrap
405 msgid ".nh\n"
406 msgstr ".nh\n"
407
408 #. type: tbl table
409 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
410 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
411 #, no-wrap
412 msgid ""
413 "B<pthread_setschedparam>(),\n"
414 "B<pthread_getschedparam>()"
415 msgstr ""
416 "B<pthread_setschedparam>(),\n"
417 "B<pthread_getschedparam>()"
418
419 #. type: tbl table
420 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
421 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
422 #, no-wrap
423 msgid "Thread safety"
424 msgstr "Безвредность в нитях"
425
426 #. type: tbl table
427 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
428 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
429 #, no-wrap
430 msgid "MT-Safe"
431 msgstr "MT-Safe"
432
433 #. type: SH
434 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
435 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
436 #, no-wrap
437 msgid "STANDARDS"
438 msgstr "СТАНДАРТЫ"
439
440 #. type: Plain text
441 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
442 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
443 msgid "POSIX.1-2008."
444 msgstr "POSIX.1-2008."
445
446 #. type: SH
447 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
448 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
449 #, no-wrap
450 msgid "HISTORY"
451 msgstr "ИСТОРИЯ"
452
453 #. type: Plain text
454 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
455 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
456 msgid "glibc 2.0 POSIX.1-2001."
457 msgstr "glibc 2.0 POSIX.1-2001."
458
459 #. type: SH
460 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
461 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
462 #, no-wrap
463 msgid "NOTES"
464 msgstr "ПРИМЕЧАНИЯ"
465
466 #. type: Plain text
467 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
468 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
469 msgid ""
470 "For a description of the permissions required to, and the effect of, "
471 "changing a thread's scheduling policy and priority, and details of the "
472 "permitted ranges for priorities in each scheduling policy, see B<sched>(7)."
473 msgstr ""
474 "Список требуемых прав, результат, изменение алгоритма и приоритета "
475 "планирования нити и подробности разрешённых диапазонов приоритетов для "
476 "каждого алгоритма планирования смотрите в B<sched>(7)."
477
478 #. type: SH
479 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
480 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
481 #, no-wrap
482 msgid "EXAMPLES"
483 msgstr "ПРИМЕРЫ"
484
485 #. type: Plain text
486 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
487 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
488 msgid ""
489 "The program below demonstrates the use of B<pthread_setschedparam>() and "
490 "B<pthread_getschedparam>(), as well as the use of a number of other "
491 "scheduling-related pthreads functions."
492 msgstr ""
493 "Представленная ниже программа показывает использование "
494 "B<pthread_setschedparam>() и B<pthread_getschedparam>(), а также других "
495 "относящихся к планированию функций программного интерфейса pthreads."
496
497 #. type: Plain text
498 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
499 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
500 msgid ""
501 "In the following run, the main thread sets its scheduling policy to "
502 "B<SCHED_FIFO> with a priority of 10, and initializes a thread attributes "
503 "object with a scheduling policy attribute of B<SCHED_RR> and a scheduling "
504 "priority attribute of 20. The program then sets (using "
505 "B<pthread_attr_setinheritsched>(3)) the inherit scheduler attribute of the "
506 "thread attributes object to B<PTHREAD_EXPLICIT_SCHED>, meaning that threads "
507 "created using this attributes object should take their scheduling attributes "
508 "from the thread attributes object. The program then creates a thread using "
509 "the thread attributes object, and that thread displays its scheduling policy "
510 "and priority."
511 msgstr ""
512 "В этом сеансе, главная нить изменяет свой алгоритм планирования на "
513 "B<SCHED_FIFO> с приоритетом 10, и инициализирует объект атрибутов нити с "
514 "атрибутом алгоритма планирования B<SCHED_RR> и атрибутом приоритета "
515 "планирования 20. Затем программа изменяет (с помощью "
516 "B<pthread_attr_setinheritsched>(3)) атрибут наследования планировщика в "
517 "объекте атрибутов нити на B<PTHREAD_EXPLICIT_SCHED>, из-за чего создаваемые "
518 "с использованием данного объекта атрибутов нити получат значения атрибуты "
519 "планирования из объекта атрибутов нити. Затем программа создаёт нить с "
520 "учётом объекта атрибутов нити, после чего эта нить выводит значения своего "
521 "алгоритма и приоритета планирования."
522
523 #. type: Plain text
524 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
525 #: opensuse-tumbleweed
526 #, fuzzy, no-wrap
527 #| msgid ""
528 #| "$ B<su> # Need privilege to set real-time scheduling policies\n"
529 #| "Password:\n"
530 #| "# B<./a.out -mf10 -ar20 -i e>\n"
531 #| "Scheduler settings of main thread\n"
532 #| " policy=SCHED_FIFO, priority=10\n"
533 msgid ""
534 "$B< su>; # Need privilege to set real-time scheduling policies\n"
535 "Password:\n"
536 "#B< ./a.out -mf10 -ar20 -i e>;\n"
537 "Scheduler settings of main thread\n"
538 " policy=SCHED_FIFO, priority=10\n"
539 "\\&\n"
540 "Scheduler settings in \\[aq]attr\\[aq]\n"
541 " policy=SCHED_RR, priority=20\n"
542 " inheritsched is EXPLICIT\n"
543 "\\&\n"
544 "Scheduler attributes of new thread\n"
545 " policy=SCHED_RR, priority=20\n"
546 msgstr ""
547 "$ B<su> # требуются права для назначения алгоритмов\n"
548 " планирования реального времени\n"
549 "Пароль:\n"
550 "# B<./a.out -mf10 -ar20 -i e>\n"
551 "Настройки планировщика главной нити\n"
552 " алгоритм=SCHED_FIFO, приоритет=10\n"
553
554 #. type: Plain text
555 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
556 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
557 msgid ""
558 "In the above output, one can see that the scheduling policy and priority "
559 "were taken from the values specified in the thread attributes object."
560 msgstr ""
561 "В показанном выше выводе можно видеть приоритет и алгоритм планирования, "
562 "которые были взяты из объекта атрибутов нити."
563
564 #. type: Plain text
565 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
566 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
567 msgid ""
568 "The next run is the same as the previous, except that the inherit scheduler "
569 "attribute is set to B<PTHREAD_INHERIT_SCHED>, meaning that threads created "
570 "using the thread attributes object should ignore the scheduling attributes "
571 "specified in the attributes object and instead take their scheduling "
572 "attributes from the creating thread."
573 msgstr ""
574 "Следующий сеанс похож на предыдущий, то в нём атрибут наследования "
575 "планировщика равен B<PTHREAD_INHERIT_SCHED>, то есть создаваемые с "
576 "использованием объекта атрибутов нити игнорируют значения параметров и "
577 "алгоритм планирования, заданные в объекте атрибутов нити, и берут их от "
578 "создавшей нити."
579
580 #. type: Plain text
581 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
582 #: opensuse-tumbleweed
583 #, fuzzy, no-wrap
584 #| msgid ""
585 #| "$ B<su> # Need privilege to set real-time scheduling policies\n"
586 #| "Password:\n"
587 #| "# B<./a.out -mf10 -ar20 -i e>\n"
588 #| "Scheduler settings of main thread\n"
589 #| " policy=SCHED_FIFO, priority=10\n"
590 msgid ""
591 "#B< ./a.out -mf10 -ar20 -i i>;\n"
592 "Scheduler settings of main thread\n"
593 " policy=SCHED_FIFO, priority=10\n"
594 "\\&\n"
595 "Scheduler settings in \\[aq]attr\\[aq]\n"
596 " policy=SCHED_RR, priority=20\n"
597 " inheritsched is INHERIT\n"
598 "\\&\n"
599 "Scheduler attributes of new thread\n"
600 " policy=SCHED_FIFO, priority=10\n"
601 msgstr ""
602 "$ B<su> # требуются права для назначения алгоритмов\n"
603 " планирования реального времени\n"
604 "Пароль:\n"
605 "# B<./a.out -mf10 -ar20 -i e>\n"
606 "Настройки планировщика главной нити\n"
607 " алгоритм=SCHED_FIFO, приоритет=10\n"
608
609 #. type: Plain text
610 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
611 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
612 msgid ""
613 "In the above output, one can see that the scheduling policy and priority "
614 "were taken from the creating thread, rather than the thread attributes "
615 "object."
616 msgstr ""
617 "В показанном выше выводе можно видеть приоритет и алгоритм планирования, "
618 "которые были взяты из создаваемой нити, а не из объекта атрибутов нити."
619
620 #. type: Plain text
621 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
622 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
623 #, fuzzy
624 #| msgid ""
625 #| "Note that if we had omitted the I<-i\\ i> option, the output would have "
626 #| "been the same, since B<PTHREAD_INHERIT_SCHED> is the default for the "
627 #| "inherit scheduler attribute."
628 msgid ""
629 "Note that if we had omitted the I<-i\\ i> option, the output would have been "
630 "the same, since B<PTHREAD_INHERIT_SCHED> is the default for the inherit "
631 "scheduler attribute."
632 msgstr ""
633 "Заметим, чти если не указать параметр I<-i\\ i>, то вывод будет тем же "
634 "самым, так как B<PTHREAD_INHERIT_SCHED> является значением по умолчанию для "
635 "атрибута наследования планировщика."
636
637 #. type: SS
638 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
639 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
640 #, no-wrap
641 msgid "Program source"
642 msgstr "Исходный код программы"
643
644 #. type: Plain text
645 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
646 #: opensuse-tumbleweed
647 #, no-wrap
648 msgid ""
649 "/* pthreads_sched_test.c */\n"
650 "\\&\n"
651 "#include E<lt>err.hE<gt>\n"
652 "#include E<lt>errno.hE<gt>\n"
653 "#include E<lt>pthread.hE<gt>\n"
654 "#include E<lt>stdio.hE<gt>\n"
655 "#include E<lt>stdlib.hE<gt>\n"
656 "#include E<lt>unistd.hE<gt>\n"
657 "\\&\n"
658 "[[noreturn]]\n"
659 "static void\n"
660 "usage(char *prog_name, char *msg)\n"
661 "{\n"
662 " if (msg != NULL)\n"
663 " fputs(msg, stderr);\n"
664 "\\&\n"
665 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
666 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
667 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
668 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\[rs]n\");\n"
669 " fpe(\" thread attributes object\\[rs]n\");\n"
670 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
671 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
672 " fpe(\" r SCHED_RR\\[rs]n\");\n"
673 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
674 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
675 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
676 " fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\[rs]n\");\n"
677 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\[rs]n\");\n"
678 " fpe(\" main thread before pthread_create() call\\[rs]n\");\n"
679 " exit(EXIT_FAILURE);\n"
680 "}\n"
681 "\\&\n"
682 "static int\n"
683 "get_policy(char p, int *policy)\n"
684 "{\n"
685 " switch (p) {\n"
686 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
687 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
688 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
689 " default: return 0;\n"
690 " }\n"
691 "}\n"
692 "\\&\n"
693 "static void\n"
694 "display_sched_attr(int policy, const struct sched_param *param)\n"
695 "{\n"
696 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
697 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
698 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
699 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
700 " \"???\",\n"
701 " param-E<gt>sched_priority);\n"
702 "}\n"
703 "\\&\n"
704 "static void\n"
705 "display_thread_sched_attr(char *msg)\n"
706 "{\n"
707 " int policy, s;\n"
708 " struct sched_param param;\n"
709 "\\&\n"
710 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
711 " if (s != 0)\n"
712 " errc(EXIT_FAILURE, s, \"pthread_getschedparam\");\n"
713 "\\&\n"
714 " printf(\"%s\\[rs]n\", msg);\n"
715 " display_sched_attr(policy, &param);\n"
716 "}\n"
717 "\\&\n"
718 "static void *\n"
719 "thread_start(void *arg)\n"
720 "{\n"
721 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
722 "\\&\n"
723 " return NULL;\n"
724 "}\n"
725 "\\&\n"
726 "int\n"
727 "main(int argc, char *argv[])\n"
728 "{\n"
729 " int s, opt, inheritsched, use_null_attrib, policy;\n"
730 " pthread_t thread;\n"
731 " pthread_attr_t attr;\n"
732 " pthread_attr_t *attrp;\n"
733 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
734 " struct sched_param param;\n"
735 "\\&\n"
736 " /* Process command-line options. */\n"
737 "\\&\n"
738 " use_null_attrib = 0;\n"
739 " attr_sched_str = NULL;\n"
740 " main_sched_str = NULL;\n"
741 " inheritsched_str = NULL;\n"
742 "\\&\n"
743 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
744 " switch (opt) {\n"
745 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
746 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
747 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
748 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
749 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
750 " }\n"
751 " }\n"
752 "\\&\n"
753 " if (use_null_attrib\n"
754 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
755 " {\n"
756 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
757 " }\n"
758 "\\&\n"
759 " /* Optionally set scheduling attributes of main thread,\n"
760 " and display the attributes. */\n"
761 "\\&\n"
762 " if (main_sched_str != NULL) {\n"
763 " if (!get_policy(main_sched_str[0], &policy))\n"
764 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
765 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
766 "\\&\n"
767 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
768 " if (s != 0)\n"
769 " errc(EXIT_FAILURE, s, \"pthread_setschedparam\");\n"
770 " }\n"
771 "\\&\n"
772 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
773 " printf(\"\\[rs]n\");\n"
774 "\\&\n"
775 " /* Initialize thread attributes object according to options. */\n"
776 "\\&\n"
777 " attrp = NULL;\n"
778 "\\&\n"
779 " if (!use_null_attrib) {\n"
780 " s = pthread_attr_init(&attr);\n"
781 " if (s != 0)\n"
782 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
783 " attrp = &attr;\n"
784 " }\n"
785 "\\&\n"
786 " if (inheritsched_str != NULL) {\n"
787 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
788 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
789 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
790 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
791 " else\n"
792 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or \\[aq]i\\[aq]\\[rs]n\");\n"
793 "\\&\n"
794 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
795 " if (s != 0)\n"
796 " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n"
797 " }\n"
798 "\\&\n"
799 " if (attr_sched_str != NULL) {\n"
800 " if (!get_policy(attr_sched_str[0], &policy))\n"
801 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
802 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
803 "\\&\n"
804 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
805 " if (s != 0)\n"
806 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedpolicy\");\n"
807 " s = pthread_attr_setschedparam(&attr, &param);\n"
808 " if (s != 0)\n"
809 " errc(EXIT_FAILURE, s, \"pthread_attr_setschedparam\");\n"
810 " }\n"
811 "\\&\n"
812 " /* If we initialized a thread attributes object, display\n"
813 " the scheduling attributes that were set in the object. */\n"
814 "\\&\n"
815 " if (attrp != NULL) {\n"
816 " s = pthread_attr_getschedparam(&attr, &param);\n"
817 " if (s != 0)\n"
818 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n"
819 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
820 " if (s != 0)\n"
821 " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n"
822 "\\&\n"
823 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
824 " display_sched_attr(policy, &param);\n"
825 "\\&\n"
826 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
827 " printf(\" inheritsched is %s\\[rs]n\",\n"
828 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
829 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
830 " \"???\");\n"
831 " printf(\"\\[rs]n\");\n"
832 " }\n"
833 "\\&\n"
834 " /* Create a thread that will display its scheduling attributes. */\n"
835 "\\&\n"
836 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
837 " if (s != 0)\n"
838 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
839 "\\&\n"
840 " /* Destroy unneeded thread attributes object. */\n"
841 "\\&\n"
842 " if (!use_null_attrib) {\n"
843 " s = pthread_attr_destroy(&attr);\n"
844 " if (s != 0)\n"
845 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
846 " }\n"
847 "\\&\n"
848 " s = pthread_join(thread, NULL);\n"
849 " if (s != 0)\n"
850 " errc(EXIT_FAILURE, s, \"pthread_join\");\n"
851 "\\&\n"
852 " exit(EXIT_SUCCESS);\n"
853 "}\n"
854 msgstr ""
855
856 #. SRC END
857 #. type: SH
858 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
859 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
860 #, no-wrap
861 msgid "SEE ALSO"
862 msgstr "СМОТРИТЕ ТАКЖЕ"
863
864 #. type: Plain text
865 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
866 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
867 msgid ""
868 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
869 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
870 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
871 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
872 msgstr ""
873 "B<getrlimit>(2), B<sched_get_priority_min>(2), B<pthread_attr_init>(3), "
874 "B<pthread_attr_setinheritsched>(3), B<pthread_attr_setschedparam>(3), "
875 "B<pthread_attr_setschedpolicy>(3), B<pthread_create>(3), B<pthread_self>(3), "
876 "B<pthread_setschedprio>(3), B<pthreads>(7), B<sched>(7)"
877
878 #. type: TH
879 #: debian-trixie
880 #, no-wrap
881 msgid "2024-06-15"
882 msgstr "15 июня 2024 г."
883
884 #. type: TH
885 #: debian-trixie
886 #, no-wrap
887 msgid "Linux man-pages 6.9.1"
888 msgstr "Страницы руководства Linux 6.9.1"
889
890 #. type: Plain text
891 #: debian-trixie
892 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
893 msgstr "Библиотека потоков POSIX (I<libpthread>, I<-lpthread>)"
894
895 #. type: Plain text
896 #: debian-trixie fedora-44 fedora-rawhide
897 #, fuzzy, no-wrap
898 #| msgid ""
899 #| "$ B<su> # Need privilege to set real-time scheduling policies\n"
900 #| "Password:\n"
901 #| "# B<./a.out -mf10 -ar20 -i e>\n"
902 #| "Scheduler settings of main thread\n"
903 #| " policy=SCHED_FIFO, priority=10\n"
904 msgid ""
905 "$ B<su> # Need privilege to set real-time scheduling policies\n"
906 "Password:\n"
907 "# B<./a.out -mf10 -ar20 -i e>\n"
908 "Scheduler settings of main thread\n"
909 " policy=SCHED_FIFO, priority=10\n"
910 "\\&\n"
911 "Scheduler settings in \\[aq]attr\\[aq]\n"
912 " policy=SCHED_RR, priority=20\n"
913 " inheritsched is EXPLICIT\n"
914 "\\&\n"
915 "Scheduler attributes of new thread\n"
916 " policy=SCHED_RR, priority=20\n"
917 msgstr ""
918 "$ B<su> # требуются права для назначения алгоритмов\n"
919 " планирования реального времени\n"
920 "Пароль:\n"
921 "# B<./a.out -mf10 -ar20 -i e>\n"
922 "Настройки планировщика главной нити\n"
923 " алгоритм=SCHED_FIFO, приоритет=10\n"
924
925 #. type: Plain text
926 #: debian-trixie fedora-44 fedora-rawhide
927 #, no-wrap
928 msgid ""
929 "# B<./a.out -mf10 -ar20 -i i>\n"
930 "Scheduler settings of main thread\n"
931 " policy=SCHED_FIFO, priority=10\n"
932 "\\&\n"
933 "Scheduler settings in \\[aq]attr\\[aq]\n"
934 " policy=SCHED_RR, priority=20\n"
935 " inheritsched is INHERIT\n"
936 "\\&\n"
937 "Scheduler attributes of new thread\n"
938 " policy=SCHED_FIFO, priority=10\n"
939 msgstr ""
940
941 #. type: Plain text
942 #: debian-trixie fedora-44 fedora-rawhide
943 #, no-wrap
944 msgid ""
945 "/* pthreads_sched_test.c */\n"
946 "\\&\n"
947 "#include E<lt>errno.hE<gt>\n"
948 "#include E<lt>pthread.hE<gt>\n"
949 "#include E<lt>stdio.hE<gt>\n"
950 "#include E<lt>stdlib.hE<gt>\n"
951 "#include E<lt>unistd.hE<gt>\n"
952 "\\&\n"
953 "#define handle_error_en(en, msg) \\[rs]\n"
954 " do { errno = en; perror(msg); exit(EXIT_FAILURE); } while (0)\n"
955 "\\&\n"
956 "[[noreturn]]\n"
957 "static void\n"
958 "usage(char *prog_name, char *msg)\n"
959 "{\n"
960 " if (msg != NULL)\n"
961 " fputs(msg, stderr);\n"
962 "\\&\n"
963 " fprintf(stderr, \"Usage: %s [options]\\[rs]n\", prog_name);\n"
964 " fprintf(stderr, \"Options are:\\[rs]n\");\n"
965 "#define fpe(msg) fprintf(stderr, \"\\[rs]t%s\", msg) /* Shorter */\n"
966 " fpe(\"-aE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority in\\[rs]n\");\n"
967 " fpe(\" thread attributes object\\[rs]n\");\n"
968 " fpe(\" E<lt>policyE<gt> can be\\[rs]n\");\n"
969 " fpe(\" f SCHED_FIFO\\[rs]n\");\n"
970 " fpe(\" r SCHED_RR\\[rs]n\");\n"
971 " fpe(\" o SCHED_OTHER\\[rs]n\");\n"
972 " fpe(\"-A Use default thread attributes object\\[rs]n\");\n"
973 " fpe(\"-i {e|i} Set inherit scheduler attribute to\\[rs]n\");\n"
974 " fpe(\" \\[aq]explicit\\[aq] or \\[aq]inherit\\[aq]\\[rs]n\");\n"
975 " fpe(\"-mE<lt>policyE<gt>E<lt>prioE<gt> Set scheduling policy and priority on\\[rs]n\");\n"
976 " fpe(\" main thread before pthread_create() call\\[rs]n\");\n"
977 " exit(EXIT_FAILURE);\n"
978 "}\n"
979 "\\&\n"
980 "static int\n"
981 "get_policy(char p, int *policy)\n"
982 "{\n"
983 " switch (p) {\n"
984 " case \\[aq]f\\[aq]: *policy = SCHED_FIFO; return 1;\n"
985 " case \\[aq]r\\[aq]: *policy = SCHED_RR; return 1;\n"
986 " case \\[aq]o\\[aq]: *policy = SCHED_OTHER; return 1;\n"
987 " default: return 0;\n"
988 " }\n"
989 "}\n"
990 "\\&\n"
991 "static void\n"
992 "display_sched_attr(int policy, const struct sched_param *param)\n"
993 "{\n"
994 " printf(\" policy=%s, priority=%d\\[rs]n\",\n"
995 " (policy == SCHED_FIFO) ? \"SCHED_FIFO\" :\n"
996 " (policy == SCHED_RR) ? \"SCHED_RR\" :\n"
997 " (policy == SCHED_OTHER) ? \"SCHED_OTHER\" :\n"
998 " \"???\",\n"
999 " param-E<gt>sched_priority);\n"
1000 "}\n"
1001 "\\&\n"
1002 "static void\n"
1003 "display_thread_sched_attr(char *msg)\n"
1004 "{\n"
1005 " int policy, s;\n"
1006 " struct sched_param param;\n"
1007 "\\&\n"
1008 " s = pthread_getschedparam(pthread_self(), &policy, &param);\n"
1009 " if (s != 0)\n"
1010 " handle_error_en(s, \"pthread_getschedparam\");\n"
1011 "\\&\n"
1012 " printf(\"%s\\[rs]n\", msg);\n"
1013 " display_sched_attr(policy, &param);\n"
1014 "}\n"
1015 "\\&\n"
1016 "static void *\n"
1017 "thread_start(void *arg)\n"
1018 "{\n"
1019 " display_thread_sched_attr(\"Scheduler attributes of new thread\");\n"
1020 "\\&\n"
1021 " return NULL;\n"
1022 "}\n"
1023 "\\&\n"
1024 "int\n"
1025 "main(int argc, char *argv[])\n"
1026 "{\n"
1027 " int s, opt, inheritsched, use_null_attrib, policy;\n"
1028 " pthread_t thread;\n"
1029 " pthread_attr_t attr;\n"
1030 " pthread_attr_t *attrp;\n"
1031 " char *attr_sched_str, *main_sched_str, *inheritsched_str;\n"
1032 " struct sched_param param;\n"
1033 "\\&\n"
1034 " /* Process command-line options. */\n"
1035 "\\&\n"
1036 " use_null_attrib = 0;\n"
1037 " attr_sched_str = NULL;\n"
1038 " main_sched_str = NULL;\n"
1039 " inheritsched_str = NULL;\n"
1040 "\\&\n"
1041 " while ((opt = getopt(argc, argv, \"a:Ai:m:\")) != -1) {\n"
1042 " switch (opt) {\n"
1043 " case \\[aq]a\\[aq]: attr_sched_str = optarg; break;\n"
1044 " case \\[aq]A\\[aq]: use_null_attrib = 1; break;\n"
1045 " case \\[aq]i\\[aq]: inheritsched_str = optarg; break;\n"
1046 " case \\[aq]m\\[aq]: main_sched_str = optarg; break;\n"
1047 " default: usage(argv[0], \"Unrecognized option\\[rs]n\");\n"
1048 " }\n"
1049 " }\n"
1050 "\\&\n"
1051 " if (use_null_attrib\n"
1052 " && (inheritsched_str != NULL || attr_sched_str != NULL))\n"
1053 " {\n"
1054 " usage(argv[0], \"Can\\[aq]t specify -A with -i or -a\\[rs]n\");\n"
1055 " }\n"
1056 "\\&\n"
1057 " /* Optionally set scheduling attributes of main thread,\n"
1058 " and display the attributes. */\n"
1059 "\\&\n"
1060 " if (main_sched_str != NULL) {\n"
1061 " if (!get_policy(main_sched_str[0], &policy))\n"
1062 " usage(argv[0], \"Bad policy for main thread (-m)\\[rs]n\");\n"
1063 " param.sched_priority = strtol(&main_sched_str[1], NULL, 0);\n"
1064 "\\&\n"
1065 " s = pthread_setschedparam(pthread_self(), policy, &param);\n"
1066 " if (s != 0)\n"
1067 " handle_error_en(s, \"pthread_setschedparam\");\n"
1068 " }\n"
1069 "\\&\n"
1070 " display_thread_sched_attr(\"Scheduler settings of main thread\");\n"
1071 " printf(\"\\[rs]n\");\n"
1072 "\\&\n"
1073 " /* Initialize thread attributes object according to options. */\n"
1074 "\\&\n"
1075 " attrp = NULL;\n"
1076 "\\&\n"
1077 " if (!use_null_attrib) {\n"
1078 " s = pthread_attr_init(&attr);\n"
1079 " if (s != 0)\n"
1080 " handle_error_en(s, \"pthread_attr_init\");\n"
1081 " attrp = &attr;\n"
1082 " }\n"
1083 "\\&\n"
1084 " if (inheritsched_str != NULL) {\n"
1085 " if (inheritsched_str[0] == \\[aq]e\\[aq])\n"
1086 " inheritsched = PTHREAD_EXPLICIT_SCHED;\n"
1087 " else if (inheritsched_str[0] == \\[aq]i\\[aq])\n"
1088 " inheritsched = PTHREAD_INHERIT_SCHED;\n"
1089 " else\n"
1090 " usage(argv[0], \"Value for -i must be \\[aq]e\\[aq] or \\[aq]i\\[aq]\\[rs]n\");\n"
1091 "\\&\n"
1092 " s = pthread_attr_setinheritsched(&attr, inheritsched);\n"
1093 " if (s != 0)\n"
1094 " handle_error_en(s, \"pthread_attr_setinheritsched\");\n"
1095 " }\n"
1096 "\\&\n"
1097 " if (attr_sched_str != NULL) {\n"
1098 " if (!get_policy(attr_sched_str[0], &policy))\n"
1099 " usage(argv[0], \"Bad policy for \\[aq]attr\\[aq] (-a)\\[rs]n\");\n"
1100 " param.sched_priority = strtol(&attr_sched_str[1], NULL, 0);\n"
1101 "\\&\n"
1102 " s = pthread_attr_setschedpolicy(&attr, policy);\n"
1103 " if (s != 0)\n"
1104 " handle_error_en(s, \"pthread_attr_setschedpolicy\");\n"
1105 " s = pthread_attr_setschedparam(&attr, &param);\n"
1106 " if (s != 0)\n"
1107 " handle_error_en(s, \"pthread_attr_setschedparam\");\n"
1108 " }\n"
1109 "\\&\n"
1110 " /* If we initialized a thread attributes object, display\n"
1111 " the scheduling attributes that were set in the object. */\n"
1112 "\\&\n"
1113 " if (attrp != NULL) {\n"
1114 " s = pthread_attr_getschedparam(&attr, &param);\n"
1115 " if (s != 0)\n"
1116 " handle_error_en(s, \"pthread_attr_getschedparam\");\n"
1117 " s = pthread_attr_getschedpolicy(&attr, &policy);\n"
1118 " if (s != 0)\n"
1119 " handle_error_en(s, \"pthread_attr_getschedpolicy\");\n"
1120 "\\&\n"
1121 " printf(\"Scheduler settings in \\[aq]attr\\[aq]\\[rs]n\");\n"
1122 " display_sched_attr(policy, &param);\n"
1123 "\\&\n"
1124 " pthread_attr_getinheritsched(&attr, &inheritsched);\n"
1125 " printf(\" inheritsched is %s\\[rs]n\",\n"
1126 " (inheritsched == PTHREAD_INHERIT_SCHED) ? \"INHERIT\" :\n"
1127 " (inheritsched == PTHREAD_EXPLICIT_SCHED) ? \"EXPLICIT\" :\n"
1128 " \"???\");\n"
1129 " printf(\"\\[rs]n\");\n"
1130 " }\n"
1131 "\\&\n"
1132 " /* Create a thread that will display its scheduling attributes. */\n"
1133 "\\&\n"
1134 " s = pthread_create(&thread, attrp, &thread_start, NULL);\n"
1135 " if (s != 0)\n"
1136 " handle_error_en(s, \"pthread_create\");\n"
1137 "\\&\n"
1138 " /* Destroy unneeded thread attributes object. */\n"
1139 "\\&\n"
1140 " if (!use_null_attrib) {\n"
1141 " s = pthread_attr_destroy(&attr);\n"
1142 " if (s != 0)\n"
1143 " handle_error_en(s, \"pthread_attr_destroy\");\n"
1144 " }\n"
1145 "\\&\n"
1146 " s = pthread_join(thread, NULL);\n"
1147 " if (s != 0)\n"
1148 " handle_error_en(s, \"pthread_join\");\n"
1149 "\\&\n"
1150 " exit(EXIT_SUCCESS);\n"
1151 "}\n"
1152 msgstr ""
1153
1154 #. type: TH
1155 #: fedora-44 fedora-rawhide
1156 #, no-wrap
1157 msgid "2024-07-23"
1158 msgstr "23 июля 2024 г."
1159
1160 #. type: TH
1161 #: fedora-44 fedora-rawhide
1162 #, no-wrap
1163 msgid "Linux man-pages 6.13"
1164 msgstr "Страницы руководства Linux 6.13"
1165
1166 #. type: TH
1167 #: mageia-cauldron
1168 #, no-wrap
1169 msgid "Linux man-pages 6.17"
1170 msgstr "Страницы руководства Linux 6.17"
1171
1172 #. type: TH
1173 #: opensuse-leap-16-1 opensuse-tumbleweed
1174 #, no-wrap
1175 msgid "Linux man-pages (unreleased)"
1176 msgstr "Страницы руководства Linux (не выпущены)"