Debian Codegraph @

po/ar/man2/futex.2.po

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