Debian Codegraph @

po/ru/man3/pthread_getattr_np.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 "B<pthread_getattr_np>()"
32 msgid "pthread_getattr_np"
33 msgstr "B<pthread_getattr_np>()"
34
35 #. type: TH
36 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
37 #: opensuse-tumbleweed
38 #, no-wrap
39 msgid "2025-09-25"
40 msgstr "25 сентября 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 "pthread_getattr_np - get attributes of created thread"
60 msgstr "pthread_getattr_np - возвращает атрибуты созданной нити"
61
62 #. type: SH
63 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
64 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
65 #, no-wrap
66 msgid "LIBRARY"
67 msgstr "БИБЛИОТЕКА"
68
69 #. type: Plain text
70 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
71 #: opensuse-leap-16-1 opensuse-tumbleweed
72 msgid "POSIX threads library (I<libpthread>,\\ I<-lpthread>)"
73 msgstr "Библиотека потоков POSIX (I<libpthread>,\\ I<-lpthread>)"
74
75 #. type: SH
76 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
77 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
78 #, no-wrap
79 msgid "SYNOPSIS"
80 msgstr "СИНТАКСИС"
81
82 #. type: Plain text
83 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
84 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
85 #, no-wrap
86 msgid ""
87 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
88 "B<#include E<lt>pthread.hE<gt>>\n"
89 msgstr ""
90 "B<#define _GNU_SOURCE> /* Смотрите feature_test_macros(7) */\n"
91 "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 #, no-wrap
97 msgid "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
98 msgstr "B<int pthread_getattr_np(pthread_t >I<thread>B<, pthread_attr_t *>I<attr>B<);>\n"
99
100 #. type: SH
101 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
102 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
103 #, no-wrap
104 msgid "DESCRIPTION"
105 msgstr "ОПИСАНИЕ"
106
107 #. type: Plain text
108 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
109 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
110 msgid ""
111 "The B<pthread_getattr_np>() function initializes the thread attributes "
112 "object referred to by I<attr> so that it contains actual attribute values "
113 "describing the running thread I<thread>."
114 msgstr ""
115 "Функция B<pthread_getattr_np>() инициализирует объект атрибутов нити, на "
116 "который указывает I<attr>, так, чтобы он содержал актуальные значения "
117 "атрибутов выполняющейся нити I<thread>."
118
119 #. type: Plain text
120 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
121 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
122 msgid ""
123 "The returned attribute values may differ from the corresponding attribute "
124 "values passed in the I<attr> object that was used to create the thread using "
125 "B<pthread_create>(3). In particular, the following attributes may differ:"
126 msgstr ""
127 "Возвращаемые значения атрибутов могут отличаться от соответствующих значений "
128 "атрибутов переданных в объекте I<attr>, который использовался при создании "
129 "нити с помощью B<pthread_create>(3). В частности, могут отличаться "
130 "следующие атрибуты:"
131
132 #. type: IP
133 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
134 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
135 #, no-wrap
136 msgid "\\[bu]"
137 msgstr "\\[bu]"
138
139 #. type: Plain text
140 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
141 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
142 msgid ""
143 "the detach state, since a joinable thread may have detached itself after "
144 "creation;"
145 msgstr ""
146 "состояние отсоединения, так как присоединяемая нить могла сама отсоединиться "
147 "после создания;"
148
149 #. type: Plain text
150 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
151 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
152 msgid ""
153 "the stack size, which the implementation may align to a suitable boundary."
154 msgstr ""
155 "размер стека, так как реализация нитей могла выронить значение по уместной "
156 "границе."
157
158 #. type: Plain text
159 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
160 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
161 msgid ""
162 "and the guard size, which the implementation may round upward to a multiple "
163 "of the page size, or ignore (i.e., treat as 0), if the application is "
164 "allocating its own stack."
165 msgstr ""
166 "размер защиты, так как реализация нитей могла округлить значение в большую "
167 "сторону до кратного размера страницы, или проигнорировать (т. е., посчитать "
168 "за 0), если приложение само выделяет себе стек."
169
170 #. type: Plain text
171 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
172 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
173 msgid ""
174 "Furthermore, if the stack address attribute was not set in the thread "
175 "attributes object used to create the thread, then the returned thread "
176 "attributes object will report the actual stack address that the "
177 "implementation selected for the thread."
178 msgstr ""
179 "Кроме этого, если атрибут адреса стека не был указан в объекте атрибутов "
180 "нити при создании нити, то возвращаемый объект атрибутов нити будет "
181 "содержать актуальный адрес стека, который был выбран реализацией для нити."
182
183 #. type: Plain text
184 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
185 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
186 msgid ""
187 "When the thread attributes object returned by B<pthread_getattr_np>() is no "
188 "longer required, it should be destroyed using B<pthread_attr_destroy>(3)."
189 msgstr ""
190 "Когда объект атрибутов нити, возвращаемый B<pthread_getattr_np>(), больше не "
191 "требуется, то он должен быть удалён с помощью B<pthread_attr_destroy>(3)."
192
193 #. type: SH
194 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
195 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
196 #, no-wrap
197 msgid "RETURN VALUE"
198 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
199
200 #. type: Plain text
201 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
202 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
203 msgid ""
204 "On success, this function returns 0; on error, it returns a nonzero error "
205 "number."
206 msgstr ""
207 "При успешном выполнении функция возвращает 0; при ошибке возвращается "
208 "ненулевой номер ошибки."
209
210 #. type: SH
211 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
212 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
213 #, no-wrap
214 msgid "ERRORS"
215 msgstr "ОШИБКИ"
216
217 #. type: TP
218 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
219 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
220 #, no-wrap
221 msgid "B<ENOMEM>"
222 msgstr "B<ENOMEM>"
223
224 #. Can happen (but unlikely) while trying to allocate memory for cpuset
225 #. type: Plain text
226 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
227 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
228 msgid "Insufficient memory."
229 msgstr "Недостаточно памяти."
230
231 #. type: Plain text
232 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
233 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
234 msgid ""
235 "In addition, if I<thread> refers to the main thread, then "
236 "B<pthread_getattr_np>() can fail because of errors from various underlying "
237 "calls: B<fopen>(3), if I</proc/self/maps> can't be opened; and "
238 "B<getrlimit>(2), if the B<RLIMIT_STACK> resource limit is not supported."
239 msgstr ""
240 "Также, если I<thread> указывает на главную нить, то B<pthread_getattr_np>() "
241 "может завершиться с ошибкой из-за ошибок различных используемых вызовов: "
242 "B<fopen>(3), если невозможно открыть I</proc/self/maps>; B<getrlimit>(2), "
243 "если не поддерживается ограничение ресурса B<RLIMIT_STACK>."
244
245 #. type: SH
246 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
247 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
248 #, no-wrap
249 msgid "ATTRIBUTES"
250 msgstr "АТРИБУТЫ"
251
252 #. type: Plain text
253 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
254 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
255 msgid ""
256 "For an explanation of the terms used in this section, see B<attributes>(7)."
257 msgstr "Описание терминов данного раздела смотрите в B<attributes>(7)."
258
259 #. type: tbl table
260 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
261 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
262 #, no-wrap
263 msgid "Interface"
264 msgstr "Интерфейс"
265
266 #. type: tbl table
267 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
268 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
269 #, no-wrap
270 msgid "Attribute"
271 msgstr "Атрибут"
272
273 #. type: tbl table
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 #, no-wrap
277 msgid "Value"
278 msgstr "Значение"
279
280 #. type: tbl table
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 #, no-wrap
284 msgid ".na\n"
285 msgstr ".na\n"
286
287 #. type: tbl table
288 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
289 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
290 #, no-wrap
291 msgid ".nh\n"
292 msgstr ".nh\n"
293
294 #. type: tbl table
295 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
296 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
297 #, no-wrap
298 msgid "B<pthread_getattr_np>()"
299 msgstr "B<pthread_getattr_np>()"
300
301 #. type: tbl table
302 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
303 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
304 #, no-wrap
305 msgid "Thread safety"
306 msgstr "Безвредность в нитях"
307
308 #. type: tbl table
309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
311 #, no-wrap
312 msgid "MT-Safe"
313 msgstr "MT-Safe"
314
315 #. type: SH
316 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
317 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
318 #, no-wrap
319 msgid "STANDARDS"
320 msgstr "СТАНДАРТЫ"
321
322 #. type: Plain text
323 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
324 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
325 msgid "GNU; hence the suffix \"_np\" (nonportable) in the name."
326 msgstr "GNU; отсюда и суффикс \"_np\" (непереносимый) в названии."
327
328 #. type: SH
329 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
330 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
331 #, no-wrap
332 msgid "HISTORY"
333 msgstr "ИСТОРИЯ"
334
335 #. type: Plain text
336 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
337 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
338 msgid "glibc 2.2.3."
339 msgstr "glibc 2.2.3."
340
341 #. type: SH
342 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
343 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
344 #, no-wrap
345 msgid "EXAMPLES"
346 msgstr "ПРИМЕРЫ"
347
348 #. type: Plain text
349 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
350 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
351 msgid ""
352 "The program below demonstrates the use of B<pthread_getattr_np>(). The "
353 "program creates a thread that then uses B<pthread_getattr_np>() to retrieve "
354 "and display its guard size, stack address, and stack size attributes. "
355 "Command-line arguments can be used to set these attributes to values other "
356 "than the default when creating the thread. The shell sessions below "
357 "demonstrate the use of the program."
358 msgstr ""
359 "В программе, показанной далее, демонстрируется использование "
360 "B<pthread_getattr_np>(). Программа создаёт нить, которая, затем, использует "
361 "B<pthread_getattr_np>() для получения и показа своих атрибутов размера "
362 "защиты, адреса стека и размера стека. Аргументами командной строки можно "
363 "изменить эти атрибуты. Работа программы показана далее."
364
365 #. type: Plain text
366 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
367 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
368 msgid ""
369 "In the first run, on an x86-32 system, a thread is created using default "
370 "attributes:"
371 msgstr ""
372 "В этом запуске на системе x86-32 нить создаётся со значениями атрибутов по "
373 "умолчанию:"
374
375 #. type: Plain text
376 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
377 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
378 #, no-wrap
379 msgid ""
380 "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
381 "unlimited\n"
382 "$B< ./a.out>\n"
383 "Attributes of created thread:\n"
384 " Guard size = 4096 bytes\n"
385 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
386 " Stack size = 0x201000 (2101248) bytes\n"
387 msgstr ""
388 "$B< ulimit -s> # Без ограничения стека ==E<gt>\n"
389 " # размер стека по умолчанию 2 МБ\n"
390 "unlimited\n"
391 "$B< ./a.out>\n"
392 "Атрибуты созданной нити:\n"
393 " Размер защиты = 4096 байт\n"
394 " Адрес стека = 0x40196000 (EOS = 0x40397000)\n"
395 " Размер стека = 0x201000 (2101248) байт\n"
396
397 #. type: Plain text
398 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
399 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
400 msgid ""
401 "In the following run, we see that if a guard size is specified, it is "
402 "rounded up to the next multiple of the system page size (4096 bytes on "
403 "x86-32):"
404 msgstr ""
405 "В этом запуске мы видим, что при задании размера защиты его значение "
406 "округляется до значение следующего кратного размера системной страницы (4096 "
407 "байт на x86-32):"
408
409 #. type: Plain text
410 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
411 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
412 #, fuzzy, no-wrap
413 #| msgid ""
414 #| "$B< ulimit -s> # No stack limit ==E<gt> default stack size is 2 MB\n"
415 #| "unlimited\n"
416 #| "$B< ./a.out>\n"
417 #| "Attributes of created thread:\n"
418 #| " Guard size = 4096 bytes\n"
419 #| " Stack address = 0x40196000 (EOS = 0x40397000)\n"
420 #| " Stack size = 0x201000 (2101248) bytes\n"
421 msgid ""
422 "$B< ./a.out -g 4097>\n"
423 "Thread attributes object after initializations:\n"
424 " Guard size = 4097 bytes\n"
425 " Stack address = (nil)\n"
426 " Stack size = 0x0 (0) bytes\n"
427 "\\&\n"
428 "Attributes of created thread:\n"
429 " Guard size = 8192 bytes\n"
430 " Stack address = 0x40196000 (EOS = 0x40397000)\n"
431 " Stack size = 0x201000 (2101248) bytes\n"
432 msgstr ""
433 "$B< ulimit -s> # Без ограничения стека ==E<gt>\n"
434 " # размер стека по умолчанию 2 МБ\n"
435 "unlimited\n"
436 "$B< ./a.out>\n"
437 "Атрибуты созданной нити:\n"
438 " Размер защиты = 4096 байт\n"
439 " Адрес стека = 0x40196000 (EOS = 0x40397000)\n"
440 " Размер стека = 0x201000 (2101248) байт\n"
441
442 #. type: Plain text
443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
445 msgid ""
446 "In the last run, the program manually allocates a stack for the thread. In "
447 "this case, the guard size attribute is ignored."
448 msgstr ""
449 "В этом запуске программа вручную выделяет стек для нити. В этом случае "
450 "атрибут размера защиты игнорируется."
451
452 #. type: Plain text
453 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
454 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
455 #, fuzzy, no-wrap
456 #| msgid ""
457 #| "Thread attributes object after initializations:\n"
458 #| " Guard size = 4096 bytes\n"
459 #| " Stack address = 0x804d000 (EOS = 0x8055000)\n"
460 #| " Stack size = 0x8000 (32768) bytes\n"
461 msgid ""
462 "$B< ./a.out -g 4096 -s 0x8000 -a>\n"
463 "Allocated thread stack at 0x804d000\n"
464 "\\&\n"
465 "Thread attributes object after initializations:\n"
466 " Guard size = 4096 bytes\n"
467 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
468 " Stack size = 0x8000 (32768) bytes\n"
469 "\\&\n"
470 "Attributes of created thread:\n"
471 " Guard size = 0 bytes\n"
472 " Stack address = 0x804d000 (EOS = 0x8055000)\n"
473 " Stack size = 0x8000 (32768) bytes\n"
474 msgstr ""
475 "Объект атрибутов нити после инициализации:\n"
476 " Размер защиты = 4096 байт\n"
477 " Адрес стека = 0x804d000 (EOS = 0x8055000)\n"
478 " Размер стека = 0x8000 (32768) байт\n"
479
480 #. type: SS
481 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
482 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
483 #, no-wrap
484 msgid "Program source"
485 msgstr "Исходный код программы"
486
487 #. type: Plain text
488 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
489 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
490 #, no-wrap
491 msgid ""
492 "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n"
493 "#include E<lt>err.hE<gt>\n"
494 "#include E<lt>errno.hE<gt>\n"
495 "#include E<lt>pthread.hE<gt>\n"
496 "#include E<lt>stdio.hE<gt>\n"
497 "#include E<lt>stdlib.hE<gt>\n"
498 "#include E<lt>unistd.hE<gt>\n"
499 "\\&\n"
500 "static void\n"
501 "display_stack_related_attributes(pthread_attr_t *attr, char *prefix)\n"
502 "{\n"
503 " int s;\n"
504 " size_t stack_size, guard_size;\n"
505 " void *stack_addr;\n"
506 "\\&\n"
507 " s = pthread_attr_getguardsize(attr, &guard_size);\n"
508 " if (s != 0)\n"
509 " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n"
510 " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, guard_size);\n"
511 "\\&\n"
512 " s = pthread_attr_getstack(attr, &stack_addr, &stack_size);\n"
513 " if (s != 0)\n"
514 " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n"
515 " printf(\"%sStack address = %p\", prefix, stack_addr);\n"
516 " if (stack_size E<gt> 0)\n"
517 " printf(\" (EOS = %p)\", (char *) stack_addr + stack_size);\n"
518 " printf(\"\\[rs]n\");\n"
519 " printf(\"%sStack size = %#zx (%zu) bytes\\[rs]n\",\n"
520 " prefix, stack_size, stack_size);\n"
521 "}\n"
522 "\\&\n"
523 "static void\n"
524 "display_thread_attributes(pthread_t thread, char *prefix)\n"
525 "{\n"
526 " int s;\n"
527 " pthread_attr_t attr;\n"
528 "\\&\n"
529 " s = pthread_getattr_np(thread, &attr);\n"
530 " if (s != 0)\n"
531 " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n"
532 "\\&\n"
533 " display_stack_related_attributes(&attr, prefix);\n"
534 "\\&\n"
535 " s = pthread_attr_destroy(&attr);\n"
536 " if (s != 0)\n"
537 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
538 "}\n"
539 "\\&\n"
540 "static void * /* Start function for thread we create */\n"
541 "thread_start(void *arg)\n"
542 "{\n"
543 " printf(\"Attributes of created thread:\\[rs]n\");\n"
544 " display_thread_attributes(pthread_self(), \"\\[rs]t\");\n"
545 "\\&\n"
546 " exit(EXIT_SUCCESS); /* Terminate all threads */\n"
547 "}\n"
548 "\\&\n"
549 "static void\n"
550 "usage(char *pname, char *msg)\n"
551 "{\n"
552 " if (msg != NULL)\n"
553 " fputs(msg, stderr);\n"
554 " fprintf(stderr, \"Usage: %s [-s stack-size [-a]]\"\n"
555 " \" [-g guard-size]\\[rs]n\", pname);\n"
556 " fprintf(stderr, \"\\[rs]t\\[rs]t-a means program should allocate stack\\[rs]n\");\n"
557 " exit(EXIT_FAILURE);\n"
558 "}\n"
559 "\\&\n"
560 "static pthread_attr_t * /* Get thread attributes from command line */\n"
561 "get_thread_attributes_from_cl(int argc, char *argv[],\n"
562 " pthread_attr_t *attrp)\n"
563 "{\n"
564 " int s, opt, allocate_stack;\n"
565 " size_t stack_size, guard_size;\n"
566 " void *stack_addr;\n"
567 " pthread_attr_t *ret_attrp = NULL; /* Set to attrp if we initialize\n"
568 " a thread attributes object */\n"
569 " allocate_stack = 0;\n"
570 " stack_size = -1;\n"
571 " guard_size = -1;\n"
572 "\\&\n"
573 " while ((opt = getopt(argc, argv, \"ag:s:\")) != -1) {\n"
574 " switch (opt) {\n"
575 " case \\[aq]a\\[aq]: allocate_stack = 1; break;\n"
576 " case \\[aq]g\\[aq]: guard_size = strtoul(optarg, NULL, 0); break;\n"
577 " case \\[aq]s\\[aq]: stack_size = strtoul(optarg, NULL, 0); break;\n"
578 " default: usage(argv[0], NULL);\n"
579 " }\n"
580 " }\n"
581 "\\&\n"
582 " if (allocate_stack && stack_size == -1)\n"
583 " usage(argv[0], \"Specifying -a without -s makes no sense\\[rs]n\");\n"
584 "\\&\n"
585 " if (argc E<gt> optind)\n"
586 " usage(argv[0], \"Extraneous command-line arguments\\[rs]n\");\n"
587 "\\&\n"
588 " if (stack_size != -1 || guard_size E<gt> 0) {\n"
589 " ret_attrp = attrp;\n"
590 "\\&\n"
591 " s = pthread_attr_init(attrp);\n"
592 " if (s != 0)\n"
593 " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n"
594 " }\n"
595 "\\&\n"
596 " if (stack_size != -1) {\n"
597 " if (!allocate_stack) {\n"
598 " s = pthread_attr_setstacksize(attrp, stack_size);\n"
599 " if (s != 0)\n"
600 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
601 " } else {\n"
602 " s = posix_memalign(&stack_addr, sysconf(_SC_PAGESIZE),\n"
603 " stack_size);\n"
604 " if (s != 0)\n"
605 " errc(EXIT_FAILURE, s, \"posix_memalign\");\n"
606 " printf(\"Allocated thread stack at %p\\[rs]n\\[rs]n\", stack_addr);\n"
607 "\\&\n"
608 " s = pthread_attr_setstack(attrp, stack_addr, stack_size);\n"
609 " if (s != 0)\n"
610 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
611 " }\n"
612 " }\n"
613 "\\&\n"
614 " if (guard_size != -1) {\n"
615 " s = pthread_attr_setguardsize(attrp, guard_size);\n"
616 " if (s != 0)\n"
617 " errc(EXIT_FAILURE, s, \"pthread_attr_setstacksize\");\n"
618 " }\n"
619 "\\&\n"
620 " return ret_attrp;\n"
621 "}\n"
622 "\\&\n"
623 "int\n"
624 "main(int argc, char *argv[])\n"
625 "{\n"
626 " int s;\n"
627 " pthread_t thr;\n"
628 " pthread_attr_t attr;\n"
629 " pthread_attr_t *attrp = NULL; /* Set to &attr if we initialize\n"
630 " a thread attributes object */\n"
631 "\\&\n"
632 " attrp = get_thread_attributes_from_cl(argc, argv, &attr);\n"
633 "\\&\n"
634 " if (attrp != NULL) {\n"
635 " printf(\"Thread attributes object after initializations:\\[rs]n\");\n"
636 " display_stack_related_attributes(attrp, \"\\[rs]t\");\n"
637 " printf(\"\\[rs]n\");\n"
638 " }\n"
639 "\\&\n"
640 " s = pthread_create(&thr, attrp, &thread_start, NULL);\n"
641 " if (s != 0)\n"
642 " errc(EXIT_FAILURE, s, \"pthread_create\");\n"
643 "\\&\n"
644 " if (attrp != NULL) {\n"
645 " s = pthread_attr_destroy(attrp);\n"
646 " if (s != 0)\n"
647 " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n"
648 " }\n"
649 "\\&\n"
650 " pause(); /* Terminates when other thread calls exit() */\n"
651 "}\n"
652 msgstr ""
653
654 #. SRC END
655 #. type: SH
656 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
657 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
658 #, no-wrap
659 msgid "SEE ALSO"
660 msgstr "СМОТРИТЕ ТАКЖЕ"
661
662 #. type: Plain text
663 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
664 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
665 msgid ""
666 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
667 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
668 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
669 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
670 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
671 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
672 msgstr ""
673 "B<pthread_attr_getaffinity_np>(3), B<pthread_attr_getdetachstate>(3), "
674 "B<pthread_attr_getguardsize>(3), B<pthread_attr_getinheritsched>(3), "
675 "B<pthread_attr_getschedparam>(3), B<pthread_attr_getschedpolicy>(3), "
676 "B<pthread_attr_getscope>(3), B<pthread_attr_getstack>(3), "
677 "B<pthread_attr_getstackaddr>(3), B<pthread_attr_getstacksize>(3), "
678 "B<pthread_attr_init>(3), B<pthread_create>(3), B<pthreads>(7)"
679
680 #. type: TH
681 #: debian-trixie
682 #, no-wrap
683 msgid "2024-06-15"
684 msgstr "15 июня 2024 г."
685
686 #. type: TH
687 #: debian-trixie
688 #, no-wrap
689 msgid "Linux man-pages 6.9.1"
690 msgstr "Страницы руководства Linux 6.9.1"
691
692 #. type: Plain text
693 #: debian-trixie
694 msgid "POSIX threads library (I<libpthread>, I<-lpthread>)"
695 msgstr "Библиотека потоков POSIX (I<libpthread>, I<-lpthread>)"
696
697 #. type: TH
698 #: fedora-44 fedora-rawhide
699 #, no-wrap
700 msgid "2024-07-23"
701 msgstr "23 июля 2024 г."
702
703 #. type: TH
704 #: fedora-44 fedora-rawhide
705 #, no-wrap
706 msgid "Linux man-pages 6.13"
707 msgstr "Страницы руководства Linux 6.13"
708
709 #. type: TH
710 #: mageia-cauldron
711 #, no-wrap
712 msgid "Linux man-pages 6.17"
713 msgstr "Страницы руководства Linux 6.17"
714
715 #. type: TH
716 #: opensuse-leap-16-1 opensuse-tumbleweed
717 #, no-wrap
718 msgid "Linux man-pages (unreleased)"
719 msgstr "Страницы руководства Linux (не выпущены)"