# 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 , 2014-2017. # kogamatranslator49 , 2015. # Darima Kogan , 2014. # Max Is , 2016. # Yuri Kozlov , 2011-2019. # Иван Павлов , 2017. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2026-06-05 06:38+0200\n" "PO-Revision-Date: 2024-12-21 19:50+0300\n" "Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \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-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "See B(3)." msgid "pthread_attr_init" msgstr "Смотрите B(3)." #. type: TH #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "2025-09-21" msgstr "21 сентября 2025 г." #. type: TH #: archlinux debian-unstable #, fuzzy, no-wrap #| msgid "Linux man-pages 6.17" msgid "Linux man-pages 6.18" msgstr "Справочные страницы Linux 6.17" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "НАИМЕНОВАНИЕ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "pthread_attr_init, pthread_attr_destroy - initialize and destroy thread " "attributes object" msgstr "" "pthread_attr_init, pthread_attr_destroy - инициализирует и уничтожает объект " "атрибутов нити" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "БИБЛИОТЕКА" #. type: Plain text #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron #: opensuse-leap-16-1 opensuse-tumbleweed msgid "POSIX threads library (I,\\ I<-lpthread>)" msgstr "Библиотека потоков POSIX (I,\\ I<-lpthread>)" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "СИНТАКСИС" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "B<#include Epthread.hE>\n" msgstr "B<#include Epthread.hE>\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "BIB<);>\n" "BIB<);>\n" msgstr "" "BIB<);>\n" "BIB<);>\n" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "ОПИСАНИЕ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The B() function initializes the thread attributes " "object pointed to by I with default attribute values. After this " "call, individual attributes of the object can be set using various related " "functions (listed under SEE ALSO), and then the object can be used in one or " "more B(3) calls that create threads." msgstr "" "Функция B() инициализирует объект атрибутов нити, на " "который указывает I, значениями атрибутов по умолчанию. После этого " "вызова отдельные атрибуты объекта можно изменять с помощью различных " "соответствующих функций (перечислены в разделе СМОТРИТЕ ТАКЖЕ, а после этого " "объект можно использовать в одном или нескольких вызовах " "B(3) для создания нитей." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Calling B() on a thread attributes object that has " "already been initialized results in undefined behavior." msgstr "" "Вызов B() с уже инициализированным объектом атрибутов " "нити приводит к непредсказуемому поведению." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When a thread attributes object is no longer required, it should be " "destroyed using the B() function. Destroying a " "thread attributes object has no effect on threads that were created using " "that object." msgstr "" "Когда объект атрибутов нити больше не нужен, он должен быть уничтожен с " "помощью функции B(). Уничтожение объекта атрибутов " "нити не влияет на нить, которая была создана с использованием этого объекта." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "Once a thread attributes object has been destroyed, it can be reinitialized " "using B(). Any other use of a destroyed thread " "attributes object has undefined results." msgstr "" "После уничтожения объекта атрибутов нити его можно инициализировать с " "помощью B() повторно. При использовании уничтоженного " "объекта атрибутов нити другим способом приводит непредсказуемым результатам." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "RETURN VALUE" msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "On success, these functions return 0; on error, they return a nonzero error " "number." msgstr "" "При успешном выполнении эти функции возвращают 0; при ошибке возвращается " "ненулевой номер ошибки." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "ОШИБКИ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "POSIX.1 documents an B error for B(); on Linux " "these functions always succeed (but portable and future-proof applications " "should nevertheless handle a possible error return)." msgstr "" "В POSIX.1 описана ошибка B для B(); в Linux эти " "функции всегда выполняются успешно (тем не менее, в переносимых приложениях " "нужно учитывать возможность возврата ошибки)." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "ATTRIBUTES" msgstr "АТРИБУТЫ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "For an explanation of the terms used in this section, see B(7)." msgstr "Описание терминов данного раздела смотрите в B(7)." #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Interface" msgstr "Интерфейс" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Attribute" msgstr "Атрибут" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Value" msgstr "Значение" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".na\n" msgstr ".na\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid ".nh\n" msgstr ".nh\n" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "B(),\n" "B()" msgstr "" "B(),\n" "B()" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Thread safety" msgstr "Безвредность в нитях" #. type: tbl table #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "MT-Safe" msgstr "MT-Safe" #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "СТАНДАРТЫ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "POSIX.1-2008." msgstr "POSIX.1-2008." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "ИСТОРИЯ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "POSIX.1-2001." msgstr "POSIX.1-2001." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "NOTES" msgstr "ПРИМЕЧАНИЯ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The I type should be treated as opaque: any access to the " "object other than via pthreads functions is nonportable and produces " "undefined results." msgstr "" "Тип I должен считаться со скрытым форматом: любой доступ к " "объекту помимо функций pthreads является непереносимым и приводит к " "непредсказуемым результатам." #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "ПРИМЕРЫ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "The program below optionally makes use of B() and " "various related functions to initialize a thread attributes object that is " "used to create a single thread. Once created, the thread uses the " "B(3) function (a nonstandard GNU extension) to retrieve " "the thread's attributes, and then displays those attributes." msgstr "" "В программе, представленной ниже, для создания одной нити используется " "B() и другие функции, относящиеся к инициализации объекта " "атрибутов нити. После создания в нити используется функция " "B(3) (нестандартное расширение GNU) для получения " "атрибутов нити, а затем показываются эти атрибуты." #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "If the program is run with no command-line argument, then it passes NULL as " "the I argument of B(3), so that the thread is created " "with default attributes. Running the program on Linux/x86-32 with the NPTL " "threading implementation, we see the following:" msgstr "" "Если программа запускается без аргументов командной строки, то аргумент " "I функции B(3) равен NULL, и поэтому нить создаётся с " "атрибутами по умолчанию. При запуске программы на Linux/x86-32 с реализацией " "нитей NPTL мы увидим следующее:" #. Results from glibc 2.8, SUSE 11.0; Oct 2008 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "$B< ulimit -s> # No stack limit ==E default stack size is 2 MB\n" "unlimited\n" "$B< ./a.out>\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_JOINABLE\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_INHERIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 4096 bytes\n" " Stack address = 0x40196000\n" " Stack size = 0x201000 bytes\n" msgstr "" "$B< ulimit -s> # стек не ограничен ==E размер стека по умолчанию 2 МБ\n" "unlimited\n" "$B< ./a.out>\n" "Атрибуты нити:\n" " Состояние отсоединения = PTHREAD_CREATE_JOINABLE\n" " Область = PTHREAD_SCOPE_SYSTEM\n" " Унаследованный планировщик = PTHREAD_INHERIT_SCHED\n" " Алгоритм планирования = SCHED_OTHER\n" " Приоритет планирования = 0\n" " Размер защиты = 4096 байт\n" " Адрес стека = 0x40196000\n" " Размер стека = 0x201000 байт\n" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed msgid "" "When we supply a stack size as a command-line argument, the program " "initializes a thread attributes object, sets various attributes in that " "object, and passes a pointer to the object in the call to " "B(3). Running the program on Linux/x86-32 with the NPTL " "threading implementation, we see the following:" msgstr "" "Если в командной строке мы укажем размер стека, то программа инициализирует " "объект атрибутов нити, задаёт различные атрибуты в этом объекте и передаёт " "указатель на объект в вызов B(3). При запуске программы на " "Linux/x86-32 с реализацией нитей NPTL мы увидим следующее:" #. Results from glibc 2.8, SUSE 11.0; Oct 2008 #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "" "$B< ./a.out 0x3000000>\n" "posix_memalign() allocated at 0x40197000\n" "Thread attributes:\n" " Detach state = PTHREAD_CREATE_DETACHED\n" " Scope = PTHREAD_SCOPE_SYSTEM\n" " Inherit scheduler = PTHREAD_EXPLICIT_SCHED\n" " Scheduling policy = SCHED_OTHER\n" " Scheduling priority = 0\n" " Guard size = 0 bytes\n" " Stack address = 0x40197000\n" " Stack size = 0x3000000 bytes\n" msgstr "" "$B< ./a.out 0x3000000>\n" "posix_memalign() выделен по адресу 0x40197000\n" "Атрибуты нити:\n" " Состояние отсоединения = PTHREAD_CREATE_DETACHED\n" " Область = PTHREAD_SCOPE_SYSTEM\n" " Унаследованный планировщик = PTHREAD_EXPLICIT_SCHED\n" " Алгоритм планирования = SCHED_OTHER\n" " Приоритет планирования = 0\n" " Размер защиты = 0 байт\n" " Адрес стека = 0x40197000\n" " Размер стека = 0x3000000 байт\n" #. type: SS #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "Исходный код программы" #. type: Plain text #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 #: opensuse-tumbleweed #, no-wrap msgid "" "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static void\n" "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s, i;\n" " size_t v;\n" " void *stkaddr;\n" " struct sched_param sp;\n" "\\&\n" " s = pthread_attr_getdetachstate(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n" " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n" " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getscope(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n" " printf(\"%sScope = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n" " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getinheritsched(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n" " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n" " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getschedpolicy(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n" " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n" " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (i == SCHED_RR) ? \"SCHED_RR\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getschedparam(attr, &sp);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n" " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n" "\\&\n" " s = pthread_attr_getguardsize(attr, &v);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n" "\\&\n" " s = pthread_attr_getstack(attr, &stkaddr, &v);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n" " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " int s;\n" " pthread_attr_t gattr;\n" "\\&\n" " /* pthread_getattr_np() is a non-standard GNU extension that\n" " retrieves the attributes of the thread specified in its\n" " first argument. */\n" "\\&\n" " s = pthread_getattr_np(pthread_self(), &gattr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n" "\\&\n" " printf(\"Thread attributes:\\[rs]n\");\n" " display_pthread_attr(&gattr, \"\\[rs]t\");\n" "\\&\n" " exit(EXIT_SUCCESS); /* Terminate all threads */\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp; /* NULL or &attr */\n" " int s;\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " /* If a command-line argument was supplied, use it to set the\n" " stack-size attribute and set a few other thread attributes,\n" " and set attrp pointing to thread attributes object. */\n" "\\&\n" " if (argc E 1) {\n" " size_t stack_size;\n" " void *sp;\n" "\\&\n" " attrp = &attr;\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" "\\&\n" " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n" "\\&\n" " stack_size = strtoul(argv[1], NULL, 0);\n" "\\&\n" " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"posix_memalign\");\n" "\\&\n" " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n" "\\&\n" " s = pthread_attr_setstack(&attr, sp, stack_size);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n" " }\n" "\\&\n" " s = pthread_create(&thr, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_destroy(attrp);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " pause(); /* Terminates when other thread calls exit() */\n" "}\n" msgstr "" #. SRC END #. type: SH #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "SEE ALSO" msgstr "СМОТРИТЕ ТАКЖЕ" #. type: Plain text #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed #, fuzzy #| msgid "" #| "B(3), B(3), " #| "B(3), B(3), " #| "B(3), B(3), " #| "B(3), B(3), " #| "B(3), B(3), " #| "B(3), B(3), " #| "B(3), B(7)" msgid "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), B(7)" msgstr "" "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(3), " "B(3), B(7)" #. type: TH #: debian-trixie #, no-wrap msgid "2024-06-15" msgstr "15 июня 2024 г." #. type: TH #: debian-trixie #, no-wrap msgid "Linux man-pages 6.9.1" msgstr "Страницы руководства Linux 6.9.1" #. type: Plain text #: debian-trixie msgid "POSIX threads library (I, I<-lpthread>)" msgstr "Библиотека потоков POSIX (I, I<-lpthread>)" #. type: Plain text #: debian-trixie fedora-44 fedora-rawhide #, no-wrap msgid "" "#define _GNU_SOURCE /* To get pthread_getattr_np() declaration */\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Eunistd.hE\n" "\\&\n" "static void\n" "display_pthread_attr(pthread_attr_t *attr, char *prefix)\n" "{\n" " int s, i;\n" " size_t v;\n" " void *stkaddr;\n" " struct sched_param sp;\n" "\\&\n" " s = pthread_attr_getdetachstate(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getdetachstate\");\n" " printf(\"%sDetach state = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_CREATE_DETACHED) ? \"PTHREAD_CREATE_DETACHED\" :\n" " (i == PTHREAD_CREATE_JOINABLE) ? \"PTHREAD_CREATE_JOINABLE\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getscope(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getscope\");\n" " printf(\"%sScope = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_SCOPE_SYSTEM) ? \"PTHREAD_SCOPE_SYSTEM\" :\n" " (i == PTHREAD_SCOPE_PROCESS) ? \"PTHREAD_SCOPE_PROCESS\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getinheritsched(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getinheritsched\");\n" " printf(\"%sInherit scheduler = %s\\[rs]n\", prefix,\n" " (i == PTHREAD_INHERIT_SCHED) ? \"PTHREAD_INHERIT_SCHED\" :\n" " (i == PTHREAD_EXPLICIT_SCHED) ? \"PTHREAD_EXPLICIT_SCHED\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getschedpolicy(attr, &i);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedpolicy\");\n" " printf(\"%sScheduling policy = %s\\[rs]n\", prefix,\n" " (i == SCHED_OTHER) ? \"SCHED_OTHER\" :\n" " (i == SCHED_FIFO) ? \"SCHED_FIFO\" :\n" " (i == SCHED_RR) ? \"SCHED_RR\" :\n" " \"???\");\n" "\\&\n" " s = pthread_attr_getschedparam(attr, &sp);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getschedparam\");\n" " printf(\"%sScheduling priority = %d\\[rs]n\", prefix, sp.sched_priority);\n" "\\&\n" " s = pthread_attr_getguardsize(attr, &v);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getguardsize\");\n" " printf(\"%sGuard size = %zu bytes\\[rs]n\", prefix, v);\n" "\\&\n" " s = pthread_attr_getstack(attr, &stkaddr, &v);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_getstack\");\n" " printf(\"%sStack address = %p\\[rs]n\", prefix, stkaddr);\n" " printf(\"%sStack size = %#zx bytes\\[rs]n\", prefix, v);\n" "}\n" "\\&\n" "static void *\n" "thread_start(void *arg)\n" "{\n" " int s;\n" " pthread_attr_t gattr;\n" "\\&\n" " /* pthread_getattr_np() is a non-standard GNU extension that\n" " retrieves the attributes of the thread specified in its\n" " first argument. */\n" "\\&\n" " s = pthread_getattr_np(pthread_self(), &gattr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_getattr_np\");\n" "\\&\n" " printf(\"Thread attributes:\\[rs]n\");\n" " display_pthread_attr(&gattr, \"\\[rs]t\");\n" "\\&\n" " exit(EXIT_SUCCESS); /* Terminate all threads */\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " pthread_t thr;\n" " pthread_attr_t attr;\n" " pthread_attr_t *attrp; /* NULL or &attr */\n" " int s;\n" "\\&\n" " attrp = NULL;\n" "\\&\n" " /* If a command-line argument was supplied, use it to set the\n" " stack-size attribute and set a few other thread attributes,\n" " and set attrp pointing to thread attributes object. */\n" "\\&\n" " if (argc E 1) {\n" " size_t stack_size;\n" " void *sp;\n" "\\&\n" " attrp = &attr;\n" "\\&\n" " s = pthread_attr_init(&attr);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_init\");\n" "\\&\n" " s = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setdetachstate\");\n" "\\&\n" " s = pthread_attr_setinheritsched(&attr, PTHREAD_EXPLICIT_SCHED);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setinheritsched\");\n" "\\&\n" " stack_size = strtoul(argv[1], NULL, 0);\n" "\\&\n" " s = posix_memalign(&sp, sysconf(_SC_PAGESIZE), stack_size);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"posix_memalign\");\n" "\\&\n" " printf(\"posix_memalign() allocated at %p\\[rs]n\", sp);\n" "\\&\n" " s = pthread_attr_setstack(&attr, sp, stack_size);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_setstack\");\n" " }\n" "\\&\n" " s = pthread_create(&thr, attrp, &thread_start, NULL);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" "\\&\n" " if (attrp != NULL) {\n" " s = pthread_attr_destroy(attrp);\n" " if (s != 0)\n" " errc(EXIT_FAILURE, s, \"pthread_attr_destroy\");\n" " }\n" "\\&\n" " pause(); /* Terminates when other thread calls exit() */\n" "}\n" msgstr "" #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "2024-07-23" msgstr "23 июля 2024 г." #. type: TH #: fedora-44 fedora-rawhide #, no-wrap msgid "Linux man-pages 6.13" msgstr "Страницы руководства Linux 6.13" #. type: TH #: mageia-cauldron #, no-wrap msgid "Linux man-pages 6.17" msgstr "Страницы руководства Linux 6.17" #. type: TH #: opensuse-leap-16-1 opensuse-tumbleweed #, no-wrap msgid "Linux man-pages (unreleased)" msgstr "Страницы руководства Linux (не выпущены)"