Debian Codegraph @

po/ru/man2/futex.2.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 # Azamat Hackimov <[email protected]>, 2017.
5 # Dmitry Bolkhovskikh <[email protected]>, 2017.
6 # Yuri Kozlov <[email protected]>, 2011-2019.
7 # Иван Павлов <[email protected]>, 2017.
8 msgid ""
9 msgstr ""
10 "Project-Id-Version: manpages-l10n\n"
11 "POT-Creation-Date: 2026-06-05 06:25+0200\n"
12 "PO-Revision-Date: 2024-12-21 19:49+0300\n"
13 "Last-Translator: Yuri Kozlov <[email protected]>\n"
14 "Language-Team: Russian <[email protected]>\n"
15 "Language: ru\n"
16 "MIME-Version: 1.0\n"
17 "Content-Type: text/plain; charset=UTF-8\n"
18 "Content-Transfer-Encoding: 8bit\n"
19 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
20 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
21 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
22 "X-Generator: Lokalize 2.0\n"
23
24 #. type: TH
25 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
26 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
27 #, no-wrap
28 msgid "futex"
29 msgstr "futex"
30
31 #. type: TH
32 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
33 #, no-wrap
34 msgid "2026-02-14"
35 msgstr "14 февраля 2026 г."
36
37 #. type: TH
38 #: archlinux debian-unstable
39 #, fuzzy, no-wrap
40 #| msgid "Linux man-pages 6.17"
41 msgid "Linux man-pages 6.18"
42 msgstr "Справочные страницы Linux 6.17"
43
44 #. type: SH
45 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
46 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
47 #, no-wrap
48 msgid "NAME"
49 msgstr "НАИМЕНОВАНИЕ"
50
51 #. type: Plain text
52 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
53 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
54 msgid "futex - fast user-space locking"
55 msgstr "futex - быстрая блокировка в пользовательском пространстве"
56
57 #. type: SH
58 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
59 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
60 #, no-wrap
61 msgid "LIBRARY"
62 msgstr "БИБЛИОТЕКА"
63
64 #. type: Plain text
65 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
66 #: opensuse-leap-16-1 opensuse-tumbleweed
67 msgid "Standard C library (I<libc>,\\ I<-lc>)"
68 msgstr "Стандартная библиотека языка C (I<libc>,\\ I<-lc>)"
69
70 #. type: SH
71 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
72 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
73 #, no-wrap
74 msgid "SYNOPSIS"
75 msgstr "СИНТАКСИС"
76
77 #. type: Plain text
78 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
79 #: opensuse-tumbleweed
80 #, fuzzy, no-wrap
81 #| msgid ""
82 #| "B<#include E<lt>linux/futex.hE<gt>> /* Definition of B<FUTEX_*> constants */\n"
83 #| "B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n"
84 #| "B<#include E<lt>unistd.hE<gt>>\n"
85 msgid ""
86 "B<#include E<lt>linux/futex.hE<gt>> /* Definition of B<FUTEX_*> constants */\n"
87 "B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n"
88 "B<#include E<lt>unistd.hE<gt>>\n"
89 msgstr ""
90 "B<#include E<lt>linux/futex.hE<gt>> /* определения констант B<FUTEX_*> */\n"
91 "B<#include E<lt>sys/syscall.hE<gt>> /* определения констант B<SYS_*> */\n"
92 "B<#include E<lt>unistd.hE<gt>>\n"
93
94 #. type: Plain text
95 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
96 #: opensuse-tumbleweed
97 #, fuzzy, no-wrap
98 #| msgid "B<int ioctl(int >I<fd>B<, int >I<op>B<, ...);>\n"
99 msgid "B<long syscall(SYS_futex, uint32_t *>I<uaddr>B<, int >I<op>B<, ...);>\n"
100 msgstr "B<int ioctl(int >I<fd>B<, int >I<op>B<, ...);>\n"
101
102 #. type: SH
103 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
104 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
105 #, no-wrap
106 msgid "DESCRIPTION"
107 msgstr "ОПИСАНИЕ"
108
109 #. type: Plain text
110 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
111 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
112 msgid ""
113 "The B<futex>() system call provides a method for waiting until a certain "
114 "condition becomes true. It is typically used as a blocking construct in the "
115 "context of shared-memory synchronization. When using futexes, the majority "
116 "of the synchronization operations are performed in user space. A user-space "
117 "program employs the B<futex>() system call only when it is likely that the "
118 "program has to block for a longer time until the condition becomes true. "
119 "Other B<futex>() operations can be used to wake any processes or threads "
120 "waiting for a particular condition."
121 msgstr ""
122 "Системный вызов B<futex>() предоставляет программам метод для ожидания пока "
123 "определённое условие не станет истинным. Обычно, этот системный вызов "
124 "используется блокирующая конструкция в контексте синхронизации общей памяти. "
125 "При использовании фьютексов основные операции синхронизации выполняются в "
126 "пространстве пользователя. Программы пользовательского пространства "
127 "выполняются системный вызов B<futex>() только когда нужно, чтобы программа "
128 "вошла в режим ожидания на долгий срок, пока условие не станет истинным. "
129 "Также B<futex>() можно использовать для пробуждения процессов или нитей, "
130 "ожидающих определённого условия."
131
132 #. type: Plain text
133 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
134 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
135 #, fuzzy
136 #| msgid ""
137 #| "A futex is a 32-bit value\\(emreferred to below as a I<futex word>\\"
138 #| "(emwhose address is supplied to the B<futex>() system call. (Futexes "
139 #| "are 32 bits in size on all platforms, including 64-bit systems.) All "
140 #| "futex operations are governed by this value. In order to share a futex "
141 #| "between processes, the futex is placed in a region of shared memory, "
142 #| "created using (for example) B<mmap>(2) or B<shmat>(2). (Thus, the "
143 #| "futex word may have different virtual addresses in different processes, "
144 #| "but these addresses all refer to the same location in physical memory.) "
145 #| "In a multithreaded program, it is sufficient to place the futex word in a "
146 #| "global variable shared by all threads."
147 msgid ""
148 "A futex is a 32-bit value\\[em]referred to below as a I<futex word>\\"
149 "[em]whose address is supplied to the B<futex>() system call. (Futexes are "
150 "32 bits in size on all platforms, including 64-bit systems.) All futex "
151 "operations are governed by this value. In order to share a futex between "
152 "processes, the futex is placed in a region of shared memory, created using "
153 "(for example) B<mmap>(2) or B<shmat>(2). (Thus, the futex word may have "
154 "different virtual addresses in different processes, but these addresses all "
155 "refer to the same location in physical memory.) In a multithreaded program, "
156 "it is sufficient to place the futex word in a global variable shared by all "
157 "threads."
158 msgstr ""
159 "Фьютекс это 32-битное значение — называемое далее I<словом фьютекса> — чей "
160 "адрес передаётся в системный вызов B<futex>() (фьютексы имеют размер в 32 "
161 "бита на всех платформах, включая 64-битные системы). Все операции с "
162 "фьютексами выполняются с этим значением. Чтобы сделать фьюетекс общим между "
163 "процессами, фьютекс помещается в область общем памяти, создаваемой с помощью "
164 "(например) B<mmap>(2) или B<shmat>(2) (то есть слово фьютекса может иметь "
165 "различающиеся виртуальные адреса в разных процессах, но эти адреса всё равно "
166 "указывают на одну область в физической памяти). В многонитевых программах "
167 "достаточно поместить слово фьютекса в глобальную переменную, доступную из "
168 "всех нитей."
169
170 #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
171 #. Notes from Darren Hart (Dec 2015):
172 #. Totally ordered with respect futex operations refers to semantics
173 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
174 #. memory reads and writes. The kernel futex operations are protected
175 #. by spinlocks, which ensure that all operations are serialized
176 #. with respect to one another.
177 #. This is a lot to attempt to define in this document. Perhaps a
178 #. reference to linux/Documentation/memory-barriers.txt as a footnote
179 #. would be sufficient? Or perhaps for this manual, "serialized" would
180 #. be sufficient, with a footnote regarding "totally ordered" and a
181 #. pointer to the memory-barrier documentation?
182 #. FIXME(Torvald Riegel):
183 #. Eventually we want to have some text in NOTES to satisfy
184 #. the reference in the following sentence
185 #. See NOTES for a detailed specification of
186 #. the synchronization semantics.
187 #. type: Plain text
188 #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
189 #. Notes from Darren Hart (Dec 2015):
190 #. Totally ordered with respect futex operations refers to semantics
191 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
192 #. memory reads and writes. The kernel futex operations are protected
193 #. by spinlocks, which ensure that all operations are serialized
194 #. with respect to one another.
195 #. This is a lot to attempt to define in this document. Perhaps a
196 #. reference to linux/Documentation/memory-barriers.txt as a footnote
197 #. would be sufficient? Or perhaps for this manual, "serialized" would
198 #. be sufficient, with a footnote regarding "totally ordered" and a
199 #. pointer to the memory-barrier documentation?
200 #. FIXME(Torvald Riegel):
201 #. Eventually we want to have some text in NOTES to satisfy
202 #. the reference in the following sentence
203 #. See NOTES for a detailed specification of
204 #. the synchronization semantics.
205 #. type: Plain text
206 #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
207 #. Notes from Darren Hart (Dec 2015):
208 #. Totally ordered with respect futex operations refers to semantics
209 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
210 #. memory reads and writes. The kernel futex operations are protected
211 #. by spinlocks, which ensure that all operations are serialized
212 #. with respect to one another.
213 #. This is a lot to attempt to define in this document. Perhaps a
214 #. reference to linux/Documentation/memory-barriers.txt as a footnote
215 #. would be sufficient? Or perhaps for this manual, "serialized" would
216 #. be sufficient, with a footnote regarding "totally ordered" and a
217 #. pointer to the memory-barrier documentation?
218 #. FIXME(Torvald Riegel):
219 #. Eventually we want to have some text in NOTES to satisfy
220 #. the reference in the following sentence
221 #. See NOTES for a detailed specification of
222 #. the synchronization semantics.
223 #. type: Plain text
224 #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
225 #. Notes from Darren Hart (Dec 2015):
226 #. Totally ordered with respect futex operations refers to semantics
227 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
228 #. memory reads and writes. The kernel futex operations are protected
229 #. by spinlocks, which ensure that all operations are serialized
230 #. with respect to one another.
231 #. This is a lot to attempt to define in this document. Perhaps a
232 #. reference to linux/Documentation/memory-barriers.txt as a footnote
233 #. would be sufficient? Or perhaps for this manual, "serialized" would
234 #. be sufficient, with a footnote regarding "totally ordered" and a
235 #. pointer to the memory-barrier documentation?
236 #. FIXME(Torvald Riegel):
237 #. Eventually we want to have some text in NOTES to satisfy
238 #. the reference in the following sentence
239 #. See NOTES for a detailed specification of
240 #. the synchronization semantics.
241 #. type: Plain text
242 #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
243 #. Notes from Darren Hart (Dec 2015):
244 #. Totally ordered with respect futex operations refers to semantics
245 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
246 #. memory reads and writes. The kernel futex operations are protected
247 #. by spinlocks, which ensure that all operations are serialized
248 #. with respect to one another.
249 #. This is a lot to attempt to define in this document. Perhaps a
250 #. reference to linux/Documentation/memory-barriers.txt as a footnote
251 #. would be sufficient? Or perhaps for this manual, "serialized" would
252 #. be sufficient, with a footnote regarding "totally ordered" and a
253 #. pointer to the memory-barrier documentation?
254 #. FIXME(Torvald Riegel):
255 #. Eventually we want to have some text in NOTES to satisfy
256 #. the reference in the following sentence
257 #. See NOTES for a detailed specification of
258 #. the synchronization semantics.
259 #. type: Plain text
260 #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
261 #. Notes from Darren Hart (Dec 2015):
262 #. Totally ordered with respect futex operations refers to semantics
263 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
264 #. memory reads and writes. The kernel futex operations are protected
265 #. by spinlocks, which ensure that all operations are serialized
266 #. with respect to one another.
267 #. This is a lot to attempt to define in this document. Perhaps a
268 #. reference to linux/Documentation/memory-barriers.txt as a footnote
269 #. would be sufficient? Or perhaps for this manual, "serialized" would
270 #. be sufficient, with a footnote regarding "totally ordered" and a
271 #. pointer to the memory-barrier documentation?
272 #. FIXME(Torvald Riegel):
273 #. Eventually we want to have some text in NOTES to satisfy
274 #. the reference in the following sentence
275 #. See NOTES for a detailed specification of
276 #. the synchronization semantics.
277 #. type: Plain text
278 #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
279 #. Notes from Darren Hart (Dec 2015):
280 #. Totally ordered with respect futex operations refers to semantics
281 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
282 #. memory reads and writes. The kernel futex operations are protected
283 #. by spinlocks, which ensure that all operations are serialized
284 #. with respect to one another.
285 #. This is a lot to attempt to define in this document. Perhaps a
286 #. reference to linux/Documentation/memory-barriers.txt as a footnote
287 #. would be sufficient? Or perhaps for this manual, "serialized" would
288 #. be sufficient, with a footnote regarding "totally ordered" and a
289 #. pointer to the memory-barrier documentation?
290 #. FIXME(Torvald Riegel):
291 #. Eventually we want to have some text in NOTES to satisfy
292 #. the reference in the following sentence
293 #. See NOTES for a detailed specification of
294 #. the synchronization semantics.
295 #. type: Plain text
296 #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
297 #. Notes from Darren Hart (Dec 2015):
298 #. Totally ordered with respect futex operations refers to semantics
299 #. of the ACQUIRE/RELEASE operations and how they impact ordering of
300 #. memory reads and writes. The kernel futex operations are protected
301 #. by spinlocks, which ensure that all operations are serialized
302 #. with respect to one another.
303 #. This is a lot to attempt to define in this document. Perhaps a
304 #. reference to linux/Documentation/memory-barriers.txt as a footnote
305 #. would be sufficient? Or perhaps for this manual, "serialized" would
306 #. be sufficient, with a footnote regarding "totally ordered" and a
307 #. pointer to the memory-barrier documentation?
308 #. FIXME(Torvald Riegel):
309 #. Eventually we want to have some text in NOTES to satisfy
310 #. the reference in the following sentence
311 #. See NOTES for a detailed specification of
312 #. the synchronization semantics.
313 #. type: Plain text
314 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
315 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
316 msgid ""
317 "When executing a futex operation that requests to block a thread, the kernel "
318 "will block only if the futex word has the value that the calling thread "
319 "supplied (as one of the arguments of the B<futex>() call) as the expected "
320 "value of the futex word. The loading of the futex word's value, the "
321 "comparison of that value with the expected value, and the actual blocking "
322 "will happen atomically and will be totally ordered with respect to "
323 "concurrent operations performed by other threads on the same futex word. "
324 "Thus, the futex word is used to connect the synchronization in user space "
325 "with the implementation of blocking by the kernel. Analogously to an atomic "
326 "compare-and-exchange operation that potentially changes shared memory, "
327 "blocking via a futex is an atomic compare-and-block operation."
328 msgstr ""
329 "Когда выполняется операция с фьютексом, запрашивается блокировка нити, "
330 "которую выполняет ядро только, если слово фьютекса имеет значение, которое "
331 "передаёт вызывающая нить (в одном из аргументов вызова B<futex>()) равное "
332 "ожидаемому значению слова фьютекса. Загрузка значения слова фьютекса, "
333 "сравнение этого значения с ожидаемым и реальная блокировка выполняется "
334 "автоматически и будет полностью упорядочена в соответствии с одновременными "
335 "операциями, выполняемыми другими нитями на тем же словом фьютекса. Таким "
336 "образом, слово фьютекса используется для обеспечения синхронизации в "
337 "пользовательском пространстве реализованной через блокировку ядром. По "
338 "аналогии с атомарной операцией сравнения-и-обмена, которая, потенциально, "
339 "изменяет общую память, блокировка через фьютекс является атомарной операцией "
340 "сравнения-и-блокировки."
341
342 #. type: Plain text
343 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
344 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
345 msgid ""
346 "One use of futexes is for implementing locks. The state of the lock (i.e., "
347 "acquired or not acquired) can be represented as an atomically accessed flag "
348 "in shared memory. In the uncontended case, a thread can access or modify "
349 "the lock state with atomic instructions, for example atomically changing it "
350 "from not acquired to acquired using an atomic compare-and-exchange "
351 "instruction. (Such instructions are performed entirely in user mode, and "
352 "the kernel maintains no information about the lock state.) On the other "
353 "hand, a thread may be unable to acquire a lock because it is already "
354 "acquired by another thread. It then may pass the lock's flag as a futex "
355 "word and the value representing the acquired state as the expected value to "
356 "a B<futex>() wait operation. This B<futex>() operation will block if and "
357 "only if the lock is still acquired (i.e., the value in the futex word still "
358 "matches the \"acquired state\"). When releasing the lock, a thread has to "
359 "first reset the lock state to not acquired and then execute a futex "
360 "operation that wakes threads blocked on the lock flag used as a futex word "
361 "(this can be further optimized to avoid unnecessary wake-ups). See "
362 "B<futex>(7) for more detail on how to use futexes."
363 msgstr ""
364 "Одним из применений фьютексов является реализация блокировок. Состояние "
365 "блокировки (т. е., получена или не получена) может быть представлено в виде "
366 "атомарно доступного флага в общей памяти. При отсутствии конкурентов, нить "
367 "может получить доступ или изменить состояние блокировки атомарными "
368 "инструкциями, например атомарно изменяя её значение с не полученной на "
369 "полученную с помощью атомарной инструкции сравнения-и-обмена (эти инструкции "
370 "целиком выполняются в пользовательском режим, и ядро с состоянием блокировки "
371 "ничего не делает). С другой стороны, нить может не получить блокировку, так "
372 "как она уже получена другой нитью. После этого она может передать флаг "
373 "блокировки в виде слова фьютекса, значением которого будет ожидаемое "
374 "значение состояния получения в операции ожидания B<futex>(). Операция "
375 "B<futex>() блокируется, только когда блокировка всё ещё имеется (т. е., "
376 "значение слова фьютекса совпадает с «состояния получения»). При освобождении "
377 "блокировки нить сначала сбрасывает состояние блокировки в не полученное, а "
378 "затем вызывает операцию фьютекса, которая пробуждает нить, заблокированную "
379 "флагом блокировки, используя его как слово фьютекса (в дальнейшем это может "
380 "быть оптимизировано для устранения ненужных пробуждений). О том, как "
381 "использовать фьютексы, смотрите B<futex>(7)."
382
383 #. type: Plain text
384 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
385 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
386 msgid ""
387 "Besides the basic wait and wake-up futex functionality, there are further "
388 "futex operations aimed at supporting more complex use cases."
389 msgstr ""
390 "Кроме основных операций ожидания и пробуждения у фьютексов есть и другие "
391 "операции, для более сложных случаев применения."
392
393 #. type: Plain text
394 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
395 #: opensuse-tumbleweed
396 #, fuzzy
397 #| msgid ""
398 #| "Note that no explicit initialization or destruction is necessary to use "
399 #| "futexes; the kernel maintains a futex (i.e., the kernel-internal "
400 #| "implementation artifact) only while operations such as B<FUTEX_WAIT>, "
401 #| "described below, are being performed on a particular futex word."
402 msgid ""
403 "Note that no explicit initialization or destruction is necessary to use "
404 "futexes; the kernel maintains a futex (i.e., the kernel-internal "
405 "implementation artifact) only while operations such as "
406 "B<FUTEX_WAIT>(2const) are being performed on a particular futex word."
407 msgstr ""
408 "Заметим, что для использования фьютексов не требуется явных действий по "
409 "инициализации и удалению; ядро поддерживает фьютексы (т. е., внутренняя "
410 "часть реализации ядра) только в операции B<FUTEX_WAIT>, описанной далее, "
411 "обрабатывая определённое слово фьютекса."
412
413 #. type: SS
414 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
415 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
416 #, no-wrap
417 msgid "Arguments"
418 msgstr "Аргументы"
419
420 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
421 #. type: Plain text
422 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
423 #: opensuse-tumbleweed
424 #, fuzzy
425 #| msgid ""
426 #| "The I<uaddr> argument points to the futex word. On all platforms, "
427 #| "futexes are four-byte integers that must be aligned on a four-byte "
428 #| "boundary. The operation to perform on the futex is specified in the "
429 #| "I<futex_op> argument; I<val> is a value whose meaning and purpose depends "
430 #| "on I<futex_op>."
431 msgid ""
432 "The I<uaddr> argument points to the futex word. On all platforms, futexes "
433 "are four-byte integers that must be aligned on a four-byte boundary. The "
434 "operation to perform on the futex is specified in the I<op> argument."
435 msgstr ""
436 "В аргументе I<uaddr> указывает слово фьютекса. На всех платформах фьютексы "
437 "это целые числа размером в четыре байта, которые должны быть выровнены по "
438 "четырёх байтовой границе. Операция, выполняемая с фьютексом, задаётся в "
439 "аргументе I<futex_op>; какое значение будет задаваться в I<val>, зависит от "
440 "I<futex_op>."
441
442 #. type: SS
443 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
444 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
445 #, no-wrap
446 msgid "Futex operations"
447 msgstr "Операции с фьютексами"
448
449 #. type: Plain text
450 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
451 #: opensuse-tumbleweed
452 #, fuzzy
453 #| msgid ""
454 #| "The I<futex_op> argument consists of two parts: a command that specifies "
455 #| "the operation to be performed, bitwise ORed with zero or more options "
456 #| "that modify the behaviour of the operation. The options that may be "
457 #| "included in I<futex_op> are as follows:"
458 msgid ""
459 "The I<op> argument consists of two parts: a command that specifies the "
460 "operation to be performed, bitwise ORed with zero or more options that "
461 "modify the behavior of the operation. The options that may be included in "
462 "I<op> are as follows:"
463 msgstr ""
464 "Аргумент I<futex_op> состоит из двух частей: команды, задающей выполняемую "
465 "операцию, и объединённые биты нуля или более параметров, которые изменяют "
466 "поведение операции. Параметры, которые можно включать в I<futex_op>:"
467
468 #. type: TP
469 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
470 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
471 #, no-wrap
472 msgid "B<FUTEX_PRIVATE_FLAG> (since Linux 2.6.22)"
473 msgstr "B<FUTEX_PRIVATE_FLAG> (начиная с Linux 2.6.22)"
474
475 #. commit 34f01cc1f512fa783302982776895c73714ebbc2
476 #. I.e., It allows the kernel choose the fast path for validating
477 #. the user-space address and avoids expensive VMA lookups,
478 #. taking reference counts on file backing store, and so on.
479 #. type: Plain text
480 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
481 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
482 msgid ""
483 "This option bit can be employed with all futex operations. It tells the "
484 "kernel that the futex is process-private and not shared with another process "
485 "(i.e., it is being used for synchronization only between threads of the same "
486 "process). This allows the kernel to make some additional performance "
487 "optimizations."
488 msgstr ""
489 "Этот параметр может быть использован для всех операций с фьютексами. Он "
490 "указывает ядру, что фьютекс доступен только для одного процесса и недоступен "
491 "другим процессам (т. е., используется для синхронизации только между нитями "
492 "одного процесса). Это позволяет ядру выполнять некоторые дополнительные "
493 "оптимизации для производительности."
494
495 #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
496 #. except the obsolete FUTEX_FD(2const), for which the "private" flag was
497 #. meaningless
498 #. type: Plain text
499 #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
500 #. except the obsolete FUTEX_FD, for which the "private" flag was
501 #. meaningless
502 #. type: Plain text
503 #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
504 #. except the obsolete FUTEX_FD(2const), for which the "private" flag was
505 #. meaningless
506 #. type: Plain text
507 #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
508 #. except the obsolete FUTEX_FD, for which the "private" flag was
509 #. meaningless
510 #. type: Plain text
511 #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
512 #. except the obsolete FUTEX_FD, for which the "private" flag was
513 #. meaningless
514 #. type: Plain text
515 #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
516 #. except the obsolete FUTEX_FD(2const), for which the "private" flag was
517 #. meaningless
518 #. type: Plain text
519 #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
520 #. except the obsolete FUTEX_FD(2const), for which the "private" flag was
521 #. meaningless
522 #. type: Plain text
523 #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
524 #. except the obsolete FUTEX_FD(2const), for which the "private" flag was
525 #. meaningless
526 #. type: Plain text
527 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
528 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
529 msgid ""
530 "As a convenience, I<E<lt>linux/futex.hE<gt>> defines a set of constants with "
531 "the suffix B<_PRIVATE> that are equivalents of all of the operations listed "
532 "below, but with the B<FUTEX_PRIVATE_FLAG> ORed into the constant value. "
533 "Thus, there are B<FUTEX_WAIT_PRIVATE>, B<FUTEX_WAKE_PRIVATE>, and so on."
534 msgstr ""
535 "Для удобства, в I<E<lt>linux/futex.hE<gt>> определён набор констант с "
536 "суффиксом B<_PRIVATE>, которые эквивалентны всем операциям, перечисленным "
537 "ниже, но с добавленным константным значением флага B<FUTEX_PRIVATE_FLAG>. То "
538 "есть, существуют B<FUTEX_WAIT_PRIVATE>, B<FUTEX_WAKE_PRIVATE> и т. д."
539
540 #. type: TP
541 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
542 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
543 #, no-wrap
544 msgid "B<FUTEX_CLOCK_REALTIME> (since Linux 2.6.28)"
545 msgstr "B<FUTEX_CLOCK_REALTIME> (начиная с Linux 2.6.28)"
546
547 #. commit 1acdac104668a0834cfa267de9946fac7764d486
548 #. commit 337f13046ff03717a9e99675284a817527440a49
549 #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae
550 #. type: Plain text
551 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
552 #: opensuse-tumbleweed
553 #, fuzzy
554 #| msgid ""
555 #| "This option bit can be employed only with the B<FUTEX_WAIT_BITSET>, "
556 #| "B<FUTEX_WAIT_REQUEUE_PI>, and (since Linux 4.5) B<FUTEX_WAIT> operations."
557 msgid ""
558 "This option bit can be employed only with the B<FUTEX_WAIT_BITSET>(2const), "
559 "B<FUTEX_WAIT_REQUEUE_PI>(2const), (since Linux 4.5) B<FUTEX_WAIT>(2const), "
560 "and (since Linux 5.14) B<FUTEX_LOCK_PI2>(2const) operations."
561 msgstr ""
562 "Этот бит параметра может применяться только с операциями "
563 "B<FUTEX_WAIT_BITSET>, B<FUTEX_WAIT_REQUEUE_PI> и B<FUTEX_WAIT> (начиная с "
564 "Linux 4.5)."
565
566 #. type: Plain text
567 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
568 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
569 msgid ""
570 "If this option is set, the kernel measures the I<timeout> against the "
571 "B<CLOCK_REALTIME> clock."
572 msgstr ""
573 "Если он указан, то ядро измеряет I<timeout> по часам B<CLOCK_REALTIME>."
574
575 #. type: Plain text
576 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
577 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
578 msgid ""
579 "If this option is not set, the kernel measures the I<timeout> against the "
580 "B<CLOCK_MONOTONIC> clock."
581 msgstr ""
582 "Если он не указан, то ядро измеряет I<timeout> по часам B<CLOCK_MONOTONIC>."
583
584 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
585 #. type: Plain text
586 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
587 #: opensuse-tumbleweed
588 #, fuzzy
589 #| msgid "The operation specified in I<futex_op> is one of the following:"
590 msgid "The operation specified in I<op> is one of the following:"
591 msgstr "Операцией в I<futex_op> может быть одно из:"
592
593 #. type: TP
594 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
595 #: opensuse-tumbleweed
596 #, fuzzy, no-wrap
597 #| msgid "B<FUTEX_WAIT>"
598 msgid "B<FUTEX_WAIT>(2const)"
599 msgstr "B<FUTEX_WAIT>"
600
601 #. type: TQ
602 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
603 #: opensuse-tumbleweed
604 #, fuzzy, no-wrap
605 #| msgid "B<FUTEX_WAKE>"
606 msgid "B<FUTEX_WAKE>(2const)"
607 msgstr "B<FUTEX_WAKE>"
608
609 #. type: TQ
610 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
611 #: opensuse-tumbleweed
612 #, fuzzy, no-wrap
613 #| msgid "B<FUTEX_FD>"
614 msgid "B<FUTEX_FD>(2const)"
615 msgstr "B<FUTEX_FD>"
616
617 #. type: TQ
618 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
619 #: opensuse-tumbleweed
620 #, fuzzy, no-wrap
621 #| msgid "B<FUTEX_REQUEUE>"
622 msgid "B<FUTEX_REQUEUE>(2const)"
623 msgstr "B<FUTEX_REQUEUE>"
624
625 #. type: TQ
626 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
627 #: opensuse-tumbleweed
628 #, fuzzy, no-wrap
629 #| msgid "B<FUTEX_CMP_REQUEUE>"
630 msgid "B<FUTEX_CMP_REQUEUE>(2const)"
631 msgstr "B<FUTEX_CMP_REQUEUE>"
632
633 #. type: TQ
634 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
635 #: opensuse-tumbleweed
636 #, fuzzy, no-wrap
637 #| msgid "B<FUTEX_WAKE_OP>"
638 msgid "B<FUTEX_WAKE_OP>(2const)"
639 msgstr "B<FUTEX_WAKE_OP>"
640
641 #. type: TQ
642 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
643 #: opensuse-tumbleweed
644 #, fuzzy, no-wrap
645 #| msgid "B<FUTEX_WAIT_BITSET>"
646 msgid "B<FUTEX_WAIT_BITSET>(2const)"
647 msgstr "B<FUTEX_WAIT_BITSET>"
648
649 #. type: TQ
650 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
651 #: opensuse-tumbleweed
652 #, fuzzy, no-wrap
653 #| msgid "B<FUTEX_WAKE_BITSET>"
654 msgid "B<FUTEX_WAKE_BITSET>(2const)"
655 msgstr "B<FUTEX_WAKE_BITSET>"
656
657 #. type: SS
658 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
659 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
660 #, no-wrap
661 msgid "Priority-inheritance futexes"
662 msgstr "Наследование приоритета из-за фьютексов"
663
664 #. type: Plain text
665 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
666 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
667 msgid ""
668 "Linux supports priority-inheritance (PI) futexes in order to handle priority-"
669 "inversion problems that can be encountered with normal futex locks. "
670 "Priority inversion is the problem that occurs when a high-priority task is "
671 "blocked waiting to acquire a lock held by a low-priority task, while tasks "
672 "at an intermediate priority continuously preempt the low-priority task from "
673 "the CPU. Consequently, the low-priority task makes no progress toward "
674 "releasing the lock, and the high-priority task remains blocked."
675 msgstr ""
676 "В Linux поддерживается наследование приоритета из-за фьютексов priority-"
677 "inheritance (PI), так как требуется решать проблему обратного приоритета, "
678 "которая встречается у обычных блокировок фьютексов. Проблема обратного "
679 "приоритета возникает, когда задача с высоким приоритетом блокируется в "
680 "ожидании получения блокировки, которую удерживает задача с низким "
681 "приоритетом, в то время как задачи со средним приоритетом постоянно "
682 "вытесняют задачу с низким приоритетом с ЦП. В следствии этого, выполнение "
683 "задачи с низким приоритетом никак не продвигается к освобождению блокировки, "
684 "и задача с высоким приоритетом остаётся заблокированной."
685
686 #. type: Plain text
687 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
688 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
689 msgid ""
690 "Priority inheritance is a mechanism for dealing with the priority-inversion "
691 "problem. With this mechanism, when a high-priority task becomes blocked by "
692 "a lock held by a low-priority task, the priority of the low-priority task is "
693 "temporarily raised to that of the high-priority task, so that it is not "
694 "preempted by any intermediate level tasks, and can thus make progress toward "
695 "releasing the lock. To be effective, priority inheritance must be "
696 "transitive, meaning that if a high-priority task blocks on a lock held by a "
697 "lower-priority task that is itself blocked by a lock held by another "
698 "intermediate-priority task (and so on, for chains of arbitrary length), then "
699 "both of those tasks (or more generally, all of the tasks in a lock chain) "
700 "have their priorities raised to be the same as the high-priority task."
701 msgstr ""
702 "Наследование приоритета — это механизм, который решает проблему обратного "
703 "приоритета. С его помощью, когда задача с высоким приоритетом блокируется из-"
704 "за удержания блокировки задачей с низким приоритетом, приоритет задачи с "
705 "низким приоритетом временно повышается до приоритета, имеющегося у "
706 "заблокированной задачи, и поэтому не происходит вытеснения задачами с "
707 "средним приоритетом, что способствует ускорению освобождения блокировки. "
708 "Чтобы это работало, наследование приоритета должно быть транзитивным, то "
709 "есть если задача с высоким приоритетом заблокирована, из-за удержания "
710 "блокировки задачей с низким приоритетом, которая сама заблокирована из-за "
711 "удержания блокировки другой задачей со средним приоритетом (и так далее, по "
712 "цепочке произвольной длины), то для обеих этих задач (или, шире, всех задач "
713 "в заблокированной цепочке) повышается приоритет, который равен приоритету "
714 "задачи с высоким приоритетом."
715
716 #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
717 #. Quoting Darren Hart:
718 #. These opcodes paired with the PI futex value policy (described below)
719 #. defines a "futex" as PI aware. These were created very specifically
720 #. in support of PI pthread_mutexes, so it makes a lot more sense to
721 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
722 #. there is a lot of policy and scaffolding that has to be built up
723 #. around it to use it properly (this is what a PI pthread_mutex is).
724 #. type: Plain text
725 #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
726 #. Quoting Darren Hart:
727 #. These opcodes paired with the PI futex value policy (described below)
728 #. defines a "futex" as PI aware. These were created very specifically
729 #. in support of PI pthread_mutexes, so it makes a lot more sense to
730 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
731 #. there is a lot of policy and scaffolding that has to be built up
732 #. around it to use it properly (this is what a PI pthread_mutex is).
733 #. type: Plain text
734 #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
735 #. Quoting Darren Hart:
736 #. These opcodes paired with the PI futex value policy (described below)
737 #. defines a "futex" as PI aware. These were created very specifically
738 #. in support of PI pthread_mutexes, so it makes a lot more sense to
739 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
740 #. there is a lot of policy and scaffolding that has to be built up
741 #. around it to use it properly (this is what a PI pthread_mutex is).
742 #. type: Plain text
743 #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
744 #. Quoting Darren Hart:
745 #. These opcodes paired with the PI futex value policy (described below)
746 #. defines a "futex" as PI aware. These were created very specifically
747 #. in support of PI pthread_mutexes, so it makes a lot more sense to
748 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
749 #. there is a lot of policy and scaffolding that has to be built up
750 #. around it to use it properly (this is what a PI pthread_mutex is).
751 #. type: Plain text
752 #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
753 #. Quoting Darren Hart:
754 #. These opcodes paired with the PI futex value policy (described below)
755 #. defines a "futex" as PI aware. These were created very specifically
756 #. in support of PI pthread_mutexes, so it makes a lot more sense to
757 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
758 #. there is a lot of policy and scaffolding that has to be built up
759 #. around it to use it properly (this is what a PI pthread_mutex is).
760 #. type: Plain text
761 #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
762 #. Quoting Darren Hart:
763 #. These opcodes paired with the PI futex value policy (described below)
764 #. defines a "futex" as PI aware. These were created very specifically
765 #. in support of PI pthread_mutexes, so it makes a lot more sense to
766 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
767 #. there is a lot of policy and scaffolding that has to be built up
768 #. around it to use it properly (this is what a PI pthread_mutex is).
769 #. type: Plain text
770 #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
771 #. Quoting Darren Hart:
772 #. These opcodes paired with the PI futex value policy (described below)
773 #. defines a "futex" as PI aware. These were created very specifically
774 #. in support of PI pthread_mutexes, so it makes a lot more sense to
775 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
776 #. there is a lot of policy and scaffolding that has to be built up
777 #. around it to use it properly (this is what a PI pthread_mutex is).
778 #. type: Plain text
779 #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
780 #. Quoting Darren Hart:
781 #. These opcodes paired with the PI futex value policy (described below)
782 #. defines a "futex" as PI aware. These were created very specifically
783 #. in support of PI pthread_mutexes, so it makes a lot more sense to
784 #. talk about a PI aware pthread_mutex, than a PI aware futex, since
785 #. there is a lot of policy and scaffolding that has to be built up
786 #. around it to use it properly (this is what a PI pthread_mutex is).
787 #. type: Plain text
788 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
789 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
790 msgid ""
791 "From a user-space perspective, what makes a futex PI-aware is a policy "
792 "agreement (described below) between user space and the kernel about the "
793 "value of the futex word, coupled with the use of the PI-futex operations "
794 "described below. (Unlike the other futex operations described above, the PI-"
795 "futex operations are designed for the implementation of very specific IPC "
796 "mechanisms.)"
797 msgstr ""
798 "Со стороны пользовательского пространства фьютекс является PI из-за "
799 "следования соглашениям (описанных далее) между пользовательским "
800 "пространством и ядром о значении слова фьютекса и применяемым операциям над "
801 "PI-фьютексами, описанным далее (в отличие от других операций с фьютексами, "
802 "описанных выше, операции с PI-фьютексами разработаны для реализации очень "
803 "специфичных механизмов IPC)."
804
805 #. mtk: The following text is drawn from the Hart/Guniguntala paper
806 #. (listed in SEE ALSO), but I have reworded some pieces
807 #. significantly.
808 #. type: Plain text
809 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
810 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
811 msgid ""
812 "The PI-futex operations described below differ from the other futex "
813 "operations in that they impose policy on the use of the value of the futex "
814 "word:"
815 msgstr ""
816 "Операции с PI-фьютексами, описанные далее, отличаются от других операций с "
817 "фьютексами в том, что они следуют политике использования значения слова "
818 "фьютекса:"
819
820 #. type: IP
821 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
822 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
823 #, no-wrap
824 msgid "\\[bu]"
825 msgstr "\\[bu]"
826
827 #. type: Plain text
828 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
829 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
830 msgid "If the lock is not acquired, the futex word's value shall be 0."
831 msgstr ""
832 "Если блокировка не получена, то значение слова фьютекса должно быть равно 0."
833
834 #. type: Plain text
835 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
836 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
837 msgid ""
838 "If the lock is acquired, the futex word's value shall be the thread ID (TID; "
839 "see B<gettid>(2)) of the owning thread."
840 msgstr ""
841 "Если блокировка получена, то значение слова фьютекса должно быть равно ID "
842 "нити (TID; смотрите B<gettid>(2)), которой оно принадлежит."
843
844 #. type: Plain text
845 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
846 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
847 msgid ""
848 "If the lock is owned and there are threads contending for the lock, then the "
849 "B<FUTEX_WAITERS> bit shall be set in the futex word's value; in other words, "
850 "this value is:"
851 msgstr ""
852 "Если блокировка получена и есть претендующие на неё нити, то в значении "
853 "слова фьютекса должен быть установлен бит B<FUTEX_WAITERS>; иначе говоря, "
854 "это значение равно:"
855
856 #. type: Plain text
857 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
858 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
859 #, no-wrap
860 msgid "FUTEX_WAITERS | TID\n"
861 msgstr "FUTEX_WAITERS | TID\n"
862
863 #. type: Plain text
864 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
865 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
866 msgid ""
867 "(Note that is invalid for a PI futex word to have no owner and "
868 "B<FUTEX_WAITERS> set.)"
869 msgstr ""
870 "(заметим, что некорректное слово PI-фьютекса не имеет владельца и "
871 "B<FUTEX_WAITERS>)"
872
873 #. type: Plain text
874 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
875 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
876 msgid ""
877 "With this policy in place, a user-space application can acquire an "
878 "unacquired lock or release a lock using atomic instructions executed in user "
879 "mode (e.g., a compare-and-swap operation such as I<cmpxchg> on the x86 "
880 "architecture). Acquiring a lock simply consists of using compare-and-swap "
881 "to atomically set the futex word's value to the caller's TID if its previous "
882 "value was 0. Releasing a lock requires using compare-and-swap to set the "
883 "futex word's value to 0 if the previous value was the expected TID."
884 msgstr ""
885 "С этой действующей политикой приложение пространства пользователя может "
886 "получить свободную блокировку или освободить блокировку с помощью атомарных "
887 "инструкций, выполняемых в пользовательском режиме (например, операцией "
888 "сравнение-и-обмен I<cmpxchg> на архитектуре x86). Получение блокировки "
889 "состоит просто из использования сравнения-и-обмена для атомарного изменения "
890 "значения слова фьютекса на TID вызывающего, если предыдущее значение было "
891 "равно 0. Для освобождения блокировки требуется использовать сравнение-и-"
892 "обмен для изменения значения слова фьютекса на 0, если предыдущее значение "
893 "равно ожидаемому TID."
894
895 #. type: Plain text
896 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
897 #: opensuse-tumbleweed
898 #, fuzzy
899 #| msgid ""
900 #| "If a futex is already acquired (i.e., has a nonzero value), waiters must "
901 #| "employ the B<FUTEX_LOCK_PI> operation to acquire the lock. If other "
902 #| "threads are waiting for the lock, then the B<FUTEX_WAITERS> bit is set in "
903 #| "the futex value; in this case, the lock owner must employ the "
904 #| "B<FUTEX_UNLOCK_PI> operation to release the lock."
905 msgid ""
906 "If a futex is already acquired (i.e., has a nonzero value), waiters must "
907 "employ the B<FUTEX_LOCK_PI>(2const) or B<FUTEX_LOCK_PI2>(2const) "
908 "operations to acquire the lock. If other threads are waiting for the lock, "
909 "then the B<FUTEX_WAITERS> bit is set in the futex value; in this case, the "
910 "lock owner must employ the B<FUTEX_UNLOCK_PI>(2const) operation to release "
911 "the lock."
912 msgstr ""
913 "Если фьютекс уже получен (т. е. имеет ненулевое значение), то ожидающие "
914 "должны применить операцию B<FUTEX_LOCK_PI> для получения блокировки. Если "
915 "другие нити ждут блокировку, то в значении фьютекса установлен бит "
916 "B<FUTEX_WAITERS>; в этом случае владелец блокировки должен применить "
917 "операцию B<FUTEX_UNLOCK_PI> для освобождения блокировки."
918
919 #. type: Plain text
920 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
921 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
922 msgid ""
923 "In the cases where callers are forced into the kernel (i.e., required to "
924 "perform a B<futex>() call), they then deal directly with a so-called RT-"
925 "mutex, a kernel locking mechanism which implements the required priority-"
926 "inheritance semantics. After the RT-mutex is acquired, the futex value is "
927 "updated accordingly, before the calling thread returns to user space."
928 msgstr ""
929 "В случаях, когда вызывающие переходят в ядро (т. е., требуется выполнение "
930 "вызова B<futex>()), после этого они напрямую работают с так называемым RT-"
931 "мьютексом, механизмом блокировок ядра, которым реализована требуемая "
932 "семантика наследования приоритета. После получения RT-мьютекса, значение "
933 "фьютекса обновляется соответствующим образом, перед возврата вызывающей нити "
934 "в пространство пользователя."
935
936 #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
937 #. tglx (July 2015):
938 #. If there are multiple waiters on a pi futex then a wake pi operation
939 #. will wake the first waiter and hand over the lock to this waiter. This
940 #. includes handing over the rtmutex which represents the futex in the
941 #. kernel. The strict requirement is that the futex owner and the rtmutex
942 #. owner must be the same, except for the update period which is
943 #. serialized by the futex internal locking. That means the kernel must
944 #. update the user-space value prior to returning to user space
945 #. type: Plain text
946 #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
947 #. tglx (July 2015):
948 #. If there are multiple waiters on a pi futex then a wake pi operation
949 #. will wake the first waiter and hand over the lock to this waiter. This
950 #. includes handing over the rtmutex which represents the futex in the
951 #. kernel. The strict requirement is that the futex owner and the rtmutex
952 #. owner must be the same, except for the update period which is
953 #. serialized by the futex internal locking. That means the kernel must
954 #. update the user-space value prior to returning to user space
955 #. type: Plain text
956 #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
957 #. tglx (July 2015):
958 #. If there are multiple waiters on a pi futex then a wake pi operation
959 #. will wake the first waiter and hand over the lock to this waiter. This
960 #. includes handing over the rtmutex which represents the futex in the
961 #. kernel. The strict requirement is that the futex owner and the rtmutex
962 #. owner must be the same, except for the update period which is
963 #. serialized by the futex internal locking. That means the kernel must
964 #. update the user-space value prior to returning to user space
965 #. type: Plain text
966 #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
967 #. tglx (July 2015):
968 #. If there are multiple waiters on a pi futex then a wake pi operation
969 #. will wake the first waiter and hand over the lock to this waiter. This
970 #. includes handing over the rtmutex which represents the futex in the
971 #. kernel. The strict requirement is that the futex owner and the rtmutex
972 #. owner must be the same, except for the update period which is
973 #. serialized by the futex internal locking. That means the kernel must
974 #. update the user-space value prior to returning to user space
975 #. type: Plain text
976 #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
977 #. tglx (July 2015):
978 #. If there are multiple waiters on a pi futex then a wake pi operation
979 #. will wake the first waiter and hand over the lock to this waiter. This
980 #. includes handing over the rtmutex which represents the futex in the
981 #. kernel. The strict requirement is that the futex owner and the rtmutex
982 #. owner must be the same, except for the update period which is
983 #. serialized by the futex internal locking. That means the kernel must
984 #. update the user-space value prior to returning to user space
985 #. type: Plain text
986 #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
987 #. tglx (July 2015):
988 #. If there are multiple waiters on a pi futex then a wake pi operation
989 #. will wake the first waiter and hand over the lock to this waiter. This
990 #. includes handing over the rtmutex which represents the futex in the
991 #. kernel. The strict requirement is that the futex owner and the rtmutex
992 #. owner must be the same, except for the update period which is
993 #. serialized by the futex internal locking. That means the kernel must
994 #. update the user-space value prior to returning to user space
995 #. type: Plain text
996 #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
997 #. tglx (July 2015):
998 #. If there are multiple waiters on a pi futex then a wake pi operation
999 #. will wake the first waiter and hand over the lock to this waiter. This
1000 #. includes handing over the rtmutex which represents the futex in the
1001 #. kernel. The strict requirement is that the futex owner and the rtmutex
1002 #. owner must be the same, except for the update period which is
1003 #. serialized by the futex internal locking. That means the kernel must
1004 #. update the user-space value prior to returning to user space
1005 #. type: Plain text
1006 #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1007 #. tglx (July 2015):
1008 #. If there are multiple waiters on a pi futex then a wake pi operation
1009 #. will wake the first waiter and hand over the lock to this waiter. This
1010 #. includes handing over the rtmutex which represents the futex in the
1011 #. kernel. The strict requirement is that the futex owner and the rtmutex
1012 #. owner must be the same, except for the update period which is
1013 #. serialized by the futex internal locking. That means the kernel must
1014 #. update the user-space value prior to returning to user space
1015 #. type: Plain text
1016 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1017 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1018 msgid ""
1019 "It is important to note that the kernel will update the futex word's value "
1020 "prior to returning to user space. (This prevents the possibility of the "
1021 "futex word's value ending up in an invalid state, such as having an owner "
1022 "but the value being 0, or having waiters but not having the B<FUTEX_WAITERS> "
1023 "bit set.)"
1024 msgstr ""
1025 "Важно упомянуть, что ядро обновит значение слова фьютекса до возврата в "
1026 "пространство пользователя (это предотвращает возможность попадания значения "
1027 "слова фьютекса в некорректное состояние, такое, что имея владельца, значение "
1028 "равно 0, или имея ожидающих, не установлен бит B<FUTEX_WAITERS>)."
1029
1030 #. #-#-#-#-# archlinux: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1031 #. tglx (July 2015):
1032 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1033 #. the kernel has no state associated. This happens via the robust futex
1034 #. mechanism. In that case the futex value will be set to
1035 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1036 #. PI futexes.
1037 #. type: Plain text
1038 #. #-#-#-#-# debian-trixie: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1039 #. tglx (July 2015):
1040 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1041 #. the kernel has no state associated. This happens via the robust futex
1042 #. mechanism. In that case the futex value will be set to
1043 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1044 #. PI futexes.
1045 #. type: Plain text
1046 #. #-#-#-#-# debian-unstable: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1047 #. tglx (July 2015):
1048 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1049 #. the kernel has no state associated. This happens via the robust futex
1050 #. mechanism. In that case the futex value will be set to
1051 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1052 #. PI futexes.
1053 #. type: Plain text
1054 #. #-#-#-#-# fedora-44: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1055 #. tglx (July 2015):
1056 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1057 #. the kernel has no state associated. This happens via the robust futex
1058 #. mechanism. In that case the futex value will be set to
1059 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1060 #. PI futexes.
1061 #. type: Plain text
1062 #. #-#-#-#-# fedora-rawhide: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1063 #. tglx (July 2015):
1064 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1065 #. the kernel has no state associated. This happens via the robust futex
1066 #. mechanism. In that case the futex value will be set to
1067 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1068 #. PI futexes.
1069 #. type: Plain text
1070 #. #-#-#-#-# mageia-cauldron: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1071 #. tglx (July 2015):
1072 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1073 #. the kernel has no state associated. This happens via the robust futex
1074 #. mechanism. In that case the futex value will be set to
1075 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1076 #. PI futexes.
1077 #. type: Plain text
1078 #. #-#-#-#-# opensuse-leap-16-1: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1079 #. tglx (July 2015):
1080 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1081 #. the kernel has no state associated. This happens via the robust futex
1082 #. mechanism. In that case the futex value will be set to
1083 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1084 #. PI futexes.
1085 #. type: Plain text
1086 #. #-#-#-#-# opensuse-tumbleweed: futex.2.pot (PACKAGE VERSION) #-#-#-#-#
1087 #. tglx (July 2015):
1088 #. The FUTEX_OWNER_DIED bit can also be set on uncontended futexes, where
1089 #. the kernel has no state associated. This happens via the robust futex
1090 #. mechanism. In that case the futex value will be set to
1091 #. FUTEX_OWNER_DIED. The robust futex mechanism is also available for non
1092 #. PI futexes.
1093 #. type: Plain text
1094 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1095 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1096 msgid ""
1097 "If a futex has an associated RT-mutex in the kernel (i.e., there are blocked "
1098 "waiters) and the owner of the futex/RT-mutex dies unexpectedly, then the "
1099 "kernel cleans up the RT-mutex and hands it over to the next waiter. This in "
1100 "turn requires that the user-space value is updated accordingly. To indicate "
1101 "that this is required, the kernel sets the B<FUTEX_OWNER_DIED> bit in the "
1102 "futex word along with the thread ID of the new owner. User space can detect "
1103 "this situation via the presence of the B<FUTEX_OWNER_DIED> bit and is then "
1104 "responsible for cleaning up the stale state left over by the dead owner."
1105 msgstr ""
1106 "Если фьютекс связан с RT-мьютексом в ядре (т. е., есть заблокированные "
1107 "ожидающие) и владелец фьютекса/RT-мьютекса неожиданно завершился, то ядро "
1108 "очищает RT-мьютекс и передаёт его следующему ожидающему. Это, в свою "
1109 "очередь, требует, чтобы значение в пользовательском пространстве было "
1110 "изменено соответствующим образом. Для сообщения о необходимости этого ядро "
1111 "изменяет бит B<FUTEX_OWNER_DIED> в слове фьютекса вместе со сменой ID нити "
1112 "нового владельца. Пользовательское пространство может определить такую "
1113 "ситуацию по установленному биту B<FUTEX_OWNER_DIED> и затем, соответствующим "
1114 "образом, очистить устаревшее состояние, возникшее из-за закончившего работу "
1115 "владельца."
1116
1117 #. type: Plain text
1118 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1119 #: opensuse-tumbleweed
1120 #, fuzzy
1121 #| msgid ""
1122 #| "PI futexes are operated on by specifying one of the values listed below "
1123 #| "in I<futex_op>. Note that the PI futex operations must be used as paired "
1124 #| "operations and are subject to some additional requirements:"
1125 msgid ""
1126 "PI futexes are operated on by specifying one of the values listed below in "
1127 "I<op>. Note that the PI futex operations must be used as paired operations "
1128 "and are subject to some additional requirements:"
1129 msgstr ""
1130 "PI-фьютексы обрабатываются при указании в I<futex_op> одного из значений, "
1131 "перечисленных далее. Заметим, что операции с PI-фьютексами должны "
1132 "использовать попарно и учитывать некоторые дополнительные требования:"
1133
1134 #. type: Plain text
1135 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1136 #: opensuse-tumbleweed
1137 #, fuzzy
1138 #| msgid ""
1139 #| "B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, and B<FUTEX_TRYLOCK_PI> pair with "
1140 #| "B<FUTEX_UNLOCK_PI>. B<FUTEX_UNLOCK_PI> must be called only on a futex "
1141 #| "owned by the calling thread, as defined by the value policy, otherwise "
1142 #| "the error B<EPERM> results."
1143 msgid ""
1144 "B<FUTEX_LOCK_PI>(2const), B<FUTEX_LOCK_PI2>(2const), and "
1145 "B<FUTEX_TRYLOCK_PI>(2const) pair with B<FUTEX_UNLOCK_PI>(2const). "
1146 "B<FUTEX_UNLOCK_PI>(2const) must be called only on a futex owned by the "
1147 "calling thread, as defined by the value policy, otherwise the error B<EPERM> "
1148 "results."
1149 msgstr ""
1150 "Парой к операциям B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2> и B<FUTEX_TRYLOCK_PI> "
1151 "является B<FUTEX_UNLOCK_PI>. Операция B<FUTEX_UNLOCK_PI> должна применяться "
1152 "только к фьютексам, принадлежащим вызывающей нити, определённой значением "
1153 "политики, или же возникнет ошибка B<EPERM>."
1154
1155 #. type: Plain text
1156 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1157 #: opensuse-tumbleweed
1158 #, fuzzy
1159 #| msgid ""
1160 #| "B<FUTEX_WAIT_REQUEUE_PI> pairs with B<FUTEX_CMP_REQUEUE_PI>. This must "
1161 #| "be performed from a non-PI futex to a distinct PI futex (or the error "
1162 #| "B<EINVAL> results). Additionally, I<val> (the number of waiters to be "
1163 #| "woken) must be 1 (or the error B<EINVAL> results)."
1164 msgid ""
1165 "B<FUTEX_WAIT_REQUEUE_PI>(2const) pairs with "
1166 "B<FUTEX_CMP_REQUEUE_PI>(2const). This must be performed from a non-PI futex "
1167 "to a distinct PI futex (or the error B<EINVAL> results). Additionally, the "
1168 "number of waiters to be woken must be 1 (or the error B<EINVAL> results)."
1169 msgstr ""
1170 "Парой к операции B<FUTEX_WAIT_REQUEUE_PI> является B<FUTEX_CMP_REQUEUE_PI>. "
1171 "Она должна применяться для перехода с не PI-фьютекса к PI-фьютексу (или "
1172 "возникает ошибка B<EINVAL>). Также, I<val> (количество разбуживаемых "
1173 "ожидающих) должно равняться 1 (или возникает ошибка B<EINVAL>)."
1174
1175 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1176 #. type: Plain text
1177 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1178 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1179 msgid "The PI futex operations are as follows:"
1180 msgstr "Операции с PI-фьютексами:"
1181
1182 #. type: TP
1183 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1184 #: opensuse-tumbleweed
1185 #, fuzzy, no-wrap
1186 #| msgid "B<FUTEX_LOCK_PI>"
1187 msgid "B<FUTEX_LOCK_PI>(2const)"
1188 msgstr "B<FUTEX_LOCK_PI>"
1189
1190 #. type: TQ
1191 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1192 #: opensuse-tumbleweed
1193 #, fuzzy, no-wrap
1194 #| msgid "B<FUTEX_LOCK_PI2>"
1195 msgid "B<FUTEX_LOCK_PI2>(2const)"
1196 msgstr "B<FUTEX_LOCK_PI2>"
1197
1198 #. type: TQ
1199 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1200 #: opensuse-tumbleweed
1201 #, fuzzy, no-wrap
1202 #| msgid "B<FUTEX_TRYLOCK_PI>"
1203 msgid "B<FUTEX_TRYLOCK_PI>(2const)"
1204 msgstr "B<FUTEX_TRYLOCK_PI>"
1205
1206 #. type: TQ
1207 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1208 #: opensuse-tumbleweed
1209 #, fuzzy, no-wrap
1210 #| msgid "B<FUTEX_UNLOCK_PI>"
1211 msgid "B<FUTEX_UNLOCK_PI>(2const)"
1212 msgstr "B<FUTEX_UNLOCK_PI>"
1213
1214 #. type: TQ
1215 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1216 #: opensuse-tumbleweed
1217 #, fuzzy, no-wrap
1218 #| msgid "B<FUTEX_CMP_REQUEUE_PI>"
1219 msgid "B<FUTEX_CMP_REQUEUE_PI>(2const)"
1220 msgstr "B<FUTEX_CMP_REQUEUE_PI>"
1221
1222 #. type: TQ
1223 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1224 #: opensuse-tumbleweed
1225 #, fuzzy, no-wrap
1226 #| msgid "B<FUTEX_WAIT_REQUEUE_PI>"
1227 msgid "B<FUTEX_WAIT_REQUEUE_PI>(2const)"
1228 msgstr "B<FUTEX_WAIT_REQUEUE_PI>"
1229
1230 #. Darren Hart notes that a patch to allow glibc to fully support
1231 #. PI-aware pthreads condition variables has not yet been accepted into
1232 #. glibc. The story is complex, and can be found at
1233 #. https://sourceware.org/bugzilla/show_bug.cgi?id=11588
1234 #. Darren notes that in the meantime, the patch is shipped with various
1235 #. PREEMPT_RT-enabled Linux systems.
1236 #. Related to the preceding, Darren proposed that somewhere, man-pages
1237 #. should document the following point:
1238 #. While the Linux kernel, since Linux 2.6.31, supports requeueing of
1239 #. priority-inheritance (PI) aware mutexes via the
1240 #. FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI futex operations,
1241 #. the glibc implementation does not yet take full advantage of this.
1242 #. Specifically, the condvar internal data lock remains a non-PI aware
1243 #. mutex, regardless of the type of the pthread_mutex associated with
1244 #. the condvar. This can lead to an unbounded priority inversion on
1245 #. the internal data lock even when associating a PI aware
1246 #. pthread_mutex with a condvar during a pthread_cond*_wait
1247 #. operation. For this reason, it is not recommended to rely on
1248 #. priority inheritance when using pthread condition variables.
1249 #. The problem is that the obvious location for this text is
1250 #. the pthread_cond*wait(3) man page. However, such a man page
1251 #. does not currently exist.
1252 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1253 #. type: Plain text
1254 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1255 #: opensuse-tumbleweed
1256 #, fuzzy
1257 #| msgid ""
1258 #| "The B<FUTEX_WAIT_REQUEUE_PI> and B<FUTEX_CMP_REQUEUE_PI> were added to "
1259 #| "support a fairly specific use case: support for priority-inheritance-"
1260 #| "aware POSIX threads condition variables. The idea is that these "
1261 #| "operations should always be paired, in order to ensure that user space "
1262 #| "and the kernel remain in sync. Thus, in the B<FUTEX_WAIT_REQUEUE_PI> "
1263 #| "operation, the user-space application pre-specifies the target of the "
1264 #| "requeue that takes place in the B<FUTEX_CMP_REQUEUE_PI> operation."
1265 msgid ""
1266 "The B<FUTEX_WAIT_REQUEUE_PI>(2const) and B<FUTEX_CMP_REQUEUE_PI>(2const) "
1267 "were added to support a fairly specific use case: support for priority-"
1268 "inheritance-aware POSIX threads condition variables. The idea is that these "
1269 "operations should always be paired, in order to ensure that user space and "
1270 "the kernel remain in sync. Thus, in the B<FUTEX_WAIT_REQUEUE_PI>(2const) "
1271 "operation, the user-space application pre-specifies the target of the "
1272 "requeue that takes place in the B<FUTEX_CMP_REQUEUE_PI>(2const) operation."
1273 msgstr ""
1274 "Операции B<FUTEX_WAIT_REQUEUE_PI> и B<FUTEX_CMP_REQUEUE_PI> добавлены для "
1275 "довольно узкого варианта применения — поддержки переменных условия нитей "
1276 "POSIX с наследованием приоритета. Идея в том, что эти операции всегда должны "
1277 "использоваться попарно, для поддержания синхронизации между пользовательским "
1278 "пространством и ядром. То есть в операции B<FUTEX_WAIT_REQUEUE_PI> "
1279 "приложение пользовательского пространства заранее задаёт назначение для "
1280 "перемещения в очередь, которое проводится операцией B<FUTEX_CMP_REQUEUE_PI>."
1281
1282 #. type: SH
1283 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1284 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1285 #, no-wrap
1286 msgid "RETURN VALUE"
1287 msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ"
1288
1289 #. type: Plain text
1290 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1291 #: opensuse-tumbleweed
1292 msgid "On error, -1 is returned, and I<errno> is set to indicate the error."
1293 msgstr ""
1294 "В случае ошибки возвращается -1, а I<errno> устанавливается в значение "
1295 "ошибки."
1296
1297 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1298 #. type: Plain text
1299 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1300 #: opensuse-tumbleweed
1301 #, fuzzy
1302 #| msgid ""
1303 #| "The return value on success depends on the operation, as described in the "
1304 #| "following list:"
1305 msgid "The return value on success depends on the operation."
1306 msgstr "При успешном выполнении возвращаемое значение зависит от операции:"
1307
1308 #. type: SH
1309 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1310 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1311 #, no-wrap
1312 msgid "ERRORS"
1313 msgstr "ОШИБКИ"
1314
1315 #. type: TP
1316 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1317 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1318 #, no-wrap
1319 msgid "B<EACCES>"
1320 msgstr "B<EACCES>"
1321
1322 #. type: Plain text
1323 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1324 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1325 msgid "No read access to the memory of a futex word."
1326 msgstr "Нет доступа на чтение памяти слова фьютекса."
1327
1328 #. type: TP
1329 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1330 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1331 #, no-wrap
1332 msgid "B<EFAULT>"
1333 msgstr "B<EFAULT>"
1334
1335 #. type: Plain text
1336 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1337 #: opensuse-tumbleweed
1338 #, fuzzy
1339 #| msgid ""
1340 #| "A required pointer argument (i.e., I<uaddr>, I<uaddr2>, or I<timeout>) "
1341 #| "did not point to a valid user-space address."
1342 msgid "I<uaddr> did not point to a valid user-space address."
1343 msgstr ""
1344 "Требуемый аргумент указателя (т. е., I<uaddr>, I<uaddr2> или I<timeout>) не "
1345 "указывает на допустимый адрес пользовательского пространства."
1346
1347 #. type: TP
1348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1350 #, no-wrap
1351 msgid "B<EINVAL>"
1352 msgstr "B<EINVAL>"
1353
1354 #. type: Plain text
1355 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1356 #: opensuse-tumbleweed
1357 #, fuzzy
1358 #| msgid ""
1359 #| "The operation specified in I<futex_op> employs one or both of the "
1360 #| "pointers I<uaddr> and I<uaddr2>, but one of these does not point to a "
1361 #| "valid object\\(emthat is, the address is not four-byte-aligned."
1362 msgid ""
1363 "I<uaddr> does not point to a valid object\\[em]that is, the address is not "
1364 "four-byte-aligned."
1365 msgstr ""
1366 "Операция, указанная в I<futex_op>, использует один или оба указателя "
1367 "I<uaddr> и I<uaddr2>, но один из них не указывает на корректный объект, то "
1368 "есть адрес не выровнен по четырёх байтовой границе."
1369
1370 #. type: Plain text
1371 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1372 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1373 msgid "Invalid argument."
1374 msgstr "Неверный аргумент."
1375
1376 #. type: TP
1377 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1378 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1379 #, no-wrap
1380 msgid "B<ENOSYS>"
1381 msgstr "B<ENOSYS>"
1382
1383 #. type: Plain text
1384 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1385 #: opensuse-tumbleweed
1386 #, fuzzy
1387 #| msgid "Invalid operation specified in I<futex_op>."
1388 msgid "Invalid operation specified in I<op>."
1389 msgstr "В I<futex_op> задана неверная операция."
1390
1391 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1392 #. type: Plain text
1393 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1394 #: opensuse-tumbleweed
1395 #, fuzzy
1396 #| msgid ""
1397 #| "The B<FUTEX_CLOCK_REALTIME> option was specified in I<futex_op>, but the "
1398 #| "accompanying operation was neither B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET>, "
1399 #| "nor B<FUTEX_WAIT_REQUEUE_PI>."
1400 msgid ""
1401 "The B<FUTEX_CLOCK_REALTIME> option was specified in I<op>, but the "
1402 "accompanying operation was neither B<FUTEX_WAIT_BITSET>(2const), "
1403 "B<FUTEX_WAIT_REQUEUE_PI>(2const), nor B<FUTEX_LOCK_PI2>(2const)."
1404 msgstr ""
1405 "В I<futex_op> был указан параметр B<FUTEX_CLOCK_REALTIME>, но сопутствующая "
1406 "операция не равна B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET> или "
1407 "B<FUTEX_WAIT_REQUEUE_PI>."
1408
1409 #. type: SH
1410 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1411 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1412 #, no-wrap
1413 msgid "STANDARDS"
1414 msgstr "СТАНДАРТЫ"
1415
1416 #. type: Plain text
1417 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1418 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1419 msgid "Linux."
1420 msgstr "Linux."
1421
1422 #. type: SH
1423 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1424 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1425 #, no-wrap
1426 msgid "HISTORY"
1427 msgstr "ИСТОРИЯ"
1428
1429 #. type: Plain text
1430 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1431 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1432 msgid "Linux 2.6.0."
1433 msgstr "Linux 2.6.0."
1434
1435 #. type: Plain text
1436 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1437 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1438 msgid ""
1439 "Initial futex support was merged in Linux 2.5.7 but with different semantics "
1440 "from what was described above. A four-argument system call with the "
1441 "semantics described in this page was introduced in Linux 2.5.40. A fifth "
1442 "argument was added in Linux 2.5.70, and a sixth argument was added in Linux "
1443 "2.6.7."
1444 msgstr ""
1445 "Начальная поддержка фьютексов была встроена в Linux 2.5.7, но с другой "
1446 "семантикой, отличающейся от описанной выше. Семантика системного вызова с "
1447 "четырьмя аргументами, описанная в этой странице, появилась в Linux 2.5.40. "
1448 "Пятый аргумент была добавлен в Linux 2.5.70, а шестой аргумент был добавлен "
1449 "в Linux 2.6.7."
1450
1451 #. type: SH
1452 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1453 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1454 #, no-wrap
1455 msgid "EXAMPLES"
1456 msgstr "ПРИМЕРЫ"
1457
1458 #. type: Plain text
1459 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1460 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1461 msgid ""
1462 "The program below demonstrates use of futexes in a program where a parent "
1463 "process and a child process use a pair of futexes located inside a shared "
1464 "anonymous mapping to synchronize access to a shared resource: the terminal. "
1465 "The two processes each write I<nloops> (a command-line argument that "
1466 "defaults to 5 if omitted) messages to the terminal and employ a "
1467 "synchronization protocol that ensures that they alternate in writing "
1468 "messages. Upon running this program we see output such as the following:"
1469 msgstr ""
1470 "В программе, показанной далее, показано использование фьютексов: "
1471 "родительский и дочерний процессы используют пару фьютексов, расположенных в "
1472 "общем анонимном отображении, для синхронизации доступа к общему ресурсу: "
1473 "терминалу. Каждый из процессов записывает I<nloops> (аргумент командной "
1474 "строки, если отсутствует, то 5) сообщений на терминал и использует протокол "
1475 "синхронизации, который гарантирует, что они записываются поочерёдно. "
1476 "Результат работы программы:"
1477
1478 #. type: Plain text
1479 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1480 #: opensuse-tumbleweed
1481 #, fuzzy, no-wrap
1482 #| msgid ""
1483 #| "$ B<./futex_demo>\n"
1484 #| "Parent (18534) 0\n"
1485 #| "Child (18535) 0\n"
1486 #| "Parent (18534) 1\n"
1487 #| "Child (18535) 1\n"
1488 #| "Parent (18534) 2\n"
1489 #| "Child (18535) 2\n"
1490 #| "Parent (18534) 3\n"
1491 #| "Child (18535) 3\n"
1492 #| "Parent (18534) 4\n"
1493 #| "Child (18535) 4\n"
1494 msgid ""
1495 "$B< ./futex_demo>;\n"
1496 "Parent (18534) 0\n"
1497 "Child (18535) 0\n"
1498 "Parent (18534) 1\n"
1499 "Child (18535) 1\n"
1500 "Parent (18534) 2\n"
1501 "Child (18535) 2\n"
1502 "Parent (18534) 3\n"
1503 "Child (18535) 3\n"
1504 "Parent (18534) 4\n"
1505 "Child (18535) 4\n"
1506 msgstr ""
1507 "$ B<./futex_demo>\n"
1508 "Родитель (18534) 0\n"
1509 "Потомок (18535) 0\n"
1510 "Родитель (18534) 1\n"
1511 "Потомок (18535) 1\n"
1512 "Родитель (18534) 2\n"
1513 "Потомок (18535) 2\n"
1514 "Родитель (18534) 3\n"
1515 "Потомок (18535) 3\n"
1516 "Родитель (18534) 4\n"
1517 "Потомок (18535) 4\n"
1518
1519 #. type: SS
1520 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1521 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1522 #, no-wrap
1523 msgid "Program source"
1524 msgstr "Исходный код программы"
1525
1526 #. type: Plain text
1527 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
1528 #, no-wrap
1529 msgid ""
1530 "/* futex_demo.c\n"
1531 "\\&\n"
1532 " Usage: futex_demo [nloops]\n"
1533 " (Default: 5)\n"
1534 "\\&\n"
1535 " Demonstrate the use of futexes in a program where parent and child\n"
1536 " use a pair of futexes located inside a shared anonymous mapping to\n"
1537 " synchronize access to a shared resource: the terminal. The two\n"
1538 " processes each write \\[aq]num-loops\\[aq] messages to the terminal and employ\n"
1539 " a synchronization protocol that ensures that they alternate in\n"
1540 " writing messages.\n"
1541 "*/\n"
1542 "#define _GNU_SOURCE\n"
1543 "#include E<lt>err.hE<gt>\n"
1544 "#include E<lt>errno.hE<gt>\n"
1545 "#include E<lt>linux/futex.hE<gt>\n"
1546 "#include E<lt>stdatomic.hE<gt>\n"
1547 "#include E<lt>stdint.hE<gt>\n"
1548 "#include E<lt>stdio.hE<gt>\n"
1549 "#include E<lt>stdlib.hE<gt>\n"
1550 "#include E<lt>sys/mman.hE<gt>\n"
1551 "#include E<lt>sys/syscall.hE<gt>\n"
1552 "#include E<lt>sys/time.hE<gt>\n"
1553 "#include E<lt>sys/wait.hE<gt>\n"
1554 "#include E<lt>unistd.hE<gt>\n"
1555 "\\&\n"
1556 "static uint32_t *futex1, *futex2, *iaddr;\n"
1557 "\\&\n"
1558 "static int\n"
1559 "futex(uint32_t *uaddr, int op, uint32_t val,\n"
1560 " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n"
1561 "{\n"
1562 " return syscall(SYS_futex, uaddr, op, val,\n"
1563 " timeout, uaddr2, val3);\n"
1564 "}\n"
1565 "\\&\n"
1566 "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n"
1567 " become 1, and then set the value to 0. */\n"
1568 "\\&\n"
1569 "static void\n"
1570 "fwait(uint32_t *futexp)\n"
1571 "{\n"
1572 " long s;\n"
1573 " const uint32_t one = 1;\n"
1574 "\\&\n"
1575 " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n"
1576 " atomically performs the equivalent of:\n"
1577 "\\&\n"
1578 " if (*ptr == *oldval)\n"
1579 " *ptr = newval;\n"
1580 "\\&\n"
1581 " It returns true if the test yielded true and *ptr was updated. */\n"
1582 "\\&\n"
1583 " for (;;) {\n"
1584 "\\&\n"
1585 " /* Is the futex available? */\n"
1586 " if (atomic_compare_exchange_strong(futexp, &one, 0))\n"
1587 " break; /* Yes */\n"
1588 "\\&\n"
1589 " /* Futex is not available; wait. */\n"
1590 "\\&\n"
1591 " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n"
1592 " if (s == -1 && errno != EAGAIN)\n"
1593 " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n"
1594 " }\n"
1595 "}\n"
1596 "\\&\n"
1597 "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex currently\n"
1598 " has the value 0, set its value to 1 and then wake any futex waiters,\n"
1599 " so that if the peer is blocked in fwait(), it can proceed. */\n"
1600 "\\&\n"
1601 "static void\n"
1602 "fpost(uint32_t *futexp)\n"
1603 "{\n"
1604 " long s;\n"
1605 " const uint32_t zero = 0;\n"
1606 "\\&\n"
1607 " /* atomic_compare_exchange_strong() was described\n"
1608 " in comments above. */\n"
1609 "\\&\n"
1610 " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n"
1611 " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
1612 " if (s == -1)\n"
1613 " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n"
1614 " }\n"
1615 "}\n"
1616 "\\&\n"
1617 "int\n"
1618 "main(int argc, char *argv[])\n"
1619 "{\n"
1620 " pid_t childPid;\n"
1621 " unsigned int nloops;\n"
1622 "\\&\n"
1623 " setbuf(stdout, NULL);\n"
1624 "\\&\n"
1625 " nloops = (argc E<gt> 1) ? atoi(argv[1]) : 5;\n"
1626 "\\&\n"
1627 " /* Create a shared anonymous mapping that will hold the futexes.\n"
1628 " Since the futexes are being shared between processes, we\n"
1629 " subsequently use the \"shared\" futex operations (i.e., not the\n"
1630 " ones suffixed \"_PRIVATE\"). */\n"
1631 "\\&\n"
1632 " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n"
1633 " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n"
1634 " if (iaddr == MAP_FAILED)\n"
1635 " err(EXIT_FAILURE, \"mmap\");\n"
1636 "\\&\n"
1637 " futex1 = &iaddr[0];\n"
1638 " futex2 = &iaddr[1];\n"
1639 "\\&\n"
1640 " *futex1 = 0; /* State: unavailable */\n"
1641 " *futex2 = 1; /* State: available */\n"
1642 "\\&\n"
1643 " /* Create a child process that inherits the shared anonymous\n"
1644 " mapping. */\n"
1645 "\\&\n"
1646 " childPid = fork();\n"
1647 " if (childPid == -1)\n"
1648 " err(EXIT_FAILURE, \"fork\");\n"
1649 "\\&\n"
1650 " if (childPid == 0) { /* Child */\n"
1651 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
1652 " fwait(futex1);\n"
1653 " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
1654 " fpost(futex2);\n"
1655 " }\n"
1656 "\\&\n"
1657 " exit(EXIT_SUCCESS);\n"
1658 " }\n"
1659 "\\&\n"
1660 " /* Parent falls through to here. */\n"
1661 "\\&\n"
1662 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
1663 " fwait(futex2);\n"
1664 " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
1665 " fpost(futex1);\n"
1666 " }\n"
1667 "\\&\n"
1668 " wait(NULL);\n"
1669 "\\&\n"
1670 " exit(EXIT_SUCCESS);\n"
1671 "}\n"
1672 msgstr ""
1673
1674 #. SRC END
1675 #. type: SH
1676 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1677 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1678 #, no-wrap
1679 msgid "SEE ALSO"
1680 msgstr "СМОТРИТЕ ТАКЖЕ"
1681
1682 #. type: Plain text
1683 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1684 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1685 msgid ""
1686 "B<get_robust_list>(2), B<restart_syscall>(2), "
1687 "B<pthread_mutexattr_getprotocol>(3), B<futex>(7), B<sched>(7)"
1688 msgstr ""
1689 "B<get_robust_list>(2), B<restart_syscall>(2), "
1690 "B<pthread_mutexattr_getprotocol>(3), B<futex>(7), B<sched>(7)"
1691
1692 #. type: Plain text
1693 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1694 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1695 msgid "The following kernel source files:"
1696 msgstr "Файлы из дерева исходного кода ядра:"
1697
1698 #. type: Plain text
1699 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1700 #: opensuse-tumbleweed
1701 #, fuzzy
1702 #| msgid "I<Documentation/locking/rt-mutex.txt>"
1703 msgid "I<Documentation/locking/pi-futex.rst>"
1704 msgstr "I<Documentation/locking/rt-mutex.txt>"
1705
1706 #. type: Plain text
1707 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1708 #: opensuse-tumbleweed
1709 #, fuzzy
1710 #| msgid "I<Documentation/futex-requeue-pi.txt>"
1711 msgid "I<Documentation/locking/futex-requeue-pi.rst>"
1712 msgstr "I<Documentation/futex-requeue-pi.txt>"
1713
1714 #. type: Plain text
1715 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1716 #: opensuse-tumbleweed
1717 #, fuzzy
1718 #| msgid "I<Documentation/locking/rt-mutex.txt>"
1719 msgid "I<Documentation/locking/rt-mutex.rst>"
1720 msgstr "I<Documentation/locking/rt-mutex.txt>"
1721
1722 #. type: Plain text
1723 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1724 #: opensuse-tumbleweed
1725 #, fuzzy
1726 #| msgid "I<Documentation/locking/rt-mutex-design.txt>"
1727 msgid "I<Documentation/locking/rt-mutex-design.rst>"
1728 msgstr "I<Documentation/locking/rt-mutex-design.txt>"
1729
1730 #. type: Plain text
1731 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1732 #: opensuse-tumbleweed
1733 #, fuzzy
1734 #| msgid "I<Documentation/robust-futex-ABI.txt>"
1735 msgid "I<Documentation/robust-futex-ABI.rst>"
1736 msgstr "I<Documentation/robust-futex-ABI.txt>"
1737
1738 #. type: Plain text
1739 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1740 #: opensuse-tumbleweed
1741 msgid "Franke, H., Russell, R., and Kirwood, M., 2002."
1742 msgstr ""
1743
1744 #. type: Plain text
1745 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1746 #: opensuse-tumbleweed
1747 #, fuzzy
1748 #| msgid ""
1749 #| "Franke, H., Russell, R., and Kirwood, M., 2002. I<Fuss, Futexes and "
1750 #| "Furwocks: Fast Userlevel Locking in Linux> (from proceedings of the "
1751 #| "Ottawa Linux Symposium 2002),"
1752 msgid ""
1753 "E<.UR http:\\://kernel.org/\\:doc/\\:ols/\\:2002/\\:ols2002-"
1754 "pages-479-495.pdf> I<Fuss, Futexes and Furwocks: Fast Userlevel Locking in "
1755 "Linux> E<.UE> (from proceedings of the Ottawa Linux Symposium 2002)."
1756 msgstr ""
1757 "Franke, H., Russell, R., and Kirwood, M., 2002. I<Fuss, Futexes and "
1758 "Furwocks: Fast Userlevel Locking in Linux> (доклад на симпозиуме по Linux в "
1759 "2002 году),"
1760
1761 #. type: Plain text
1762 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1763 #: opensuse-tumbleweed
1764 #, fuzzy
1765 #| msgid ""
1766 #| "Hart, D., 2009. I<A futex overview and update>, E<.UR http://lwn.net/"
1767 #| "Articles/360699/> E<.UE>"
1768 msgid ""
1769 "Hart, D., 2009. E<.UR http:\\://lwn.net/\\:Articles/\\:360699/> I<A futex "
1770 "overview and update> E<.UE .>"
1771 msgstr ""
1772 "Hart, D., 2009. I<A futex overview and update>, E<.UR http://lwn.net/"
1773 "Articles/360699/> E<.UE>"
1774
1775 #. type: Plain text
1776 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1777 #: opensuse-tumbleweed
1778 #, fuzzy
1779 #| msgid ""
1780 #| "Hart, D.\\& and Guniguntala, D., 2009. I<Requeue-PI: Making Glibc "
1781 #| "Condvars PI-Aware> (from proceedings of the 2009 Real-Time Linux "
1782 #| "Workshop), E<.UR http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> "
1783 #| "E<.UE>"
1784 msgid ""
1785 "Hart, D.\\& and Guniguntala, D., 2009. E<.UR http:\\://lwn.net/\\:images/"
1786 "\\:conf/\\:rtlws11/\\:papers/\\:proc/\\:p10.pdf> I<Requeue-PI: Making glibc "
1787 "Condvars PI-Aware> E<.UE> (from proceedings of the 2009 Real-Time Linux "
1788 "Workshop)."
1789 msgstr ""
1790 "Hart, D.\\& и Guniguntala, D., 2009. I<Requeue-PI: Making Glibc Condvars PI-"
1791 "Aware> (доклад на Real-Time Linux Workshop в 2009 году), E<.UR http://"
1792 "lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> E<.UE>"
1793
1794 #. type: Plain text
1795 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1796 #: opensuse-tumbleweed
1797 #, fuzzy
1798 #| msgid ""
1799 #| "Drepper, U., 2011. I<Futexes Are Tricky>, E<.UR http://www.akkadia.org/"
1800 #| "drepper/futex.pdf> E<.UE>"
1801 msgid ""
1802 "Drepper, U., 2011. E<.UR http:\\://www.akkadia.org/\\:drepper/\\:futex.pdf> "
1803 "I<Futexes Are Tricky> E<.UE .>"
1804 msgstr ""
1805 "Drepper, U., 2011. I<Futexes Are Tricky>, E<.UR http://www.akkadia.org/"
1806 "drepper/futex.pdf> E<.UE>"
1807
1808 #. type: Plain text
1809 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1810 #: opensuse-tumbleweed
1811 #, fuzzy
1812 #| msgid ""
1813 #| "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/"
1814 #| "rusty/> E<.UE>"
1815 msgid ""
1816 "Futex example library, E<.UR https:\\://mirrors.kernel.org/\\:pub/\\:linux/"
1817 "\\:kernel/\\:people/\\:rusty/> futex-*.tar.bz2 E<.UE .>"
1818 msgstr ""
1819 "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/"
1820 "rusty/> E<.UE>"
1821
1822 #. type: TH
1823 #: debian-trixie
1824 #, no-wrap
1825 msgid "2024-06-15"
1826 msgstr "15 июня 2024 г."
1827
1828 #. type: TH
1829 #: debian-trixie
1830 #, no-wrap
1831 msgid "Linux man-pages 6.9.1"
1832 msgstr "Страницы руководства Linux 6.9.1"
1833
1834 #. type: Plain text
1835 #: debian-trixie
1836 msgid "Standard C library (I<libc>, I<-lc>)"
1837 msgstr "Стандартная библиотека языка C (I<libc>, I<-lc>)"
1838
1839 #. type: Plain text
1840 #: debian-trixie fedora-44 fedora-rawhide
1841 #, no-wrap
1842 msgid ""
1843 "B<#include E<lt>linux/futex.hE<gt>> /* Definition of B<FUTEX_*> constants */\n"
1844 "B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n"
1845 "B<#include E<lt>unistd.hE<gt>>\n"
1846 msgstr ""
1847 "B<#include E<lt>linux/futex.hE<gt>> /* определения констант B<FUTEX_*> */\n"
1848 "B<#include E<lt>sys/syscall.hE<gt>> /* определения констант B<SYS_*> */\n"
1849 "B<#include E<lt>unistd.hE<gt>>\n"
1850
1851 #. type: Plain text
1852 #: debian-trixie fedora-44 fedora-rawhide
1853 #, fuzzy, no-wrap
1854 #| msgid ""
1855 #| "B<int futex(int *>I<uaddr>B<, int >I<futex_op>B<, int >I<val>B<,>\n"
1856 #| "B< const struct timespec *>I<timeout>B<,>I< > /* or: B<uint32_t >I<val2>B< */>\n"
1857 #| "B< int *>I<uaddr2>B<, int >I<val3>B<);>\n"
1858 msgid ""
1859 "B<long syscall(SYS_futex, uint32_t *>I<uaddr>B<, int >I<futex_op>B<, uint32_t >I<val>B<,>\n"
1860 "B< const struct timespec *>I<timeout>B<,>I< > /* or: B<uint32_t >I<val2>B< */>\n"
1861 "B< uint32_t *>I<uaddr2>B<, uint32_t >I<val3>B<);>\n"
1862 msgstr ""
1863 "B<int futex(int *>I<uaddr>B<, int >I<futex_op>B<, int >I<val>B<,>\n"
1864 "B< const struct timespec *>I<timeout>B<,>I< > /* or: B<uint32_t >I<val2>B< */>\n"
1865 "B< int *>I<uaddr2>B<, int >I<val3>B<);>\n"
1866
1867 #. type: Plain text
1868 #: debian-trixie fedora-44 fedora-rawhide
1869 #, fuzzy
1870 #| msgid ""
1871 #| "Glibc does not provide a wrapper for this system call; call it using "
1872 #| "B<syscall>(2)."
1873 msgid ""
1874 "I<Note>: glibc provides no wrapper for B<futex>(), necessitating the use of "
1875 "B<syscall>(2)."
1876 msgstr ""
1877 "В glibc нет обёртки для данного системного вызова; запускайте его с помощью "
1878 "B<syscall>(2)."
1879
1880 #. type: Plain text
1881 #: debian-trixie fedora-44 fedora-rawhide
1882 msgid ""
1883 "Note that no explicit initialization or destruction is necessary to use "
1884 "futexes; the kernel maintains a futex (i.e., the kernel-internal "
1885 "implementation artifact) only while operations such as B<FUTEX_WAIT>, "
1886 "described below, are being performed on a particular futex word."
1887 msgstr ""
1888 "Заметим, что для использования фьютексов не требуется явных действий по "
1889 "инициализации и удалению; ядро поддерживает фьютексы (т. е., внутренняя "
1890 "часть реализации ядра) только в операции B<FUTEX_WAIT>, описанной далее, "
1891 "обрабатывая определённое слово фьютекса."
1892
1893 #. type: Plain text
1894 #: debian-trixie fedora-44 fedora-rawhide
1895 msgid ""
1896 "The I<uaddr> argument points to the futex word. On all platforms, futexes "
1897 "are four-byte integers that must be aligned on a four-byte boundary. The "
1898 "operation to perform on the futex is specified in the I<futex_op> argument; "
1899 "I<val> is a value whose meaning and purpose depends on I<futex_op>."
1900 msgstr ""
1901 "В аргументе I<uaddr> указывает слово фьютекса. На всех платформах фьютексы "
1902 "это целые числа размером в четыре байта, которые должны быть выровнены по "
1903 "четырёх байтовой границе. Операция, выполняемая с фьютексом, задаётся в "
1904 "аргументе I<futex_op>; какое значение будет задаваться в I<val>, зависит от "
1905 "I<futex_op>."
1906
1907 #. type: Plain text
1908 #: debian-trixie fedora-44 fedora-rawhide
1909 msgid ""
1910 "The remaining arguments (I<timeout>, I<uaddr2>, and I<val3>) are required "
1911 "only for certain of the futex operations described below. Where one of "
1912 "these arguments is not required, it is ignored."
1913 msgstr ""
1914 "Остальные аргументы (I<timeout>, I<uaddr2> и I<val3>) требуются только для "
1915 "определённых операций с фьютексами и описаны далее. Там, где эти аргументы "
1916 "не нужны, они игнорируются."
1917
1918 #. type: Plain text
1919 #: debian-trixie fedora-44 fedora-rawhide
1920 msgid ""
1921 "For several blocking operations, the I<timeout> argument is a pointer to a "
1922 "I<timespec> structure that specifies a timeout for the operation. However, "
1923 "notwithstanding the prototype shown above, for some operations, the least "
1924 "significant four bytes of this argument are instead used as an integer whose "
1925 "meaning is determined by the operation. For these operations, the kernel "
1926 "casts the I<timeout> value first to I<unsigned long>, then to I<uint32_t>, "
1927 "and in the remainder of this page, this argument is referred to as I<val2> "
1928 "when interpreted in this fashion."
1929 msgstr ""
1930 "Для некоторых операций блокировки аргументом I<timeout> является указатель "
1931 "на структуру I<timespec>, в которой задаётся время ожидания операции. "
1932 "Однако, несмотря на прототип, показанный выше, для некоторых операций "
1933 "используются только младшие четыре байта этого аргумента вместо целого "
1934 "числа, назначение которого определяется операцией. Для этих операций ядро "
1935 "преобразует значение I<timeout> сначала к I<unsigned long>, затем к "
1936 "I<uint32_t>. Отсюда и до конца страницы этот аргумент будет называться "
1937 "I<val2>, когда он интерпретируется в такой манере."
1938
1939 #. type: Plain text
1940 #: debian-trixie fedora-44 fedora-rawhide
1941 msgid ""
1942 "Where it is required, the I<uaddr2> argument is a pointer to a second futex "
1943 "word that is employed by the operation."
1944 msgstr ""
1945 "Там, где требуется, аргумент I<uaddr2> представляет собой указатель на "
1946 "второе слово фьютекса, которое используется операцией."
1947
1948 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1949 #. type: Plain text
1950 #: debian-trixie fedora-44 fedora-rawhide
1951 msgid ""
1952 "The interpretation of the final integer argument, I<val3>, depends on the "
1953 "operation."
1954 msgstr ""
1955 "Интерпретация последнего целочисленного аргумента, I<val3>, зависит от "
1956 "операции."
1957
1958 #. type: Plain text
1959 #: debian-trixie fedora-44 fedora-rawhide
1960 msgid ""
1961 "The I<futex_op> argument consists of two parts: a command that specifies the "
1962 "operation to be performed, bitwise ORed with zero or more options that "
1963 "modify the behaviour of the operation. The options that may be included in "
1964 "I<futex_op> are as follows:"
1965 msgstr ""
1966 "Аргумент I<futex_op> состоит из двух частей: команды, задающей выполняемую "
1967 "операцию, и объединённые биты нуля или более параметров, которые изменяют "
1968 "поведение операции. Параметры, которые можно включать в I<futex_op>:"
1969
1970 #. commit 1acdac104668a0834cfa267de9946fac7764d486
1971 #. commit 337f13046ff03717a9e99675284a817527440a49
1972 #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae
1973 #. type: Plain text
1974 #: debian-trixie fedora-44 fedora-rawhide
1975 #, fuzzy
1976 #| msgid ""
1977 #| "This option bit can be employed only with the B<FUTEX_WAIT_BITSET>, "
1978 #| "B<FUTEX_WAIT_REQUEUE_PI>, and (since Linux 4.5) B<FUTEX_WAIT> operations."
1979 msgid ""
1980 "This option bit can be employed only with the B<FUTEX_WAIT_BITSET>, "
1981 "B<FUTEX_WAIT_REQUEUE_PI>, (since Linux 4.5) B<FUTEX_WAIT>, and (since Linux "
1982 "5.14) B<FUTEX_LOCK_PI2> operations."
1983 msgstr ""
1984 "Этот бит параметра может применяться только с операциями "
1985 "B<FUTEX_WAIT_BITSET>, B<FUTEX_WAIT_REQUEUE_PI> и B<FUTEX_WAIT> (начиная с "
1986 "Linux 4.5)."
1987
1988 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
1989 #. type: Plain text
1990 #: debian-trixie fedora-44 fedora-rawhide
1991 msgid "The operation specified in I<futex_op> is one of the following:"
1992 msgstr "Операцией в I<futex_op> может быть одно из:"
1993
1994 #. type: TP
1995 #: debian-trixie fedora-44 fedora-rawhide
1996 #, no-wrap
1997 msgid "B<FUTEX_WAIT> (since Linux 2.6.0)"
1998 msgstr "B<FUTEX_WAIT> (начиная с Linux 2.6.0)"
1999
2000 #. Strictly speaking, since some time in Linux 2.5.x
2001 #. FIXME: Torvald, I think we may need to add some explanation of
2002 #. "totally ordered" here.
2003 #. type: Plain text
2004 #: debian-trixie fedora-44 fedora-rawhide
2005 msgid ""
2006 "This operation tests that the value at the futex word pointed to by the "
2007 "address I<uaddr> still contains the expected value I<val>, and if so, then "
2008 "sleeps waiting for a B<FUTEX_WAKE> operation on the futex word. The load of "
2009 "the value of the futex word is an atomic memory access (i.e., using atomic "
2010 "machine instructions of the respective architecture). This load, the "
2011 "comparison with the expected value, and starting to sleep are performed "
2012 "atomically and totally ordered with respect to other futex operations on the "
2013 "same futex word. If the thread starts to sleep, it is considered a waiter "
2014 "on this futex word. If the futex value does not match I<val>, then the call "
2015 "fails immediately with the error B<EAGAIN>."
2016 msgstr ""
2017 "Эта операция проверяет, что значение слова фьютекса, на которое указывает "
2018 "адрес I<uaddr> по прежнему содержит ожидаемое значение I<val> и если это "
2019 "так, то засыпает, ожидая операции B<FUTEX_WAKE> для этого слова фьютекса. "
2020 "Загрузка значения слова фьютекса является атомарным доступом к памяти (т. "
2021 "е., используются атомарные машинные инструкции соответствующей архитектуры). "
2022 "Эта загрузка, сравнение с ожидаемым значением и запуск сна выполняются "
2023 "атомарно и целиком упорядочены относительно других фьютекс-операций с этим "
2024 "словом фьютекса. Если нить начала засыпать, то считается что она — ожидающий "
2025 "этого слова фьютекса. Если значение фьютекса не совпадает с I<val>, то вызов "
2026 "немедленно завершается с ошибкой B<EAGAIN>."
2027
2028 #. type: Plain text
2029 #: debian-trixie fedora-44 fedora-rawhide
2030 msgid ""
2031 "The purpose of the comparison with the expected value is to prevent lost "
2032 "wake-ups. If another thread changed the value of the futex word after the "
2033 "calling thread decided to block based on the prior value, and if the other "
2034 "thread executed a B<FUTEX_WAKE> operation (or similar wake-up) after the "
2035 "value change and before this B<FUTEX_WAIT> operation, then the calling "
2036 "thread will observe the value change and will not start to sleep."
2037 msgstr ""
2038 "Целью сравнения с ожидаемым значением является предотвращение потери "
2039 "пробуждения. Если другая нить изменит значение слова фьютекса после того, "
2040 "как вызывающая нить решила заблокироваться из-за предыдущего значения и если "
2041 "другая нить выполнила операцию B<FUTEX_WAKE> (или подобное пробуждение) "
2042 "после изменения значения и до этой операции B<FUTEX_WAIT>, то вызывающая "
2043 "нить увидит эту смену значения и не станет впадать в сон."
2044
2045 #. type: Plain text
2046 #: debian-trixie fedora-44 fedora-rawhide
2047 msgid ""
2048 "If the I<timeout> is not NULL, the structure it points to specifies a "
2049 "timeout for the wait. (This interval will be rounded up to the system clock "
2050 "granularity, and is guaranteed not to expire early.) The timeout is by "
2051 "default measured according to the B<CLOCK_MONOTONIC> clock, but, since Linux "
2052 "4.5, the B<CLOCK_REALTIME> clock can be selected by specifying "
2053 "B<FUTEX_CLOCK_REALTIME> in I<futex_op>. If I<timeout> is NULL, the call "
2054 "blocks indefinitely."
2055 msgstr ""
2056 "Если значение I<timeout> не равно NULL, то структура, на которую он "
2057 "указывает, определяет время ожидания (этот интервал будет округлён до "
2058 "точности системных часов, и гарантируется, что он не наступит раньше "
2059 "положенного). По умолчанию время ожидания измеряется по часам "
2060 "B<CLOCK_MONOTONIC>, но начиная с Linux 4.5 можно выбрать часы "
2061 "B<CLOCK_REALTIME>, указав B<FUTEX_CLOCK_REALTIME> в I<futex_op>. Если "
2062 "I<timeout> равно NULL, то вызов блокируется бессрочно."
2063
2064 #. type: Plain text
2065 #: debian-trixie fedora-44 fedora-rawhide
2066 msgid ""
2067 "I<Note>: for B<FUTEX_WAIT>, I<timeout> is interpreted as a I<relative> "
2068 "value. This differs from other futex operations, where I<timeout> is "
2069 "interpreted as an absolute value. To obtain the equivalent of B<FUTEX_WAIT> "
2070 "with an absolute timeout, employ B<FUTEX_WAIT_BITSET> with I<val3> specified "
2071 "as B<FUTEX_BITSET_MATCH_ANY>."
2072 msgstr ""
2073 "I<Замечание>: при B<FUTEX_WAIT> значение I<timeout> интерпретируется как "
2074 "I<относительное>. В этом отличие от других операций над фьютексами, в "
2075 "которых I<timeout> интерпретируется как абсолютное значение. Чтобы получить "
2076 "эквивалент B<FUTEX_WAIT> с абсолютным временем ожидания укажите "
2077 "B<FUTEX_WAIT_BITSET> в I<val3> вместе с B<FUTEX_BITSET_MATCH_ANY>."
2078
2079 #. FIXME . (Torvald) I think we should remove this. Or maybe adapt to a
2080 #. different example.
2081 #. For
2082 #. .BR futex (7),
2083 #. this call is executed if decrementing the count gave a negative value
2084 #. (indicating contention),
2085 #. and will sleep until another process or thread releases
2086 #. the futex and executes the
2087 #. .B FUTEX_WAKE
2088 #. operation.
2089 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2090 #. type: Plain text
2091 #: debian-trixie fedora-44 fedora-rawhide
2092 msgid "The arguments I<uaddr2> and I<val3> are ignored."
2093 msgstr "Аргументы I<uaddr2> и I<val3> игнорируются."
2094
2095 #. type: TP
2096 #: debian-trixie fedora-44 fedora-rawhide
2097 #, no-wrap
2098 msgid "B<FUTEX_WAKE> (since Linux 2.6.0)"
2099 msgstr "B<FUTEX_WAKE> (начиная с Linux 2.6.0)"
2100
2101 #. Strictly speaking, since Linux 2.5.x
2102 #. type: Plain text
2103 #: debian-trixie fedora-44 fedora-rawhide
2104 msgid ""
2105 "This operation wakes at most I<val> of the waiters that are waiting (e.g., "
2106 "inside B<FUTEX_WAIT>) on the futex word at the address I<uaddr>. Most "
2107 "commonly, I<val> is specified as either 1 (wake up a single waiter) or "
2108 "B<INT_MAX> (wake up all waiters). No guarantee is provided about which "
2109 "waiters are awoken (e.g., a waiter with a higher scheduling priority is not "
2110 "guaranteed to be awoken in preference to a waiter with a lower priority)."
2111 msgstr ""
2112 "Эта операция пробуждает не больше I<val> процессов, ожидающих (например, "
2113 "внутри B<FUTEX_WAIT>) слово фьютекса по адресу I<uaddr>. Чаще всего, I<val> "
2114 "присваивают или 1 (пробудить одного ожидающего), или B<INT_MAX> (пробудить "
2115 "всех ожидающих). Не гарантируется, что разбудят каких-то определённых "
2116 "ожидающих (например, что ожидающий с большим приоритетом планировщика будет "
2117 "разбужен раньше ожидающего, имеющего меньший приоритет)."
2118
2119 #. type: Plain text
2120 #: debian-trixie fedora-44 fedora-rawhide
2121 msgid "The arguments I<timeout>, I<uaddr2>, and I<val3> are ignored."
2122 msgstr "Аргументы I<timeout>, I<uaddr2> и I<val3> игнорируются."
2123
2124 #. type: TP
2125 #: debian-trixie fedora-44 fedora-rawhide
2126 #, no-wrap
2127 msgid "B<FUTEX_FD> (from Linux 2.6.0 up to and including Linux 2.6.25)"
2128 msgstr "B<FUTEX_FD> (начиная с Linux 2.6.0 и по Linux 2.6.25 включительно)"
2129
2130 #. Strictly speaking, from Linux 2.5.x to Linux 2.6.25
2131 #. type: Plain text
2132 #: debian-trixie fedora-44 fedora-rawhide
2133 msgid ""
2134 "This operation creates a file descriptor that is associated with the futex "
2135 "at I<uaddr>. The caller must close the returned file descriptor after use. "
2136 "When another process or thread performs a B<FUTEX_WAKE> on the futex word, "
2137 "the file descriptor indicates as being readable with B<select>(2), "
2138 "B<poll>(2), and B<epoll>(7)"
2139 msgstr ""
2140 "Эта операция создаёт файловый дескриптор, который связан с фьютексом по "
2141 "адресу I<uaddr>. Вызывающий должен закрыть возвращённый файловый дескриптор "
2142 "после использования. Если другой процесс или нить выполняет операцию "
2143 "B<FUTEX_WAKE> со словом фьютекса, то файловый дескриптор будет отмечен как "
2144 "доступный для чтения в B<select>(2), B<poll>(2) и B<epoll>(7)."
2145
2146 #. type: Plain text
2147 #: debian-trixie fedora-44 fedora-rawhide
2148 msgid ""
2149 "The file descriptor can be used to obtain asynchronous notifications: if "
2150 "I<val> is nonzero, then, when another process or thread executes a "
2151 "B<FUTEX_WAKE>, the caller will receive the signal number that was passed in "
2152 "I<val>."
2153 msgstr ""
2154 "Файловый дескриптор можно использовать для получения асинхронных "
2155 "уведомлений: если I<val> не равно нулю, то когда другой процесс или нить "
2156 "выполняют B<FUTEX_WAKE>, то вызывающий примет сигнал с номером, который был "
2157 "указан в I<val>."
2158
2159 #. commit 82af7aca56c67061420d618cc5a30f0fd4106b80
2160 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2161 #. type: Plain text
2162 #: debian-trixie fedora-44 fedora-rawhide
2163 msgid ""
2164 "Because it was inherently racy, B<FUTEX_FD> has been removed from Linux "
2165 "2.6.26 onward."
2166 msgstr ""
2167 "Так как по своей природе операция B<FUTEX_FD> приводит к состязательности, "
2168 "она была удалена из Linux, начиная с версии 2.6.26."
2169
2170 #. type: TP
2171 #: debian-trixie fedora-44 fedora-rawhide
2172 #, no-wrap
2173 msgid "B<FUTEX_REQUEUE> (since Linux 2.6.0)"
2174 msgstr "B<FUTEX_REQUEUE> (начиная с Linux 2.6.0)"
2175
2176 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2177 #. type: Plain text
2178 #: debian-trixie fedora-44 fedora-rawhide
2179 msgid ""
2180 "This operation performs the same task as B<FUTEX_CMP_REQUEUE> (see below), "
2181 "except that no check is made using the value in I<val3>. (The argument "
2182 "I<val3> is ignored.)"
2183 msgstr ""
2184 "Эта операция выполняет ту же задачу, что и B<FUTEX_CMP_REQUEUE> (смотрите "
2185 "далее), за исключением того, что она не проверяет используемое значение в "
2186 "I<val3> (аргумент I<val3> игнорируется)."
2187
2188 #. type: TP
2189 #: debian-trixie fedora-44 fedora-rawhide
2190 #, no-wrap
2191 msgid "B<FUTEX_CMP_REQUEUE> (since Linux 2.6.7)"
2192 msgstr "B<FUTEX_CMP_REQUEUE> (начиная с Linux 2.6.7)"
2193
2194 #. type: Plain text
2195 #: debian-trixie fedora-44 fedora-rawhide
2196 msgid ""
2197 "This operation first checks whether the location I<uaddr> still contains the "
2198 "value I<val3>. If not, the operation fails with the error B<EAGAIN>. "
2199 "Otherwise, the operation wakes up a maximum of I<val> waiters that are "
2200 "waiting on the futex at I<uaddr>. If there are more than I<val> waiters, "
2201 "then the remaining waiters are removed from the wait queue of the source "
2202 "futex at I<uaddr> and added to the wait queue of the target futex at "
2203 "I<uaddr2>. The I<val2> argument specifies an upper limit on the number of "
2204 "waiters that are requeued to the futex at I<uaddr2>."
2205 msgstr ""
2206 "Сначала эта операция проверяет, что по адресу I<uaddr> по прежнему "
2207 "содержится значение I<val3>. Если нет, то операция завершается с ошибкой "
2208 "B<EAGAIN>. В противном случае, операция пробуждает не более I<val> "
2209 "ожидающих, которые ждут фьютекс по адресу I<uaddr>. Если существует более "
2210 "I<val> ожидающих, то оставшиеся ожидающие удаляются из очереди ожидания "
2211 "фьютекса-источника по адресу I<uaddr> и добавляются в очередь ожидания "
2212 "фьютекса-назначения по адресу I<uaddr2>. В аргументе I<val2> задаётся "
2213 "верхний предел количества ожидающих, которые перемещаются в очередь фьютекса "
2214 "по адресу I<uaddr2>."
2215
2216 #. FIXME(Torvald) Is the following correct? Or is just the decision
2217 #. which threads to wake or requeue part of the atomic operation?
2218 #. Notes from a f2f conversation with Thomas Gleixner (Aug 2015): ###
2219 #. The operation is serialized with respect to operations on both
2220 #. source and target futex. No other waiter can enqueue itself
2221 #. for waiting and no other waiter can dequeue itself because of
2222 #. a timeout or signal.
2223 #. type: Plain text
2224 #: debian-trixie fedora-44 fedora-rawhide
2225 msgid ""
2226 "The load from I<uaddr> is an atomic memory access (i.e., using atomic "
2227 "machine instructions of the respective architecture). This load, the "
2228 "comparison with I<val3>, and the requeueing of any waiters are performed "
2229 "atomically and totally ordered with respect to other operations on the same "
2230 "futex word."
2231 msgstr ""
2232 "Загрузка из I<uaddr> является атомарным доступом к памяти (т. е., "
2233 "используются атомарные машинные инструкции соответствующей архитектуры). Эта "
2234 "загрузка, сравнение с I<val3> и перестановка в очередь ожидающих выполняются "
2235 "атомарно и целиком упорядочены относительно других фьютекс-операций с этим "
2236 "словом фьютекса."
2237
2238 #. type: Plain text
2239 #: debian-trixie fedora-44 fedora-rawhide
2240 msgid ""
2241 "Typical values to specify for I<val> are 0 or 1. (Specifying B<INT_MAX> is "
2242 "not useful, because it would make the B<FUTEX_CMP_REQUEUE> operation "
2243 "equivalent to B<FUTEX_WAKE>.) The limit value specified via I<val2> is "
2244 "typically either 1 or B<INT_MAX>. (Specifying the argument as 0 is not "
2245 "useful, because it would make the B<FUTEX_CMP_REQUEUE> operation equivalent "
2246 "to B<FUTEX_WAIT>.)"
2247 msgstr ""
2248 "Типичными значениями I<val> являются 0 или 1 (указание B<INT_MAX> "
2249 "бесполезно, так как это сделало бы операцию B<FUTEX_CMP_REQUEUE> "
2250 "эквивалентной B<FUTEX_WAKE>). Значение ограничения, указанное в I<val2>, "
2251 "обычно, или 1 или B<INT_MAX> (указание 0 бесполезно, так как это сделало бы "
2252 "операцию B<FUTEX_CMP_REQUEUE> эквивалентной B<FUTEX_WAIT>)."
2253
2254 #. But, as Rich Felker points out, there remain valid use cases for
2255 #. FUTEX_REQUEUE, for example, when the calling thread is requeuing
2256 #. the target(s) to a lock that the calling thread owns
2257 #. From: Rich Felker <[email protected]>
2258 #. Date: Wed, 29 Oct 2014 22:43:17 -0400
2259 #. To: Darren Hart <[email protected]>
2260 #. CC: [email protected], ...
2261 #. Subject: Re: Add futex wrapper to glibc?
2262 #. type: Plain text
2263 #: debian-trixie fedora-44 fedora-rawhide
2264 msgid ""
2265 "The B<FUTEX_CMP_REQUEUE> operation was added as a replacement for the "
2266 "earlier B<FUTEX_REQUEUE>. The difference is that the check of the value at "
2267 "I<uaddr> can be used to ensure that requeueing happens only under certain "
2268 "conditions, which allows race conditions to be avoided in certain use cases."
2269 msgstr ""
2270 "Операция B<FUTEX_CMP_REQUEUE> была добавлена в качестве замены имевшейся "
2271 "B<FUTEX_REQUEUE>. Различие в том, что проверку значения по адресу I<uaddr> "
2272 "можно использовать для гарантии того, что перестановка в очередь произойдёт "
2273 "только при определённых условиях, что в определённых случаях позволит "
2274 "избежать состязательности."
2275
2276 #. type: Plain text
2277 #: debian-trixie fedora-44 fedora-rawhide
2278 msgid ""
2279 "Both B<FUTEX_REQUEUE> and B<FUTEX_CMP_REQUEUE> can be used to avoid "
2280 "\"thundering herd\" wake-ups that could occur when using B<FUTEX_WAKE> in "
2281 "cases where all of the waiters that are woken need to acquire another "
2282 "futex. Consider the following scenario, where multiple waiter threads are "
2283 "waiting on B, a wait queue implemented using a futex:"
2284 msgstr ""
2285 "И B<FUTEX_REQUEUE> и B<FUTEX_CMP_REQUEUE> можно использовать для недопущения "
2286 "«нашествия орды» из пробудившихся, которое может произойти при использовании "
2287 "B<FUTEX_WAKE> в случаях, когда всем разбуженным ожидающим требуется "
2288 "заблокировать другой фьютекс. Рассмотрим следующий сценарий, где несколько "
2289 "ожидающих нитей ждут B, очередь ожидания реализована с помощью фьютекса:"
2290
2291 #. type: Plain text
2292 #: debian-trixie fedora-44 fedora-rawhide
2293 #, no-wrap
2294 msgid ""
2295 "lock(A)\n"
2296 "while (!check_value(V)) {\n"
2297 " unlock(A);\n"
2298 " block_on(B);\n"
2299 " lock(A);\n"
2300 "};\n"
2301 "unlock(A);\n"
2302 msgstr ""
2303 "lock(A)\n"
2304 "while (!check_value(V)) {\n"
2305 " unlock(A);\n"
2306 " block_on(B);\n"
2307 " lock(A);\n"
2308 "};\n"
2309 "unlock(A);\n"
2310
2311 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2312 #. type: Plain text
2313 #: debian-trixie fedora-44 fedora-rawhide
2314 msgid ""
2315 "If a waker thread used B<FUTEX_WAKE>, then all waiters waiting on B would be "
2316 "woken up, and they would all try to acquire lock A. However, waking all of "
2317 "the threads in this manner would be pointless because all except one of the "
2318 "threads would immediately block on lock A again. By contrast, a requeue "
2319 "operation wakes just one waiter and moves the other waiters to lock A, and "
2320 "when the woken waiter unlocks A then the next waiter can proceed."
2321 msgstr ""
2322 "Если пробуждающая нить использует B<FUTEX_WAKE>, то все ожидающие,ждущие B, "
2323 "проснулись бы, и попытались получить блокировку A. Однако пробуждение всех "
2324 "нитей таким образом было бы нецелесообразно, так как все кроме одной нити "
2325 "снова немедленно бы заблокировались в ожидании A. В отличие от этого, "
2326 "операция перестановки в очередь разбудит только одного ожидающего и "
2327 "переместит остальных ожидающих в ожидание блокировки A, и когда разбуженный "
2328 "ожидающий разблокирует A, то следующий ожидающий сможет продолжить работу."
2329
2330 #. type: TP
2331 #: debian-trixie fedora-44 fedora-rawhide
2332 #, no-wrap
2333 msgid "B<FUTEX_WAKE_OP> (since Linux 2.6.14)"
2334 msgstr "B<FUTEX_WAKE_OP> (начиная с Linux 2.6.14)"
2335
2336 #. commit 4732efbeb997189d9f9b04708dc26bf8613ed721
2337 #. Author: Jakub Jelinek <[email protected]>
2338 #. Date: Tue Sep 6 15:16:25 2005 -0700
2339 #. FIXME. (Torvald) The glibc condvar implementation is currently being
2340 #. revised (e.g., to not use an internal lock anymore).
2341 #. It is probably more future-proof to remove this paragraph.
2342 #. [Torvald, do you have an update here?]
2343 #. type: Plain text
2344 #: debian-trixie fedora-44 fedora-rawhide
2345 msgid ""
2346 "This operation was added to support some user-space use cases where more "
2347 "than one futex must be handled at the same time. The most notable example "
2348 "is the implementation of B<pthread_cond_signal>(3), which requires "
2349 "operations on two futexes, the one used to implement the mutex and the one "
2350 "used in the implementation of the wait queue associated with the condition "
2351 "variable. B<FUTEX_WAKE_OP> allows such cases to be implemented without "
2352 "leading to high rates of contention and context switching."
2353 msgstr ""
2354 "Эта операция была добавлена для работы в некоторых случаях из "
2355 "пользовательского пространства, в которых нужно одновременно учитывать "
2356 "несколько фьютексов. Самый известный пример — реализация "
2357 "B<pthread_cond_signal>(3), которая требует операций для работы с двумя "
2358 "фьютексами: один для реализации мьютекса, а другой для реализации очереди "
2359 "ожидания, связанной с переменной условия. Операция B<FUTEX_WAKE_OP> "
2360 "позволяет это реализовать без увеличения состязательности и контекстного "
2361 "переключения."
2362
2363 #. type: Plain text
2364 #: debian-trixie fedora-44 fedora-rawhide
2365 msgid ""
2366 "The B<FUTEX_WAKE_OP> operation is equivalent to executing the following code "
2367 "atomically and totally ordered with respect to other futex operations on any "
2368 "of the two supplied futex words:"
2369 msgstr ""
2370 "Операция B<FUTEX_WAKE_OP> эквивалентна выполнению следующего кода, при чём, "
2371 "атомарно и полностью упорядочено в соответствии с другими фьютекс-"
2372 "операциями, выполняемыми над двумя указанными словами фьютекса:"
2373
2374 #. type: Plain text
2375 #: debian-trixie fedora-44 fedora-rawhide
2376 #, no-wrap
2377 msgid ""
2378 "uint32_t oldval = *(uint32_t *) uaddr2;\n"
2379 "*(uint32_t *) uaddr2 = oldval I<op> I<oparg>;\n"
2380 "futex(uaddr, FUTEX_WAKE, val, 0, 0, 0);\n"
2381 "if (oldval I<cmp> I<cmparg>)\n"
2382 " futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);\n"
2383 msgstr ""
2384 "uint32_t oldval = *(uint32_t *) uaddr2;\n"
2385 "*(uint32_t *) uaddr2 = oldval I<op> I<oparg>;\n"
2386 "futex(uaddr, FUTEX_WAKE, val, 0, 0, 0);\n"
2387 "if (oldval I<cmp> I<cmparg>)\n"
2388 " futex(uaddr2, FUTEX_WAKE, val2, 0, 0, 0);\n"
2389
2390 #. type: Plain text
2391 #: debian-trixie fedora-44 fedora-rawhide
2392 msgid "In other words, B<FUTEX_WAKE_OP> does the following:"
2393 msgstr "Иначе говоря, B<FUTEX_WAKE_OP> делает следующее:"
2394
2395 #. type: Plain text
2396 #: debian-trixie fedora-44 fedora-rawhide
2397 msgid ""
2398 "saves the original value of the futex word at I<uaddr2> and performs an "
2399 "operation to modify the value of the futex at I<uaddr2>; this is an atomic "
2400 "read-modify-write memory access (i.e., using atomic machine instructions of "
2401 "the respective architecture)"
2402 msgstr ""
2403 "сохраняет первоначальное значение слова фьютекса по адресу I<uaddr2> и "
2404 "выполняет операцию изменения значения фьютекса по адресу I<uaddr2>; это "
2405 "атомарная операция с памятью по чтению-изменению-записи (т. е., используются "
2406 "атомарные машинные инструкции на соответствующей архитектуре);"
2407
2408 #. type: Plain text
2409 #: debian-trixie fedora-44 fedora-rawhide
2410 msgid ""
2411 "wakes up a maximum of I<val> waiters on the futex for the futex word at "
2412 "I<uaddr>; and"
2413 msgstr ""
2414 "пробуждает не более I<val> ожидающих у фьютекса слова фьютекса по адресу "
2415 "I<uaddr>; и"
2416
2417 #. type: Plain text
2418 #: debian-trixie fedora-44 fedora-rawhide
2419 msgid ""
2420 "dependent on the results of a test of the original value of the futex word "
2421 "at I<uaddr2>, wakes up a maximum of I<val2> waiters on the futex for the "
2422 "futex word at I<uaddr2>."
2423 msgstr ""
2424 "в зависимости от результата проверки первоначального значения слова фьютекса "
2425 "по адресу I<uaddr2>, пробуждает не более I<val2> ожидающих у фьютекса слова "
2426 "фьютекса по адресу I<uaddr2>."
2427
2428 #. type: Plain text
2429 #: debian-trixie fedora-44 fedora-rawhide
2430 msgid ""
2431 "The operation and comparison that are to be performed are encoded in the "
2432 "bits of the argument I<val3>. Pictorially, the encoding is:"
2433 msgstr ""
2434 "Операция и сравнение, которое будет выполнено, кодируется в битах аргумента "
2435 "I<val3>. Графически, кодирование выглядит так:"
2436
2437 #. type: Plain text
2438 #: debian-trixie fedora-44 fedora-rawhide
2439 #, no-wrap
2440 msgid ""
2441 "+---+---+-----------+-----------+\n"
2442 "|op |cmp| oparg | cmparg |\n"
2443 "+---+---+-----------+-----------+\n"
2444 " 4 4 12 12 E<lt>== # of bits\n"
2445 msgstr ""
2446 "+---+---+-----------+-----------+\n"
2447 "|оп |сра| аргоп | аргсра |\n"
2448 "+---+---+-----------+-----------+\n"
2449 " 4 4 12 12 E<lt>== кол-во бит\n"
2450
2451 #. type: Plain text
2452 #: debian-trixie fedora-44 fedora-rawhide
2453 msgid "Expressed in code, the encoding is:"
2454 msgstr "В виде кода это выглядит так:"
2455
2456 #. type: Plain text
2457 #: debian-trixie fedora-44 fedora-rawhide
2458 #, fuzzy, no-wrap
2459 #| msgid ""
2460 #| "#define FUTEX_OP(op, oparg, cmp, cmparg) \\e\n"
2461 #| " (((op & 0xf) E<lt>E<lt> 28) | \\e\n"
2462 #| " ((cmp & 0xf) E<lt>E<lt> 24) | \\e\n"
2463 #| " ((oparg & 0xfff) E<lt>E<lt> 12) | \\e\n"
2464 #| " (cmparg & 0xfff))\n"
2465 msgid ""
2466 "#define FUTEX_OP(op, oparg, cmp, cmparg) \\[rs]\n"
2467 " (((op & 0xf) E<lt>E<lt> 28) | \\[rs]\n"
2468 " ((cmp & 0xf) E<lt>E<lt> 24) | \\[rs]\n"
2469 " ((oparg & 0xfff) E<lt>E<lt> 12) | \\[rs]\n"
2470 " (cmparg & 0xfff))\n"
2471 msgstr ""
2472 "#define FUTEX_OP(op, oparg, cmp, cmparg) \\e\n"
2473 " (((op & 0xf) E<lt>E<lt> 28) | \\e\n"
2474 " ((cmp & 0xf) E<lt>E<lt> 24) | \\e\n"
2475 " ((oparg & 0xfff) E<lt>E<lt> 12) | \\e\n"
2476 " (cmparg & 0xfff))\n"
2477
2478 #. type: Plain text
2479 #: debian-trixie fedora-44 fedora-rawhide
2480 msgid ""
2481 "In the above, I<op> and I<cmp> are each one of the codes listed below. The "
2482 "I<oparg> and I<cmparg> components are literal numeric values, except as "
2483 "noted below."
2484 msgstr ""
2485 "Указанные выше I<op> и I<cmp> могут содержат один из кодов, перечисленных "
2486 "далее. Компоненты I<oparg> и I<cmparg> являются числовыми литералами, с "
2487 "учётом замечаний далее."
2488
2489 #. type: Plain text
2490 #: debian-trixie fedora-44 fedora-rawhide
2491 msgid "The I<op> component has one of the following values:"
2492 msgstr "Компонент I<op> может иметь одно из следующих значений:"
2493
2494 #. type: Plain text
2495 #: debian-trixie fedora-44 fedora-rawhide
2496 #, fuzzy, no-wrap
2497 #| msgid ""
2498 #| "FUTEX_OP_SET 0 /* uaddr2 = oparg; */\n"
2499 #| "FUTEX_OP_ADD 1 /* uaddr2 += oparg; */\n"
2500 #| "FUTEX_OP_OR 2 /* uaddr2 |= oparg; */\n"
2501 #| "FUTEX_OP_ANDN 3 /* uaddr2 &= \\(tioparg; */\n"
2502 #| "FUTEX_OP_XOR 4 /* uaddr2 \\(ha= oparg; */\n"
2503 msgid ""
2504 "FUTEX_OP_SET 0 /* uaddr2 = oparg; */\n"
2505 "FUTEX_OP_ADD 1 /* uaddr2 += oparg; */\n"
2506 "FUTEX_OP_OR 2 /* uaddr2 |= oparg; */\n"
2507 "FUTEX_OP_ANDN 3 /* uaddr2 &= \\[ti]oparg; */\n"
2508 "FUTEX_OP_XOR 4 /* uaddr2 \\[ha]= oparg; */\n"
2509 msgstr ""
2510 "FUTEX_OP_SET 0 /* uaddr2 = oparg; */\n"
2511 "FUTEX_OP_ADD 1 /* uaddr2 += oparg; */\n"
2512 "FUTEX_OP_OR 2 /* uaddr2 |= oparg; */\n"
2513 "FUTEX_OP_ANDN 3 /* uaddr2 &= \\(tioparg; */\n"
2514 "FUTEX_OP_XOR 4 /* uaddr2 \\(ha= oparg; */\n"
2515
2516 #. type: Plain text
2517 #: debian-trixie fedora-44 fedora-rawhide
2518 #, fuzzy
2519 #| msgid ""
2520 #| "In addition, bitwise ORing the following value into I<op> causes "
2521 #| "I<(1\\~E<lt>E<lt>\\~oparg)> to be used as the operand:"
2522 msgid ""
2523 "In addition, bitwise ORing the following value into I<op> causes I<(1\\ "
2524 "E<lt>E<lt>\\ oparg)> to be used as the operand:"
2525 msgstr ""
2526 "Также, битовое сложение следующего значения с I<op> приводит к использованию "
2527 "I<(1\\ E<lt>E<lt>\\~oparg)> в качестве операнда:"
2528
2529 #. type: Plain text
2530 #: debian-trixie fedora-44 fedora-rawhide
2531 #, no-wrap
2532 msgid "FUTEX_OP_ARG_SHIFT 8 /* Use (1 E<lt>E<lt> oparg) as operand */\n"
2533 msgstr "FUTEX_OP_ARG_SHIFT 8 /* исп. (1 E<lt>E<lt> oparg) как операнд */\n"
2534
2535 #. type: Plain text
2536 #: debian-trixie fedora-44 fedora-rawhide
2537 msgid "The I<cmp> field is one of the following:"
2538 msgstr "В поле I<cmp> может быть одно из:"
2539
2540 #. type: Plain text
2541 #: debian-trixie fedora-44 fedora-rawhide
2542 #, no-wrap
2543 msgid ""
2544 "FUTEX_OP_CMP_EQ 0 /* if (oldval == cmparg) wake */\n"
2545 "FUTEX_OP_CMP_NE 1 /* if (oldval != cmparg) wake */\n"
2546 "FUTEX_OP_CMP_LT 2 /* if (oldval E<lt> cmparg) wake */\n"
2547 "FUTEX_OP_CMP_LE 3 /* if (oldval E<lt>= cmparg) wake */\n"
2548 "FUTEX_OP_CMP_GT 4 /* if (oldval E<gt> cmparg) wake */\n"
2549 "FUTEX_OP_CMP_GE 5 /* if (oldval E<gt>= cmparg) wake */\n"
2550 msgstr ""
2551 "FUTEX_OP_CMP_EQ 0 /* если (oldval == cmparg) — пробудить */\n"
2552 "FUTEX_OP_CMP_NE 1 /* если (oldval != cmparg) — пробудить */\n"
2553 "FUTEX_OP_CMP_LT 2 /* если (oldval E<lt> cmparg) — пробудить */\n"
2554 "FUTEX_OP_CMP_LE 3 /* если (oldval E<lt>= cmparg) — пробудить */\n"
2555 "FUTEX_OP_CMP_GT 4 /* если (oldval E<gt> cmparg) — пробудить */\n"
2556 "FUTEX_OP_CMP_GE 5 /* если (oldval E<gt>= cmparg) — пробудить */\n"
2557
2558 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2559 #. type: Plain text
2560 #: debian-trixie fedora-44 fedora-rawhide
2561 msgid ""
2562 "The return value of B<FUTEX_WAKE_OP> is the sum of the number of waiters "
2563 "woken on the futex I<uaddr> plus the number of waiters woken on the futex "
2564 "I<uaddr2>."
2565 msgstr ""
2566 "Возвращаемое значение операции B<FUTEX_WAKE_OP> — сумма количества "
2567 "разбуженных ожидающих фьютекса I<uaddr> и количества разбуженных ожидающих "
2568 "фьютекса I<uaddr2>."
2569
2570 #. type: TP
2571 #: debian-trixie fedora-44 fedora-rawhide
2572 #, no-wrap
2573 msgid "B<FUTEX_WAIT_BITSET> (since Linux 2.6.25)"
2574 msgstr "B<FUTEX_WAIT_BITSET> (начиная с Linux 2.6.25)"
2575
2576 #. commit cd689985cf49f6ff5c8eddc48d98b9d581d9475d
2577 #. type: Plain text
2578 #: debian-trixie fedora-44 fedora-rawhide
2579 msgid ""
2580 "This operation is like B<FUTEX_WAIT> except that I<val3> is used to provide "
2581 "a 32-bit bit mask to the kernel. This bit mask, in which at least one bit "
2582 "must be set, is stored in the kernel-internal state of the waiter. See the "
2583 "description of B<FUTEX_WAKE_BITSET> for further details."
2584 msgstr ""
2585 "Эта операция подобна B<FUTEX_WAIT>, за исключением того, что I<val3> "
2586 "используется для передачи 32-битной маски в ядро. Данная битовая маска, в "
2587 "которой должен быть установлен хотя бы один бит, хранится в ядре во "
2588 "внутреннем состоянии ожидающего. Подробности смотрите в описании "
2589 "B<FUTEX_WAKE_BITSET>."
2590
2591 #. type: Plain text
2592 #: debian-trixie fedora-44 fedora-rawhide
2593 msgid ""
2594 "If I<timeout> is not NULL, the structure it points to specifies an absolute "
2595 "timeout for the wait operation. If I<timeout> is NULL, the operation can "
2596 "block indefinitely."
2597 msgstr ""
2598 "Если значение I<timeout> не равно NULL, то структура, на которую он "
2599 "указывает, определяет абсолютное время ожидания. Если I<timeout> равно NULL, "
2600 "то операция блокируется бессрочно."
2601
2602 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2603 #. type: Plain text
2604 #: debian-trixie fedora-44 fedora-rawhide
2605 msgid "The I<uaddr2> argument is ignored."
2606 msgstr "Аргумент I<uaddr2> игнорируется."
2607
2608 #. type: TP
2609 #: debian-trixie fedora-44 fedora-rawhide
2610 #, no-wrap
2611 msgid "B<FUTEX_WAKE_BITSET> (since Linux 2.6.25)"
2612 msgstr "B<FUTEX_WAKE_BITSET> (начиная с Linux 2.6.25)"
2613
2614 #. commit cd689985cf49f6ff5c8eddc48d98b9d581d9475d
2615 #. type: Plain text
2616 #: debian-trixie fedora-44 fedora-rawhide
2617 msgid ""
2618 "This operation is the same as B<FUTEX_WAKE> except that the I<val3> argument "
2619 "is used to provide a 32-bit bit mask to the kernel. This bit mask, in which "
2620 "at least one bit must be set, is used to select which waiters should be "
2621 "woken up. The selection is done by a bitwise AND of the \"wake\" bit mask "
2622 "(i.e., the value in I<val3>) and the bit mask which is stored in the kernel-"
2623 "internal state of the waiter (the \"wait\" bit mask that is set using "
2624 "B<FUTEX_WAIT_BITSET>). All of the waiters for which the result of the AND "
2625 "is nonzero are woken up; the remaining waiters are left sleeping."
2626 msgstr ""
2627 "Данная операция подобна B<FUTEX_WAKE>, за исключением того, что I<val3> "
2628 "используется для передачи 32-битной маски в ядро. Данная битовая маска, в "
2629 "которой должен быть установлен хотя бы один бит, используется для выбора "
2630 "ожидающих, которые должны быть разбужены. Выбор выполняется путём побитового "
2631 "И битовой маски «wake» (т. е., значения I<val3>) и битовой маски, которая "
2632 "хранится в ядре во внутреннем состоянии ожидающего (битовая маска «wait», "
2633 "устанавливающаяся с помощью B<FUTEX_WAIT_BITSET>). Все ожидающие, для "
2634 "которых результат побитового И не равен нулю, пробуждаются; оставшиеся "
2635 "ожидающие продолжают спать."
2636
2637 #. According to http://locklessinc.com/articles/futex_cheat_sheet/:
2638 #. "The original reason for the addition of these extensions
2639 #. was to improve the performance of pthread read-write locks
2640 #. in glibc. However, the pthreads library no longer uses the
2641 #. same locking algorithm, and these extensions are not used
2642 #. without the bitset parameter being all ones.
2643 #. The page goes on to note that the FUTEX_WAIT_BITSET operation
2644 #. is nevertheless used (with a bit mask of all ones) in order to
2645 #. obtain the absolute timeout functionality that is useful
2646 #. for efficiently implementing Pthreads APIs (which use absolute
2647 #. timeouts); FUTEX_WAIT provides only relative timeouts.
2648 #. type: Plain text
2649 #: debian-trixie fedora-44 fedora-rawhide
2650 msgid ""
2651 "The effect of B<FUTEX_WAIT_BITSET> and B<FUTEX_WAKE_BITSET> is to allow "
2652 "selective wake-ups among multiple waiters that are blocked on the same "
2653 "futex. However, note that, depending on the use case, employing this bit-"
2654 "mask multiplexing feature on a futex can be less efficient than simply using "
2655 "multiple futexes, because employing bit-mask multiplexing requires the "
2656 "kernel to check all waiters on a futex, including those that are not "
2657 "interested in being woken up (i.e., they do not have the relevant bit set in "
2658 "their \"wait\" bit mask)."
2659 msgstr ""
2660 "Влияние B<FUTEX_WAIT_BITSET> и B<FUTEX_WAKE_BITSET> позволяет выбирать "
2661 "пробуждающихся из многих ожидающих, которые заблокированы на один фьютекс. "
2662 "Однако заметим, что в зависимости от варианта применения, использование "
2663 "данного свойства комбинирования битовой маски с фьютексом может быть менее "
2664 "эффективно, чем простое использование нескольких фьютексов, так как "
2665 "использование комбинирования битовой маски требует от ядра проверки всех "
2666 "ожидающих фьютекса, включая тех, которые и не нужно было бы будить (т. е., у "
2667 "них неподходящий набор бит в их битовой маске «wait»)."
2668
2669 #. type: Plain text
2670 #: debian-trixie fedora-44 fedora-rawhide
2671 msgid ""
2672 "The constant B<FUTEX_BITSET_MATCH_ANY>, which corresponds to all 32 bits set "
2673 "in the bit mask, can be used as the I<val3> argument for "
2674 "B<FUTEX_WAIT_BITSET> and B<FUTEX_WAKE_BITSET>. Other than differences in "
2675 "the handling of the I<timeout> argument, the B<FUTEX_WAIT> operation is "
2676 "equivalent to B<FUTEX_WAIT_BITSET> with I<val3> specified as "
2677 "B<FUTEX_BITSET_MATCH_ANY>; that is, allow a wake-up by any waker. The "
2678 "B<FUTEX_WAKE> operation is equivalent to B<FUTEX_WAKE_BITSET> with I<val3> "
2679 "specified as B<FUTEX_BITSET_MATCH_ANY>; that is, wake up any waiter(s)."
2680 msgstr ""
2681 "Константу B<FUTEX_BITSET_MATCH_ANY>, которая соответствует всем "
2682 "установленным битам в 32-битной маске, можно использовать в аргументе "
2683 "I<val3> для B<FUTEX_WAIT_BITSET> и B<FUTEX_WAKE_BITSET>. Кроме различий в "
2684 "обработке аргумента I<timeout>, операция B<FUTEX_WAIT> эквивалентна "
2685 "B<FUTEX_WAIT_BITSET> с I<val3>, равным B<FUTEX_BITSET_MATCH_ANY>, то есть "
2686 "разрешается будить любого пробуждающего. Операция B<FUTEX_WAKE> эквивалентна "
2687 "B<FUTEX_WAKE_BITSET> с I<val3>, равным B<FUTEX_BITSET_MATCH_ANY>, то есть "
2688 "пробуждается любой(ые) пробуждающий."
2689
2690 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2691 #. type: Plain text
2692 #: debian-trixie fedora-44 fedora-rawhide
2693 msgid "The I<uaddr2> and I<timeout> arguments are ignored."
2694 msgstr "Аргументы I<uaddr2> и I<timeout> игнорируются."
2695
2696 #. type: Plain text
2697 #: debian-trixie fedora-44 fedora-rawhide
2698 #, fuzzy
2699 #| msgid ""
2700 #| "If a futex is already acquired (i.e., has a nonzero value), waiters must "
2701 #| "employ the B<FUTEX_LOCK_PI> operation to acquire the lock. If other "
2702 #| "threads are waiting for the lock, then the B<FUTEX_WAITERS> bit is set in "
2703 #| "the futex value; in this case, the lock owner must employ the "
2704 #| "B<FUTEX_UNLOCK_PI> operation to release the lock."
2705 msgid ""
2706 "If a futex is already acquired (i.e., has a nonzero value), waiters must "
2707 "employ the B<FUTEX_LOCK_PI> or B<FUTEX_LOCK_PI2> operations to acquire the "
2708 "lock. If other threads are waiting for the lock, then the B<FUTEX_WAITERS> "
2709 "bit is set in the futex value; in this case, the lock owner must employ the "
2710 "B<FUTEX_UNLOCK_PI> operation to release the lock."
2711 msgstr ""
2712 "Если фьютекс уже получен (т. е. имеет ненулевое значение), то ожидающие "
2713 "должны применить операцию B<FUTEX_LOCK_PI> для получения блокировки. Если "
2714 "другие нити ждут блокировку, то в значении фьютекса установлен бит "
2715 "B<FUTEX_WAITERS>; в этом случае владелец блокировки должен применить "
2716 "операцию B<FUTEX_UNLOCK_PI> для освобождения блокировки."
2717
2718 #. type: Plain text
2719 #: debian-trixie fedora-44 fedora-rawhide
2720 msgid ""
2721 "PI futexes are operated on by specifying one of the values listed below in "
2722 "I<futex_op>. Note that the PI futex operations must be used as paired "
2723 "operations and are subject to some additional requirements:"
2724 msgstr ""
2725 "PI-фьютексы обрабатываются при указании в I<futex_op> одного из значений, "
2726 "перечисленных далее. Заметим, что операции с PI-фьютексами должны "
2727 "использовать попарно и учитывать некоторые дополнительные требования:"
2728
2729 #. type: Plain text
2730 #: debian-trixie fedora-44 fedora-rawhide
2731 msgid ""
2732 "B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, and B<FUTEX_TRYLOCK_PI> pair with "
2733 "B<FUTEX_UNLOCK_PI>. B<FUTEX_UNLOCK_PI> must be called only on a futex owned "
2734 "by the calling thread, as defined by the value policy, otherwise the error "
2735 "B<EPERM> results."
2736 msgstr ""
2737 "Парой к операциям B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2> и B<FUTEX_TRYLOCK_PI> "
2738 "является B<FUTEX_UNLOCK_PI>. Операция B<FUTEX_UNLOCK_PI> должна применяться "
2739 "только к фьютексам, принадлежащим вызывающей нити, определённой значением "
2740 "политики, или же возникнет ошибка B<EPERM>."
2741
2742 #. type: Plain text
2743 #: debian-trixie fedora-44 fedora-rawhide
2744 msgid ""
2745 "B<FUTEX_WAIT_REQUEUE_PI> pairs with B<FUTEX_CMP_REQUEUE_PI>. This must be "
2746 "performed from a non-PI futex to a distinct PI futex (or the error B<EINVAL> "
2747 "results). Additionally, I<val> (the number of waiters to be woken) must be "
2748 "1 (or the error B<EINVAL> results)."
2749 msgstr ""
2750 "Парой к операции B<FUTEX_WAIT_REQUEUE_PI> является B<FUTEX_CMP_REQUEUE_PI>. "
2751 "Она должна применяться для перехода с не PI-фьютекса к PI-фьютексу (или "
2752 "возникает ошибка B<EINVAL>). Также, I<val> (количество разбуживаемых "
2753 "ожидающих) должно равняться 1 (или возникает ошибка B<EINVAL>)."
2754
2755 #. type: TP
2756 #: debian-trixie fedora-44 fedora-rawhide
2757 #, no-wrap
2758 msgid "B<FUTEX_LOCK_PI> (since Linux 2.6.18)"
2759 msgstr "B<FUTEX_LOCK_PI> (начиная с Linux 2.6.18)"
2760
2761 #. commit c87e2837be82df479a6bae9f155c43516d2feebc
2762 #. type: Plain text
2763 #: debian-trixie fedora-44 fedora-rawhide
2764 #, fuzzy
2765 #| msgid ""
2766 #| "This operation is used after an attempt to acquire the lock via an atomic "
2767 #| "user-mode instruction failed because the futex word has a nonzero value\\"
2768 #| "(emspecifically, because it contained the (PID-namespace-specific) TID of "
2769 #| "the lock owner."
2770 msgid ""
2771 "This operation is used after an attempt to acquire the lock via an atomic "
2772 "user-mode instruction failed because the futex word has a nonzero value\\"
2773 "[em]specifically, because it contained the (PID-namespace-specific) TID of "
2774 "the lock owner."
2775 msgstr ""
2776 "Данная операция используется после попытки получить блокировку через "
2777 "атомарную инструкцию в пространстве пользователя, которая завершилась с "
2778 "ошибкой из-за того, что слово фьютекса не равно нулю — содержит value\\"
2779 "(emspecifically, because it contained the TID (PID в этом пространстве имён) "
2780 "владельца блокировки."
2781
2782 #. tglx (July 2015):
2783 #. The operation here is similar to the FUTEX_WAIT logic. When the user
2784 #. space atomic acquire does not succeed because the futex value was non
2785 #. zero, then the waiter goes into the kernel, takes the kernel internal
2786 #. lock and retries the acquisition under the lock. If the acquisition
2787 #. does not succeed either, then it sets the FUTEX_WAITERS bit, to signal
2788 #. the lock owner that it needs to go into the kernel. Here is the pseudo
2789 #. code:
2790 #. lock(kernel_lock);
2791 #. retry:
2792 #. /*
2793 #. * Owner might have unlocked in user space before we
2794 #. * were able to set the waiter bit.
2795 #. */
2796 #. if (atomic_acquire(futex) == SUCCESS) {
2797 #. unlock(kernel_lock());
2798 #. return 0;
2799 #. }
2800 #. /*
2801 #. * Owner might have unlocked after the above atomic_acquire()
2802 #. * attempt.
2803 #. */
2804 #. if (atomic_set_waiters_bit(futex) != SUCCESS)
2805 #. goto retry;
2806 #. queue_waiter();
2807 #. unlock(kernel_lock);
2808 #. block();
2809 #. type: Plain text
2810 #: debian-trixie fedora-44 fedora-rawhide
2811 msgid ""
2812 "The operation checks the value of the futex word at the address I<uaddr>. "
2813 "If the value is 0, then the kernel tries to atomically set the futex value "
2814 "to the caller's TID. If the futex word's value is nonzero, the kernel "
2815 "atomically sets the B<FUTEX_WAITERS> bit, which signals the futex owner that "
2816 "it cannot unlock the futex in user space atomically by setting the futex "
2817 "value to 0. After that, the kernel:"
2818 msgstr ""
2819 "Операция проверяет значение слова фьютекса по адресу I<uaddr>. Если значение "
2820 "равно 0, то ядро пытается атомарно изменить слово фьютекса на TID "
2821 "вызывающего. Если слово фьютекса не равно нулю, то ядро атомарно "
2822 "устанавливает бит B<FUTEX_WAITERS>, который указывает владельцу фьютекса, "
2823 "что он не может разблокировать фьютекс в пространстве пользователя атомарным "
2824 "способом посредством установки значения фьюетекса в 0. После этого ядро:"
2825
2826 #. type: IP
2827 #: debian-trixie fedora-44 fedora-rawhide
2828 #, no-wrap
2829 msgid "(1)"
2830 msgstr "(1)"
2831
2832 #. type: Plain text
2833 #: debian-trixie fedora-44 fedora-rawhide
2834 msgid "Tries to find the thread which is associated with the owner TID."
2835 msgstr "Пытается найти нить-владельца по TID."
2836
2837 #. type: IP
2838 #: debian-trixie fedora-44 fedora-rawhide
2839 #, no-wrap
2840 msgid "(2)"
2841 msgstr "(2)"
2842
2843 #. type: Plain text
2844 #: debian-trixie fedora-44 fedora-rawhide
2845 msgid ""
2846 "Creates or reuses kernel state on behalf of the owner. (If this is the "
2847 "first waiter, there is no kernel state for this futex, so kernel state is "
2848 "created by locking the RT-mutex and the futex owner is made the owner of the "
2849 "RT-mutex. If there are existing waiters, then the existing state is reused.)"
2850 msgstr ""
2851 "Создаёт или повторно использует состояние ядра от имени владельца (если это "
2852 "первый ожидающий, то для этого фьютекса не состояния ядра, поэтому состояние "
2853 "ядра создаётся блокировкой RT-мьютекса и владелец фьютекса становится "
2854 "владельцем RT-мьютекса. Если ожидающие уже есть, то используется имеющееся "
2855 "состояние)."
2856
2857 #. type: IP
2858 #: debian-trixie fedora-44 fedora-rawhide
2859 #, no-wrap
2860 msgid "(3)"
2861 msgstr "(3)"
2862
2863 #. type: Plain text
2864 #: debian-trixie fedora-44 fedora-rawhide
2865 msgid ""
2866 "Attaches the waiter to the futex (i.e., the waiter is enqueued on the RT-"
2867 "mutex waiter list)."
2868 msgstr ""
2869 "Присоединяет ожидающего к фьютексу (т. е., ожидающий ставится в очередь "
2870 "списка ожидающих на основе RT-мьютекса)."
2871
2872 #. August 2015:
2873 #. mtk: If the realm is restricted purely to SCHED_OTHER (SCHED_NORMAL)
2874 #. processes, does the nice value come into play also?
2875 #. tglx: No. SCHED_OTHER/NORMAL tasks are handled in FIFO order
2876 #. (i.e., task 1 blocks on lock A, held by task 2,
2877 #. while task 2 blocks on lock B, held by task 3)
2878 #. type: Plain text
2879 #: debian-trixie fedora-44 fedora-rawhide
2880 msgid ""
2881 "If more than one waiter exists, the enqueueing of the waiter is in "
2882 "descending priority order. (For information on priority ordering, see the "
2883 "discussion of the B<SCHED_DEADLINE>, B<SCHED_FIFO>, and B<SCHED_RR> "
2884 "scheduling policies in B<sched>(7).) The owner inherits either the waiter's "
2885 "CPU bandwidth (if the waiter is scheduled under the B<SCHED_DEADLINE> "
2886 "policy) or the waiter's priority (if the waiter is scheduled under the "
2887 "B<SCHED_RR> or B<SCHED_FIFO> policy). This inheritance follows the lock "
2888 "chain in the case of nested locking and performs deadlock detection."
2889 msgstr ""
2890 "Если есть более одного ожидающего, то перестановка ожидающего в очередь "
2891 "выполняется в порядке убывания приоритета (упорядочивание по приоритету "
2892 "описано в разделе об алгоритмах планирования B<SCHED_DEADLINE>, "
2893 "B<SCHED_FIFO> и B<SCHED_RR> в B<sched>(7)). Владелец наследует от ожидающего "
2894 "пропускную способность ЦП (если ожидающий работает по алгоритму планирования "
2895 "B<SCHED_DEADLINE>) или приоритет (если ожидающий работает по алгоритму "
2896 "планирования B<SCHED_RR> или B<SCHED_FIFO>). При обнаружении вложенности "
2897 "блокировки и клинча такое наследование распространяется по всей цепочке "
2898 "блокировки."
2899
2900 #. 2016-07-07 response from Thomas Gleixner on LKML:
2901 #. From: Thomas Gleixner <[email protected]>
2902 #. Date: 6 July 2016 at 20:57
2903 #. Subject: Re: futex: Allow FUTEX_CLOCK_REALTIME with FUTEX_WAIT op
2904 #. On Thu, 23 Jun 2016, Michael Kerrisk (man-pages) wrote:
2905 #. > On 06/23/2016 08:28 PM, Darren Hart wrote:
2906 #. > > And as a follow-on, what is the reason for FUTEX_LOCK_PI only using
2907 #. > > CLOCK_REALTIME? It seems reasonable to me that a user may want to wait a
2908 #. > > specific amount of time, regardless of wall time.
2909 #. >
2910 #. > Yes, that's another weird inconsistency.
2911 #. The reason is that phtread_mutex_timedlock() uses absolute timeouts based on
2912 #. CLOCK_REALTIME. glibc folks asked to make that the default behaviour back
2913 #. then when we added LOCK_PI.
2914 #. type: Plain text
2915 #: debian-trixie fedora-44 fedora-rawhide
2916 msgid ""
2917 "The I<timeout> argument provides a timeout for the lock attempt. If "
2918 "I<timeout> is not NULL, the structure it points to specifies an absolute "
2919 "timeout, measured against the B<CLOCK_REALTIME> clock. If I<timeout> is "
2920 "NULL, the operation will block indefinitely."
2921 msgstr ""
2922 "В аргументе I<timeout> задаётся время ожидания захвата блокировки. Если "
2923 "I<timeout> равно NULL, то структура, на которую он указывает, определяет "
2924 "абсолютное время ожидания, отсчитываемое по часам B<CLOCK_REALTIME>. Если "
2925 "I<timeout> равно NULL, то операция может быть в блокировке неопределённо "
2926 "долго."
2927
2928 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2929 #. type: Plain text
2930 #: debian-trixie fedora-44 fedora-rawhide
2931 msgid "The I<uaddr2>, I<val>, and I<val3> arguments are ignored."
2932 msgstr "Аргументы I<uaddr2>, I<val> и I<val3> игнорируются."
2933
2934 #. type: TP
2935 #: debian-trixie fedora-44 fedora-rawhide
2936 #, no-wrap
2937 msgid "B<FUTEX_LOCK_PI2> (since Linux 5.14)"
2938 msgstr "B<FUTEX_LOCK_PI2> (начиная с Linux 5.14)"
2939
2940 #
2941 #. commit bf22a6976897977b0a3f1aeba6823c959fc4fdae
2942 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
2943 #. type: Plain text
2944 #: debian-trixie fedora-44 fedora-rawhide
2945 msgid ""
2946 "This operation is the same as B<FUTEX_LOCK_PI>, except that the clock "
2947 "against which I<timeout> is measured is selectable. By default, the "
2948 "(absolute) timeout specified in I<timeout> is measured against the "
2949 "B<CLOCK_MONOTONIC> clock, but if the B<FUTEX_CLOCK_REALTIME> flag is "
2950 "specified in I<futex_op>, then the timeout is measured against the "
2951 "B<CLOCK_REALTIME> clock."
2952 msgstr ""
2953
2954 #. type: TP
2955 #: debian-trixie fedora-44 fedora-rawhide
2956 #, no-wrap
2957 msgid "B<FUTEX_TRYLOCK_PI> (since Linux 2.6.18)"
2958 msgstr "B<FUTEX_TRYLOCK_PI> (начиная с Linux 2.6.18)"
2959
2960 #. commit c87e2837be82df479a6bae9f155c43516d2feebc
2961 #. type: Plain text
2962 #: debian-trixie fedora-44 fedora-rawhide
2963 msgid ""
2964 "This operation tries to acquire the lock at I<uaddr>. It is invoked when a "
2965 "user-space atomic acquire did not succeed because the futex word was not 0."
2966 msgstr ""
2967 "Эта операция пытается получить блокировку по адресу I<uaddr>. Она "
2968 "вызывается, когда не удалось выполнить атомарное получение из "
2969 "пользовательского пространства, так как слово фьютекса не равно 0."
2970
2971 #. Paraphrasing a f2f conversation with Thomas Gleixner about the
2972 #. above point (Aug 2015): ###
2973 #. There is a rare possibility of a race condition involving an
2974 #. uncontended futex with no owner, but with waiters. The
2975 #. kernel-user-space contract is that if a futex is nonzero, you must
2976 #. go into kernel. The futex was owned by a task, and that task dies
2977 #. but there are no waiters, so the futex value is non zero.
2978 #. Therefore, the next locker has to go into the kernel,
2979 #. so that the kernel has a chance to clean up. (CMXCH on zero
2980 #. in user space would fail, so kernel has to clean up.)
2981 #. Darren Hart (Oct 2015):
2982 #. The trylock in the kernel has more state, so it can independently
2983 #. verify the flags that user space must trust implicitly.
2984 #. type: Plain text
2985 #: debian-trixie fedora-44 fedora-rawhide
2986 msgid ""
2987 "Because the kernel has access to more state information than user space, "
2988 "acquisition of the lock might succeed if performed by the kernel in cases "
2989 "where the futex word (i.e., the state information accessible to use-space) "
2990 "contains stale state (B<FUTEX_WAITERS> and/or B<FUTEX_OWNER_DIED>). This "
2991 "can happen when the owner of the futex died. User space cannot handle this "
2992 "condition in a race-free manner, but the kernel can fix this up and acquire "
2993 "the futex."
2994 msgstr ""
2995 "Так как ядро имеет больший доступ к информации о состоянии, чем "
2996 "пользовательское пространство, получение блокировки из ядра может "
2997 "осуществиться, в случаях когда слово фьютекса (т. е., информация о состоянии "
2998 "доступна из пользовательского пространства) устарело (B<FUTEX_WAITERS> и/или "
2999 "B<FUTEX_OWNER_DIED>). Это может случиться, если владелец фьютекса неожиданно "
3000 "завершился. Пользовательское пространство не может учесть это событие не "
3001 "получив состязательности, но ядро может решить данную проблему и получить "
3002 "блокировку."
3003
3004 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3005 #. type: Plain text
3006 #: debian-trixie fedora-44 fedora-rawhide
3007 msgid "The I<uaddr2>, I<val>, I<timeout>, and I<val3> arguments are ignored."
3008 msgstr "Аргументы I<uaddr2>, I<val>, I<timeout> и I<val3> игнорируются."
3009
3010 #. type: TP
3011 #: debian-trixie fedora-44 fedora-rawhide
3012 #, no-wrap
3013 msgid "B<FUTEX_UNLOCK_PI> (since Linux 2.6.18)"
3014 msgstr "B<FUTEX_UNLOCK_PI> (начиная с Linux 2.6.18)"
3015
3016 #. commit c87e2837be82df479a6bae9f155c43516d2feebc
3017 #. type: Plain text
3018 #: debian-trixie fedora-44 fedora-rawhide
3019 #, fuzzy
3020 #| msgid ""
3021 #| "This operation wakes the top priority waiter that is waiting in "
3022 #| "B<FUTEX_LOCK_PI> on the futex address provided by the I<uaddr> argument."
3023 msgid ""
3024 "This operation wakes the top priority waiter that is waiting in "
3025 "B<FUTEX_LOCK_PI> or B<FUTEX_LOCK_PI2> on the futex address provided by the "
3026 "I<uaddr> argument."
3027 msgstr ""
3028 "Данная операция будит ожидающего с самым высоким приоритетом, который ждёт "
3029 "фьютекс по адресу из I<uaddr> посредством операции B<FUTEX_LOCK_PI>."
3030
3031 #. type: Plain text
3032 #: debian-trixie fedora-44 fedora-rawhide
3033 msgid ""
3034 "This is called when the user-space value at I<uaddr> cannot be changed "
3035 "atomically from a TID (of the owner) to 0."
3036 msgstr ""
3037 "Операция вызывается, когда значение по адресу I<uaddr> пользовательского "
3038 "пространства невозможно изменить атомарно с TID (владельца) на 0."
3039
3040 #. type: TP
3041 #: debian-trixie fedora-44 fedora-rawhide
3042 #, no-wrap
3043 msgid "B<FUTEX_CMP_REQUEUE_PI> (since Linux 2.6.31)"
3044 msgstr "B<FUTEX_CMP_REQUEUE_PI> (начиная с Linux 2.6.31)"
3045
3046 #. commit 52400ba946759af28442dee6265c5c0180ac7122
3047 #. type: Plain text
3048 #: debian-trixie fedora-44 fedora-rawhide
3049 msgid ""
3050 "This operation is a PI-aware variant of B<FUTEX_CMP_REQUEUE>. It requeues "
3051 "waiters that are blocked via B<FUTEX_WAIT_REQUEUE_PI> on I<uaddr> from a non-"
3052 "PI source futex (I<uaddr>) to a PI target futex (I<uaddr2>)."
3053 msgstr ""
3054 "Данная операция является PI-аналогом операции B<FUTEX_CMP_REQUEUE>. Она "
3055 "перестанавливает ожидающих, заблокированных с помощью "
3056 "B<FUTEX_WAIT_REQUEUE_PI> для I<uaddr>, из очереди не PI-фьютекса источника "
3057 "(I<uaddr>) в очередь PI-фьютекса назначения (I<uaddr2>)."
3058
3059 #. type: Plain text
3060 #: debian-trixie fedora-44 fedora-rawhide
3061 msgid ""
3062 "As with B<FUTEX_CMP_REQUEUE>, this operation wakes up a maximum of I<val> "
3063 "waiters that are waiting on the futex at I<uaddr>. However, for "
3064 "B<FUTEX_CMP_REQUEUE_PI>, I<val> is required to be 1 (since the main point is "
3065 "to avoid a thundering herd). The remaining waiters are removed from the "
3066 "wait queue of the source futex at I<uaddr> and added to the wait queue of "
3067 "the target futex at I<uaddr2>."
3068 msgstr ""
3069 "Как и B<FUTEX_CMP_REQUEUE>, эта операция пробуждает не более I<val> "
3070 "ожидающих, которые ждут фьютекса по адресу I<uaddr>. Однако у "
3071 "B<FUTEX_CMP_REQUEUE_PI> значение I<val> должно быть равно 1 (чтобы избежать "
3072 "«нашествия орды»). Оставшиеся ожидающие удаляются из очереди ожидания "
3073 "фьютекса-источника по адресу I<uaddr> и добавляются в очередь ожидания "
3074 "фьютекса-назначения по адресу I<uaddr2>."
3075
3076 #. val2 is the cap on the number of requeued waiters.
3077 #. In the glibc pthread_cond_broadcast() implementation, this argument
3078 #. is specified as INT_MAX, and for pthread_cond_signal() it is 0.
3079 #. The page at http://locklessinc.com/articles/futex_cheat_sheet/
3080 #. notes that "priority-inheritance Futex to priority-inheritance
3081 #. Futex requeues are currently unsupported". However, probably
3082 #. the page does not need to say nothing about this, since
3083 #. Thomas Gleixner commented (July 2015): "they never will be
3084 #. supported because they make no sense at all"
3085 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3086 #. type: Plain text
3087 #: debian-trixie fedora-44 fedora-rawhide
3088 msgid ""
3089 "The I<val2> and I<val3> arguments serve the same purposes as for "
3090 "B<FUTEX_CMP_REQUEUE>."
3091 msgstr ""
3092 "Аргументы I<val2> и I<val3> служат тем же целям, что и в "
3093 "B<FUTEX_CMP_REQUEUE>."
3094
3095 #. type: TP
3096 #: debian-trixie fedora-44 fedora-rawhide
3097 #, no-wrap
3098 msgid "B<FUTEX_WAIT_REQUEUE_PI> (since Linux 2.6.31)"
3099 msgstr "B<FUTEX_WAIT_REQUEUE_PI> (начиная с Linux 2.6.31)"
3100
3101 #. commit 52400ba946759af28442dee6265c5c0180ac7122
3102 #. type: Plain text
3103 #: debian-trixie fedora-44 fedora-rawhide
3104 msgid ""
3105 "Wait on a non-PI futex at I<uaddr> and potentially be requeued (via a "
3106 "B<FUTEX_CMP_REQUEUE_PI> operation in another task) onto a PI futex at "
3107 "I<uaddr2>. The wait operation on I<uaddr> is the same as for B<FUTEX_WAIT>."
3108 msgstr ""
3109 "Ждать не PI-фьютекса по адресу I<uaddr> и, потенциально быть перемещённым в "
3110 "очередь (при операции B<FUTEX_CMP_REQUEUE_PI> из другой задачи) PI-фьютекса "
3111 "по адресу I<uaddr2>. Операция ожидания на адресе I<uaddr> такая же как для "
3112 "B<FUTEX_WAIT>."
3113
3114 #. type: Plain text
3115 #: debian-trixie fedora-44 fedora-rawhide
3116 msgid ""
3117 "The waiter can be removed from the wait on I<uaddr> without requeueing on "
3118 "I<uaddr2> via a B<FUTEX_WAKE> operation in another task. In this case, the "
3119 "B<FUTEX_WAIT_REQUEUE_PI> operation fails with the error B<EAGAIN>."
3120 msgstr ""
3121 "Ожидающий может быть удалён из ожидающих на адресе I<uaddr> перемещения в "
3122 "очередь у I<uaddr2> при операции B<FUTEX_WAKE> из другой задачи. В этом "
3123 "случае операция B<FUTEX_WAIT_REQUEUE_PI> завершается с ошибкой B<EAGAIN>."
3124
3125 #. type: Plain text
3126 #: debian-trixie fedora-44 fedora-rawhide
3127 msgid "The I<val3> argument is ignored."
3128 msgstr "Аргумент I<val3> игнорируется."
3129
3130 #. Darren Hart notes that a patch to allow glibc to fully support
3131 #. PI-aware pthreads condition variables has not yet been accepted into
3132 #. glibc. The story is complex, and can be found at
3133 #. https://sourceware.org/bugzilla/show_bug.cgi?id=11588
3134 #. Darren notes that in the meantime, the patch is shipped with various
3135 #. PREEMPT_RT-enabled Linux systems.
3136 #. Related to the preceding, Darren proposed that somewhere, man-pages
3137 #. should document the following point:
3138 #. While the Linux kernel, since Linux 2.6.31, supports requeueing of
3139 #. priority-inheritance (PI) aware mutexes via the
3140 #. FUTEX_WAIT_REQUEUE_PI and FUTEX_CMP_REQUEUE_PI futex operations,
3141 #. the glibc implementation does not yet take full advantage of this.
3142 #. Specifically, the condvar internal data lock remains a non-PI aware
3143 #. mutex, regardless of the type of the pthread_mutex associated with
3144 #. the condvar. This can lead to an unbounded priority inversion on
3145 #. the internal data lock even when associating a PI aware
3146 #. pthread_mutex with a condvar during a pthread_cond*_wait
3147 #. operation. For this reason, it is not recommended to rely on
3148 #. priority inheritance when using pthread condition variables.
3149 #. The problem is that the obvious location for this text is
3150 #. the pthread_cond*wait(3) man page. However, such a man page
3151 #. does not currently exist.
3152 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3153 #. type: Plain text
3154 #: debian-trixie fedora-44 fedora-rawhide
3155 msgid ""
3156 "The B<FUTEX_WAIT_REQUEUE_PI> and B<FUTEX_CMP_REQUEUE_PI> were added to "
3157 "support a fairly specific use case: support for priority-inheritance-aware "
3158 "POSIX threads condition variables. The idea is that these operations should "
3159 "always be paired, in order to ensure that user space and the kernel remain "
3160 "in sync. Thus, in the B<FUTEX_WAIT_REQUEUE_PI> operation, the user-space "
3161 "application pre-specifies the target of the requeue that takes place in the "
3162 "B<FUTEX_CMP_REQUEUE_PI> operation."
3163 msgstr ""
3164 "Операции B<FUTEX_WAIT_REQUEUE_PI> и B<FUTEX_CMP_REQUEUE_PI> добавлены для "
3165 "довольно узкого варианта применения — поддержки переменных условия нитей "
3166 "POSIX с наследованием приоритета. Идея в том, что эти операции всегда должны "
3167 "использоваться попарно, для поддержания синхронизации между пользовательским "
3168 "пространством и ядром. То есть в операции B<FUTEX_WAIT_REQUEUE_PI> "
3169 "приложение пользовательского пространства заранее задаёт назначение для "
3170 "перемещения в очередь, которое проводится операцией B<FUTEX_CMP_REQUEUE_PI>."
3171
3172 #. type: Plain text
3173 #: debian-trixie fedora-44 fedora-rawhide
3174 #, fuzzy
3175 #| msgid ""
3176 #| "In the event of an error (and assuming that B<futex>() was invoked via "
3177 #| "B<syscall>(2)), all operations return -1 and set I<errno> to indicate the "
3178 #| "cause of the error."
3179 msgid ""
3180 "In the event of an error (and assuming that B<futex>() was invoked via "
3181 "B<syscall>(2)), all operations return -1 and set I<errno> to indicate the "
3182 "error."
3183 msgstr ""
3184 "В случае ошибки (предполагается, что B<futex>() был вызван через "
3185 "B<syscall>(2)), все операции возвращают -1 и присваивают I<errno> номер "
3186 "ошибки."
3187
3188 #. type: Plain text
3189 #: debian-trixie fedora-44 fedora-rawhide
3190 msgid ""
3191 "The return value on success depends on the operation, as described in the "
3192 "following list:"
3193 msgstr "При успешном выполнении возвращаемое значение зависит от операции:"
3194
3195 #. type: TP
3196 #: debian-trixie fedora-44 fedora-rawhide
3197 #, no-wrap
3198 msgid "B<FUTEX_WAIT>"
3199 msgstr "B<FUTEX_WAIT>"
3200
3201 #. type: Plain text
3202 #: debian-trixie fedora-44 fedora-rawhide
3203 msgid ""
3204 "Returns 0 if the caller was woken up. Note that a wake-up can also be "
3205 "caused by common futex usage patterns in unrelated code that happened to "
3206 "have previously used the futex word's memory location (e.g., typical futex-"
3207 "based implementations of Pthreads mutexes can cause this under some "
3208 "conditions). Therefore, callers should always conservatively assume that a "
3209 "return value of 0 can mean a spurious wake-up, and use the futex word's "
3210 "value (i.e., the user-space synchronization scheme) to decide whether to "
3211 "continue to block or not."
3212 msgstr ""
3213 "Значение 0 возвращается, если вызывающий был разбужен. Заметим, что "
3214 "пробуждение также может быть вызвано часто используемыми вариантами "
3215 "использования фьютексов в не связанном коде, которое случается, если память "
3216 "под слово фьютекса использовалась ранее (например, при типичной реализации "
3217 "фьютексов на основе мьютексов Pthreads это может возникать при определённых "
3218 "условиях). Поэтому вызывающий всегда должен консервативно предполагать, что "
3219 "возвращаемое значение 0 может означать побочное пробуждение (spurious wake-"
3220 "up), и учитывать значение слово фьютекса (т. е. схема с синхронизацией "
3221 "пользовательского пространства) при принятии решения нужна дальнейшее "
3222 "ожидание или нет."
3223
3224 #. type: TP
3225 #: debian-trixie fedora-44 fedora-rawhide
3226 #, no-wrap
3227 msgid "B<FUTEX_WAKE>"
3228 msgstr "B<FUTEX_WAKE>"
3229
3230 #. type: Plain text
3231 #: debian-trixie fedora-44 fedora-rawhide
3232 msgid "Returns the number of waiters that were woken up."
3233 msgstr "Возвращается количество разбуженных ожидающих."
3234
3235 #. type: TP
3236 #: debian-trixie fedora-44 fedora-rawhide
3237 #, no-wrap
3238 msgid "B<FUTEX_FD>"
3239 msgstr "B<FUTEX_FD>"
3240
3241 #. type: Plain text
3242 #: debian-trixie fedora-44 fedora-rawhide
3243 msgid "Returns the new file descriptor associated with the futex."
3244 msgstr "Возвращается новый файловый дескриптор, связанный с фьютексом."
3245
3246 #. type: TP
3247 #: debian-trixie fedora-44 fedora-rawhide
3248 #, no-wrap
3249 msgid "B<FUTEX_REQUEUE>"
3250 msgstr "B<FUTEX_REQUEUE>"
3251
3252 #. type: TP
3253 #: debian-trixie fedora-44 fedora-rawhide
3254 #, no-wrap
3255 msgid "B<FUTEX_CMP_REQUEUE>"
3256 msgstr "B<FUTEX_CMP_REQUEUE>"
3257
3258 #. type: Plain text
3259 #: debian-trixie fedora-44 fedora-rawhide
3260 msgid ""
3261 "Returns the total number of waiters that were woken up or requeued to the "
3262 "futex for the futex word at I<uaddr2>. If this value is greater than "
3263 "I<val>, then the difference is the number of waiters requeued to the futex "
3264 "for the futex word at I<uaddr2>."
3265 msgstr ""
3266 "Возвращается общее количество ожидающих, которые будятся или перемещаются в "
3267 "очередь фьютекса, у которого слово фьютекса задано по адресу I<uaddr2>. Если "
3268 "это значение больше чем I<val>, то разница это количество ожидающих, "
3269 "перемещённых в очередь фьютекса, у которого слово фьютекса задано по адресу "
3270 "I<uaddr2>."
3271
3272 #. type: TP
3273 #: debian-trixie fedora-44 fedora-rawhide
3274 #, no-wrap
3275 msgid "B<FUTEX_WAKE_OP>"
3276 msgstr "B<FUTEX_WAKE_OP>"
3277
3278 #. type: Plain text
3279 #: debian-trixie fedora-44 fedora-rawhide
3280 msgid ""
3281 "Returns the total number of waiters that were woken up. This is the sum of "
3282 "the woken waiters on the two futexes for the futex words at I<uaddr> and "
3283 "I<uaddr2>."
3284 msgstr ""
3285 "Возвращается общее количество разбуженных ожидающих. Это сумма разбуженных "
3286 "ожидающих у двух фьютексов для слов фьютексов по адресам I<uaddr> и "
3287 "I<uaddr2>."
3288
3289 #. type: TP
3290 #: debian-trixie fedora-44 fedora-rawhide
3291 #, no-wrap
3292 msgid "B<FUTEX_WAIT_BITSET>"
3293 msgstr "B<FUTEX_WAIT_BITSET>"
3294
3295 #. type: Plain text
3296 #: debian-trixie fedora-44 fedora-rawhide
3297 msgid ""
3298 "Returns 0 if the caller was woken up. See B<FUTEX_WAIT> for how to "
3299 "interpret this correctly in practice."
3300 msgstr ""
3301 "Возвращается 0, если вызывающий был разбужен. Смотрите в описании "
3302 "B<FUTEX_WAIT>, как это правильно учитывать на практике."
3303
3304 #. type: TP
3305 #: debian-trixie fedora-44 fedora-rawhide
3306 #, no-wrap
3307 msgid "B<FUTEX_WAKE_BITSET>"
3308 msgstr "B<FUTEX_WAKE_BITSET>"
3309
3310 #. type: TP
3311 #: debian-trixie fedora-44 fedora-rawhide
3312 #, no-wrap
3313 msgid "B<FUTEX_LOCK_PI>"
3314 msgstr "B<FUTEX_LOCK_PI>"
3315
3316 #. type: Plain text
3317 #: debian-trixie fedora-44 fedora-rawhide
3318 msgid "Returns 0 if the futex was successfully locked."
3319 msgstr "Возвращается 0, если фьютекс был успешно заблокирован."
3320
3321 #. type: TP
3322 #: debian-trixie fedora-44 fedora-rawhide
3323 #, no-wrap
3324 msgid "B<FUTEX_LOCK_PI2>"
3325 msgstr "B<FUTEX_LOCK_PI2>"
3326
3327 #. type: TP
3328 #: debian-trixie fedora-44 fedora-rawhide
3329 #, no-wrap
3330 msgid "B<FUTEX_TRYLOCK_PI>"
3331 msgstr "B<FUTEX_TRYLOCK_PI>"
3332
3333 #. type: TP
3334 #: debian-trixie fedora-44 fedora-rawhide
3335 #, no-wrap
3336 msgid "B<FUTEX_UNLOCK_PI>"
3337 msgstr "B<FUTEX_UNLOCK_PI>"
3338
3339 #. type: Plain text
3340 #: debian-trixie fedora-44 fedora-rawhide
3341 msgid "Returns 0 if the futex was successfully unlocked."
3342 msgstr "Возвращается 0, если фьютекс был успешно разблокирован."
3343
3344 #. type: TP
3345 #: debian-trixie fedora-44 fedora-rawhide
3346 #, no-wrap
3347 msgid "B<FUTEX_CMP_REQUEUE_PI>"
3348 msgstr "B<FUTEX_CMP_REQUEUE_PI>"
3349
3350 #. type: Plain text
3351 #: debian-trixie fedora-44 fedora-rawhide
3352 msgid ""
3353 "Returns the total number of waiters that were woken up or requeued to the "
3354 "futex for the futex word at I<uaddr2>. If this value is greater than "
3355 "I<val>, then difference is the number of waiters requeued to the futex for "
3356 "the futex word at I<uaddr2>."
3357 msgstr ""
3358 "Возвращается общее количество ожидающих, которые будятся или перемещаются в "
3359 "очередь фьютекса, у которого слово фьютекса задано по адресу I<uaddr2>. Если "
3360 "это значение больше чем I<val>, то разница это количество ожидающих, "
3361 "перемещённых в очередь фьютекса, у которого слово фьютекса задано по адресу "
3362 "I<uaddr2>."
3363
3364 #. type: TP
3365 #: debian-trixie fedora-44 fedora-rawhide
3366 #, no-wrap
3367 msgid "B<FUTEX_WAIT_REQUEUE_PI>"
3368 msgstr "B<FUTEX_WAIT_REQUEUE_PI>"
3369
3370 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3371 #. type: Plain text
3372 #: debian-trixie fedora-44 fedora-rawhide
3373 msgid ""
3374 "Returns 0 if the caller was successfully requeued to the futex for the futex "
3375 "word at I<uaddr2>."
3376 msgstr ""
3377 "Возвращается 0, если вызывающий был успешно перемещён в очередь фьютекса со "
3378 "словом фьютекса по адресу I<uaddr2>."
3379
3380 #. type: TP
3381 #: debian-trixie fedora-44 fedora-rawhide
3382 #, no-wrap
3383 msgid "B<EAGAIN>"
3384 msgstr "B<EAGAIN>"
3385
3386 #. type: Plain text
3387 #: debian-trixie fedora-44 fedora-rawhide
3388 msgid ""
3389 "(B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET>, B<FUTEX_WAIT_REQUEUE_PI>) The value "
3390 "pointed to by I<uaddr> was not equal to the expected value I<val> at the "
3391 "time of the call."
3392 msgstr ""
3393 "(B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET>, B<FUTEX_WAIT_REQUEUE_PI>) Значение, на "
3394 "которое указывает I<uaddr>, не было равно ожидаемому значению I<val> на "
3395 "момент вызова."
3396
3397 #. type: Plain text
3398 #: debian-trixie fedora-44 fedora-rawhide
3399 msgid ""
3400 "B<Note>: on Linux, the symbolic names B<EAGAIN> and B<EWOULDBLOCK> (both of "
3401 "which appear in different parts of the kernel futex code) have the same "
3402 "value."
3403 msgstr ""
3404 "B<Замечание>: в Linux символические имена B<EAGAIN> и B<EWOULDBLOCK> (оба "
3405 "есть в разных частях кода фьютекса ядра) имеют одинаковое значение."
3406
3407 #. type: Plain text
3408 #: debian-trixie fedora-44 fedora-rawhide
3409 msgid ""
3410 "(B<FUTEX_CMP_REQUEUE>, B<FUTEX_CMP_REQUEUE_PI>) The value pointed to by "
3411 "I<uaddr> is not equal to the expected value I<val3>."
3412 msgstr ""
3413 "(B<FUTEX_CMP_REQUEUE>, B<FUTEX_CMP_REQUEUE_PI>) Значение, на которое "
3414 "указывает I<uaddr>, не равно ожидаемому значению I<val3>."
3415
3416 #. type: Plain text
3417 #: debian-trixie fedora-44 fedora-rawhide
3418 msgid ""
3419 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3420 "B<FUTEX_CMP_REQUEUE_PI>) The futex owner thread ID of I<uaddr> (for "
3421 "B<FUTEX_CMP_REQUEUE_PI>: I<uaddr2>) is about to exit, but has not yet "
3422 "handled the internal state cleanup. Try again."
3423 msgstr ""
3424 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3425 "B<FUTEX_CMP_REQUEUE_PI>) ID нити владельца фьютекса по адресу I<uaddr> (для "
3426 "B<FUTEX_CMP_REQUEUE_PI> — I<uaddr2>) вскоре закончит работу, но не выполнил "
3427 "очистку внутреннего состояния. Попробуйте ещё раз."
3428
3429 #. type: TP
3430 #: debian-trixie fedora-44 fedora-rawhide
3431 #, no-wrap
3432 msgid "B<EDEADLK>"
3433 msgstr "B<EDEADLK>"
3434
3435 #. type: Plain text
3436 #: debian-trixie fedora-44 fedora-rawhide
3437 msgid ""
3438 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3439 "B<FUTEX_CMP_REQUEUE_PI>) The futex word at I<uaddr> is already locked by "
3440 "the caller."
3441 msgstr ""
3442 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3443 "B<FUTEX_CMP_REQUEUE_PI>) Слово фьютекса по адресу I<uaddr> уже заблокировано "
3444 "вызывающим."
3445
3446 #. FIXME . I see that kernel/locking/rtmutex.c uses EDEADLK in some
3447 #. places, and EDEADLOCK in others. On almost all architectures
3448 #. these constants are synonymous. Is there a reason that both
3449 #. names are used?
3450 #. tglx (July 2015): "No. We should probably fix that."
3451 #. type: Plain text
3452 #: debian-trixie fedora-44 fedora-rawhide
3453 msgid ""
3454 "(B<FUTEX_CMP_REQUEUE_PI>) While requeueing a waiter to the PI futex for the "
3455 "futex word at I<uaddr2>, the kernel detected a deadlock."
3456 msgstr ""
3457 "(B<FUTEX_CMP_REQUEUE_PI>) Во время перемещения в другую очередь ожидающего "
3458 "PI-фьютекса со словом фьютекса по адресу I<uaddr2> ядро обнаружило тупиковую "
3459 "блокировку (deadlock)."
3460
3461 #. type: Plain text
3462 #: debian-trixie fedora-44 fedora-rawhide
3463 msgid ""
3464 "A required pointer argument (i.e., I<uaddr>, I<uaddr2>, or I<timeout>) did "
3465 "not point to a valid user-space address."
3466 msgstr ""
3467 "Требуемый аргумент указателя (т. е., I<uaddr>, I<uaddr2> или I<timeout>) не "
3468 "указывает на допустимый адрес пользовательского пространства."
3469
3470 #. type: TP
3471 #: debian-trixie fedora-44 fedora-rawhide
3472 #, no-wrap
3473 msgid "B<EINTR>"
3474 msgstr "B<EINTR>"
3475
3476 #. type: Plain text
3477 #: debian-trixie fedora-44 fedora-rawhide
3478 #, fuzzy
3479 #| msgid ""
3480 #| "A B<FUTEX_WAIT> or B<FUTEX_WAIT_BITSET> operation was interrupted by a "
3481 #| "signal (see B<signal>(7)). In kernels before Linux 2.6.22, this error "
3482 #| "could also be returned for a spurious wakeup; since Linux 2.6.22, this no "
3483 #| "longer happens."
3484 msgid ""
3485 "A B<FUTEX_WAIT> or B<FUTEX_WAIT_BITSET> operation was interrupted by a "
3486 "signal (see B<signal>(7)). Before Linux 2.6.22, this error could also be "
3487 "returned for a spurious wakeup; since Linux 2.6.22, this no longer happens."
3488 msgstr ""
3489 "Операция B<FUTEX_WAIT> или B<FUTEX_WAIT_BITSET> была прервана сигналом "
3490 "(смотрите B<signal>(7)). В ядрах до версии Linux 2.6.22 эта ошибка также "
3491 "возвращалась при побочном пробуждении; начиная с Linux 2.6.22 этого больше "
3492 "не происходит."
3493
3494 #. type: Plain text
3495 #: debian-trixie fedora-44 fedora-rawhide
3496 msgid ""
3497 "The operation in I<futex_op> is one of those that employs a timeout, but the "
3498 "supplied I<timeout> argument was invalid (I<tv_sec> was less than zero, or "
3499 "I<tv_nsec> was not less than 1,000,000,000)."
3500 msgstr ""
3501 "Операция в I<futex_op> является одной из тех, что используют ожидание "
3502 "(timeout), но значение аргумента I<timeout> некорректно (I<tv_sec> меньше "
3503 "нуля или I<tv_nsec> больше 1000000000)."
3504
3505 #. type: Plain text
3506 #: debian-trixie fedora-44 fedora-rawhide
3507 #, fuzzy
3508 #| msgid ""
3509 #| "The operation specified in I<futex_op> employs one or both of the "
3510 #| "pointers I<uaddr> and I<uaddr2>, but one of these does not point to a "
3511 #| "valid object\\(emthat is, the address is not four-byte-aligned."
3512 msgid ""
3513 "The operation specified in I<futex_op> employs one or both of the pointers "
3514 "I<uaddr> and I<uaddr2>, but one of these does not point to a valid object\\"
3515 "[em]that is, the address is not four-byte-aligned."
3516 msgstr ""
3517 "Операция, указанная в I<futex_op>, использует один или оба указателя "
3518 "I<uaddr> и I<uaddr2>, но один из них не указывает на корректный объект, то "
3519 "есть адрес не выровнен по четырёх байтовой границе."
3520
3521 #. type: Plain text
3522 #: debian-trixie fedora-44 fedora-rawhide
3523 msgid ""
3524 "(B<FUTEX_WAIT_BITSET>, B<FUTEX_WAKE_BITSET>) The bit mask supplied in "
3525 "I<val3> is zero."
3526 msgstr ""
3527 "(B<FUTEX_WAIT_BITSET>, B<FUTEX_WAKE_BITSET>) Битовая маска, указанная в "
3528 "I<val3>, равна нулю."
3529
3530 #. type: Plain text
3531 #: debian-trixie fedora-44 fedora-rawhide
3532 msgid ""
3533 "(B<FUTEX_CMP_REQUEUE_PI>) I<uaddr> equals I<uaddr2> (i.e., an attempt was "
3534 "made to requeue to the same futex)."
3535 msgstr ""
3536 "(B<FUTEX_CMP_REQUEUE_PI>) Значение I<uaddr> равно I<uaddr2> (т. е., "
3537 "предпринята попытка выполнить перемещение в одну и ту же очередь)."
3538
3539 #. type: Plain text
3540 #: debian-trixie fedora-44 fedora-rawhide
3541 msgid "(B<FUTEX_FD>) The signal number supplied in I<val> is invalid."
3542 msgstr "(B<FUTEX_FD>) В I<val> указан некорректный номер сигнала."
3543
3544 #. type: Plain text
3545 #: debian-trixie fedora-44 fedora-rawhide
3546 #, fuzzy
3547 #| msgid ""
3548 #| "(B<FUTEX_WAKE>, B<FUTEX_WAKE_OP>, B<FUTEX_WAKE_BITSET>, B<FUTEX_REQUEUE>, "
3549 #| "B<FUTEX_CMP_REQUEUE>) The kernel detected an inconsistency between the "
3550 #| "user-space state at I<uaddr> and the kernel state\\(emthat is, it "
3551 #| "detected a waiter which waits in B<FUTEX_LOCK_PI> on I<uaddr>."
3552 msgid ""
3553 "(B<FUTEX_WAKE>, B<FUTEX_WAKE_OP>, B<FUTEX_WAKE_BITSET>, B<FUTEX_REQUEUE>, "
3554 "B<FUTEX_CMP_REQUEUE>) The kernel detected an inconsistency between the user-"
3555 "space state at I<uaddr> and the kernel state\\[em]that is, it detected a "
3556 "waiter which waits in B<FUTEX_LOCK_PI> or B<FUTEX_LOCK_PI2> on I<uaddr>."
3557 msgstr ""
3558 "(B<FUTEX_WAKE>, B<FUTEX_WAKE_OP>, B<FUTEX_WAKE_BITSET>, B<FUTEX_REQUEUE>, "
3559 "B<FUTEX_CMP_REQUEUE>) Ядро обнаружило противоречие между состояние в "
3560 "пользовательском пространстве по адресу I<uaddr> и состоянием в ядре, то "
3561 "есть обнаружило, что ожидающий ждёт посредством операции B<FUTEX_LOCK_PI> на "
3562 "адресе I<uaddr>."
3563
3564 #. type: Plain text
3565 #: debian-trixie fedora-44 fedora-rawhide
3566 msgid ""
3567 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3568 "B<FUTEX_UNLOCK_PI>) The kernel detected an inconsistency between the user-"
3569 "space state at I<uaddr> and the kernel state. This indicates either state "
3570 "corruption or that the kernel found a waiter on I<uaddr> which is waiting "
3571 "via B<FUTEX_WAIT> or B<FUTEX_WAIT_BITSET>."
3572 msgstr ""
3573 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3574 "B<FUTEX_UNLOCK_PI>) Ядро обнаружило противоречие между состояние в "
3575 "пользовательском пространстве по адресу I<uaddr> и состоянием в ядре. Это "
3576 "указывает на поврежденное значение состояния или что ядро обнаружило "
3577 "ожидающего на адресе I<uaddr>, который делает это посредством операции "
3578 "B<FUTEX_WAIT> или B<FUTEX_WAIT_BITSET>."
3579
3580 #. From a conversation with Thomas Gleixner (Aug 2015): ###
3581 #. The kernel sees: I have non PI state for a futex you tried to
3582 #. tell me was PI
3583 #. type: Plain text
3584 #: debian-trixie fedora-44 fedora-rawhide
3585 msgid ""
3586 "(B<FUTEX_CMP_REQUEUE_PI>) The kernel detected an inconsistency between the "
3587 "user-space state at I<uaddr2> and the kernel state; that is, the kernel "
3588 "detected a waiter which waits via B<FUTEX_WAIT> or B<FUTEX_WAIT_BITSET> on "
3589 "I<uaddr2>."
3590 msgstr ""
3591 "(B<FUTEX_CMP_REQUEUE_PI>) Ядро обнаружило противоречие между состояние в "
3592 "пользовательском пространстве по адресу I<uaddr2> и состоянием в ядре, то "
3593 "есть обнаружило, что ожидающий ждёт посредством операции B<FUTEX_WAIT> или "
3594 "B<FUTEX_WAIT_BITSET> на адресе I<uaddr2>."
3595
3596 #. type: Plain text
3597 #: debian-trixie fedora-44 fedora-rawhide
3598 msgid ""
3599 "(B<FUTEX_CMP_REQUEUE_PI>) The kernel detected an inconsistency between the "
3600 "user-space state at I<uaddr> and the kernel state; that is, the kernel "
3601 "detected a waiter which waits via B<FUTEX_WAIT> or B<FUTEX_WAIT_BITSET> on "
3602 "I<uaddr>."
3603 msgstr ""
3604 "(B<FUTEX_CMP_REQUEUE_PI>) Ядро обнаружило противоречие между состояние в "
3605 "пользовательском пространстве по адресу I<uaddr> и состоянием в ядре, то "
3606 "есть обнаружило, что ожидающий ждёт посредством операции B<FUTEX_WAIT> или "
3607 "B<FUTEX_WAIT_BITSET> на адресе I<uaddr>."
3608
3609 #. type: Plain text
3610 #: debian-trixie fedora-44 fedora-rawhide
3611 #, fuzzy
3612 #| msgid ""
3613 #| "(B<FUTEX_CMP_REQUEUE_PI>) The kernel detected an inconsistency between "
3614 #| "the user-space state at I<uaddr> and the kernel state; that is, the "
3615 #| "kernel detected a waiter which waits on I<uaddr> via B<FUTEX_LOCK_PI> "
3616 #| "(instead of B<FUTEX_WAIT_REQUEUE_PI>)."
3617 msgid ""
3618 "(B<FUTEX_CMP_REQUEUE_PI>) The kernel detected an inconsistency between the "
3619 "user-space state at I<uaddr> and the kernel state; that is, the kernel "
3620 "detected a waiter which waits on I<uaddr> via B<FUTEX_LOCK_PI> or "
3621 "B<FUTEX_LOCK_PI2> (instead of B<FUTEX_WAIT_REQUEUE_PI>)."
3622 msgstr ""
3623 "(B<FUTEX_CMP_REQUEUE_PI>) Ядро обнаружило противоречие между состояние в "
3624 "пользовательском пространстве по адресу I<uaddr> и состоянием в ядре, то "
3625 "есть обнаружило, что ожидающий ждёт посредством операции B<FUTEX_LOCK_PI> на "
3626 "адресе I<uaddr> (вместо B<FUTEX_WAIT_REQUEUE_PI>)."
3627
3628 #. This deals with the case:
3629 #. wait_requeue_pi(A, B);
3630 #. requeue_pi(A, C);
3631 #. type: Plain text
3632 #: debian-trixie fedora-44 fedora-rawhide
3633 msgid ""
3634 "(B<FUTEX_CMP_REQUEUE_PI>) An attempt was made to requeue a waiter to a "
3635 "futex other than that specified by the matching B<FUTEX_WAIT_REQUEUE_PI> "
3636 "call for that waiter."
3637 msgstr ""
3638 "(B<FUTEX_CMP_REQUEUE_PI>) Предпринята попытка выполнить перемещение "
3639 "ожидающего на фьютекс, отличный от указанного в соответствующем вызове "
3640 "B<FUTEX_WAIT_REQUEUE_PI> для этого вызывающего."
3641
3642 #. type: Plain text
3643 #: debian-trixie fedora-44 fedora-rawhide
3644 msgid "(B<FUTEX_CMP_REQUEUE_PI>) The I<val> argument is not 1."
3645 msgstr "(B<FUTEX_CMP_REQUEUE_PI>) Значение аргумента I<val> не равно 1."
3646
3647 #. type: TP
3648 #: debian-trixie fedora-44 fedora-rawhide
3649 #, no-wrap
3650 msgid "B<ENFILE>"
3651 msgstr "B<ENFILE>"
3652
3653 #. type: Plain text
3654 #: debian-trixie fedora-44 fedora-rawhide
3655 msgid ""
3656 "(B<FUTEX_FD>) The system-wide limit on the total number of open files has "
3657 "been reached."
3658 msgstr ""
3659 "(B<FUTEX_FD>) Достигнуто ограничение на общее количество открытых файлов в "
3660 "системе."
3661
3662 #. type: TP
3663 #: debian-trixie fedora-44 fedora-rawhide
3664 #, no-wrap
3665 msgid "B<ENOMEM>"
3666 msgstr "B<ENOMEM>"
3667
3668 #. type: Plain text
3669 #: debian-trixie fedora-44 fedora-rawhide
3670 msgid ""
3671 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3672 "B<FUTEX_CMP_REQUEUE_PI>) The kernel could not allocate memory to hold state "
3673 "information."
3674 msgstr ""
3675 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3676 "B<FUTEX_CMP_REQUEUE_PI>) Ядро не может выделить память для хранения "
3677 "информации о состоянии."
3678
3679 #. type: Plain text
3680 #: debian-trixie fedora-44 fedora-rawhide
3681 msgid "Invalid operation specified in I<futex_op>."
3682 msgstr "В I<futex_op> задана неверная операция."
3683
3684 #. type: Plain text
3685 #: debian-trixie fedora-44 fedora-rawhide
3686 #, fuzzy
3687 #| msgid ""
3688 #| "The B<FUTEX_CLOCK_REALTIME> option was specified in I<futex_op>, but the "
3689 #| "accompanying operation was neither B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET>, "
3690 #| "nor B<FUTEX_WAIT_REQUEUE_PI>."
3691 msgid ""
3692 "The B<FUTEX_CLOCK_REALTIME> option was specified in I<futex_op>, but the "
3693 "accompanying operation was neither B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET>, "
3694 "B<FUTEX_WAIT_REQUEUE_PI>, nor B<FUTEX_LOCK_PI2>."
3695 msgstr ""
3696 "В I<futex_op> был указан параметр B<FUTEX_CLOCK_REALTIME>, но сопутствующая "
3697 "операция не равна B<FUTEX_WAIT>, B<FUTEX_WAIT_BITSET> или "
3698 "B<FUTEX_WAIT_REQUEUE_PI>."
3699
3700 #. type: Plain text
3701 #: debian-trixie fedora-44 fedora-rawhide
3702 msgid ""
3703 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3704 "B<FUTEX_UNLOCK_PI>, B<FUTEX_CMP_REQUEUE_PI>, B<FUTEX_WAIT_REQUEUE_PI>) A "
3705 "run-time check determined that the operation is not available. The PI-futex "
3706 "operations are not implemented on all architectures and are not supported on "
3707 "some CPU variants."
3708 msgstr ""
3709 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3710 "B<FUTEX_UNLOCK_PI>, B<FUTEX_CMP_REQUEUE_PI>, B<FUTEX_WAIT_REQUEUE_PI>) "
3711 "Проверка во время выполнения обнаружила, что операция недоступна. Операции с "
3712 "PI-фьютексами реализованы не на всех архитектурах и не поддерживаются на "
3713 "некоторых моделях ЦП."
3714
3715 #. type: TP
3716 #: debian-trixie fedora-44 fedora-rawhide
3717 #, no-wrap
3718 msgid "B<EPERM>"
3719 msgstr "B<EPERM>"
3720
3721 #. type: Plain text
3722 #: debian-trixie fedora-44 fedora-rawhide
3723 msgid ""
3724 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3725 "B<FUTEX_CMP_REQUEUE_PI>) The caller is not allowed to attach itself to the "
3726 "futex at I<uaddr> (for B<FUTEX_CMP_REQUEUE_PI>: the futex at I<uaddr2>). "
3727 "(This may be caused by a state corruption in user space.)"
3728 msgstr ""
3729 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3730 "B<FUTEX_CMP_REQUEUE_PI>) Вызывающему запрещено самостоятельно присоединяться "
3731 "к фьютексу по адресу I<uaddr> (для B<FUTEX_CMP_REQUEUE_PI>: фьютексу по "
3732 "адресу I<uaddr2>) (это может быть вызвано повреждением состояния в "
3733 "пользовательском пространстве)."
3734
3735 #. type: Plain text
3736 #: debian-trixie fedora-44 fedora-rawhide
3737 msgid ""
3738 "(B<FUTEX_UNLOCK_PI>) The caller does not own the lock represented by the "
3739 "futex word."
3740 msgstr ""
3741 "(B<FUTEX_UNLOCK_PI>) Вызывающему не принадлежит блокировка, представленная в "
3742 "слове фьютекса."
3743
3744 #. type: TP
3745 #: debian-trixie fedora-44 fedora-rawhide
3746 #, no-wrap
3747 msgid "B<ESRCH>"
3748 msgstr "B<ESRCH>"
3749
3750 #. type: Plain text
3751 #: debian-trixie fedora-44 fedora-rawhide
3752 msgid ""
3753 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3754 "B<FUTEX_CMP_REQUEUE_PI>) The thread ID in the futex word at I<uaddr> does "
3755 "not exist."
3756 msgstr ""
3757 "(B<FUTEX_LOCK_PI>, B<FUTEX_LOCK_PI2>, B<FUTEX_TRYLOCK_PI>, "
3758 "B<FUTEX_CMP_REQUEUE_PI>) Идентификатор нити из слова фьютекса по адресу "
3759 "I<uaddr> не существует."
3760
3761 #. type: Plain text
3762 #: debian-trixie fedora-44 fedora-rawhide
3763 msgid ""
3764 "(B<FUTEX_CMP_REQUEUE_PI>) The thread ID in the futex word at I<uaddr2> does "
3765 "not exist."
3766 msgstr ""
3767 "(B<FUTEX_CMP_REQUEUE_PI>) Идентификатор нити из слова фьютекса по адресу "
3768 "I<uaddr2> не существует."
3769
3770 #. type: TP
3771 #: debian-trixie fedora-44 fedora-rawhide
3772 #, no-wrap
3773 msgid "B<ETIMEDOUT>"
3774 msgstr "B<ETIMEDOUT>"
3775
3776 #. """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
3777 #. type: Plain text
3778 #: debian-trixie fedora-44 fedora-rawhide
3779 msgid ""
3780 "The operation in I<futex_op> employed the timeout specified in I<timeout>, "
3781 "and the timeout expired before the operation completed."
3782 msgstr ""
3783 "Операция в I<futex_op> использует время ожидания, указанное в I<timeout>, и "
3784 "время истекло до завершения операции."
3785
3786 #. type: Plain text
3787 #: debian-trixie fedora-44 fedora-rawhide
3788 #, no-wrap
3789 msgid ""
3790 "$ B<./futex_demo>\n"
3791 "Parent (18534) 0\n"
3792 "Child (18535) 0\n"
3793 "Parent (18534) 1\n"
3794 "Child (18535) 1\n"
3795 "Parent (18534) 2\n"
3796 "Child (18535) 2\n"
3797 "Parent (18534) 3\n"
3798 "Child (18535) 3\n"
3799 "Parent (18534) 4\n"
3800 "Child (18535) 4\n"
3801 msgstr ""
3802 "$ B<./futex_demo>\n"
3803 "Родитель (18534) 0\n"
3804 "Потомок (18535) 0\n"
3805 "Родитель (18534) 1\n"
3806 "Потомок (18535) 1\n"
3807 "Родитель (18534) 2\n"
3808 "Потомок (18535) 2\n"
3809 "Родитель (18534) 3\n"
3810 "Потомок (18535) 3\n"
3811 "Родитель (18534) 4\n"
3812 "Потомок (18535) 4\n"
3813
3814 #. type: Plain text
3815 #: debian-trixie fedora-44 fedora-rawhide
3816 #, no-wrap
3817 msgid ""
3818 "/* futex_demo.c\n"
3819 "\\&\n"
3820 " Usage: futex_demo [nloops]\n"
3821 " (Default: 5)\n"
3822 "\\&\n"
3823 " Demonstrate the use of futexes in a program where parent and child\n"
3824 " use a pair of futexes located inside a shared anonymous mapping to\n"
3825 " synchronize access to a shared resource: the terminal. The two\n"
3826 " processes each write \\[aq]num-loops\\[aq] messages to the terminal and employ\n"
3827 " a synchronization protocol that ensures that they alternate in\n"
3828 " writing messages.\n"
3829 "*/\n"
3830 "#define _GNU_SOURCE\n"
3831 "#include E<lt>err.hE<gt>\n"
3832 "#include E<lt>errno.hE<gt>\n"
3833 "#include E<lt>linux/futex.hE<gt>\n"
3834 "#include E<lt>stdatomic.hE<gt>\n"
3835 "#include E<lt>stdint.hE<gt>\n"
3836 "#include E<lt>stdio.hE<gt>\n"
3837 "#include E<lt>stdlib.hE<gt>\n"
3838 "#include E<lt>sys/mman.hE<gt>\n"
3839 "#include E<lt>sys/syscall.hE<gt>\n"
3840 "#include E<lt>sys/time.hE<gt>\n"
3841 "#include E<lt>sys/wait.hE<gt>\n"
3842 "#include E<lt>unistd.hE<gt>\n"
3843 "\\&\n"
3844 "static uint32_t *futex1, *futex2, *iaddr;\n"
3845 "\\&\n"
3846 "static int\n"
3847 "futex(uint32_t *uaddr, int futex_op, uint32_t val,\n"
3848 " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n"
3849 "{\n"
3850 " return syscall(SYS_futex, uaddr, futex_op, val,\n"
3851 " timeout, uaddr2, val3);\n"
3852 "}\n"
3853 "\\&\n"
3854 "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n"
3855 " become 1, and then set the value to 0. */\n"
3856 "\\&\n"
3857 "static void\n"
3858 "fwait(uint32_t *futexp)\n"
3859 "{\n"
3860 " long s;\n"
3861 " const uint32_t one = 1;\n"
3862 "\\&\n"
3863 " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n"
3864 " atomically performs the equivalent of:\n"
3865 "\\&\n"
3866 " if (*ptr == *oldval)\n"
3867 " *ptr = newval;\n"
3868 "\\&\n"
3869 " It returns true if the test yielded true and *ptr was updated. */\n"
3870 "\\&\n"
3871 " while (1) {\n"
3872 "\\&\n"
3873 " /* Is the futex available? */\n"
3874 " if (atomic_compare_exchange_strong(futexp, &one, 0))\n"
3875 " break; /* Yes */\n"
3876 "\\&\n"
3877 " /* Futex is not available; wait. */\n"
3878 "\\&\n"
3879 " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n"
3880 " if (s == -1 && errno != EAGAIN)\n"
3881 " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n"
3882 " }\n"
3883 "}\n"
3884 "\\&\n"
3885 "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex currently\n"
3886 " has the value 0, set its value to 1 and then wake any futex waiters,\n"
3887 " so that if the peer is blocked in fwait(), it can proceed. */\n"
3888 "\\&\n"
3889 "static void\n"
3890 "fpost(uint32_t *futexp)\n"
3891 "{\n"
3892 " long s;\n"
3893 " const uint32_t zero = 0;\n"
3894 "\\&\n"
3895 " /* atomic_compare_exchange_strong() was described\n"
3896 " in comments above. */\n"
3897 "\\&\n"
3898 " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n"
3899 " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
3900 " if (s == -1)\n"
3901 " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n"
3902 " }\n"
3903 "}\n"
3904 "\\&\n"
3905 "int\n"
3906 "main(int argc, char *argv[])\n"
3907 "{\n"
3908 " pid_t childPid;\n"
3909 " unsigned int nloops;\n"
3910 "\\&\n"
3911 " setbuf(stdout, NULL);\n"
3912 "\\&\n"
3913 " nloops = (argc E<gt> 1) ? atoi(argv[1]) : 5;\n"
3914 "\\&\n"
3915 " /* Create a shared anonymous mapping that will hold the futexes.\n"
3916 " Since the futexes are being shared between processes, we\n"
3917 " subsequently use the \"shared\" futex operations (i.e., not the\n"
3918 " ones suffixed \"_PRIVATE\"). */\n"
3919 "\\&\n"
3920 " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n"
3921 " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n"
3922 " if (iaddr == MAP_FAILED)\n"
3923 " err(EXIT_FAILURE, \"mmap\");\n"
3924 "\\&\n"
3925 " futex1 = &iaddr[0];\n"
3926 " futex2 = &iaddr[1];\n"
3927 "\\&\n"
3928 " *futex1 = 0; /* State: unavailable */\n"
3929 " *futex2 = 1; /* State: available */\n"
3930 "\\&\n"
3931 " /* Create a child process that inherits the shared anonymous\n"
3932 " mapping. */\n"
3933 "\\&\n"
3934 " childPid = fork();\n"
3935 " if (childPid == -1)\n"
3936 " err(EXIT_FAILURE, \"fork\");\n"
3937 "\\&\n"
3938 " if (childPid == 0) { /* Child */\n"
3939 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
3940 " fwait(futex1);\n"
3941 " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
3942 " fpost(futex2);\n"
3943 " }\n"
3944 "\\&\n"
3945 " exit(EXIT_SUCCESS);\n"
3946 " }\n"
3947 "\\&\n"
3948 " /* Parent falls through to here. */\n"
3949 "\\&\n"
3950 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
3951 " fwait(futex2);\n"
3952 " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
3953 " fpost(futex1);\n"
3954 " }\n"
3955 "\\&\n"
3956 " wait(NULL);\n"
3957 "\\&\n"
3958 " exit(EXIT_SUCCESS);\n"
3959 "}\n"
3960 msgstr ""
3961
3962 #. type: Plain text
3963 #: debian-trixie fedora-44 fedora-rawhide
3964 msgid "I<Documentation/pi-futex.txt>"
3965 msgstr "I<Documentation/pi-futex.txt>"
3966
3967 #. type: Plain text
3968 #: debian-trixie fedora-44 fedora-rawhide
3969 msgid "I<Documentation/futex-requeue-pi.txt>"
3970 msgstr "I<Documentation/futex-requeue-pi.txt>"
3971
3972 #. type: Plain text
3973 #: debian-trixie fedora-44 fedora-rawhide
3974 msgid "I<Documentation/locking/rt-mutex.txt>"
3975 msgstr "I<Documentation/locking/rt-mutex.txt>"
3976
3977 #. type: Plain text
3978 #: debian-trixie fedora-44 fedora-rawhide
3979 msgid "I<Documentation/locking/rt-mutex-design.txt>"
3980 msgstr "I<Documentation/locking/rt-mutex-design.txt>"
3981
3982 #. type: Plain text
3983 #: debian-trixie fedora-44 fedora-rawhide
3984 msgid "I<Documentation/robust-futex-ABI.txt>"
3985 msgstr "I<Documentation/robust-futex-ABI.txt>"
3986
3987 #. type: Plain text
3988 #: debian-trixie fedora-44 fedora-rawhide
3989 msgid ""
3990 "Franke, H., Russell, R., and Kirwood, M., 2002. I<Fuss, Futexes and "
3991 "Furwocks: Fast Userlevel Locking in Linux> (from proceedings of the Ottawa "
3992 "Linux Symposium 2002),"
3993 msgstr ""
3994 "Franke, H., Russell, R., and Kirwood, M., 2002. I<Fuss, Futexes and "
3995 "Furwocks: Fast Userlevel Locking in Linux> (доклад на симпозиуме по Linux в "
3996 "2002 году),"
3997
3998 #. type: Plain text
3999 #: debian-trixie fedora-44 fedora-rawhide
4000 msgid ""
4001 "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> "
4002 "E<.UE>"
4003 msgstr ""
4004 "E<.UR http://kernel.org\\:/doc\\:/ols\\:/2002\\:/ols2002-pages-479-495.pdf> "
4005 "E<.UE>"
4006
4007 #. type: Plain text
4008 #: debian-trixie fedora-44 fedora-rawhide
4009 msgid ""
4010 "Hart, D., 2009. I<A futex overview and update>, E<.UR http://lwn.net/"
4011 "Articles/360699/> E<.UE>"
4012 msgstr ""
4013 "Hart, D., 2009. I<A futex overview and update>, E<.UR http://lwn.net/"
4014 "Articles/360699/> E<.UE>"
4015
4016 #. type: Plain text
4017 #: debian-trixie fedora-44 fedora-rawhide
4018 #, fuzzy
4019 #| msgid ""
4020 #| "Hart, D.\\& and Guniguntala, D., 2009. I<Requeue-PI: Making Glibc "
4021 #| "Condvars PI-Aware> (from proceedings of the 2009 Real-Time Linux "
4022 #| "Workshop), E<.UR http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> "
4023 #| "E<.UE>"
4024 msgid ""
4025 "Hart, D.\\& and Guniguntala, D., 2009. I<Requeue-PI: Making glibc Condvars "
4026 "PI-Aware> (from proceedings of the 2009 Real-Time Linux Workshop), E<.UR "
4027 "http://lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> E<.UE>"
4028 msgstr ""
4029 "Hart, D.\\& и Guniguntala, D., 2009. I<Requeue-PI: Making Glibc Condvars PI-"
4030 "Aware> (доклад на Real-Time Linux Workshop в 2009 году), E<.UR http://"
4031 "lwn.net/images/conf/rtlws11/papers/proc/p10.pdf> E<.UE>"
4032
4033 #. type: Plain text
4034 #: debian-trixie fedora-44 fedora-rawhide
4035 msgid ""
4036 "Drepper, U., 2011. I<Futexes Are Tricky>, E<.UR http://www.akkadia.org/"
4037 "drepper/futex.pdf> E<.UE>"
4038 msgstr ""
4039 "Drepper, U., 2011. I<Futexes Are Tricky>, E<.UR http://www.akkadia.org/"
4040 "drepper/futex.pdf> E<.UE>"
4041
4042 #. type: Plain text
4043 #: debian-trixie fedora-44 fedora-rawhide
4044 msgid "Futex example library, futex-*.tar.bz2 at"
4045 msgstr "Пример библиотеки futex, futex-*.tar.bz2, доступен на"
4046
4047 #. type: Plain text
4048 #: debian-trixie fedora-44 fedora-rawhide
4049 msgid ""
4050 "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/"
4051 "rusty/> E<.UE>"
4052 msgstr ""
4053 "E<.UR https://mirrors.kernel.org\\:/pub\\:/linux\\:/kernel\\:/people\\:/"
4054 "rusty/> E<.UE>"
4055
4056 #. type: TH
4057 #: fedora-44 fedora-rawhide
4058 #, no-wrap
4059 msgid "2024-07-23"
4060 msgstr "23 июля 2024 г."
4061
4062 #. type: TH
4063 #: fedora-44 fedora-rawhide
4064 #, no-wrap
4065 msgid "Linux man-pages 6.13"
4066 msgstr "Страницы руководства Linux 6.13"
4067
4068 #. type: TH
4069 #: mageia-cauldron
4070 #, no-wrap
4071 msgid "2026-02-08"
4072 msgstr "8 февраля 2026 г."
4073
4074 #. type: TH
4075 #: mageia-cauldron
4076 #, no-wrap
4077 msgid "Linux man-pages 6.17"
4078 msgstr "Страницы руководства Linux 6.17"
4079
4080 #. type: Plain text
4081 #: mageia-cauldron
4082 #, no-wrap
4083 msgid ""
4084 "/* futex_demo.c\n"
4085 "\\&\n"
4086 " Usage: futex_demo [nloops]\n"
4087 " (Default: 5)\n"
4088 "\\&\n"
4089 " Demonstrate the use of futexes in a program where parent and child\n"
4090 " use a pair of futexes located inside a shared anonymous mapping to\n"
4091 " synchronize access to a shared resource: the terminal. The two\n"
4092 " processes each write \\[aq]num-loops\\[aq] messages to the terminal and employ\n"
4093 " a synchronization protocol that ensures that they alternate in\n"
4094 " writing messages.\n"
4095 "*/\n"
4096 "#define _GNU_SOURCE\n"
4097 "#include E<lt>err.hE<gt>\n"
4098 "#include E<lt>errno.hE<gt>\n"
4099 "#include E<lt>linux/futex.hE<gt>\n"
4100 "#include E<lt>stdatomic.hE<gt>\n"
4101 "#include E<lt>stdint.hE<gt>\n"
4102 "#include E<lt>stdio.hE<gt>\n"
4103 "#include E<lt>stdlib.hE<gt>\n"
4104 "#include E<lt>sys/mman.hE<gt>\n"
4105 "#include E<lt>sys/syscall.hE<gt>\n"
4106 "#include E<lt>sys/time.hE<gt>\n"
4107 "#include E<lt>sys/wait.hE<gt>\n"
4108 "#include E<lt>unistd.hE<gt>\n"
4109 "\\&\n"
4110 "static uint32_t *futex1, *futex2, *iaddr;\n"
4111 "\\&\n"
4112 "static int\n"
4113 "futex(uint32_t *uaddr, int op, uint32_t val,\n"
4114 " const struct timespec *timeout, uint32_t *uaddr2, uint32_t val3)\n"
4115 "{\n"
4116 " return syscall(SYS_futex, uaddr, op, val,\n"
4117 " timeout, uaddr2, val3);\n"
4118 "}\n"
4119 "\\&\n"
4120 "/* Acquire the futex pointed to by \\[aq]futexp\\[aq]: wait for its value to\n"
4121 " become 1, and then set the value to 0. */\n"
4122 "\\&\n"
4123 "static void\n"
4124 "fwait(uint32_t *futexp)\n"
4125 "{\n"
4126 " long s;\n"
4127 " const uint32_t one = 1;\n"
4128 "\\&\n"
4129 " /* atomic_compare_exchange_strong(ptr, oldval, newval)\n"
4130 " atomically performs the equivalent of:\n"
4131 "\\&\n"
4132 " if (*ptr == *oldval)\n"
4133 " *ptr = newval;\n"
4134 "\\&\n"
4135 " It returns true if the test yielded true and *ptr was updated. */\n"
4136 "\\&\n"
4137 " while (1) {\n"
4138 "\\&\n"
4139 " /* Is the futex available? */\n"
4140 " if (atomic_compare_exchange_strong(futexp, &one, 0))\n"
4141 " break; /* Yes */\n"
4142 "\\&\n"
4143 " /* Futex is not available; wait. */\n"
4144 "\\&\n"
4145 " s = futex(futexp, FUTEX_WAIT, 0, NULL, NULL, 0);\n"
4146 " if (s == -1 && errno != EAGAIN)\n"
4147 " err(EXIT_FAILURE, \"futex-FUTEX_WAIT\");\n"
4148 " }\n"
4149 "}\n"
4150 "\\&\n"
4151 "/* Release the futex pointed to by \\[aq]futexp\\[aq]: if the futex currently\n"
4152 " has the value 0, set its value to 1 and then wake any futex waiters,\n"
4153 " so that if the peer is blocked in fwait(), it can proceed. */\n"
4154 "\\&\n"
4155 "static void\n"
4156 "fpost(uint32_t *futexp)\n"
4157 "{\n"
4158 " long s;\n"
4159 " const uint32_t zero = 0;\n"
4160 "\\&\n"
4161 " /* atomic_compare_exchange_strong() was described\n"
4162 " in comments above. */\n"
4163 "\\&\n"
4164 " if (atomic_compare_exchange_strong(futexp, &zero, 1)) {\n"
4165 " s = futex(futexp, FUTEX_WAKE, 1, NULL, NULL, 0);\n"
4166 " if (s == -1)\n"
4167 " err(EXIT_FAILURE, \"futex-FUTEX_WAKE\");\n"
4168 " }\n"
4169 "}\n"
4170 "\\&\n"
4171 "int\n"
4172 "main(int argc, char *argv[])\n"
4173 "{\n"
4174 " pid_t childPid;\n"
4175 " unsigned int nloops;\n"
4176 "\\&\n"
4177 " setbuf(stdout, NULL);\n"
4178 "\\&\n"
4179 " nloops = (argc E<gt> 1) ? atoi(argv[1]) : 5;\n"
4180 "\\&\n"
4181 " /* Create a shared anonymous mapping that will hold the futexes.\n"
4182 " Since the futexes are being shared between processes, we\n"
4183 " subsequently use the \"shared\" futex operations (i.e., not the\n"
4184 " ones suffixed \"_PRIVATE\"). */\n"
4185 "\\&\n"
4186 " iaddr = mmap(NULL, sizeof(*iaddr) * 2, PROT_READ | PROT_WRITE,\n"
4187 " MAP_ANONYMOUS | MAP_SHARED, -1, 0);\n"
4188 " if (iaddr == MAP_FAILED)\n"
4189 " err(EXIT_FAILURE, \"mmap\");\n"
4190 "\\&\n"
4191 " futex1 = &iaddr[0];\n"
4192 " futex2 = &iaddr[1];\n"
4193 "\\&\n"
4194 " *futex1 = 0; /* State: unavailable */\n"
4195 " *futex2 = 1; /* State: available */\n"
4196 "\\&\n"
4197 " /* Create a child process that inherits the shared anonymous\n"
4198 " mapping. */\n"
4199 "\\&\n"
4200 " childPid = fork();\n"
4201 " if (childPid == -1)\n"
4202 " err(EXIT_FAILURE, \"fork\");\n"
4203 "\\&\n"
4204 " if (childPid == 0) { /* Child */\n"
4205 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
4206 " fwait(futex1);\n"
4207 " printf(\"Child (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
4208 " fpost(futex2);\n"
4209 " }\n"
4210 "\\&\n"
4211 " exit(EXIT_SUCCESS);\n"
4212 " }\n"
4213 "\\&\n"
4214 " /* Parent falls through to here. */\n"
4215 "\\&\n"
4216 " for (unsigned int j = 0; j E<lt> nloops; j++) {\n"
4217 " fwait(futex2);\n"
4218 " printf(\"Parent (%jd) %u\\[rs]n\", (intmax_t) getpid(), j);\n"
4219 " fpost(futex1);\n"
4220 " }\n"
4221 "\\&\n"
4222 " wait(NULL);\n"
4223 "\\&\n"
4224 " exit(EXIT_SUCCESS);\n"
4225 "}\n"
4226 msgstr ""
4227
4228 #. type: TH
4229 #: opensuse-leap-16-1 opensuse-tumbleweed
4230 #, no-wrap
4231 msgid "Linux man-pages (unreleased)"
4232 msgstr "Страницы руководства Linux (не выпущены)"