diff options
Diffstat (limited to 'po/ru/man2/select_tut.2.po')
-rw-r--r-- | po/ru/man2/select_tut.2.po | 1845 |
1 files changed, 1845 insertions, 0 deletions
diff --git a/po/ru/man2/select_tut.2.po b/po/ru/man2/select_tut.2.po new file mode 100644 index 00000000..f1c14e1e --- /dev/null +++ b/po/ru/man2/select_tut.2.po @@ -0,0 +1,1845 @@ +# Russian translation of manpages +# This file is distributed under the same license as the manpages-l10n package. +# Copyright © of this file: +# Alexander Golubev <fatzer2@gmail.com>, 2018. +# Azamat Hackimov <azamat.hackimov@gmail.com>, 2011, 2014-2016. +# Hotellook, 2014. +# Nikita <zxcvbnm3230@mail.ru>, 2014. +# Spiros Georgaras <sng@hellug.gr>, 2016. +# Vladislav <ivladislavefimov@gmail.com>, 2015. +# Yuri Kozlov <yuray@komyakino.ru>, 2011-2019. +# Иван Павлов <pavia00@gmail.com>, 2017. +msgid "" +msgstr "" +"Project-Id-Version: manpages-l10n\n" +"POT-Creation-Date: 2024-03-01 17:07+0100\n" +"PO-Revision-Date: 2019-10-15 18:55+0300\n" +"Last-Translator: Yuri Kozlov <yuray@komyakino.ru>\n" +"Language-Team: Russian <man-pages-ru-talks@lists.sourceforge.net>\n" +"Language: ru\n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && " +"n%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || " +"(n%100>=11 && n%100<=14)? 2 : 3);\n" +"X-Generator: Lokalize 2.0\n" + +#. type: TH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "SELECT_TUT" +msgstr "SELECT_TUT" + +#. type: TH +#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "2023-10-31" +msgstr "31 октября 2023 г." + +#. type: TH +#: archlinux fedora-40 fedora-rawhide mageia-cauldron +#, no-wrap +msgid "Linux man-pages 6.06" +msgstr "Linux man-pages 6.06" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "NAME" +msgstr "ИМЯ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "select, pselect - synchronous I/O multiplexing" +msgstr "select, pselect - многопоточный синхронный ввод-вывод" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "LIBRARY" +msgstr "" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "Standard C library (I<libc>, I<-lc>)" +msgstr "" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "SYNOPSIS" +msgstr "СИНТАКСИС" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "See B<select>(2)" +msgstr "Смотрите B<select>(2)" + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "DESCRIPTION" +msgstr "ОПИСАНИЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "B<select>() (or B<pselect>()) is used to efficiently monitor multiple " +#| "file descriptors, to see if any of them is, or becomes, \"ready\"; that " +#| "is, to see whether I/O becomes possible, or an \"exceptional condition\" " +#| "has occurred on any of the file descriptors." +msgid "" +"The B<select>() and B<pselect>() system calls are used to efficiently " +"monitor multiple file descriptors, to see if any of them is, or becomes, " +"\"ready\"; that is, to see whether I/O becomes possible, or an \"exceptional " +"condition\" has occurred on any of the file descriptors." +msgstr "" +"Вызов B<select>() (или B<pselect>()) используется для эффективного слежения " +"за несколькими файловыми дескрипторами — для ожидания, когда какой-то из них " +"не станет «готов», то есть появится возможность чтения-записи данных, или с " +"файловым дескриптором не возникнет «исключительная ситуация»." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"This page provides background and tutorial information on the use of these " +"system calls. For details of the arguments and semantics of B<select>() " +"and B<pselect>(), see B<select>(2)." +msgstr "" + +#. type: SS +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Combining signal and data events" +msgstr "Комбинирование событий сигналов и данных" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"B<pselect>() is useful if you are waiting for a signal as well as for file " +"descriptor(s) to become ready for I/O. Programs that receive signals " +"normally use the signal handler only to raise a global flag. The global " +"flag will indicate that the event must be processed in the main loop of the " +"program. A signal will cause the B<select>() (or B<pselect>()) call to " +"return with I<errno> set to B<EINTR>. This behavior is essential so that " +"signals can be processed in the main loop of the program, otherwise " +"B<select>() would block indefinitely." +msgstr "" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "B<pselect>() is useful if you are waiting for a signal as well as for " +#| "file descriptor(s) to become ready for I/O. Programs that receive " +#| "signals normally use the signal handler only to raise a global flag. The " +#| "global flag will indicate that the event must be processed in the main " +#| "loop of the program. A signal will cause the B<select>() (or " +#| "B<pselect>()) call to return with I<errno> set to B<EINTR>. This " +#| "behavior is essential so that signals can be processed in the main loop " +#| "of the program, otherwise B<select>() would block indefinitely. Now, " +#| "somewhere in the main loop will be a conditional to check the global " +#| "flag. So we must ask: what if a signal arrives after the conditional, " +#| "but before the B<select>() call? The answer is that B<select>() would " +#| "block indefinitely, even though an event is actually pending. This race " +#| "condition is solved by the B<pselect>() call. This call can be used to " +#| "set the signal mask to a set of signals that are to be received only " +#| "within the B<pselect>() call. For instance, let us say that the event " +#| "in question was the exit of a child process. Before the start of the " +#| "main loop, we would block B<SIGCHLD> using B<sigprocmask>(2). Our " +#| "B<pselect>() call would enable B<SIGCHLD> by using an empty signal " +#| "mask. Our program would look like:" +msgid "" +"Now, somewhere in the main loop will be a conditional to check the global " +"flag. So we must ask: what if a signal arrives after the conditional, but " +"before the B<select>() call? The answer is that B<select>() would block " +"indefinitely, even though an event is actually pending. This race condition " +"is solved by the B<pselect>() call. This call can be used to set the " +"signal mask to a set of signals that are to be received only within the " +"B<pselect>() call. For instance, let us say that the event in question was " +"the exit of a child process. Before the start of the main loop, we would " +"block B<SIGCHLD> using B<sigprocmask>(2). Our B<pselect>() call would " +"enable B<SIGCHLD> by using an empty signal mask. Our program would look " +"like:" +msgstr "" +"Вызов B<pselect>() полезен как для ожидания сигнала, так и для ожидания " +"готовности файлового дескриптора для ввода-вывода. Программы, принимающие " +"сигналы, как правило, лишь выставляют в обработчике сигнала глобальный флаг, " +"который означает, что требуется обработка события в главном цикле программы. " +"Появление сигнала заставит вызов B<select>() (или B<pselect>()) вернуть " +"управление вызвавшей программе; при этом I<errno> будет присвоено B<EINTR>. " +"Это поведение продиктовано необходимостью обработки сигналов в главном цикле " +"программы во избежание бесконечной блокировки B<select>(). В главном цикле " +"программы должно быть условие, проверяющее глобальный флаг. Возникает " +"вопрос: а что если сигнал придёт после проверки этого условия, но до вызова " +"B<select>()? В этом случае программа навсегда останется в B<select>(), хотя " +"и есть ожидающее событие. Для разрешения этой проблемы существует вызов " +"B<pselect>(). Этот вызов можно использовать для установки в сигнальной маске " +"сигналов, которые принимаются только внутри вызова B<pselect>(). Например, " +"предположим что интересующее нас событие — это завершение дочернего " +"процесса. Перед запуском главного цикла заблокируем B<SIGCHLD> с помощью " +"B<sigprocmask>(2). Наш вызов B<pselect>() разблокирует B<SIGCHLD>, указав " +"пустую маску сигналов. Программа будет выглядеть так:" + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed +#, no-wrap +msgid "" +"static volatile sig_atomic_t got_SIGCHLD = 0;\n" +"\\&\n" +"static void\n" +"child_sig_handler(int sig)\n" +"{\n" +" got_SIGCHLD = 1;\n" +"}\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" sigset_t sigmask, empty_mask;\n" +" struct sigaction sa;\n" +" fd_set readfds, writefds, exceptfds;\n" +" int r;\n" +"\\&\n" +" sigemptyset(&sigmask);\n" +" sigaddset(&sigmask, SIGCHLD);\n" +" if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n" +" perror(\"sigprocmask\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" sa.sa_flags = 0;\n" +" sa.sa_handler = child_sig_handler;\n" +" sigemptyset(&sa.sa_mask);\n" +" if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n" +" perror(\"sigaction\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" sigemptyset(&empty_mask);\n" +"\\&\n" +" for (;;) { /* main loop */\n" +" /* Initialize readfds, writefds, and exceptfds\n" +" before the pselect() call. (Code omitted.) */\n" +"\\&\n" +" r = pselect(nfds, &readfds, &writefds, &exceptfds,\n" +" NULL, &empty_mask);\n" +" if (r == -1 && errno != EINTR) {\n" +" /* Handle error */\n" +" }\n" +"\\&\n" +" if (got_SIGCHLD) {\n" +" got_SIGCHLD = 0;\n" +"\\&\n" +" /* Handle signalled event here; e.g., wait() for all\n" +" terminated children. (Code omitted.) */\n" +" }\n" +"\\&\n" +" /* main body of program */\n" +" }\n" +"}\n" +msgstr "" + +#. type: SS +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Practical" +msgstr "Практика" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"So what is the point of B<select>()? Can't I just read and write to my file " +"descriptors whenever I want? The point of B<select>() is that it watches " +"multiple descriptors at the same time and properly puts the process to sleep " +"if there is no activity. UNIX programmers often find themselves in a " +"position where they have to handle I/O from more than one file descriptor " +"where the data flow may be intermittent. If you were to merely create a " +"sequence of B<read>(2) and B<write>(2) calls, you would find that one of " +"your calls may block waiting for data from/to a file descriptor, while " +"another file descriptor is unused though ready for I/O. B<select>() " +"efficiently copes with this situation." +msgstr "" +"Итак, какой прок от использования B<select>()? Разве нельзя просто считывать " +"и записывать данные в файловые дескрипторы когда этого захочется? Смысл " +"использования B<select>() в том, что он позволяет следит за несколькими " +"дескрипторами одновременно и корректно переводить процесс в режим ожидания, " +"когда активности не наблюдается. Программисты UNIX часто попадают в " +"ситуацию, когда необходимо обработать ввод-вывод из более чем одного " +"файлового дескриптора в то время как поток данных может быть неравномерным. " +"Если вы просто создадите последовательность вызовов B<read>(2) и " +"B<write>(2), то можете попасть в ситуацию, когда один из вызовов будет " +"ожидать данные из/в файлового дескриптора, в то время как другой будет " +"простаивать, хотя данные для него уже появились. Вызов B<select>() позволяет " +"эффективно справиться с такой ситуацией." + +#. type: SS +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "Select law" +msgstr "Правила использования" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Many people who try to use B<select>() come across behavior that is " +"difficult to understand and produces nonportable or borderline results. For " +"instance, the above program is carefully written not to block at any point, " +"even though it does not set its file descriptors to nonblocking mode. It is " +"easy to introduce subtle errors that will remove the advantage of using " +"B<select>(), so here is a list of essentials to watch for when using " +"B<select>()." +msgstr "" +"Многие из тех, кто пытался использовать B<select>(), сталкивались с " +"поведением, которое трудно понять, и которое приводило к непереносимым или " +"просто плохим результатам. Например, вышеприведенная программа тщательно " +"спланирована так, чтобы ни в каком случае не блокироваться, хотя для её " +"файловых дескрипторов не установлен неблокирующий режим. Несложно " +"перечислить не очевидные ошибки, которые лишат всех преимуществ " +"использования B<select>(), поэтому вот список основных моментов, на которые " +"нужно обращать внимание при использовании B<select>()." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "1." +msgstr "1." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"You should always try to use B<select>() without a timeout. Your program " +"should have nothing to do if there is no data available. Code that depends " +"on timeouts is not usually portable and is difficult to debug." +msgstr "" +"Всегда старайтесь использовать B<select>() без указания времени ожидания. " +"Ваша программа не должна ничего делать, если нет данных. Код, зависимый от " +"времени ожидания, обычно плохо переносим и сложен для отладки." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "2." +msgstr "2." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The value I<nfds> must be properly calculated for efficiency as explained " +"above." +msgstr "" +"Для повышения эффективности значение I<nfds> должно правильно вычисляться, " +"как это объяснялось выше." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "3." +msgstr "3." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"No file descriptor must be added to any set if you do not intend to check " +"its result after the B<select>() call, and respond appropriately. See next " +"rule." +msgstr "" +"Файловые дескрипторы не должны добавляться в наборы, если вы не планируете " +"после вызова B<select>() проверять результат и соответствующим образом " +"реагировать. Смотрите следующее правило." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "4." +msgstr "4." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"After B<select>() returns, all file descriptors in all sets should be " +"checked to see if they are ready." +msgstr "" +"После возврата из B<select>() должны быть проверены все файловые дескрипторы " +"во всех наборах." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "5." +msgstr "5." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2) do I<not> " +"necessarily read/write the full amount of data that you have requested. If " +"they do read/write the full amount, it's because you have a low traffic load " +"and a fast stream. This is not always going to be the case. You should " +"cope with the case of your functions managing to send or receive only a " +"single byte." +msgstr "" +"Вызовы B<read>(2), B<recv>(2), B<write>(2) и B<send>(2) I<не> обязательно " +"считывают/записывают данные в полном объёме. Такое, конечно, возможно при " +"низком трафике или быстром потоке, однако происходит далеко не всегда. Вы " +"должны рассчитывать, что ваши функции получают/отправляют только один байт " +"за раз." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "6." +msgstr "6." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Never read/write only in single bytes at a time unless you are really sure " +"that you have a small amount of data to process. It is extremely " +"inefficient not to read/write as much data as you can buffer each time. The " +"buffers in the example below are 1024 bytes although they could easily be " +"made larger." +msgstr "" +"Никогда не считывайте/записывайте побайтно, если только вы не абсолютно " +"уверены в том, что нужно обработать небольшой объём данных. Крайне " +"неэффективно считывать/записывать меньшее количество байт, чем вы можете " +"поместить в буфер за один раз. Буферы в вышеприведённом примере имеют размер " +"1024 байта, однако могут быть легко увеличены до максимального размера " +"пакета в вашей локальной сети." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "7." +msgstr "7." + +#. Nonetheless, you should still cope with these errors for completeness. +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "Calls to B<read>(2), B<recv>(2), B<write>(2), B<send>(2), and " +#| "B<select>() can fail with the error B<EINTR>, and calls to B<read>(2), " +#| "B<recv>(2) B<write>(2), and B<send>(2) can fail with I<errno> set to " +#| "B<EAGAIN> (B<EWOULDBLOCK>). These results must be properly managed (not " +#| "done properly above). If your program is not going to receive any " +#| "signals, then it is unlikely you will get B<EINTR>. If your program does " +#| "not set nonblocking I/O, you will not get B<EAGAIN>." +msgid "" +"Calls to B<read>(2), B<recv>(2), B<write>(2), B<send>(2), and B<select>() " +"can fail with the error B<EINTR>, and calls to B<read>(2), B<recv>(2), " +"B<write>(2), and B<send>(2) can fail with I<errno> set to B<EAGAIN> " +"(B<EWOULDBLOCK>). These results must be properly managed (not done properly " +"above). If your program is not going to receive any signals, then it is " +"unlikely you will get B<EINTR>. If your program does not set nonblocking I/" +"O, you will not get B<EAGAIN>." +msgstr "" +"Вызовы B<read>(2), B<recv>(2), B<write>(2), B<send>(2) и B<select>() могут " +"завершиться ошибкой B<EINTR>, а вызовы B<read>(2), B<recv>(2) B<write>(2) и " +"B<send>(2) могут завершиться присвоением I<errno> значения B<EAGAIN> " +"(B<EWOULDBLOCK>). Эти варианты должны быть правильно обработаны (в " +"вышеприведенной программе этого не сделано). Если ваша программа не " +"собирается принимать сигналы, то маловероятно, что вы получите B<EINTR>. " +"Если ваша программа не использует неблокирующий ввод-вывод, то вы не " +"получите B<EAGAIN>." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "8." +msgstr "8." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Never call B<read>(2), B<recv>(2), B<write>(2), or B<send>(2) with a buffer " +"length of zero." +msgstr "" +"Никогда не вызывайте B<read>(2), B<recv>(2), B<write>(2) или B<send>(2) с " +"буфером нулевой длины." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "9." +msgstr "9." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"If the functions B<read>(2), B<recv>(2), B<write>(2), and B<send>(2) fail " +"with errors other than those listed in B<7.>, or one of the input functions " +"returns 0, indicating end of file, then you should I<not> pass that file " +"descriptor to B<select>() again. In the example below, I close the file " +"descriptor immediately, and then set it to -1 to prevent it being included " +"in a set." +msgstr "" +"Если вызовы B<read>(2), B<recv>(2), B<write>(2) и B<send>(2) завершаются с " +"ошибками, отличными от перечисленных в пункте B<7.> или один из вызовов " +"ввода вернул 0, что указывает на конец файла, то вы I<не> должны передавать " +"этот файловый дескриптор в B<select>() снова. В примере выше я немедленно " +"закрываю файловый дескриптор и устанавливаю его в -1 для предотвращения его " +"включения в набор." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "10." +msgstr "10." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The timeout value must be initialized with each new call to B<select>(), " +"since some operating systems modify the structure. B<pselect>() however " +"does not modify its timeout structure." +msgstr "" +"Значение времени ожидания должно быть инициализировано при каждом новом " +"вызове B<select>(), так как некоторые операционные системы изменяют значение " +"структуры. Однако B<pselect>() не изменяет структуру времени ожидания." + +#. type: TP +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "11." +msgstr "11." + +#. "I have heard" does not fill me with confidence, and doesn't +#. belong in a man page, so I've commented this point out. +#. .TP +#. 11. +#. I have heard that the Windows socket layer does not cope with OOB data +#. properly. +#. It also does not cope with +#. .BR select () +#. calls when no file descriptors are set at all. +#. Having no file descriptors set is a useful +#. way to sleep the process with subsecond precision by using the timeout. +#. (See further on.) +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Since B<select>() modifies its file descriptor sets, if the call is being " +"used in a loop, then the sets must be reinitialized before each call." +msgstr "" +"Так как B<select>() изменяет переданные наборы файловых дескрипторов, то при " +"использовании его в цикле наборы должны повторно инициализироваться перед " +"каждым вызовом." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "RETURN VALUE" +msgstr "ВОЗВРАЩАЕМОЕ ЗНАЧЕНИЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "See B<select>(2)." +msgstr "Смотрите B<select>(2)." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "NOTES" +msgstr "ЗАМЕЧАНИЯ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Generally speaking, all operating systems that support sockets also support " +"B<select>(). B<select>() can be used to solve many problems in a portable " +"and efficient way that naive programmers try to solve in a more complicated " +"manner using threads, forking, IPCs, signals, memory sharing, and so on." +msgstr "" +"В общем случае, все операционные системы, поддерживающие сокеты, " +"поддерживают также и B<select>(). Вызов B<select>() можно применять для " +"переносимого и эффективного решения многих задач, вместо которого многие " +"программисты пытаются использовать нити, ветвление процессов, IPC, сигналы, " +"разделение памяти и другие методы." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The B<poll>(2) system call has the same functionality as B<select>(), and " +"is somewhat more efficient when monitoring sparse file descriptor sets. It " +"is nowadays widely available, but historically was less portable than " +"B<select>()." +msgstr "" +"Системный вызов B<poll>(2) имеет такую же функциональность, как и " +"B<select>() и иногда более эффективен для слежения за разреженным набором " +"файловых дескрипторов. В настоящее время он стал широко распространён, но " +"исторически является менее переносимым чем B<select>()." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The Linux-specific B<epoll>(7) API provides an interface that is more " +"efficient than B<select>(2) and B<poll>(2) when monitoring large numbers " +"of file descriptors." +msgstr "" +"Программный интерфейс Linux B<epoll>(7) предоставляет более эффективный " +"метод для слежения за большим количеством файловых дескрипторов чем " +"B<select>(2) и B<poll>(2)." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "EXAMPLES" +msgstr "ПРИМЕРЫ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"Here is an example that better demonstrates the true utility of " +"B<select>(). The listing below is a TCP forwarding program that forwards " +"from one TCP port to another." +msgstr "" +"Вот пример, который лучше демонстрирует возможности B<select>(). Программа " +"осуществляет перенаправление одного порта TCP в другой. " + +#. type: Plain text +#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron +#: opensuse-tumbleweed +#, no-wrap +msgid "" +"#include E<lt>arpa/inet.hE<gt>\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>netinet/in.hE<gt>\n" +"#include E<lt>signal.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/select.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +"\\&\n" +"static int forward_port;\n" +"\\&\n" +"#undef max\n" +"#define max(x, y) ((x) E<gt> (y) ? (x) : (y))\n" +"\\&\n" +"static int\n" +"listen_socket(int listen_port)\n" +"{\n" +" int lfd;\n" +" int yes;\n" +" struct sockaddr_in addr;\n" +"\\&\n" +" lfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (lfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +"\\&\n" +" yes = 1;\n" +" if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR,\n" +" &yes, sizeof(yes)) == -1)\n" +" {\n" +" perror(\"setsockopt\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(listen_port);\n" +" addr.sin_family = AF_INET;\n" +" if (bind(lfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"bind\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" printf(\"accepting connections on port %d\\en\", listen_port);\n" +" listen(lfd, 10);\n" +" return lfd;\n" +"}\n" +"\\&\n" +"static int\n" +"connect_socket(int connect_port, char *address)\n" +"{\n" +" int cfd;\n" +" struct sockaddr_in addr;\n" +"\\&\n" +" cfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (cfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +"\\&\n" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(connect_port);\n" +" addr.sin_family = AF_INET;\n" +"\\&\n" +" if (!inet_aton(address, (struct in_addr *) &addr.sin_addr.s_addr)) {\n" +" fprintf(stderr, \"inet_aton(): bad IP address format\\en\");\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +"\\&\n" +" if (connect(cfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"connect()\");\n" +" shutdown(cfd, SHUT_RDWR);\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +" return cfd;\n" +"}\n" +"\\&\n" +"#define SHUT_FD1 do { \\e\n" +" if (fd1 E<gt>= 0) { \\e\n" +" shutdown(fd1, SHUT_RDWR); \\e\n" +" close(fd1); \\e\n" +" fd1 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +"\\&\n" +"#define SHUT_FD2 do { \\e\n" +" if (fd2 E<gt>= 0) { \\e\n" +" shutdown(fd2, SHUT_RDWR); \\e\n" +" close(fd2); \\e\n" +" fd2 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +"\\&\n" +"#define BUF_SIZE 1024\n" +"\\&\n" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int h;\n" +" int ready, nfds;\n" +" int fd1 = -1, fd2 = -1;\n" +" int buf1_avail = 0, buf1_written = 0;\n" +" int buf2_avail = 0, buf2_written = 0;\n" +" char buf1[BUF_SIZE], buf2[BUF_SIZE];\n" +" fd_set readfds, writefds, exceptfds;\n" +" ssize_t nbytes;\n" +"\\&\n" +" if (argc != 4) {\n" +" fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n" +" \"E<lt>forward-to-portE<gt> E<lt>forward-to-ip-addressE<gt>\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" signal(SIGPIPE, SIG_IGN);\n" +"\\&\n" +" forward_port = atoi(argv[2]);\n" +"\\&\n" +" h = listen_socket(atoi(argv[1]));\n" +" if (h == -1)\n" +" exit(EXIT_FAILURE);\n" +"\\&\n" +" for (;;) {\n" +" nfds = 0;\n" +"\\&\n" +" FD_ZERO(&readfds);\n" +" FD_ZERO(&writefds);\n" +" FD_ZERO(&exceptfds);\n" +" FD_SET(h, &readfds);\n" +" nfds = max(nfds, h);\n" +"\\&\n" +" if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd1, &readfds);\n" +" /* Note: nfds is updated below, when fd1 is added to\n" +" exceptfds. */\n" +" if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd2, &readfds);\n" +"\\&\n" +" if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0)\n" +" FD_SET(fd1, &writefds);\n" +" if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0)\n" +" FD_SET(fd2, &writefds);\n" +"\\&\n" +" if (fd1 E<gt> 0) {\n" +" FD_SET(fd1, &exceptfds);\n" +" nfds = max(nfds, fd1);\n" +" }\n" +" if (fd2 E<gt> 0) {\n" +" FD_SET(fd2, &exceptfds);\n" +" nfds = max(nfds, fd2);\n" +" }\n" +"\\&\n" +" ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL);\n" +"\\&\n" +" if (ready == -1 && errno == EINTR)\n" +" continue;\n" +"\\&\n" +" if (ready == -1) {\n" +" perror(\"select()\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +"\\&\n" +" if (FD_ISSET(h, &readfds)) {\n" +" socklen_t addrlen;\n" +" struct sockaddr_in client_addr;\n" +" int fd;\n" +"\\&\n" +" addrlen = sizeof(client_addr);\n" +" memset(&client_addr, 0, addrlen);\n" +" fd = accept(h, (struct sockaddr *) &client_addr, &addrlen);\n" +" if (fd == -1) {\n" +" perror(\"accept()\");\n" +" } else {\n" +" SHUT_FD1;\n" +" SHUT_FD2;\n" +" buf1_avail = buf1_written = 0;\n" +" buf2_avail = buf2_written = 0;\n" +" fd1 = fd;\n" +" fd2 = connect_socket(forward_port, argv[3]);\n" +" if (fd2 == -1)\n" +" SHUT_FD1;\n" +" else\n" +" printf(\"connect from %s\\en\",\n" +" inet_ntoa(client_addr.sin_addr));\n" +"\\&\n" +" /* Skip any events on the old, closed file\n" +" descriptors. */\n" +"\\&\n" +" continue;\n" +" }\n" +" }\n" +"\\&\n" +" /* NB: read OOB data before normal reads. */\n" +"\\&\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &exceptfds)) {\n" +" char c;\n" +"\\&\n" +" nbytes = recv(fd1, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" send(fd2, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &exceptfds)) {\n" +" char c;\n" +"\\&\n" +" nbytes = recv(fd2, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" send(fd1, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &readfds)) {\n" +" nbytes = read(fd1, buf1 + buf1_avail,\n" +" BUF_SIZE - buf1_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf1_avail += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &readfds)) {\n" +" nbytes = read(fd2, buf2 + buf2_avail,\n" +" BUF_SIZE - buf2_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf2_avail += nbytes;\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &writefds) && buf2_avail E<gt> 0) {\n" +" nbytes = write(fd1, buf2 + buf2_written,\n" +" buf2_avail - buf2_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf2_written += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &writefds) && buf1_avail E<gt> 0) {\n" +" nbytes = write(fd2, buf1 + buf1_written,\n" +" buf1_avail - buf1_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf1_written += nbytes;\n" +" }\n" +"\\&\n" +" /* Check if write data has caught read data. */\n" +"\\&\n" +" if (buf1_written == buf1_avail)\n" +" buf1_written = buf1_avail = 0;\n" +" if (buf2_written == buf2_avail)\n" +" buf2_written = buf2_avail = 0;\n" +"\\&\n" +" /* One side has closed the connection, keep\n" +" writing to the other side until empty. */\n" +"\\&\n" +" if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n" +" SHUT_FD2;\n" +" if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n" +" SHUT_FD1;\n" +" }\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"The above program properly forwards most kinds of TCP connections including " +"OOB signal data transmitted by B<telnet> servers. It handles the tricky " +"problem of having data flow in both directions simultaneously. You might " +"think it more efficient to use a B<fork>(2) call and devote a thread to " +"each stream. This becomes more tricky than you might suspect. Another idea " +"is to set nonblocking I/O using B<fcntl>(2). This also has its problems " +"because you end up using inefficient timeouts." +msgstr "" +"Вышеприведенная программа правильно перенаправляет большинство данных задач, " +"использующих соединения TCP, включая внепоточные (OOB) данные, передаваемые " +"серверами B<telnet>. Она справляется со сложной проблемой поддержания " +"одновременного двустороннего обмена данными. Возможно, вы решите, что " +"эффективнее использовать B<fork>(2) и выделить отдельную нить для каждого " +"потока. На самом деле это сложнее, чем кажется. Другой идеей может быть " +"использование неблокирующего ввода-вывода с помощью B<fcntl>(2). Это также " +"может вызвать проблемы из-за того, что придётся использовать неэффективные " +"таймауты." + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, fuzzy +#| msgid "" +#| "The program does not handle more than one simultaneous connection at a " +#| "time, although it could easily be extended to do this with a linked list " +#| "of buffers\\(emone for each connection. At the moment, new connections " +#| "cause the current connection to be dropped." +msgid "" +"The program does not handle more than one simultaneous connection at a time, " +"although it could easily be extended to do this with a linked list of " +"buffers\\[em]one for each connection. At the moment, new connections cause " +"the current connection to be dropped." +msgstr "" +"Программа не обрабатывает более одного соединения, однако она может быть " +"легко доработана путем добавления связанного списка буферов — по одному на " +"каждое соединение. В данный момент новые соединения приводят к закрытию " +"текущего." + +#. type: SH +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +#, no-wrap +msgid "SEE ALSO" +msgstr "СМ. ТАКЖЕ" + +#. type: Plain text +#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide +#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed +msgid "" +"B<accept>(2), B<connect>(2), B<poll>(2), B<read>(2), B<recv>(2), " +"B<select>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<epoll>(7)" +msgstr "" +"B<accept>(2), B<connect>(2), B<poll>(2), B<read>(2), B<recv>(2), " +"B<select>(2), B<send>(2), B<sigprocmask>(2), B<write>(2), B<epoll>(7)" + +#. type: TH +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "2023-02-05" +msgstr "5 февраля 2023 г." + +#. type: TH +#: debian-bookworm +#, no-wrap +msgid "Linux man-pages 6.03" +msgstr "Linux man-pages 6.03" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "static volatile sig_atomic_t got_SIGCHLD = 0;\n" +msgstr "static volatile sig_atomic_t got_SIGCHLD = 0;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static void\n" +"child_sig_handler(int sig)\n" +"{\n" +" got_SIGCHLD = 1;\n" +"}\n" +msgstr "" +"static void\n" +"child_sig_handler(int sig)\n" +"{\n" +" got_SIGCHLD = 1;\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" sigset_t sigmask, empty_mask;\n" +" struct sigaction sa;\n" +" fd_set readfds, writefds, exceptfds;\n" +" int r;\n" +msgstr "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" sigset_t sigmask, empty_mask;\n" +" struct sigaction sa;\n" +" fd_set readfds, writefds, exceptfds;\n" +" int r;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" sigemptyset(&sigmask);\n" +" sigaddset(&sigmask, SIGCHLD);\n" +" if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n" +" perror(\"sigprocmask\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" +" sigemptyset(&sigmask);\n" +" sigaddset(&sigmask, SIGCHLD);\n" +" if (sigprocmask(SIG_BLOCK, &sigmask, NULL) == -1) {\n" +" perror(\"sigprocmask\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" sa.sa_flags = 0;\n" +" sa.sa_handler = child_sig_handler;\n" +" sigemptyset(&sa.sa_mask);\n" +" if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n" +" perror(\"sigaction\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" +" sa.sa_flags = 0;\n" +" sa.sa_handler = child_sig_handler;\n" +" sigemptyset(&sa.sa_mask);\n" +" if (sigaction(SIGCHLD, &sa, NULL) == -1) {\n" +" perror(\"sigaction\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " sigemptyset(&empty_mask);\n" +msgstr " sigemptyset(&empty_mask);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" for (;;) { /* main loop */\n" +" /* Initialize readfds, writefds, and exceptfds\n" +" before the pselect() call. (Code omitted.) */\n" +msgstr "" +" for (;;) { /* главный цикл */\n" +" /* Инициализация readfds, writefds и exceptfds\n" +" до вызова pselect() (код не показан). */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" r = pselect(nfds, &readfds, &writefds, &exceptfds,\n" +" NULL, &empty_mask);\n" +" if (r == -1 && errno != EINTR) {\n" +" /* Handle error */\n" +" }\n" +msgstr "" +" r = pselect(nfds, &readfds, &writefds, &exceptfds,\n" +" NULL, &empty_mask);\n" +" if (r == -1 && errno != EINTR) {\n" +" /* обработка ошибки */\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (got_SIGCHLD) {\n" +" got_SIGCHLD = 0;\n" +msgstr "" +" if (got_SIGCHLD) {\n" +" got_SIGCHLD = 0;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" /* Handle signalled event here; e.g., wait() for all\n" +" terminated children. (Code omitted.) */\n" +" }\n" +msgstr "" +" /* Здесь обработка сигнального события; например с\n" +" помощью wait() для завершения потомком (код не показан). */\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" /* main body of program */\n" +" }\n" +"}\n" +msgstr "" +" /* код основной программы */\n" +" }\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#include E<lt>arpa/inet.hE<gt>\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>netinet/in.hE<gt>\n" +"#include E<lt>signal.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/select.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" +msgstr "" +"#include E<lt>arpa/inet.hE<gt>\n" +"#include E<lt>errno.hE<gt>\n" +"#include E<lt>netinet/in.hE<gt>\n" +"#include E<lt>signal.hE<gt>\n" +"#include E<lt>stdio.hE<gt>\n" +"#include E<lt>stdlib.hE<gt>\n" +"#include E<lt>string.hE<gt>\n" +"#include E<lt>sys/select.hE<gt>\n" +"#include E<lt>sys/socket.hE<gt>\n" +"#include E<lt>unistd.hE<gt>\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "static int forward_port;\n" +msgstr "static int forward_port;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#undef max\n" +"#define max(x, y) ((x) E<gt> (y) ? (x) : (y))\n" +msgstr "" +"#undef max\n" +"#define max(x, y) ((x) E<gt> (y) ? (x) : (y))\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static int\n" +"listen_socket(int listen_port)\n" +"{\n" +" int lfd;\n" +" int yes;\n" +" struct sockaddr_in addr;\n" +msgstr "" +"static int\n" +"listen_socket(int listen_port)\n" +"{\n" +" int lfd;\n" +" int yes;\n" +" struct sockaddr_in addr;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" lfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (lfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +msgstr "" +" lfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (lfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" yes = 1;\n" +" if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR,\n" +" &yes, sizeof(yes)) == -1)\n" +" {\n" +" perror(\"setsockopt\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +msgstr "" +" yes = 1;\n" +" if (setsockopt(lfd, SOL_SOCKET, SO_REUSEADDR,\n" +" &yes, sizeof(yes)) == -1)\n" +" {\n" +" perror(\"setsockopt\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(listen_port);\n" +" addr.sin_family = AF_INET;\n" +" if (bind(lfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"bind\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" +msgstr "" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(listen_port);\n" +" addr.sin_family = AF_INET;\n" +" if (bind(lfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"bind\");\n" +" close(lfd);\n" +" return -1;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" printf(\"accepting connections on port %d\\en\", listen_port);\n" +" listen(lfd, 10);\n" +" return lfd;\n" +"}\n" +msgstr "" +" printf(\"приём соединений на порту %d\\en\", listen_port);\n" +" listen(lfd, 10);\n" +" return lfd;\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"static int\n" +"connect_socket(int connect_port, char *address)\n" +"{\n" +" int cfd;\n" +" struct sockaddr_in addr;\n" +msgstr "" +"static int\n" +"connect_socket(int connect_port, char *address)\n" +"{\n" +" int cfd;\n" +" struct sockaddr_in addr;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" cfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (cfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" +msgstr "" +" cfd = socket(AF_INET, SOCK_STREAM, 0);\n" +" if (cfd == -1) {\n" +" perror(\"socket\");\n" +" return -1;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(connect_port);\n" +" addr.sin_family = AF_INET;\n" +msgstr "" +" memset(&addr, 0, sizeof(addr));\n" +" addr.sin_port = htons(connect_port);\n" +" addr.sin_family = AF_INET;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (!inet_aton(address, (struct in_addr *) &addr.sin_addr.s_addr)) {\n" +" fprintf(stderr, \"inet_aton(): bad IP address format\\en\");\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +msgstr "" +" if (!inet_aton(address, (struct in_addr *) &addr.sin_addr.s_addr)) {\n" +" fprintf(stderr, \"inet_aton(): неправильный формат IP-адреса\\en\");\n" +" close(cfd);\n" +" return -1;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (connect(cfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"connect()\");\n" +" shutdown(cfd, SHUT_RDWR);\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +" return cfd;\n" +"}\n" +msgstr "" +" if (connect(cfd, (struct sockaddr *) &addr, sizeof(addr)) == -1) {\n" +" perror(\"connect()\");\n" +" shutdown(cfd, SHUT_RDWR);\n" +" close(cfd);\n" +" return -1;\n" +" }\n" +" return cfd;\n" +"}\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#define SHUT_FD1 do { \\e\n" +" if (fd1 E<gt>= 0) { \\e\n" +" shutdown(fd1, SHUT_RDWR); \\e\n" +" close(fd1); \\e\n" +" fd1 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +msgstr "" +"#define SHUT_FD1 do { \\e\n" +" if (fd1 E<gt>= 0) { \\e\n" +" shutdown(fd1, SHUT_RDWR); \\e\n" +" close(fd1); \\e\n" +" fd1 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"#define SHUT_FD2 do { \\e\n" +" if (fd2 E<gt>= 0) { \\e\n" +" shutdown(fd2, SHUT_RDWR); \\e\n" +" close(fd2); \\e\n" +" fd2 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" +msgstr "" +"#define SHUT_FD2 do { \\e\n" +" if (fd2 E<gt>= 0) { \\e\n" +" shutdown(fd2, SHUT_RDWR); \\e\n" +" close(fd2); \\e\n" +" fd2 = -1; \\e\n" +" } \\e\n" +" } while (0)\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "#define BUF_SIZE 1024\n" +msgstr "#define BUF_SIZE 1024\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int h;\n" +" int ready, nfds;\n" +" int fd1 = -1, fd2 = -1;\n" +" int buf1_avail = 0, buf1_written = 0;\n" +" int buf2_avail = 0, buf2_written = 0;\n" +" char buf1[BUF_SIZE], buf2[BUF_SIZE];\n" +" fd_set readfds, writefds, exceptfds;\n" +" ssize_t nbytes;\n" +msgstr "" +"int\n" +"main(int argc, char *argv[])\n" +"{\n" +" int h;\n" +" int ready, nfds;\n" +" int fd1 = -1, fd2 = -1;\n" +" int buf1_avail = 0, buf1_written = 0;\n" +" int buf2_avail = 0, buf2_written = 0;\n" +" char buf1[BUF_SIZE], buf2[BUF_SIZE];\n" +" fd_set readfds, writefds, exceptfds;\n" +" ssize_t nbytes;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (argc != 4) {\n" +" fprintf(stderr, \"Usage\\en\\etfwd E<lt>listen-portE<gt> \"\n" +" \"E<lt>forward-to-portE<gt> E<lt>forward-to-ip-addressE<gt>\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" +" if (argc != 4) {\n" +" fprintf(stderr, \"Использование\\en\\etfwd E<lt>прослушиваемый-портE<gt> \"\n" +" \"E<lt>порт-перенаправленияE<gt> E<lt>ip-адрес-перенаправленияE<gt>\\en\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " signal(SIGPIPE, SIG_IGN);\n" +msgstr " signal(SIGPIPE, SIG_IGN);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " forward_port = atoi(argv[2]);\n" +msgstr " forward_port = atoi(argv[2]);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" h = listen_socket(atoi(argv[1]));\n" +" if (h == -1)\n" +" exit(EXIT_FAILURE);\n" +msgstr "" +" h = listen_socket(atoi(argv[1]));\n" +" if (h == -1)\n" +" exit(EXIT_FAILURE);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" for (;;) {\n" +" nfds = 0;\n" +msgstr "" +" for (;;) {\n" +" nfds = 0;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" FD_ZERO(&readfds);\n" +" FD_ZERO(&writefds);\n" +" FD_ZERO(&exceptfds);\n" +" FD_SET(h, &readfds);\n" +" nfds = max(nfds, h);\n" +msgstr "" +" FD_ZERO(&readfds);\n" +" FD_ZERO(&writefds);\n" +" FD_ZERO(&exceptfds);\n" +" FD_SET(h, &readfds);\n" +" nfds = max(nfds, h);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd1, &readfds);\n" +" /* Note: nfds is updated below, when fd1 is added to\n" +" exceptfds. */\n" +" if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd2, &readfds);\n" +msgstr "" +" if (fd1 E<gt> 0 && buf1_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd1, &readfds);\n" +" /* Замечание: nfds обновляется ниже, когда добавляется fd1\n" +" в exceptfds. */\n" +" if (fd2 E<gt> 0 && buf2_avail E<lt> BUF_SIZE)\n" +" FD_SET(fd2, &readfds);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0)\n" +" FD_SET(fd1, &writefds);\n" +" if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0)\n" +" FD_SET(fd2, &writefds);\n" +msgstr "" +" if (fd1 E<gt> 0 && buf2_avail - buf2_written E<gt> 0)\n" +" FD_SET(fd1, &writefds);\n" +" if (fd2 E<gt> 0 && buf1_avail - buf1_written E<gt> 0)\n" +" FD_SET(fd2, &writefds);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (fd1 E<gt> 0) {\n" +" FD_SET(fd1, &exceptfds);\n" +" nfds = max(nfds, fd1);\n" +" }\n" +" if (fd2 E<gt> 0) {\n" +" FD_SET(fd2, &exceptfds);\n" +" nfds = max(nfds, fd2);\n" +" }\n" +msgstr "" +" if (fd1 E<gt> 0) {\n" +" FD_SET(fd1, &exceptfds);\n" +" nfds = max(nfds, fd1);\n" +" }\n" +" if (fd2 E<gt> 0) {\n" +" FD_SET(fd2, &exceptfds);\n" +" nfds = max(nfds, fd2);\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL);\n" +msgstr " ready = select(nfds + 1, &readfds, &writefds, &exceptfds, NULL);\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (ready == -1 && errno == EINTR)\n" +" continue;\n" +msgstr "" +" if (ready == -1 && errno == EINTR)\n" +" continue;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (ready == -1) {\n" +" perror(\"select()\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" +msgstr "" +" if (ready == -1) {\n" +" perror(\"select()\");\n" +" exit(EXIT_FAILURE);\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (FD_ISSET(h, &readfds)) {\n" +" socklen_t addrlen;\n" +" struct sockaddr_in client_addr;\n" +" int fd;\n" +msgstr "" +" if (FD_ISSET(h, &readfds)) {\n" +" socklen_t addrlen;\n" +" struct sockaddr_in client_addr;\n" +" int fd;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" addrlen = sizeof(client_addr);\n" +" memset(&client_addr, 0, addrlen);\n" +" fd = accept(h, (struct sockaddr *) &client_addr, &addrlen);\n" +" if (fd == -1) {\n" +" perror(\"accept()\");\n" +" } else {\n" +" SHUT_FD1;\n" +" SHUT_FD2;\n" +" buf1_avail = buf1_written = 0;\n" +" buf2_avail = buf2_written = 0;\n" +" fd1 = fd;\n" +" fd2 = connect_socket(forward_port, argv[3]);\n" +" if (fd2 == -1)\n" +" SHUT_FD1;\n" +" else\n" +" printf(\"connect from %s\\en\",\n" +" inet_ntoa(client_addr.sin_addr));\n" +msgstr "" +" addrlen = sizeof(client_addr);\n" +" memset(&client_addr, 0, addrlen);\n" +" fd = accept(h, (struct sockaddr *) &client_addr, &addrlen);\n" +" if (fd == -1) {\n" +" perror(\"accept()\");\n" +" } else {\n" +" SHUT_FD1;\n" +" SHUT_FD2;\n" +" buf1_avail = buf1_written = 0;\n" +" buf2_avail = buf2_written = 0;\n" +" fd1 = fd;\n" +" fd2 = connect_socket(forward_port, argv[3]);\n" +" if (fd2 == -1)\n" +" SHUT_FD1;\n" +" else\n" +" printf(\"connect from %s\\en\",\n" +" inet_ntoa(client_addr.sin_addr));\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" /* Skip any events on the old, closed file\n" +" descriptors. */\n" +msgstr "" +" /* пропускаем все события для старых, закрытых\n" +" файловых дескрипторов */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" continue;\n" +" }\n" +" }\n" +msgstr "" +" continue;\n" +" }\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " /* NB: read OOB data before normal reads. */\n" +msgstr " /* Замечание: чтение данных OOB до обычных. */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &exceptfds)) {\n" +" char c;\n" +msgstr "" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &exceptfds)) {\n" +" char c;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" nbytes = recv(fd1, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" send(fd2, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &exceptfds)) {\n" +" char c;\n" +msgstr "" +" nbytes = recv(fd1, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" send(fd2, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &exceptfds)) {\n" +" char c;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" nbytes = recv(fd2, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" send(fd1, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &readfds)) {\n" +" nbytes = read(fd1, buf1 + buf1_avail,\n" +" BUF_SIZE - buf1_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf1_avail += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &readfds)) {\n" +" nbytes = read(fd2, buf2 + buf2_avail,\n" +" BUF_SIZE - buf2_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf2_avail += nbytes;\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &writefds) && buf2_avail E<gt> 0) {\n" +" nbytes = write(fd1, buf2 + buf2_written,\n" +" buf2_avail - buf2_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf2_written += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &writefds) && buf1_avail E<gt> 0) {\n" +" nbytes = write(fd2, buf1 + buf1_written,\n" +" buf1_avail - buf1_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf1_written += nbytes;\n" +" }\n" +msgstr "" +" nbytes = recv(fd2, &c, 1, MSG_OOB);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" send(fd1, &c, 1, MSG_OOB);\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &readfds)) {\n" +" nbytes = read(fd1, buf1 + buf1_avail,\n" +" BUF_SIZE - buf1_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf1_avail += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &readfds)) {\n" +" nbytes = read(fd2, buf2 + buf2_avail,\n" +" BUF_SIZE - buf2_avail);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf2_avail += nbytes;\n" +" }\n" +" if (fd1 E<gt> 0 && FD_ISSET(fd1, &writefds) && buf2_avail E<gt> 0) {\n" +" nbytes = write(fd1, buf2 + buf2_written,\n" +" buf2_avail - buf2_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD1;\n" +" else\n" +" buf2_written += nbytes;\n" +" }\n" +" if (fd2 E<gt> 0 && FD_ISSET(fd2, &writefds) && buf1_avail E<gt> 0) {\n" +" nbytes = write(fd2, buf1 + buf1_written,\n" +" buf1_avail - buf1_written);\n" +" if (nbytes E<lt> 1)\n" +" SHUT_FD2;\n" +" else\n" +" buf1_written += nbytes;\n" +" }\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid " /* Check if write data has caught read data. */\n" +msgstr " /* Проверить, что записанные данные были прочитаны. */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (buf1_written == buf1_avail)\n" +" buf1_written = buf1_avail = 0;\n" +" if (buf2_written == buf2_avail)\n" +" buf2_written = buf2_avail = 0;\n" +msgstr "" +" if (buf1_written == buf1_avail)\n" +" buf1_written = buf1_avail = 0;\n" +" if (buf2_written == buf2_avail)\n" +" buf2_written = buf2_avail = 0;\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" /* One side has closed the connection, keep\n" +" writing to the other side until empty. */\n" +msgstr "" +" /* Одна из сторон закрыла соединение, продолжать\n" +" записывать, пока другая сторона не закончит. */\n" + +#. type: Plain text +#: debian-bookworm opensuse-leap-15-6 +#, no-wrap +msgid "" +" if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n" +" SHUT_FD2;\n" +" if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n" +" SHUT_FD1;\n" +" }\n" +" exit(EXIT_SUCCESS);\n" +"}\n" +msgstr "" +" if (fd1 E<lt> 0 && buf1_avail - buf1_written == 0)\n" +" SHUT_FD2;\n" +" if (fd2 E<lt> 0 && buf2_avail - buf2_written == 0)\n" +" SHUT_FD1;\n" +" }\n" +" exit(EXIT_SUCCESS);\n" +"}\n" + +#. type: TH +#: debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "2023-05-03" +msgstr "3 мая 2023 г." + +#. type: TH +#: debian-unstable opensuse-tumbleweed +#, no-wrap +msgid "Linux man-pages 6.05.01" +msgstr "Linux man-pages 6.05.01" + +#. type: TH +#: opensuse-leap-15-6 +#, no-wrap +msgid "Linux man-pages 6.04" +msgstr "Linux man-pages 6.04" |