Debian Codegraph @

po/ru/man7/epoll.7.po

raw
1 # Russian translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # Azamat Hackimov <[email protected]>, 2012.
5 # Yuri Kozlov <[email protected]>, 2011-2019.
6 # Иван Павлов <[email protected]>, 2017.
7 msgid ""
8 msgstr ""
9 "Project-Id-Version: manpages-l10n\n"
10 "POT-Creation-Date: 2026-06-05 06:23+0200\n"
11 "PO-Revision-Date: 2024-12-21 19:50+0300\n"
12 "Last-Translator: Yuri Kozlov <[email protected]>\n"
13 "Language-Team: Russian <[email protected]>\n"
14 "Language: ru\n"
15 "MIME-Version: 1.0\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
18 "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && "
19 "n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || "
20 "(n%100>=11 && n%100<=14)? 2 : 3);\n"
21 "X-Generator: Lokalize 2.0\n"
22
23 #. type: TH
24 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
25 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
26 #, no-wrap
27 msgid "epoll"
28 msgstr ""
29
30 #. type: TH
31 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
32 #: opensuse-tumbleweed
33 #, no-wrap
34 msgid "2026-02-08"
35 msgstr "8 февраля 2026 г."
36
37 #. type: TH
38 #: archlinux debian-unstable
39 #, fuzzy, no-wrap
40 #| msgid "Linux man-pages 6.17"
41 msgid "Linux man-pages 6.18"
42 msgstr "Справочные страницы Linux 6.17"
43
44 #. type: SH
45 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
46 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
47 #, no-wrap
48 msgid "NAME"
49 msgstr "НАИМЕНОВАНИЕ"
50
51 #. type: Plain text
52 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
53 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
54 msgid "epoll - I/O event notification facility"
55 msgstr "epoll - средство уведомления о событии ввода-вывода"
56
57 #. type: SH
58 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
59 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
60 #, no-wrap
61 msgid "SYNOPSIS"
62 msgstr "СИНТАКСИС"
63
64 #. type: Plain text
65 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
66 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
67 #, no-wrap
68 msgid "B<#include E<lt>sys/epoll.hE<gt>>\n"
69 msgstr "B<#include E<lt>sys/epoll.hE<gt>>\n"
70
71 #. type: SH
72 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
73 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
74 #, no-wrap
75 msgid "DESCRIPTION"
76 msgstr "ОПИСАНИЕ"
77
78 #. type: Plain text
79 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
80 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
81 msgid ""
82 "The B<epoll> API performs a similar task to B<poll>(2): monitoring multiple "
83 "file descriptors to see if I/O is possible on any of them. The B<epoll> API "
84 "can be used either as an edge-triggered or a level-triggered interface and "
85 "scales well to large numbers of watched file descriptors."
86 msgstr ""
87 "Программный интерфейс B<epoll> выполняется схожую с B<poll>(2) задачу: "
88 "следит за несколькими файловыми дескрипторами и ждёт, когда станет возможен "
89 "ввод-вывод для одного из них. Программный интерфейс B<epoll> можно "
90 "использовать либо в режиме edge-triggered, либо в level-triggered и "
91 "применять для слежения за достаточно большим количеством файловых "
92 "дескрипторов."
93
94 #. type: Plain text
95 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
96 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
97 msgid ""
98 "The central concept of the B<epoll> API is the B<epoll> I<instance>, an in-"
99 "kernel data structure which, from a user-space perspective, can be "
100 "considered as a container for two lists:"
101 msgstr ""
102 "Центральным элементом программного интерфейса B<epoll> является I<экземпляр> "
103 "B<epoll> — структура данных ядра, которая с точки зрения пользовательского "
104 "пространства может рассматриваться как контейнер с двумя списками:"
105
106 #. type: IP
107 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
108 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
109 #, no-wrap
110 msgid "\\[bu]"
111 msgstr "\\[bu]"
112
113 #. type: Plain text
114 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
115 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
116 msgid ""
117 "The I<interest> list (sometimes also called the B<epoll> set): the set of "
118 "file descriptors that the process has registered an interest in monitoring."
119 msgstr ""
120 "Список I<interest> (иногда также называемый набором B<epoll>): набор "
121 "файловых дескрипторов, которые зарегистрировал процесс для слежения."
122
123 #. type: Plain text
124 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
125 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
126 #, fuzzy
127 #| msgid ""
128 #| "The I<ready> list: the set of file descriptors that are \"ready\" for I/"
129 #| "O. The ready list is a subset of (or, more precisely, a set of "
130 #| "references to) the file descriptors in the interest list that is "
131 #| "dynamically populated by the kernel as a result of I/O activity on those "
132 #| "file descriptors."
133 msgid ""
134 "The I<ready> list: the set of file descriptors that are \"ready\" for I/O. "
135 "The ready list is a subset of (or, more precisely, a set of references to) "
136 "the file descriptors in the interest list. The ready list is dynamically "
137 "populated by the kernel as a result of I/O activity on those file "
138 "descriptors."
139 msgstr ""
140 "Список I<ready>: набор файловых дескрипторов, которые «готовы» для "
141 "проведения операций ввода-вывода. Список ready — это часть набора (точнее, "
142 "набор ссылок) файловых дескрипторов из списка interest, он динамически "
143 "заполняется ядром в результате действий ввода-вывода с этими файловыми "
144 "дескрипторами."
145
146 #. type: Plain text
147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
149 msgid ""
150 "The following system calls are provided to create and manage an B<epoll> "
151 "instance:"
152 msgstr ""
153 "Для создания и управления экземпляром B<epoll> служат следующие системные "
154 "вызовы:"
155
156 #. type: Plain text
157 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
158 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
159 msgid ""
160 "B<epoll_create>(2) creates a new B<epoll> instance and returns a file "
161 "descriptor referring to that instance. (The more recent "
162 "B<epoll_create1>(2) extends the functionality of B<epoll_create>(2).)"
163 msgstr ""
164 "Вызов B<epoll_create>(2) создаёт экземпляр новый B<epoll> и возвращает "
165 "файловый дескриптор, указывающий на этот экземпляр (более новый "
166 "B<epoll_create1>(2) расширяет возможности B<epoll_create>(2))."
167
168 #. type: Plain text
169 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
170 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
171 msgid ""
172 "Interest in particular file descriptors is then registered via "
173 "B<epoll_ctl>(2), which adds items to the interest list of the B<epoll> "
174 "instance."
175 msgstr ""
176 "Затем с помощью B<epoll_ctl>(2) регистрируются интересующие файловые "
177 "дескрипторы, который добавляет их в список interest экземпляра I<epoll>."
178
179 #. type: Plain text
180 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
181 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
182 msgid ""
183 "B<epoll_wait>(2) waits for I/O events, blocking the calling thread if no "
184 "events are currently available. (This system call can be thought of as "
185 "fetching items from the ready list of the B<epoll> instance.)"
186 msgstr ""
187 "Вызов B<epoll_wait>(2) ждёт наступления событий ввода-вывода, блокируя "
188 "вызывающую нить, если события пока недоступны (данный системный вызов можно "
189 "рассматривать как выборщике элементов из списка готовности экземпляра "
190 "B<epoll>)."
191
192 #. type: SS
193 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
194 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
195 #, no-wrap
196 msgid "Level-triggered and edge-triggered"
197 msgstr "Режимы level-triggered и edge-triggered"
198
199 #. type: Plain text
200 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
201 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
202 msgid ""
203 "The B<epoll> event distribution interface is able to behave both as edge-"
204 "triggered (ET) and as level-triggered (LT). The difference between the two "
205 "mechanisms can be described as follows. Suppose that this scenario happens:"
206 msgstr ""
207 "Существует два режима выдачи событий B<epoll>: edge-triggered (ET) и level-"
208 "triggered (LT). Разницу между ними можно описать так. Предположим, что "
209 "реализован следующий сценарий событий:"
210
211 #. type: IP
212 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
213 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
214 #, no-wrap
215 msgid "(1)"
216 msgstr "(1)"
217
218 #. type: Plain text
219 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
220 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
221 msgid ""
222 "The file descriptor that represents the read side of a pipe (I<rfd>) is "
223 "registered on the B<epoll> instance."
224 msgstr ""
225 "Файловый дескриптор, представляющий читающую сторону канала (I<rfd>), "
226 "регистрируется в экземпляре B<epoll>."
227
228 #. type: IP
229 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
230 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
231 #, no-wrap
232 msgid "(2)"
233 msgstr "(2)"
234
235 #. type: Plain text
236 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
237 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
238 msgid "A pipe writer writes 2\\ kB of data on the write side of the pipe."
239 msgstr ""
240 "Пишущая сторона канала записывает 2\\ КБ данных на записываемой стороне "
241 "канала."
242
243 #. type: IP
244 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
245 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
246 #, no-wrap
247 msgid "(3)"
248 msgstr "(3)"
249
250 #. type: Plain text
251 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
252 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
253 msgid ""
254 "A call to B<epoll_wait>(2) is done that will return I<rfd> as a ready file "
255 "descriptor."
256 msgstr ""
257 "Вызов B<epoll_wait>(2) завершается и возвращает I<rfd> как готовый файловый "
258 "дескриптор."
259
260 #. type: IP
261 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
262 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
263 #, no-wrap
264 msgid "(4)"
265 msgstr "(4)"
266
267 #. type: Plain text
268 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
269 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
270 msgid "The pipe reader reads 1\\ kB of data from I<rfd>."
271 msgstr "Читающая сторона канала считывает 1\\ КБ данных из I<rfd>."
272
273 #. type: IP
274 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
275 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
276 #, no-wrap
277 msgid "(5)"
278 msgstr "(5)"
279
280 #. type: Plain text
281 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
282 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
283 msgid "A call to B<epoll_wait>(2) is done."
284 msgstr "Вызов B<epoll_wait>(2) завершается."
285
286 #. type: Plain text
287 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
288 #: opensuse-leap-16-1 opensuse-tumbleweed
289 #, fuzzy
290 #| msgid ""
291 #| "If the I<rfd> file descriptor has been added to the B<epoll> interface "
292 #| "using the B<EPOLLET> (edge-triggered) flag, the call to "
293 #| "B<epoll_wait>(2) done in step B<5> will probably hang despite the "
294 #| "available data still present in the file input buffer; meanwhile the "
295 #| "remote peer might be expecting a response based on the data it already "
296 #| "sent. The reason for this is that edge-triggered mode delivers events "
297 #| "only when changes occur on the monitored file descriptor. So, in step "
298 #| "B<5> the caller might end up waiting for some data that is already "
299 #| "present inside the input buffer. In the above example, an event on "
300 #| "I<rfd> will be generated because of the write done in B<2> and the event "
301 #| "is consumed in B<3>. Since the read operation done in B<4> does not "
302 #| "consume the whole buffer data, the call to B<epoll_wait>(2) done in step "
303 #| "B<5> might block indefinitely."
304 msgid ""
305 "If the I<rfd> file descriptor has been added to the B<epoll> interface using "
306 "the B<EPOLLET> (edge-triggered) flag, the call to B<epoll_wait>(2) done in "
307 "step B<5> will probably hang despite the available data still present in the "
308 "file input buffer; meanwhile the remote peer might be expecting a response "
309 "based on the data it already sent. The reason for this is that edge-"
310 "triggered mode delivers events only when changes occur on the monitored file "
311 "descriptor, that is, an event will be generated upon each receipt of a chunk "
312 "of data. So, in step B<5> the caller might end up waiting for some data "
313 "that is already present inside the input buffer. In the above example, an "
314 "event on I<rfd> will be generated because of the write done in B<2> and the "
315 "event is consumed in B<3>. Since the read operation done in B<4> does not "
316 "consume the whole buffer data, the call to B<epoll_wait>(2) done in step "
317 "B<5> might block indefinitely."
318 msgstr ""
319 "Если файловый дескриптор I<rfd> добавлен к экземпляру B<epoll> с указанным "
320 "флагом B<EPOLLET> (edge-triggered), то вызов B<epoll_wait>(2) на шаге 5, "
321 "вероятно, повиснет, несмотря на имеющие данные в буфере ввода; в это же "
322 "время удалённая сторона может ожидать подтверждения приёма уже отправленных "
323 "данных. Причиной этого является то, что в режиме edge-triggered события "
324 "доставляются только когда происходит изменение состояния отслеживаемого "
325 "файлового дескриптора. Поэтому в шаге B<5> вызывающий может бесконечно ждать "
326 "появления данных, хотя они уже есть в буфере ввода. В приведённом выше "
327 "примере событие для I<rfd> будет сгенерировано из-за операции записи, "
328 "сделанной в шаге B<2>, и это событие будет обработано в шаге B<3>. Так как "
329 "операция в шаге B<4>, не прочитала все данные из буфера, вызов "
330 "B<epoll_wait>(2) в шаге B<5> может заблокироваться навсегда."
331
332 #. type: Plain text
333 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
334 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
335 msgid ""
336 "An application that employs the B<EPOLLET> flag should use nonblocking file "
337 "descriptors to avoid having a blocking read or write starve a task that is "
338 "handling multiple file descriptors. The suggested way to use B<epoll> as an "
339 "edge-triggered (B<EPOLLET>) interface is as follows:"
340 msgstr ""
341 "Приложение, которое применяет флаг B<EPOLLET>, должно использовать "
342 "неблокирующие файловые дескрипторы, чтобы избежать приостановки задания, "
343 "обрабатывающего множество файловых дескрипторов, из-за блокировок чтения или "
344 "записи. Предлагаемый способ использования B<epoll> с интерфейсом Edge "
345 "Triggered (B<EPOLLET>):"
346
347 #. type: Plain text
348 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
349 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
350 msgid "with nonblocking file descriptors; and"
351 msgstr "неблокирующие файловые дескрипторы; и"
352
353 #. type: Plain text
354 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
355 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
356 msgid ""
357 "by waiting for an event only after B<read>(2) or B<write>(2) return "
358 "B<EAGAIN>."
359 msgstr ""
360 "ожидание события только после того, как B<read>(2) или B<write>(2) возвратят "
361 "B<EAGAIN>."
362
363 #. type: Plain text
364 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
365 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
366 msgid ""
367 "By contrast, when used as a level-triggered interface (the default, when "
368 "B<EPOLLET> is not specified), B<epoll> is simply a faster B<poll>(2), and "
369 "can be used wherever the latter is used since it shares the same semantics."
370 msgstr ""
371 "Напротив, при использовании интерфейса level-triggered (по умолчанию, если "
372 "не указан B<EPOLLET>) B<epoll> проще и быстрее B<poll>(2), и может быть "
373 "использован везде, где используется последний, так как имеет ту же семантику."
374
375 #. type: Plain text
376 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
377 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
378 msgid ""
379 "Since even with edge-triggered B<epoll>, multiple events can be generated "
380 "upon receipt of multiple chunks of data, the caller has the option to "
381 "specify the B<EPOLLONESHOT> flag, to tell B<epoll> to disable the associated "
382 "file descriptor after the receipt of an event with B<epoll_wait>(2). When "
383 "the B<EPOLLONESHOT> flag is specified, it is the caller's responsibility to "
384 "rearm the file descriptor using B<epoll_ctl>(2) with B<EPOLL_CTL_MOD>."
385 msgstr ""
386 "Так как даже с edge-triggered B<epoll> при получении нескольких порций "
387 "данных могут генерироваться множественные события, вызывающий может задать "
388 "флаг B<EPOLLONESHOT>, который указывает B<epoll> отключить связанный "
389 "файловый дескриптор после приёма события с помощью B<epoll_wait>(2). Если "
390 "указан флаг B<EPOLLONESHOT>, то вызывающий должен переустановить файловый "
391 "дескриптор с помощью B<epoll_ctl>(2) с флагом B<EPOLL_CTL_MOD>."
392
393 #. type: Plain text
394 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
395 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
396 #, fuzzy
397 #| msgid ""
398 #| "If multiple threads (or processes, if child processes have inherited the "
399 #| "B<epoll> file descriptor across B<fork>(2)) are blocked in "
400 #| "B<epoll_wait>(2) waiting on the same the same epoll file descriptor and "
401 #| "a file descriptor in the interest list that is marked for edge-triggered "
402 #| "(B<EPOLLET>) notification becomes ready, just one of the threads (or "
403 #| "processes) is awoken from B<epoll_wait>(2). This provides a useful "
404 #| "optimization for avoiding \"thundering herd\" wake-ups in some scenarios."
405 msgid ""
406 "If multiple threads (or processes, if child processes have inherited the "
407 "B<epoll> file descriptor across B<fork>(2)) are blocked in "
408 "B<epoll_wait>(2) waiting on the same epoll file descriptor and a file "
409 "descriptor in the interest list that is marked for edge-triggered "
410 "(B<EPOLLET>) notification becomes ready, just one of the threads (or "
411 "processes) is awoken from B<epoll_wait>(2). This provides a useful "
412 "optimization for avoiding \"thundering herd\" wake-ups in some scenarios."
413 msgstr ""
414 "Если несколько нитей (или процессов, если дочерние процессы унаследовали "
415 "файловый дескриптор B<epoll> при B<fork>(2)) блокируются в ожидании "
416 "B<epoll_wait>(2) одного и того же файлового дескриптора и файловый "
417 "дескриптор в списке interest, помеченный для уведомления edge-triggered "
418 "(B<EPOLLET>), становится готовым, то только одна из нитей (или процессов) "
419 "пробуждается из B<epoll_wait>(2). Такая полезная оптимизация в некоторых "
420 "случаях помогает избежать «лавины» пробуждений."
421
422 #. type: SS
423 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
424 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
425 #, no-wrap
426 msgid "Interaction with autosleep"
427 msgstr "Взаимодействие с autosleep"
428
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 "If the system is in B<autosleep> mode via I</sys/power/autosleep> and an "
434 "event happens which wakes the device from sleep, the device driver will keep "
435 "the device awake only until that event is queued. To keep the device awake "
436 "until the event has been processed, it is necessary to use the "
437 "B<epoll_ctl>(2) B<EPOLLWAKEUP> flag."
438 msgstr ""
439 "Если система в режиме B<autosleep> посредством I</sys/power/autosleep> и "
440 "происходит событие, которое пробуждает устройство, то драйвер устройства "
441 "держит устройство проснувшимся только, пока событие ставится в очередь. "
442 "Чтобы устройство не заснуло пока не обработает событие, необходимо "
443 "использовать флаг B<epoll_ctl>(2) B<EPOLLWAKEUP>."
444
445 #. type: Plain text
446 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
447 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
448 msgid ""
449 "When the B<EPOLLWAKEUP> flag is set in the B<events> field for a I<struct "
450 "epoll_event>, the system will be kept awake from the moment the event is "
451 "queued, through the B<epoll_wait>(2) call which returns the event until the "
452 "subsequent B<epoll_wait>(2) call. If the event should keep the system "
453 "awake beyond that time, then a separate I<wake_lock> should be taken before "
454 "the second B<epoll_wait>(2) call."
455 msgstr ""
456 "Флаг B<EPOLLWAKEUP> задаётся в поле B<events> для I<struct epoll_event>; "
457 "система будет оставаться разбуженной с момента когда событие поступает в "
458 "очередь, пока не закончится работа вызова B<epoll_wait>(2), возвращающий "
459 "событие, и до последующего вызова B<epoll_wait>(2). Если событие должно "
460 "держать систему разбуженной дольше, то нужно применить отдельный "
461 "I<wake_lock> перед вторым вызовом B<epoll_wait>(2)."
462
463 #. type: SS
464 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
465 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
466 #, no-wrap
467 msgid "/proc interfaces"
468 msgstr "Интерфейс /proc"
469
470 #. Following was added in Linux 2.6.28, but them removed in Linux 2.6.29
471 #. .TP
472 #. .IR /proc/sys/fs/epoll/max_user_instances " (since Linux 2.6.28)"
473 #. This specifies an upper limit on the number of epoll instances
474 #. that can be created per real user ID.
475 #. type: Plain text
476 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
477 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
478 msgid ""
479 "The following interfaces can be used to limit the amount of kernel memory "
480 "consumed by epoll:"
481 msgstr ""
482 "Для ограничения потребления epoll памяти ядра, можно использовать следующие "
483 "интерфейсы:"
484
485 #. type: TP
486 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
487 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
488 #, no-wrap
489 msgid "I</proc/sys/fs/epoll/max_user_watches> (since Linux 2.6.28)"
490 msgstr "I</proc/sys/fs/epoll/max_user_watches> (начиная с Linux 2.6.28)"
491
492 #. Linux 2.6.29 (in Linux 2.6.28, the default was 1/32 of lowmem)
493 #. type: Plain text
494 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
495 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
496 msgid ""
497 "This specifies a limit on the total number of file descriptors that a user "
498 "can register across all epoll instances on the system. The limit is per "
499 "real user ID. Each registered file descriptor costs roughly 90 bytes on a "
500 "32-bit kernel, and roughly 160 bytes on a 64-bit kernel. Currently, the "
501 "default value for I<max_user_watches> is 1/25 (4%) of the available low "
502 "memory, divided by the registration cost in bytes."
503 msgstr ""
504 "Задаёт ограничение на общее количество файловых дескрипторов, которые "
505 "пользователь может зарегистрировать во всех экземплярах epoll в системе. "
506 "Ограничение привязывается к реальному идентификатору пользователя. Каждый "
507 "зарезервированный файловый дескриптор занимает, приблизительно, 90 байт в 32-"
508 "битном ядре, и, приблизительно, 160 байт в 64-битном ядре. В настоящее "
509 "время, значение по умолчанию для I<max_user_watches> равно 1/25 (4%) "
510 "доступной памяти ядра (low memory), поделённое на значение размера "
511 "дескриптора в байтах."
512
513 #. type: SS
514 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
515 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
516 #, no-wrap
517 msgid "Example for suggested usage"
518 msgstr "Примеры использования"
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 "While the usage of B<epoll> when employed as a level-triggered interface "
525 "does have the same semantics as B<poll>(2), the edge-triggered usage "
526 "requires more clarification to avoid stalls in the application event loop. "
527 "In this example, listener is a nonblocking socket on which B<listen>(2) has "
528 "been called. The function I<do_use_fd()> uses the new ready file descriptor "
529 "until B<EAGAIN> is returned by either B<read>(2) or B<write>(2). An event-"
530 "driven state machine application should, after having received B<EAGAIN>, "
531 "record its current state so that at the next call to I<do_use_fd()> it will "
532 "continue to B<read>(2) or B<write>(2) from where it stopped before."
533 msgstr ""
534 "При применении B<epoll> с интерфейсом level-triggered он имеет ту же "
535 "семантику что и B<poll>(2), а при edge-triggered требует больших проверок "
536 "для избежания зависаний приложения в событийном цикле. В этом примере, "
537 "слушающим является неблокирующий сокет, для которого был вызван "
538 "B<listen>(2). Функция I<do_use_fd>() использует новый готовый файловый "
539 "дескриптор до тех пор, пока не возвратится B<EAGAIN> от B<read>(2) или "
540 "B<write>(2). Приложение на основе машины состояний должно после получения "
541 "B<EAGAIN> записать своё текущее состояние так, чтобы последующий вызов "
542 "I<do_use_fd>() продолжил выполнять B<read>(2) или B<write>(2) с места "
543 "остановки."
544
545 #. type: Plain text
546 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
547 #: opensuse-tumbleweed
548 #, fuzzy, no-wrap
549 #| msgid ""
550 #| " for (n = 0; n E<lt> nfds; ++n) {\n"
551 #| " if (events[n].data.fd == listen_sock) {\n"
552 #| " conn_sock = accept(listen_sock,\n"
553 #| " (struct sockaddr *) &addr, &addrlen);\n"
554 #| " if (conn_sock == -1) {\n"
555 #| " perror(\"accept\");\n"
556 #| " exit(EXIT_FAILURE);\n"
557 #| " }\n"
558 #| " setnonblocking(conn_sock);\n"
559 #| " ev.events = EPOLLIN | EPOLLET;\n"
560 #| " ev.data.fd = conn_sock;\n"
561 #| " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
562 #| " &ev) == -1) {\n"
563 #| " perror(\"epoll_ctl: conn_sock\");\n"
564 #| " exit(EXIT_FAILURE);\n"
565 #| " }\n"
566 #| " } else {\n"
567 #| " do_use_fd(events[n].data.fd);\n"
568 #| " }\n"
569 #| " }\n"
570 #| "}\n"
571 msgid ""
572 "#define MAX_EVENTS 10\n"
573 "struct epoll_event ev, events[MAX_EVENTS];\n"
574 "int listen_sock, conn_sock, nfds, epollfd;\n"
575 "\\&\n"
576 "/* Code to set up listening socket, \\[aq]listen_sock\\[aq],\n"
577 " (socket(), bind(), listen()) omitted. */\n"
578 "\\&\n"
579 "epollfd = epoll_create1(0);\n"
580 "if (epollfd == -1) {\n"
581 " perror(\"epoll_create1\");\n"
582 " exit(EXIT_FAILURE);\n"
583 "}\n"
584 "\\&\n"
585 "ev.events = EPOLLIN;\n"
586 "ev.data.fd = listen_sock;\n"
587 "if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listen_sock, &ev) == -1) {\n"
588 " perror(\"epoll_ctl: listen_sock\");\n"
589 " exit(EXIT_FAILURE);\n"
590 "}\n"
591 "\\&\n"
592 "for (;;) {\n"
593 " nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);\n"
594 " if (nfds == -1) {\n"
595 " perror(\"epoll_wait\");\n"
596 " exit(EXIT_FAILURE);\n"
597 " }\n"
598 "\\&\n"
599 " for (n = 0; n E<lt> nfds; ++n) {\n"
600 " if (events[n].data.fd == listen_sock) {\n"
601 " conn_sock = accept(listen_sock,\n"
602 " (struct sockaddr *) &addr, &addrlen);\n"
603 " if (conn_sock == -1) {\n"
604 " perror(\"accept\");\n"
605 " exit(EXIT_FAILURE);\n"
606 " }\n"
607 " setnonblocking(conn_sock);\n"
608 " ev.events = EPOLLIN | EPOLLET;\n"
609 " ev.data.fd = conn_sock;\n"
610 " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
611 " &ev) == -1) {\n"
612 " perror(\"epoll_ctl: conn_sock\");\n"
613 " exit(EXIT_FAILURE);\n"
614 " }\n"
615 " } else {\n"
616 " do_use_fd(events[n].data.fd);\n"
617 " }\n"
618 " }\n"
619 "}\n"
620 msgstr ""
621 " for (n = 0; n E<lt> nfds; ++n) {\n"
622 " if (events[n].data.fd == listen_sock) {\n"
623 " conn_sock = accept(listen_sock,\n"
624 " (struct sockaddr *) &addr, &addrlen);\n"
625 " if (conn_sock == -1) {\n"
626 " perror(\"accept\");\n"
627 " exit(EXIT_FAILURE);\n"
628 " }\n"
629 " setnonblocking(conn_sock);\n"
630 " ev.events = EPOLLIN | EPOLLET;\n"
631 " ev.data.fd = conn_sock;\n"
632 " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
633 " &ev) == -1) {\n"
634 " perror(\"epoll_ctl: conn_sock\");\n"
635 " exit(EXIT_FAILURE);\n"
636 " }\n"
637 " } else {\n"
638 " do_use_fd(events[n].data.fd);\n"
639 " }\n"
640 " }\n"
641 "}\n"
642
643 #. type: Plain text
644 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
645 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
646 msgid ""
647 "When used as an edge-triggered interface, for performance reasons, it is "
648 "possible to add the file descriptor inside the B<epoll> interface "
649 "(B<EPOLL_CTL_ADD>) once by specifying (B<EPOLLIN>|B<EPOLLOUT>). This "
650 "allows you to avoid continuously switching between B<EPOLLIN> and "
651 "B<EPOLLOUT> calling B<epoll_ctl>(2) with B<EPOLL_CTL_MOD>."
652 msgstr ""
653 "При использовании интерфейса edge-triggered для большей производительности "
654 "можно однократно добавить файловый дескриптор внутрь интерфейса B<epoll> "
655 "(B<EPOLL_CTL_ADD>), указав (B<EPOLLIN>|B<EPOLLOUT>). Это позволит вам "
656 "избежать постоянного переключения между B<EPOLLIN> и B<EPOLLOUT>, "
657 "вызывающими B<epoll_ctl>(2) c B<EPOLL_CTL_MOD>."
658
659 #. type: SS
660 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
661 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
662 #, no-wrap
663 msgid "Questions and answers"
664 msgstr "Вопросы и ответы"
665
666 #. type: Plain text
667 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
668 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
669 msgid ""
670 "What is the key used to distinguish the file descriptors registered in an "
671 "interest list?"
672 msgstr ""
673 "По какому ключу различать зарегистрированные файловые дескрипторы в списке "
674 "interest?"
675
676 #. type: Plain text
677 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
678 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
679 msgid ""
680 "The key is the combination of the file descriptor number and the open file "
681 "description (also known as an \"open file handle\", the kernel's internal "
682 "representation of an open file)."
683 msgstr ""
684 "Уникальной комбинацией является номер файлового дескриптора и описание "
685 "открытого файла (так называемый «описатель открытого файла» — внутреннее "
686 "представление открытого файла в ядре)."
687
688 #. type: Plain text
689 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
690 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
691 msgid ""
692 "What happens if you register the same file descriptor on an B<epoll> "
693 "instance twice?"
694 msgstr ""
695 "Что случится, если зарегистрировать один файловый дескриптор в экземпляре "
696 "B<epoll> дважды?"
697
698 #. But a file descriptor duplicated by fork(2) can't be added to the
699 #. set, because the [file *, fd] pair is already in the epoll set.
700 #. That is a somewhat ugly inconsistency. On the one hand, a child process
701 #. cannot add the duplicate file descriptor to the epoll set. (In every
702 #. other case that I can think of, file descriptors duplicated by fork have
703 #. similar semantics to file descriptors duplicated by dup() and friends.) On
704 #. the other hand, the very fact that the child has a duplicate of the
705 #. file descriptor means that even if the parent closes its file descriptor,
706 #. then epoll_wait() in the parent will continue to receive notifications for
707 #. that file descriptor because of the duplicated file descriptor in the child.
708 #. See http://thread.gmane.org/gmane.linux.kernel/596462/
709 #. "epoll design problems with common fork/exec patterns"
710 #. mtk, Feb 2008
711 #. type: Plain text
712 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
713 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
714 msgid ""
715 "You will probably get B<EEXIST>. However, it is possible to add a duplicate "
716 "(B<dup>(2), B<dup2>(2), B<fcntl>(2) B<F_DUPFD>) file descriptor to the "
717 "same B<epoll> instance. This can be a useful technique for filtering "
718 "events, if the duplicate file descriptors are registered with different "
719 "I<events> masks."
720 msgstr ""
721 "Вероятно, вы получите B<EEXIST>. Однако возможно добавить дубликат файлового "
722 "дескриптора (B<dup>(2), B<dup2>(2), B<fcntl>(2) B<F_DUPFD>) в тот же "
723 "экземпляр B<epoll>. Это может быть полезно для фильтрующих событий, если "
724 "дубликаты файловых дескрипторов регистрируются с разными масками I<events>."
725
726 #. type: Plain text
727 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
728 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
729 msgid ""
730 "Can two B<epoll> instances wait for the same file descriptor? If so, are "
731 "events reported to both B<epoll> file descriptors?"
732 msgstr ""
733 "Могут ли два экземпляра B<epoll> ожидать один файловый дескриптор? Если да, "
734 "то сообщаются ли события в оба файловых дескриптора B<epoll>?"
735
736 #. type: Plain text
737 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
738 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
739 msgid ""
740 "Yes, and events would be reported to both. However, careful programming may "
741 "be needed to do this correctly."
742 msgstr ""
743 "Да, и события будут доходить в оба. Однако, чтобы сделать это правильно, "
744 "нужна внимательность к деталям."
745
746 #. type: Plain text
747 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
748 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
749 msgid "Is the B<epoll> file descriptor itself poll/epoll/selectable?"
750 msgstr ""
751 "Могут ли операции poll/epoll/select применяться к самому файловому "
752 "дескриптору B<epoll>?"
753
754 #. type: Plain text
755 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
756 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
757 msgid ""
758 "Yes. If an B<epoll> file descriptor has events waiting, then it will "
759 "indicate as being readable."
760 msgstr ""
761 "Да. Если файловый дескриптор B<epoll> имеет ожидающие события, то он будет "
762 "помечен как доступный для чтения."
763
764 #. type: Plain text
765 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
766 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
767 msgid ""
768 "What happens if one attempts to put an B<epoll> file descriptor into its own "
769 "file descriptor set?"
770 msgstr ""
771 "Что случится, если попытаться поместить файловый дескриптор B<epoll> в свой "
772 "собственный набор файловых дескрипторов?"
773
774 #. type: Plain text
775 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
776 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
777 msgid ""
778 "The B<epoll_ctl>(2) call fails (B<EINVAL>). However, you can add an "
779 "B<epoll> file descriptor inside another B<epoll> file descriptor set."
780 msgstr ""
781 "Вызов B<epoll_ctl>(2) завершается ошибкой (B<EINVAL>). Однако вы можете "
782 "добавить файловый дескриптор B<epoll> внутрь другого набора файлового "
783 "дескриптора B<epoll>."
784
785 #. type: Plain text
786 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
787 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
788 msgid ""
789 "Can I send an B<epoll> file descriptor over a UNIX domain socket to another "
790 "process?"
791 msgstr ""
792 "Можно ли отправить файловый дескриптор B<epoll> через доменный сокет UNIX "
793 "другому процессу?"
794
795 #. type: Plain text
796 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
797 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
798 msgid ""
799 "Yes, but it does not make sense to do this, since the receiving process "
800 "would not have copies of the file descriptors in the interest list."
801 msgstr ""
802 "Да, но это не имеет смысла, так как принимающий процесс не имеет копий "
803 "файловых дескрипторов в списке interest."
804
805 #. type: Plain text
806 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
807 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
808 msgid ""
809 "Will closing a file descriptor cause it to be removed from all B<epoll> "
810 "interest lists?"
811 msgstr ""
812 "Приводит ли закрытие файлового дескриптора к его удалению из всех списков "
813 "interest B<epoll>?"
814
815 #. type: Plain text
816 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
817 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
818 msgid ""
819 "Yes, but be aware of the following point. A file descriptor is a reference "
820 "to an open file description (see B<open>(2)). Whenever a file descriptor is "
821 "duplicated via B<dup>(2), B<dup2>(2), B<fcntl>(2) B<F_DUPFD>, or "
822 "B<fork>(2), a new file descriptor referring to the same open file "
823 "description is created. An open file description continues to exist until "
824 "all file descriptors referring to it have been closed."
825 msgstr ""
826 "Да, но учтите следующий момент. Файловый дескриптор является ссылкой на "
827 "открытое файловое описание (смотрите B<open>(2)). При создании дубля "
828 "файлового дескриптора с помощью B<dup>(2), B<dup2>(2), B<fcntl>(2) "
829 "B<F_DUPFD> или B<fork>(2) созданный новый файловый дескриптор указывает на "
830 "то же открытое файловое описание. Открытое файловое описание продолжает "
831 "существовать до тех пор, пока все указывающие на него файловые дескрипторы "
832 "не будут закрыты."
833
834 #. type: Plain text
835 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
836 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
837 msgid ""
838 "A file descriptor is removed from an interest list only after all the file "
839 "descriptors referring to the underlying open file description have been "
840 "closed. This means that even after a file descriptor that is part of an "
841 "interest list has been closed, events may be reported for that file "
842 "descriptor if other file descriptors referring to the same underlying file "
843 "description remain open. To prevent this happening, the file descriptor "
844 "must be explicitly removed from the interest list (using B<epoll_ctl>(2) "
845 "B<EPOLL_CTL_DEL>) before it is duplicated. Alternatively, the application "
846 "must ensure that all file descriptors are closed (which may be difficult if "
847 "file descriptors were duplicated behind the scenes by library functions that "
848 "used B<dup>(2) or B<fork>(2))."
849 msgstr ""
850 "Файловый дескриптор удаляется из списка interest только после того, как "
851 "будут закрыты все файловые дескрипторы, ссылающиеся на открытое файловое "
852 "описание. Это означает, что даже после закрытия файлового дескриптора, "
853 "являющегося частью списка interest, могут поступать события от файлового "
854 "дескриптора, если остались открытыми другие файловые дескрипторы, "
855 "ссылающиеся на тоже файловое описание. Чтобы такого не случалось, файловый "
856 "дескриптор должен быть удалён из списка interest явным образом (с помощью "
857 "B<epoll_ctl>(2) B<EPOLL_CTL_DEL>) до создания его дубликата. Или же "
858 "приложение может проверить,что закрыты все файловые дескрипторы (что может "
859 "быть трудно, если дубли файлового дескриптора неявно создавались где-то в "
860 "библиотечных функциях с помощью B<dup>(2) или B<fork>(2))."
861
862 #. type: Plain text
863 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
864 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
865 msgid ""
866 "If more than one event occurs between B<epoll_wait>(2) calls, are they "
867 "combined or reported separately?"
868 msgstr ""
869 "Если между вызовами B<epoll_wait>(2) придёт более одного события, то они "
870 "будут объединены или о них будет сообщено по отдельности?"
871
872 #. type: Plain text
873 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
874 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
875 msgid "They will be combined."
876 msgstr "Они будут объединены."
877
878 #. type: Plain text
879 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
880 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
881 msgid ""
882 "Does an operation on a file descriptor affect the already collected but not "
883 "yet reported events?"
884 msgstr ""
885 "Влияет ли операция над файловым дескриптором на уже собранные, но пока ещё "
886 "не сообщенные события?"
887
888 #. type: Plain text
889 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
890 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
891 msgid ""
892 "You can do two operations on an existing file descriptor. Remove would be "
893 "meaningless for this case. Modify will reread available I/O."
894 msgstr ""
895 "Вы можете выполнить две операции на существующем файловом дескрипторе. "
896 "Удаление в этом случае бессмысленно. Изменение приведёт к повторному чтению "
897 "доступного ввода/вывода."
898
899 #. type: Plain text
900 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
901 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
902 msgid ""
903 "Do I need to continuously read/write a file descriptor until B<EAGAIN> when "
904 "using the B<EPOLLET> flag (edge-triggered behavior)?"
905 msgstr ""
906 "Должен ли я читать/записывать файловый дескриптор до пор пока, не получу "
907 "B<EAGAIN> при использовании флага B<EPOLLET> (поведение edge-triggered)?"
908
909 #. type: Plain text
910 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
911 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
912 msgid ""
913 "Receiving an event from B<epoll_wait>(2) should suggest to you that such "
914 "file descriptor is ready for the requested I/O operation. You must consider "
915 "it ready until the next (nonblocking) read/write yields B<EAGAIN>. When "
916 "and how you will use the file descriptor is entirely up to you."
917 msgstr ""
918 "Получение события от B<epoll_wait>(2) должно сообщить вам, что файловый "
919 "дескриптор готов для запрошенной операции ввода/вывода. Вы должны "
920 "предполагать, что он готов до тех пор, пока вы не получите следующий "
921 "B<EAGAIN> от (неблокирующего) чтения/записи. Когда и как вы будете "
922 "использовать файловый дескриптор — полностью зависит от вас."
923
924 #. type: Plain text
925 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
926 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
927 msgid ""
928 "For packet/token-oriented files (e.g., datagram socket, terminal in "
929 "canonical mode), the only way to detect the end of the read/write I/O space "
930 "is to continue to read/write until B<EAGAIN>."
931 msgstr ""
932 "Для пакетных/метко ориентированных файлов (например, датаграмных сокетов, "
933 "терминал в каноническом режиме) единственным способом обнаружить конец "
934 "чтения/записи пространства ввода-вывода — это продолжать чтение/записи до "
935 "получения B<EAGAIN>."
936
937 #. type: Plain text
938 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
939 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
940 msgid ""
941 "For stream-oriented files (e.g., pipe, FIFO, stream socket), the condition "
942 "that the read/write I/O space is exhausted can also be detected by checking "
943 "the amount of data read from / written to the target file descriptor. For "
944 "example, if you call B<read>(2) by asking to read a certain amount of data "
945 "and B<read>(2) returns a lower number of bytes, you can be sure of having "
946 "exhausted the read I/O space for the file descriptor. The same is true when "
947 "writing using B<write>(2). (Avoid this latter technique if you cannot "
948 "guarantee that the monitored file descriptor always refers to a stream-"
949 "oriented file.)"
950 msgstr ""
951 "Для потокоориентированных файлов (например, каналы, FIFO, потоковые сокеты) "
952 "условие, при которых чтение/запись пространства ввода/вывода закончилось, "
953 "может быть определено проверкой количества считанных/записанных данных из/в "
954 "целевого файлового дескриптора. Например, если вы вызвали B<read>(2) для "
955 "чтения определённого количества данных и B<read>(2) вернул меньшее "
956 "количество байтов, то можно быть уверенным, что пространство чтения ввода/"
957 "вывода этого файлового дескриптора закончилось. То же самое справедливо для "
958 "записи посредством B<write>(2) (не используйте последнее, если вы не можете "
959 "гарантировать, что отслеживаемый файловый дескриптор всегда ссылается на "
960 "потокоориентированный файл)."
961
962 #. type: SS
963 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
964 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
965 #, no-wrap
966 msgid "Possible pitfalls and ways to avoid them"
967 msgstr "Возможные ловушки и способы их обхода"
968
969 #. type: Plain text
970 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
971 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
972 #, fuzzy
973 #| msgid "B<o Starvation (edge-triggered)>"
974 msgid "B<Starvation (edge-triggered)>"
975 msgstr "B<o Информационный голод (edge-triggered)>"
976
977 #. type: Plain text
978 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
979 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
980 msgid ""
981 "If there is a large amount of I/O space, it is possible that by trying to "
982 "drain it the other files will not get processed causing starvation. (This "
983 "problem is not specific to B<epoll>.)"
984 msgstr ""
985 "Если существует большое пространство ввода/вывода, то возможно, что пока вы "
986 "его читаете, другие файлы не будут обрабатываться и возникнет недостаток "
987 "данных (этого, обычно, не происходит с B<epoll>)."
988
989 #. type: Plain text
990 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
991 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
992 msgid ""
993 "The solution is to maintain a ready list and mark the file descriptor as "
994 "ready in its associated data structure, thereby allowing the application to "
995 "remember which files need to be processed but still round robin amongst all "
996 "the ready files. This also supports ignoring subsequent events you receive "
997 "for file descriptors that are already ready."
998 msgstr ""
999 "Решением будет поддержка списка готовности и маркировка файлового "
1000 "дескриптора как готового в связанной с ним структуре данных, тем самым "
1001 "позволяя приложению запоминать какие файлы требуют обработки, но всё ещё не "
1002 "обработанных среди уже готовых файлов. Это также поддерживает игнорирование "
1003 "последующих событий готовности файловых дескрипторов, получаемых вами."
1004
1005 #. type: Plain text
1006 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1007 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1008 #, fuzzy
1009 #| msgid "B<o If using an event cache...>"
1010 msgid "B<If using an event cache...>"
1011 msgstr "B<o Если использовать кэш событий…>"
1012
1013 #. type: Plain text
1014 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1015 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1016 msgid ""
1017 "If you use an event cache or store all the file descriptors returned from "
1018 "B<epoll_wait>(2), then make sure to provide a way to mark its closure "
1019 "dynamically (i.e., caused by a previous event's processing). Suppose you "
1020 "receive 100 events from B<epoll_wait>(2), and in event #47 a condition "
1021 "causes event #13 to be closed. If you remove the structure and B<close>(2) "
1022 "the file descriptor for event #13, then your event cache might still say "
1023 "there are events waiting for that file descriptor causing confusion."
1024 msgstr ""
1025 "Если вы используете кэш событий или храните все файловые дескрипторы, "
1026 "возвращённые от B<epoll_wait>(2), то убедитесь, что вы обеспечили способ его "
1027 "динамического закрытия (например, вызванное обработкой предыдущего события). "
1028 "Предположим, что вы получили 100 событий от B<epoll_wait>(2), и что в "
1029 "событии №47 некоторое условие определяет, что событие №13 должно быть "
1030 "закрыто. Если вы удалите структуру и выполните B<close>(2) файлового "
1031 "дескриптора для события №13, то кэш событий всё ещё может сообщать о том, "
1032 "что есть ожидаемые события для этого файлового дескриптора, что приводит к "
1033 "путнице."
1034
1035 #. type: Plain text
1036 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1037 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1038 msgid ""
1039 "One solution for this is to call, during the processing of event 47, "
1040 "B<epoll_ctl>(B<EPOLL_CTL_DEL>) to delete file descriptor 13 and "
1041 "B<close>(2), then mark its associated data structure as removed and link it "
1042 "to a cleanup list. If you find another event for file descriptor 13 in your "
1043 "batch processing, you will discover the file descriptor had been previously "
1044 "removed and there will be no confusion."
1045 msgstr ""
1046 "Одним из решений будет вызов, во время обработки события №47, "
1047 "B<epoll_ctl>(B<EPOLL_CTL_DEL>) для удаления файлового дескриптора 13 и вызов "
1048 "B<close>(2), а затем маркировка связанной с ним структуры данных как "
1049 "удалённой и связки его со списком очистки. Если при пакетной обработке "
1050 "найдется другое событие для файлового дескриптора 13, то обнаружится, что "
1051 "файловый дескриптор уже был удалён и конфликтов не будет."
1052
1053 #. type: SH
1054 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1055 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1056 #, no-wrap
1057 msgid "VERSIONS"
1058 msgstr "ВЕРСИИ"
1059
1060 #. type: Plain text
1061 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1062 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1063 #, fuzzy
1064 #| msgid ""
1065 #| "The B<epoll> API is Linux-specific. Some other systems provide similar "
1066 #| "mechanisms, for example, FreeBSD has I<kqueue>, and Solaris has I</dev/"
1067 #| "poll>."
1068 msgid ""
1069 "Some other systems provide similar mechanisms; for example, FreeBSD has "
1070 "I<kqueue>, and Solaris has I</dev/poll>."
1071 msgstr ""
1072 "Программный интерфейс B<epoll> есть только в Linux. В некоторых других "
1073 "системах есть подобные механизмы, например, в FreeBSD есть I<kqueue>, а в "
1074 "Solaris — I</dev/poll>."
1075
1076 #. type: SH
1077 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1078 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1079 #, no-wrap
1080 msgid "STANDARDS"
1081 msgstr "СТАНДАРТЫ"
1082
1083 #. type: Plain text
1084 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1085 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1086 msgid "Linux."
1087 msgstr "Linux."
1088
1089 #. type: SH
1090 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1091 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1092 #, no-wrap
1093 msgid "HISTORY"
1094 msgstr "ИСТОРИЯ"
1095
1096 #. Its interface should be finalized in Linux 2.5.66.
1097 #. type: Plain text
1098 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1099 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1100 msgid "Linux 2.5.44. glibc 2.3.2."
1101 msgstr ""
1102
1103 #. type: SH
1104 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1105 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1106 #, no-wrap
1107 msgid "NOTES"
1108 msgstr "ПРИМЕЧАНИЯ"
1109
1110 #. type: Plain text
1111 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1112 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1113 #, fuzzy
1114 #| msgid ""
1115 #| "The set of file descriptors that is being monitored via an epoll file "
1116 #| "descriptor can be viewed via the entry for the epoll file descriptor in "
1117 #| "the process's I</proc/[pid]/fdinfo> directory. See B<proc>(5) for "
1118 #| "further details."
1119 msgid ""
1120 "The set of file descriptors that is being monitored via an epoll file "
1121 "descriptor can be viewed via the entry for the epoll file descriptor in the "
1122 "process's I</proc/>pidI</fdinfo> directory. See B<proc>(5) for further "
1123 "details."
1124 msgstr ""
1125 "Набор файловых дескрипторов, которые отслеживаются через файловый дескриптор "
1126 "epoll, можно найти в записи для файлового дескриптора epoll в каталоге "
1127 "процесса I</proc/[pid]/fdinfo>. Подробности смотрите в B<proc>(5)."
1128
1129 #. type: Plain text
1130 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1131 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1132 msgid ""
1133 "The B<kcmp>(2) B<KCMP_EPOLL_TFD> operation can be used to test whether a "
1134 "file descriptor is present in an epoll instance."
1135 msgstr ""
1136 "Вызов The B<kcmp>(2) с операцией B<KCMP_EPOLL_TFD> можно использовать для "
1137 "проверки, что файловый дескриптор присутствует в экземпляре epoll."
1138
1139 #. type: SH
1140 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1141 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1142 #, no-wrap
1143 msgid "SEE ALSO"
1144 msgstr "СМОТРИТЕ ТАКЖЕ"
1145
1146 #. type: Plain text
1147 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1148 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1149 #, fuzzy
1150 #| msgid ""
1151 #| "B<epoll_create>(2), B<epoll_create1>(2), B<epoll_ctl>(2), "
1152 #| "B<epoll_wait>(2), B<poll>(2), B<select>(2)"
1153 msgid ""
1154 "B<epoll_create>(2), B<epoll_create1>(2), B<epoll_ctl>(2), B<epoll_wait>(2), "
1155 "B<ioctl_eventpoll>(2), B<poll>(2), B<select>(2)"
1156 msgstr ""
1157 "B<epoll_create>(2), B<epoll_create1>(2), B<epoll_ctl>(2), B<epoll_wait>(2), "
1158 "B<poll>(2), B<select>(2)"
1159
1160 #. type: TH
1161 #: debian-trixie
1162 #, no-wrap
1163 msgid "2024-06-12"
1164 msgstr "12 июня 2024 г."
1165
1166 #. type: TH
1167 #: debian-trixie
1168 #, no-wrap
1169 msgid "Linux man-pages 6.9.1"
1170 msgstr "Страницы руководства Linux 6.9.1"
1171
1172 #. type: Plain text
1173 #: debian-trixie
1174 msgid ""
1175 "If the I<rfd> file descriptor has been added to the B<epoll> interface using "
1176 "the B<EPOLLET> (edge-triggered) flag, the call to B<epoll_wait>(2) done in "
1177 "step B<5> will probably hang despite the available data still present in the "
1178 "file input buffer; meanwhile the remote peer might be expecting a response "
1179 "based on the data it already sent. The reason for this is that edge-"
1180 "triggered mode delivers events only when changes occur on the monitored file "
1181 "descriptor. So, in step B<5> the caller might end up waiting for some data "
1182 "that is already present inside the input buffer. In the above example, an "
1183 "event on I<rfd> will be generated because of the write done in B<2> and the "
1184 "event is consumed in B<3>. Since the read operation done in B<4> does not "
1185 "consume the whole buffer data, the call to B<epoll_wait>(2) done in step "
1186 "B<5> might block indefinitely."
1187 msgstr ""
1188 "Если файловый дескриптор I<rfd> добавлен к экземпляру B<epoll> с указанным "
1189 "флагом B<EPOLLET> (edge-triggered), то вызов B<epoll_wait>(2) на шаге 5, "
1190 "вероятно, повиснет, несмотря на имеющие данные в буфере ввода; в это же "
1191 "время удалённая сторона может ожидать подтверждения приёма уже отправленных "
1192 "данных. Причиной этого является то, что в режиме edge-triggered события "
1193 "доставляются только когда происходит изменение состояния отслеживаемого "
1194 "файлового дескриптора. Поэтому в шаге B<5> вызывающий может бесконечно ждать "
1195 "появления данных, хотя они уже есть в буфере ввода. В приведённом выше "
1196 "примере событие для I<rfd> будет сгенерировано из-за операции записи, "
1197 "сделанной в шаге B<2>, и это событие будет обработано в шаге B<3>. Так как "
1198 "операция в шаге B<4>, не прочитала все данные из буфера, вызов "
1199 "B<epoll_wait>(2) в шаге B<5> может заблокироваться навсегда."
1200
1201 #. type: Plain text
1202 #: debian-trixie fedora-44 fedora-rawhide
1203 #, fuzzy, no-wrap
1204 #| msgid ""
1205 #| " for (n = 0; n E<lt> nfds; ++n) {\n"
1206 #| " if (events[n].data.fd == listen_sock) {\n"
1207 #| " conn_sock = accept(listen_sock,\n"
1208 #| " (struct sockaddr *) &addr, &addrlen);\n"
1209 #| " if (conn_sock == -1) {\n"
1210 #| " perror(\"accept\");\n"
1211 #| " exit(EXIT_FAILURE);\n"
1212 #| " }\n"
1213 #| " setnonblocking(conn_sock);\n"
1214 #| " ev.events = EPOLLIN | EPOLLET;\n"
1215 #| " ev.data.fd = conn_sock;\n"
1216 #| " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
1217 #| " &ev) == -1) {\n"
1218 #| " perror(\"epoll_ctl: conn_sock\");\n"
1219 #| " exit(EXIT_FAILURE);\n"
1220 #| " }\n"
1221 #| " } else {\n"
1222 #| " do_use_fd(events[n].data.fd);\n"
1223 #| " }\n"
1224 #| " }\n"
1225 #| "}\n"
1226 msgid ""
1227 "#define MAX_EVENTS 10\n"
1228 "struct epoll_event ev, events[MAX_EVENTS];\n"
1229 "int listen_sock, conn_sock, nfds, epollfd;\n"
1230 "\\&\n"
1231 "/* Code to set up listening socket, \\[aq]listen_sock\\[aq],\n"
1232 " (socket(), bind(), listen()) omitted. */\n"
1233 "\\&\n"
1234 "epollfd = epoll_create1(0);\n"
1235 "if (epollfd == -1) {\n"
1236 " perror(\"epoll_create1\");\n"
1237 " exit(EXIT_FAILURE);\n"
1238 "}\n"
1239 "\\&\n"
1240 "ev.events = EPOLLIN;\n"
1241 "ev.data.fd = listen_sock;\n"
1242 "if (epoll_ctl(epollfd, EPOLL_CTL_ADD, listen_sock, &ev) == -1) {\n"
1243 " perror(\"epoll_ctl: listen_sock\");\n"
1244 " exit(EXIT_FAILURE);\n"
1245 "}\n"
1246 "\\&\n"
1247 "for (;;) {\n"
1248 " nfds = epoll_wait(epollfd, events, MAX_EVENTS, -1);\n"
1249 " if (nfds == -1) {\n"
1250 " perror(\"epoll_wait\");\n"
1251 " exit(EXIT_FAILURE);\n"
1252 " }\n"
1253 "\\&\n"
1254 " for (n = 0; n E<lt> nfds; ++n) {\n"
1255 " if (events[n].data.fd == listen_sock) {\n"
1256 " conn_sock = accept(listen_sock,\n"
1257 " (struct sockaddr *) &addr, &addrlen);\n"
1258 " if (conn_sock == -1) {\n"
1259 " perror(\"accept\");\n"
1260 " exit(EXIT_FAILURE);\n"
1261 " }\n"
1262 " setnonblocking(conn_sock);\n"
1263 " ev.events = EPOLLIN | EPOLLET;\n"
1264 " ev.data.fd = conn_sock;\n"
1265 " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
1266 " &ev) == -1) {\n"
1267 " perror(\"epoll_ctl: conn_sock\");\n"
1268 " exit(EXIT_FAILURE);\n"
1269 " }\n"
1270 " } else {\n"
1271 " do_use_fd(events[n].data.fd);\n"
1272 " }\n"
1273 " }\n"
1274 "}\n"
1275 msgstr ""
1276 " for (n = 0; n E<lt> nfds; ++n) {\n"
1277 " if (events[n].data.fd == listen_sock) {\n"
1278 " conn_sock = accept(listen_sock,\n"
1279 " (struct sockaddr *) &addr, &addrlen);\n"
1280 " if (conn_sock == -1) {\n"
1281 " perror(\"accept\");\n"
1282 " exit(EXIT_FAILURE);\n"
1283 " }\n"
1284 " setnonblocking(conn_sock);\n"
1285 " ev.events = EPOLLIN | EPOLLET;\n"
1286 " ev.data.fd = conn_sock;\n"
1287 " if (epoll_ctl(epollfd, EPOLL_CTL_ADD, conn_sock,\n"
1288 " &ev) == -1) {\n"
1289 " perror(\"epoll_ctl: conn_sock\");\n"
1290 " exit(EXIT_FAILURE);\n"
1291 " }\n"
1292 " } else {\n"
1293 " do_use_fd(events[n].data.fd);\n"
1294 " }\n"
1295 " }\n"
1296 "}\n"
1297
1298 #. type: TH
1299 #: fedora-44 fedora-rawhide
1300 #, no-wrap
1301 msgid "2024-08-21"
1302 msgstr "21 августа 2024 г."
1303
1304 #. type: TH
1305 #: fedora-44 fedora-rawhide
1306 #, no-wrap
1307 msgid "Linux man-pages 6.13"
1308 msgstr "Страницы руководства Linux 6.13"
1309
1310 #. type: TH
1311 #: mageia-cauldron
1312 #, no-wrap
1313 msgid "Linux man-pages 6.17"
1314 msgstr "Страницы руководства Linux 6.17"
1315
1316 #. type: TH
1317 #: opensuse-leap-16-1 opensuse-tumbleweed
1318 #, no-wrap
1319 msgid "Linux man-pages (unreleased)"
1320 msgstr "Страницы руководства Linux (не выпущены)"