# Russian translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # Azamat Hackimov , 2013, 2016. # Dmitriy Ovchinnikov , 2012. # Dmitry Bolkhovskikh , 2017. # Katrin Kutepova , 2018. # Yuri Kozlov , 2011-2019. # Иван Павлов , 2017. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2024-06-01 06:33+0200\n" "PO-Revision-Date: 2019-10-15 18:59+0300\n" "Last-Translator: Yuri Kozlov \n" "Language-Team: Russian \n" "Language: ru\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=4; plural=(n%10==1 && n%100!=11 ? 0 : n%10>=2 && n" "%10<=4 && (n%100<12 || n%100>14) ? 1 : n%10==0 || (n%10>=5 && n%10<=9) || (n" "%100>=11 && n%100<=14)? 2 : 3);\n" "X-Generator: Lokalize 2.0\n" #. type: TH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "userfaultfd" msgstr "userfaultfd" #. type: TH #: archlinux debian-unstable opensuse-tumbleweed #, no-wrap msgid "2024-05-02" msgstr "2 мая 2024 г." #. type: TH #: archlinux debian-unstable #, fuzzy, no-wrap #| msgid "Linux man-pages 6.7" msgid "Linux man-pages 6.8" msgstr "Linux man-pages 6.7" #. 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 "" "userfaultfd - create a file descriptor for handling page faults in user space" msgstr "" "userfaultfd - создаёт файловый дескриптор для обработки страничных ошибок в " "пользовательском пространстве" #. 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, 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 #, no-wrap msgid "" "B<#include Efcntl.hE> /* Definition of B constants */\n" "B<#include Esys/syscall.hE> /* Definition of B constants */\n" "B<#include Elinux/userfaultfd.hE> /* Definition of B constants */\n" "B<#include Eunistd.hE>\n" msgstr "" "B<#include Efcntl.hE> /* определения констант B */\n" "B<#include Esys/syscall.hE> /* определения констант B */\n" "B<#include Elinux/userfaultfd.hE> /* определения констант B */\n" "B<#include Eunistd.hE>\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BIB<);>\n" msgstr "BIB<);>\n" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I: glibc provides no wrapper for B(), necessitating the " "use of B(2)." msgstr "" #. 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 msgid "" "B() creates a new userfaultfd object that can be used for " "delegation of page-fault handling to a user-space application, and returns a " "file descriptor that refers to the new object. The new userfaultfd object " "is configured using B(2)." msgstr "" "Вызов B() создаёт новый объект userfaultfd, который можно " "использовать для передачи обработки страничных ошибок приложению " "пользовательского пространства, и возвращает файловый дескриптор, " "ссылающийся на новый объект. Новый объект userfaultfd настраивается с " "помощью B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Once the userfaultfd object is configured, the application can use " "B(2) to receive userfaultfd notifications. The reads from " "userfaultfd may be blocking or non-blocking, depending on the value of " "I used for the creation of the userfaultfd or subsequent calls to " "B(2)." msgstr "" "После настройки объекта userfaultfd приложение может использовать вызов " "B(2) для получения уведомлений userfaultfd. Чтение из userfaultfd " "может быть блокирующим и не блокирующим, в зависимости от использованного " "при создании userfaultfd значения I или последующих вызовов " "B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The following values may be bitwise ORed in I to change the behavior " "of B():" msgstr "" "Для изменения поведения B() можно использовать следующие " "значения I (через OR):" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Enable the close-on-exec flag for the new userfaultfd file descriptor. See " "the description of the B flag in B(2)." msgstr "" "Включить флаг close-on-exec для нового открытого файлового дескриптора " "userfaultfd. Смотрите описание флага B в B(2)." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Enables non-blocking operation for the userfaultfd object. See the " "description of the B flag in B(2)." msgstr "" "Включить не блокирующую работу с объектом userfaultfd. Смотрите описание " "флага B в B(2)." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "This is an userfaultfd-specific flag that was introduced in Linux 5.11. " "When set, the userfaultfd object will only be able to handle page faults " "originated from the user space on the registered regions. When a kernel-" "originated fault was triggered on the registered range with this " "userfaultfd, a B signal will be delivered." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When the last file descriptor referring to a userfaultfd object is closed, " "all memory ranges that were registered with the object are unregistered and " "unread events are flushed." msgstr "" "Когда закрывается последний ссылающийся на объект userfaultfd файловый " "дескриптор, для всех диапазонов памяти, зарегистрированных в этом объекте, " "снимается регистрация, а все непрочитанные события очищаются." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Userfaultfd supports three modes of registration:" msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "B (since 4.10)" msgid "B (since Linux 4.10)" msgstr "B (начиная с Linux 4.10)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When registered with B mode, user-space will " "receive a page-fault notification when a missing page is accessed. The " "faulted thread will be stopped from execution until the page fault is " "resolved from user-space by either an B or an " "B ioctl." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "B (since 5.13)" msgid "B (since Linux 5.13)" msgstr "B (начиная с Linux 5.13)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When registered with B mode, user-space will " "receive a page-fault notification when a minor page fault occurs. That is, " "when a backing page is in the page cache, but page table entries don't yet " "exist. The faulted thread will be stopped from execution until the page " "fault is resolved from user-space by an B ioctl." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "B (since 5.7)" msgid "B (since Linux 5.7)" msgstr "B (начиная с Linux 5.7)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When registered with B mode, user-space will " "receive a page-fault notification when a write-protected page is written. " "The faulted thread will be stopped from execution until user-space write-" "unprotects the page using an B ioctl." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Multiple modes can be enabled at the same time for the same memory range." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 4.14, a userfaultfd page-fault notification can selectively " "embed faulting thread ID information into the notification. One needs to " "enable this feature explicitly using the B feature " "bit when initializing the userfaultfd context. By default, thread ID " "reporting is disabled." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Usage" msgstr "Использование" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The userfaultfd mechanism is designed to allow a thread in a multithreaded " "program to perform user-space paging for the other threads in the process. " "When a page fault occurs for one of the regions registered to the " "userfaultfd object, the faulting thread is put to sleep and an event is " "generated that can be read via the userfaultfd file descriptor. The fault-" "handling thread reads events from this file descriptor and services them " "using the operations described in B(2). When servicing " "the page fault events, the fault-handling thread can trigger a wake-up for " "the sleeping thread." msgstr "" "Механизм userfaultfd разработан для того, чтобы позволить нити в " "многонитевой программе выполнять деление на страницы пользовательского " "пространства других нитей процесса. При возникновении страничной ошибки в " "одной из зарегистрированных в объекте userfaultfd областей нить с ошибкой " "засыпает и генерируется событие, которое можно прочитать через файловый " "дескриптор userfaultfd. Нить обработки страничных ошибок читает сообщения из " "этого файлового дескриптора и обслуживает из с помощью операций, описанных в " "B(2). В время этого нить обработки страничных ошибок " "может привести в действие механизм пробуждения спящей нити." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "It is possible for the faulting threads and the fault-handling threads to " "run in the context of different processes. In this case, these threads may " "belong to different programs, and the program that executes the faulting " "threads will not necessarily cooperate with the program that handles the " "page faults. In such non-cooperative mode, the process that monitors " "userfaultfd and handles page faults needs to be aware of the changes in the " "virtual memory layout of the faulting process to avoid memory corruption." msgstr "" "Нити с ошибкой и нити обработки страничных ошибок могут быть запущены в " "контексте различных процессов. В этом случае данные нити могут принадлежать " "разным программам, а программам, выполняющим нити с ошибкой, не обязательно " "взаимодействовать с программой, обрабатывающей страничные ошибки. В таком " "разобщённом режиме процессу, следящему за userfaultfd и обрабатывающему " "страничные ошибки, необходимо знать об изменениях в раскладке виртуальной " "памяти процесса с ошибкой, чтобы не допустить повреждение памяти." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 4.11, userfaultfd can also notify the fault-handling threads " "about changes in the virtual memory layout of the faulting process. In " "addition, if the faulting process invokes B(2), the userfaultfd " "objects associated with the parent may be duplicated into the child process " "and the userfaultfd monitor will be notified (via the B " "described below) about the file descriptor associated with the userfault " "objects created for the child process, which allows the userfaultfd monitor " "to perform user-space paging for the child process. Unlike page faults " "which have to be synchronous and require an explicit or implicit wakeup, all " "other events are delivered asynchronously and the non-cooperative process " "resumes execution as soon as the userfaultfd manager executes B(2). " "The userfaultfd manager should carefully synchronize calls to B " "with the processing of events." msgstr "" "Начиная с Linux 4.11, userfaultfd также уведомляет нити обработки страничных " "ошибок об изменениях в раскладке виртуальной памяти процесса с ошибкой. " "Также, если процесс с ошибкой вызывает B(2), то для объекта " "userfaultfd, связанного с родителем, в дочернем процессе может быть создать " "дубликат, и отслеживающий userfaultfd также будет уведомлён (смотрите " "описание B ниже) о файловом дескрипторе, связанном с " "объектом userfault, который был создан для дочернего процесса, что позволяет " "отслеживающему userfaultfd выполнять деление на страницы пользовательское " "пространство дочернего процесса. В отличие от страничных ошибок, которые " "происходят синхронно и требуют явного или неявного пробуждения, все " "остальные события доставляются асинхронно и не взаимодействующий процесс " "возобновляет выполнение сразу же после того как отслеживающий userfaultfd " "выполняет B(2). Отслеживающий userfaultfd должен корректно " "синхронизировать вызовы B при обработке событий." #. #-#-#-#-# archlinux: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# debian-bookworm: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .PP #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# debian-unstable: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# fedora-40: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# fedora-rawhide: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# mageia-cauldron: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# opensuse-leap-15-6: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .PP #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #. #-#-#-#-# opensuse-tumbleweed: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# #. Regarding the preceding sentence, Mike Rapoport says: #. The major point here is that current events delivery model could be #. problematic for multi-threaded monitor. I even suspect that it would be #. impossible to ensure synchronization between page faults and non-page #. fault events in multi-threaded monitor. #. .P #. FIXME elaborate about non-cooperating mode, describe its limitations #. for kernels before Linux 4.11, features added in Linux 4.11 #. and limitations remaining in Linux 4.11 #. Maybe it's worth adding a dedicated sub-section... #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The current asynchronous model of the event delivery is optimal for single " "threaded non-cooperative userfaultfd manager implementations." msgstr "" "Имеющаяся асинхронная модель доставки событий оптимальна для реализации " "однонитевой не взаимодействующей отслеживающей userfaultfd программы." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 5.7, userfaultfd is able to do synchronous page dirty tracking " "using the new write-protect register mode. One should check against the " "feature bit B before using this feature. " "Similar to the original userfaultfd missing mode, the write-protect mode " "will generate a userfaultfd notification when the protected page is " "written. The user needs to resolve the page fault by unprotecting the " "faulted page and kicking the faulted thread to continue. For more " "information, please refer to the \"Userfaultfd write-protect mode\" section." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Userfaultfd operation" msgstr "Работа с userfaultfd" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, fuzzy #| msgid "" #| "After the userfaultfd object is created with B(), the " #| "application must enable it using the B B(2) " #| "operation. This operation allows a handshake between the kernel and user " #| "space to determine the API version and supported features. This " #| "operation must be performed before any of the other B(2) " #| "operations described below (or those operations fail with the B " #| "error)." msgid "" "After the userfaultfd object is created with B(), the " "application must enable it using the B B(2) operation. " "This operation allows a two-step handshake between the kernel and user space " "to determine what API version and features the kernel supports, and then to " "enable those features user space wants. This operation must be performed " "before any of the other B(2) operations described below (or those " "operations fail with the B error)." msgstr "" "После создания объекта userfaultfd с помощью B() приложение " "должно включить его с помощью операции B вызова B(2). " "Данная операция позволяет согласовать между ядром и пользовательским " "пространством версию программного интерфейса поддерживаемых свойств. Эта " "операция должна быть выполнено самой первой среди других операций " "B(2), описываемых ниже (в противном случае эти операции завершаются " "ошибкой B)." #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, fuzzy #| msgid "" #| "After a successful B operation, the application then " #| "registers memory address ranges using the B B(2) " #| "operation. After successful completion of a B " #| "operation, a page fault occurring in the requested memory range, and " #| "satisfying the mode defined at the registration time, will be forwarded " #| "by the kernel to the user-space application. The application can then " #| "use the B B or B " #| "B(2) operations to resolve the page fault." msgid "" "After a successful B operation, the application then registers " "memory address ranges using the B B(2) operation. " "After successful completion of a B operation, a page fault " "occurring in the requested memory range, and satisfying the mode defined at " "the registration time, will be forwarded by the kernel to the user-space " "application. The application can then use various (e.g., B, " "B, or B) B(2) operations to " "resolve the page fault." msgstr "" "После успешного выполнения B приложение должно зарегистрировать " "диапазоны адресов памяти с помощью операции B вызова " "B(2). После успешного выполнения B страничная " "ошибка, возникающая в запрошенном диапазоне и удовлетворяющая режиму, " "определённому в момент регистрации, будет переслана ядром приложению в " "пользовательском пространстве. Для решения страничной ошибки приложение " "может использовать операцию B, B или " "B вызова B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 4.14, if the application sets the B feature " "bit using the B B(2), no page-fault notification will be " "forwarded to user space. Instead a B signal is delivered to the " "faulting process. With this feature, userfaultfd can be used for robustness " "purposes to simply catch any access to areas within the registered address " "range that do not have pages allocated, without having to listen to " "userfaultfd events. No userfaultfd monitor will be required for dealing " "with such memory accesses. For example, this feature can be useful for " "applications that want to prevent the kernel from automatically allocating " "pages and filling holes in sparse files when the hole is accessed through a " "memory mapping." msgstr "" "Начиная с Linux 4.14, если приложение устанавливает бит свойства " "B с помощью B B(2), то уведомления о " "страничных ошибках не пересылаются в пользовательское пространство. Вместо " "этого в ошибшийся процесс посылается сигнал B. С данным свойством " "userfaultfd можно использовать в целях надёжности, просто ловя все попытки " "доступа к областях внутри зарегистрированного адресного диапазона, в котором " "нет выделенных страниц, не слушая при этом события userfaultfd. При таком " "доступе к памяти не потребуется процесс слежения за userfaultfd. Например, " "данное свойство может оказаться полезным приложениям, которые хотят не " "давать ядру выполнять автоматическое выделение страниц и заполнение дыр в " "разреженных файлах при обращении к дыре через отображение в памяти." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The B feature is implicitly inherited through " "B(2) if used in combination with B." msgstr "" "Свойство B неявно наследуется при B(2), если " "используется вместе с B." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Details of the various B(2) operations can be found in " "B(2)." msgstr "" "Подробности о различных операциях B(2) можно найти в " "B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 4.11, events other than page-fault may enabled during " "B operation." msgstr "" "Начиная с Linux 4.11 при операции B можно включить не только " "события страничной ошибки." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Up to Linux 4.11, userfaultfd can be used only with anonymous private memory " "mappings. Since Linux 4.11, userfaultfd can be also used with hugetlbfs and " "shared memory mappings." msgstr "" "До Linux 4.11 объект userfaultfd мог быть использован только с анонимными " "частными отображениями памяти. Начиная с Linux 4.11 объект userfaultfd может " "также использоваться с отображениями общей памяти и hugetlbfs." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Userfaultfd write-protect mode (since Linux 5.7)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 5.7, userfaultfd supports write-protect mode for anonymous " "memory. The user needs to first check availability of this feature using " "B ioctl against the feature bit " "B before using this feature." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 5.19, the write-protection mode was also supported on shmem and " "hugetlbfs memory types. It can be detected with the feature bit " "B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "To register with userfaultfd write-protect mode, the user needs to initiate " "the B ioctl with mode B set. Note " "that it is legal to monitor the same memory range with multiple modes. For " "example, the user can do B with the mode set to " "B. When there is " "only B registered, user-space will I receive " "any notification when a missing page is written. Instead, user-space will " "receive a write-protect page-fault notification only when an existing but " "write-protected page got written." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "After the B ioctl completed with B " "mode set, the user can write-protect any existing memory within the range " "using the ioctl B where I " "should be set to B." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When a write-protect event happens, user-space will receive a page-fault " "notification whose I will be with " "B flag set. Note: since only writes can trigger " "this kind of fault, write-protect notifications will always have the " "B bit set along with the " "B bit." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "To resolve a write-protection page fault, the user should initiate another " "B ioctl, whose I should have " "the flag B cleared upon the faulted page or " "range." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Userfaultfd minor fault mode (since Linux 5.13)" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Since Linux 5.13, userfaultfd supports minor fault mode. In this mode, " "fault messages are produced not for major faults (where the page was " "missing), but rather for minor faults, where a page exists in the page " "cache, but the page table entries are not yet present. The user needs to " "first check availability of this feature using the B ioctl with " "the appropriate feature bits set before using this feature: " "B since Linux 5.13, or " "B since Linux 5.14." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "To register with userfaultfd minor fault mode, the user needs to initiate " "the B ioctl with mode B set." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "When a minor fault occurs, user-space will receive a page-fault notification " "whose I will have the B " "flag set." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "To resolve a minor page fault, the handler should decide whether or not the " "existing page contents need to be modified first. If so, this should be " "done in-place via a second, non-userfaultfd-registered mapping to the same " "backing page (e.g., by mapping the shmem or hugetlbfs file twice). Once the " "page is considered \"up to date\", the fault can be resolved by initiating " "an B ioctl, which installs the page table entries and (by " "default) wakes up the faulting thread(s)." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Minor fault mode supports only hugetlbfs-backed (since Linux 5.13) and " "shmem-backed (since Linux 5.14) memory." msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Reading from the userfaultfd structure" msgstr "Чтение из структуры userfaultfd" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Each B(2) from the userfaultfd file descriptor returns one or more " "I structures, each of which describes a page-fault event or an " "event required for the non-cooperative userfaultfd usage:" msgstr "" "Каждый вызов B(2) из файлового дескриптора userfaultfd возвращает одну " "или более структур I, каждая из которых описывает событие " "страничной ошибки или событие, требуемое для использования userfaultfd в " "разобщённом режиме:" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "struct uffd_msg {\n" " __u8 event; /* Type of event */\n" " ...\n" " union {\n" " struct {\n" " __u64 flags; /* Flags describing fault */\n" " __u64 address; /* Faulting address */\n" " union {\n" " __u32 ptid; /* Thread ID of the fault */\n" " } feat;\n" " } pagefault;\n" "\\&\n" " struct { /* Since Linux 4.11 */\n" " __u32 ufd; /* Userfault file descriptor\n" " of the child process */\n" " } fork;\n" "\\&\n" " struct { /* Since Linux 4.11 */\n" " __u64 from; /* Old address of remapped area */\n" " __u64 to; /* New address of remapped area */\n" " __u64 len; /* Original mapping length */\n" " } remap;\n" "\\&\n" " struct { /* Since Linux 4.11 */\n" " __u64 start; /* Start address of removed area */\n" " __u64 end; /* End address of removed area */\n" " } remove;\n" " ...\n" " } arg;\n" "\\&\n" " /* Padding fields omitted */\n" "} __packed;\n" msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If multiple events are available and the supplied buffer is large enough, " "B(2) returns as many events as will fit in the supplied buffer. If " "the buffer supplied to B(2) is smaller than the size of the " "I structure, the B(2) fails with the error B." msgstr "" "Если доступно несколько событий и переданный буфер достаточного размера, то " "B(2) возвращает столько событий сколько влезает в буфер. Если буфер, " "указанный B(2), меньше размера структуры I, то B(2) " "завершается ошибкой B." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The fields set in the I structure are as follows:" msgstr "Поля структуры I:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The type of event. Depending of the event type, different fields of the " "I union represent details required for the event processing. The non-" "page-fault events are generated only when appropriate feature is enabled " "during API handshake with B B(2)." msgstr "" "Тип события. Тип события влияет на заполняемые поля объединения I, " "представляющего детали, требуемые для обработки события. События, не " "относящиеся к страничным ошибкам, генерируются только когда включено " "соответствующее свойство при согласовании программного интерфейса с помощью " "операции B вызова B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The following values can appear in the I field:" msgstr "В поле I могут появляться следующие значения:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 4.3)" msgstr "B (начиная с Linux 4.3)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A page-fault event. The page-fault details are available in the " "I field." msgstr "Событие страничной ошибки. Детали ошибки доступны в поле I." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 4.11)" msgstr "B (начиная с Linux 4.11)" #. FIXME describe duplication of userfault file descriptor during fork #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Generated when the faulting process invokes B(2) (or B(2) " "without the B flag). The event details are available in the " "I field." msgstr "" "Генерируется, когда процесс с ошибкой вызывает B(2) (или B(2) " "без флага B). Детали ошибки доступны в поле I." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 4.11)" msgstr "B (начиная с Linux 4.11)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Generated when the faulting process invokes B(2). The event details " "are available in the I field." msgstr "" "Генерируется, когда процесс с ошибкой вызывает B(2). Детали ошибки " "доступны в поле I." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 4.11)" msgstr "B (начиная с Linux 4.11)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Generated when the faulting process invokes B(2) with " "B or B advice. The event details are available " "in the I field." msgstr "" "Генерируется, когда процесс с ошибкой вызывает B(2) с советом " "B или B. Детали ошибки доступны в поле I." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 4.11)" msgstr "B (начиная с Linux 4.11)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Generated when the faulting process unmaps a memory range, either explicitly " "using B(2) or implicitly during B(2) or B(2). The " "event details are available in the I field." msgstr "" "Генерируется, когда процесс с ошибкой отменяет проецирование диапазона " "памяти явным образом с помощью B(2) или неявно при вызове B(2) " "или B(2). Детали ошибки доступны в поле I." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The address that triggered the page fault." msgstr "Адрес, из-за которого возникла страничная ошибка." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A bit mask of flags that describe the event. For B, " "the following flag may appear:" msgstr "" "Битовая маска флагов, описывающих событие. Для B может " "появляться следующий флаг:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "If this flag is set, then the fault was a write-protect fault." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "If this flag is set, then the fault was a minor fault." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "If this flag is set, then the fault was a write fault." msgstr "" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If neither B nor B are " "set, then the fault was a missing fault." msgstr "" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy #| msgid "The address that triggered the page fault." msgid "The thread ID that triggered the page fault." msgstr "Адрес, из-за которого возникла страничная ошибка." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The file descriptor associated with the userfault object created for the " "child created by B(2)." msgstr "" "С помощью B(2) был создан потомок, для которого был создан файловый " "дескриптор, связанный с объектом userfault." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The original address of the memory range that was remapped using " "B(2)." msgstr "" "Первоначальный адрес диапазона памяти, который был переотображён с помощью " "B(2)." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The new address of the memory range that was remapped using B(2)." msgstr "" "Новый адрес диапазона памяти, который был переотображён с помощью " "B(2)." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The original length of the memory range that was remapped using B(2)." msgstr "" "Первоначальный размер диапазона памяти, который был переотображён с помощью " "B(2)." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The start address of the memory range that was freed using B(2) or " "unmapped" msgstr "" "Начальный адрес диапазона памяти, который был освобождён с помощью " "B(2) или было отменено проецирование." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "I" msgstr "I" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The end address of the memory range that was freed using B(2) or " "unmapped" msgstr "" "Конечный адрес диапазона памяти, который был освобождён с помощью " "B(2) или было отменено проецирование." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "A B(2) on a userfaultfd file descriptor can fail with the following " "errors:" msgstr "" "Вызов B(2) с файловым дескриптором userfaultfd может завершиться " "следующими ошибками:" #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The userfaultfd object has not yet been enabled using the B " "B(2) operation" msgstr "" "Объект userfaultfd не был включён с помощью операции B вызова " "B(2)." #. FIXME What is the reason for this seemingly odd behavior with respect #. to the O_NONBLOCK flag? (see userfaultfd_poll() in fs/userfaultfd.c). #. Something needs to be said about this. #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If the B flag is enabled in the associated open file " "description, the userfaultfd file descriptor can be monitored with " "B(2), B(2) indicates the file descriptor as both readable " "and writable." msgstr "" "Если в связанном открытом файловом описании указан флаг B, то " "файловый дескриптор userfaultfd можно отслеживать с помощью B(2), " "B(2) показывает, что файловый дескриптор доступен на чтение и запись." #. 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 #, fuzzy #| msgid "" #| "On success, B() returns a new file descriptor that refers " #| "to the userfaultfd object. On error, -1 is returned, and I is set " #| "appropriately." msgid "" "On success, B() returns a new file descriptor that refers to " "the userfaultfd object. On error, -1 is returned, and I is set to " "indicate the error." msgstr "" "При успешном выполнении B() возвращает новый файловый " "дескриптор, который ссылается на объект userfaultfd. При ошибке возвращается " "-1, и I изменяется соответствующим образом." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "ОШИБКИ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "An unsupported value was specified in I." msgstr "В I указано неподдерживаемое значение." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The per-process limit on the number of open file descriptors has been reached" msgstr "" "Было достигнуто ограничение по количеству открытых файловых дескрипторов на " "процесс." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The system-wide limit on the total number of open files has been reached." msgstr "Достигнуто максимальное количество открытых файлов в системе." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B" msgstr "B" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "Insufficient kernel memory was available." msgstr "Недостаточное количество памяти ядра." #. type: TP #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "B (since Linux 5.2)" msgstr "B (начиная с Linux 5.2)" #. cefdca0a86be517bc390fc4541e3674b8e7803b0 #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The caller is not privileged (does not have the B capability " "in the initial user namespace), and I " "has the value 0." msgstr "" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "СТАНДАРТЫ" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux." msgstr "Linux." #. type: SH #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "HISTORY" msgstr "ИСТОРИЯ" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy #| msgid "Linux" msgid "Linux 4.3." msgstr "Linux" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed #, fuzzy #| msgid "" #| "The support for hugetlbfs and shared memory areas and non-page-fault " #| "events was added in Linux 4.11" msgid "" "Support for hugetlbfs and shared memory areas and non-page-fault events was " "added in Linux 4.11" msgstr "" "Поддержка hugetlbfs и общих областей памяти, а также событий, не относящихся " "к страничным ошибкам, была добавлена в Linux 4.11." #. 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 "" "The userfaultfd mechanism can be used as an alternative to traditional user-" "space paging techniques based on the use of the B signal and " "B(2). It can also be used to implement lazy restore for checkpoint/" "restore mechanisms, as well as post-copy migration to allow (nearly) " "uninterrupted execution when transferring virtual machines and Linux " "containers from one host to another." msgstr "" "Механизм userfaultfd может быть использован как альтернатива обычному " "страничному делению пользовательского пространства на основе использования " "сигнала B и B(2). Также он может быть использован для " "реализации отложенного (lazy) восстановления checkpoint/restore mechanisms, " "as well as post-copy migration to allow (почти) не прерываемого выполнения " "при переносе виртуальных машин и контейнеров Linux с одного узла на другой." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "ОШИБКИ" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "If the B is enabled and a system call from the " "B(2) family is interrupted by a signal or failed, a stale userfaultfd " "descriptor might be created. In this case, a spurious B " "will be delivered to the userfaultfd monitor." msgstr "" "Если указано B и системный вызов из семейства " "B(2) прерывается по сигналу или завершается ошибкой, то может быть " "создан повисший дескриптор userfaultfd. В этом случае программе слежения за " "userfaultfd может быть доставлен ложный B." #. 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 "" "The program below demonstrates the use of the userfaultfd mechanism. The " "program creates two threads, one of which acts as the page-fault handler for " "the process, for the pages in a demand-page zero region created using " "B(2)." msgstr "" "Программа, представленная далее, показывает использование механизма " "userfaultfd. Она создаёт две нити, одна служит обработчиком страничных " "ошибок процесса для страниц в режиме выделения при необходимости, созданных " "B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The program takes one command-line argument, which is the number of pages " "that will be created in a mapping whose page faults will be handled via " "userfaultfd. After creating a userfaultfd object, the program then creates " "an anonymous private mapping of the specified size and registers the address " "range of that mapping using the B B(2) operation. " "The program then creates a second thread that will perform the task of " "handling page faults." msgstr "" "Программа имеет один параметр командной строки, определяющий количество " "страниц, которые будут созданы в отображении, чьи страничные ошибки будут " "обработаны userfaultfd. После создания объекта userfaultfd программа создаёт " "анонимное частное отображение указанного размера и регистрирует адресный " "диапазон отображения с помощью операции B вызовом " "B(2). После этого программа создаёт вторую нить, которая будет " "выполнять задачу по обработке страничных ошибок." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "The main thread then walks through the pages of the mapping fetching bytes " "from successive pages. Because the pages have not yet been accessed, the " "first access of a byte in each page will trigger a page-fault event on the " "userfaultfd file descriptor." msgstr "" "После этого главная нить обходит страницы отображения запрашивая байты " "следующей страницы. Так как к страницам ещё не обращались, первый доступ к " "байту в каждой странице будет вызывать событие страничной ошибки в файловом " "дескрипторе userfaultfd." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Each of the page-fault events is handled by the second thread, which sits in " "a loop processing input from the userfaultfd file descriptor. In each loop " "iteration, the second thread first calls B(2) to check the state of " "the file descriptor, and then reads an event from the file descriptor. All " "such events should be B events, which the thread " "handles by copying a page of data into the faulting region using the " "B B(2) operation." msgstr "" "Каждое событие страничной ошибки обрабатывается второй нитью, которая " "выполняет цикл обработки ввода из файлового дескриптора userfaultfd. При " "каждом проходе цикла вторая нить сначала вызывает B(2) для проверки " "состояния файлового дескриптора, затем читает событие из файлового " "дескриптора. Все события должны быть B, для их " "обработки нить копирует страницу данных в ошибочную область с помощью " "операции B вызова B(2)." #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "The following is an example of what we see when running the program:" msgstr "Результат работы программы:" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "$ B<./userfaultfd_demo 3>\n" "Address returned by mmap() = 0x7fd30106c000\n" "\\&\n" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106c00f in main(): A\n" "Read address 0x7fd30106c40f in main(): A\n" "Read address 0x7fd30106c80f in main(): A\n" "Read address 0x7fd30106cc0f in main(): A\n" "\\&\n" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106d00f in main(): B\n" "Read address 0x7fd30106d40f in main(): B\n" "Read address 0x7fd30106d80f in main(): B\n" "Read address 0x7fd30106dc0f in main(): B\n" "\\&\n" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106e00f in main(): C\n" "Read address 0x7fd30106e40f in main(): C\n" "Read address 0x7fd30106e80f in main(): C\n" "Read address 0x7fd30106ec0f in main(): C\n" msgstr "" #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Program source" msgstr "Исходный код программы" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-tumbleweed #, no-wrap msgid "" "/* userfaultfd_demo.c\n" "\\&\n" " Licensed under the GNU General Public License version 2 or later.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Einttypes.hE\n" "#include Elinux/userfaultfd.hE\n" "#include Epoll.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/ioctl.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Eunistd.hE\n" "\\&\n" "static int page_size;\n" "\\&\n" "static void *\n" "fault_handler_thread(void *arg)\n" "{\n" " int nready;\n" " long uffd; /* userfaultfd file descriptor */\n" " ssize_t nread;\n" " struct pollfd pollfd;\n" " struct uffdio_copy uffdio_copy;\n" "\\&\n" " static int fault_cnt = 0; /* Number of faults so far handled */\n" " static char *page = NULL;\n" " static struct uffd_msg msg; /* Data read from userfaultfd */\n" "\\&\n" " uffd = (long) arg;\n" "\\&\n" " /* Create a page that will be copied into the faulting region. */\n" "\\&\n" " if (page == NULL) {\n" " page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (page == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" " }\n" "\\&\n" " /* Loop, handling incoming events on the userfaultfd\n" " file descriptor. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* See what poll() tells us about the userfaultfd. */\n" "\\&\n" " pollfd.fd = uffd;\n" " pollfd.events = POLLIN;\n" " nready = poll(&pollfd, 1, -1);\n" " if (nready == -1)\n" " err(EXIT_FAILURE, \"poll\");\n" "\\&\n" " printf(\"\\enfault_handler_thread():\\en\");\n" " printf(\" poll() returns: nready = %d; \"\n" " \"POLLIN = %d; POLLERR = %d\\en\", nready,\n" " (pollfd.revents & POLLIN) != 0,\n" " (pollfd.revents & POLLERR) != 0);\n" "\\&\n" " /* Read an event from the userfaultfd. */\n" "\\&\n" " nread = read(uffd, &msg, sizeof(msg));\n" " if (nread == 0) {\n" " printf(\"EOF on userfaultfd!\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" "\\&\n" " /* We expect only one kind of event; verify that assumption. */\n" "\\&\n" " if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" " fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Display info about the page-fault event. */\n" "\\&\n" " printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" " printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" " printf(\"address = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n" "\\&\n" " /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" " region. Vary the contents that are copied in, so that it\n" " is more obvious that each fault is handled separately. */\n" "\\&\n" " memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" " fault_cnt++;\n" "\\&\n" " uffdio_copy.src = (unsigned long) page;\n" "\\&\n" " /* We need to handle page faults in units of pages(!).\n" " So, round faulting address down to page boundary. */\n" "\\&\n" " uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" " \\[ti](page_size - 1);\n" " uffdio_copy.len = page_size;\n" " uffdio_copy.mode = 0;\n" " uffdio_copy.copy = 0;\n" " if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" "\\&\n" " printf(\" (uffdio_copy.copy returned %\"PRId64\")\\en\",\n" " uffdio_copy.copy);\n" " }\n" "}\n" "\\&\n" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s;\n" " char c;\n" " char *addr; /* Start of region handled by userfaultfd */\n" " long uffd; /* userfaultfd file descriptor */\n" " size_t len, l; /* Length of region handled by userfaultfd */\n" " pthread_t thr; /* ID of thread that handles page faults */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s num-pages\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " page_size = sysconf(_SC_PAGE_SIZE);\n" " len = strtoull(argv[1], NULL, 0) * page_size;\n" "\\&\n" " /* Create and enable userfaultfd object. */\n" "\\&\n" " uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" " if (uffd == -1)\n" " err(EXIT_FAILURE, \"userfaultfd\");\n" "\\&\n" " /* NOTE: Two-step feature handshake is not needed here, since this\n" " example doesn't require any specific features.\n" "\\&\n" " Programs that *do* should call UFFDIO_API twice: once with\n" " `features = 0` to detect features supported by this kernel, and\n" " again with the subset of features the program actually wants to\n" " enable. */\n" " uffdio_api.api = UFFD_API;\n" " uffdio_api.features = 0;\n" " if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" "\\&\n" " /* Create a private anonymous mapping. The memory will be\n" " demand-zero paged--that is, not yet allocated. When we\n" " actually touch the memory, it will be allocated via\n" " the userfaultfd. */\n" "\\&\n" " addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (addr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" "\\&\n" " printf(\"Address returned by mmap() = %p\\en\", addr);\n" "\\&\n" " /* Register the memory range of the mapping we just created for\n" " handling by the userfaultfd object. In mode, we request to track\n" " missing pages (i.e., pages that have not yet been faulted in). */\n" "\\&\n" " uffdio_register.range.start = (unsigned long) addr;\n" " uffdio_register.range.len = len;\n" " uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" " if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" "\\&\n" " /* Create a thread that will process the userfaultfd events. */\n" "\\&\n" " s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" " if (s != 0) {\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" " }\n" "\\&\n" " /* Main thread now touches memory in the mapping, touching\n" " locations 1024 bytes apart. This will trigger userfaultfd\n" " events for all pages in the region. */\n" "\\&\n" " l = 0xf; /* Ensure that faulting address is not on a page\n" " boundary, in order to test that we correctly\n" " handle that case in fault_handling_thread(). */\n" " while (l E len) {\n" " c = addr[l];\n" " printf(\"Read address %p in %s(): \", addr + l, __func__);\n" " printf(\"%c\\en\", c);\n" " l += 1024;\n" " usleep(100000); /* Slow things down a little */\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" #. SRC END #. 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(2), B(2), B(2), B(2), B(2)" msgstr "" "B(2), B(2), B(2), B(2), B(2)" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed msgid "" "I in the Linux kernel source " "tree" msgstr "" "Файл I из дерева исходного " "кода ядра Linux" #. type: TH #: debian-bookworm #, 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 msgid "" "After the userfaultfd object is created with B(), the " "application must enable it using the B B(2) operation. " "This operation allows a handshake between the kernel and user space to " "determine the API version and supported features. This operation must be " "performed before any of the other B(2) operations described below " "(or those operations fail with the B error)." msgstr "" "После создания объекта userfaultfd с помощью B() приложение " "должно включить его с помощью операции B вызова B(2). " "Данная операция позволяет согласовать между ядром и пользовательским " "пространством версию программного интерфейса поддерживаемых свойств. Эта " "операция должна быть выполнено самой первой среди других операций " "B(2), описываемых ниже (в противном случае эти операции завершаются " "ошибкой B)." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 msgid "" "After a successful B operation, the application then registers " "memory address ranges using the B B(2) operation. " "After successful completion of a B operation, a page fault " "occurring in the requested memory range, and satisfying the mode defined at " "the registration time, will be forwarded by the kernel to the user-space " "application. The application can then use the B " "B or B B(2) operations to " "resolve the page fault." msgstr "" "После успешного выполнения B приложение должно зарегистрировать " "диапазоны адресов памяти с помощью операции B вызова " "B(2). После успешного выполнения B страничная " "ошибка, возникающая в запрошенном диапазоне и удовлетворяющая режиму, " "определённому в момент регистрации, будет переслана ядром приложению в " "пользовательском пространстве. Для решения страничной ошибки приложение " "может использовать операцию B, B или " "B вызова B(2)." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| "struct uffd_msg {\n" #| " __u8 event; /* Type of event */\n" #| " ...\n" #| " union {\n" #| " struct {\n" #| " __u64 flags; /* Flags describing fault */\n" #| " __u64 address; /* Faulting address */\n" #| " } pagefault;\n" msgid "" "struct uffd_msg {\n" " __u8 event; /* Type of event */\n" " ...\n" " union {\n" " struct {\n" " __u64 flags; /* Flags describing fault */\n" " __u64 address; /* Faulting address */\n" " union {\n" " __u32 ptid; /* Thread ID of the fault */\n" " } feat;\n" " } pagefault;\n" msgstr "" "struct uffd_msg {\n" " __u8 event; /* тип события */\n" " ...\n" " union {\n" " struct {\n" " __u64 flags; /* флаги, описывающие ошибку */\n" " __u64 address; /* ошибочный адрес */\n" " } pagefault;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " struct { /* Since Linux 4.11 */\n" " __u32 ufd; /* Userfault file descriptor\n" " of the child process */\n" " } fork;\n" msgstr "" " struct { /* начиная с Linux 4.11 */\n" " __u32 ufd; /* файловый дескриптор userfault\n" " дочернего процесса */\n" " } fork;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " struct { /* Since Linux 4.11 */\n" " __u64 from; /* Old address of remapped area */\n" " __u64 to; /* New address of remapped area */\n" " __u64 len; /* Original mapping length */\n" " } remap;\n" msgstr "" " struct { /* начиная с Linux 4.11 */\n" " __u64 from; /* старый адрес переотображаемой области */\n" " __u64 to; /* новый адрес переотображаемой области */\n" " __u64 len; /* начальный размер отображения */\n" " } remap;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " struct { /* Since Linux 4.11 */\n" " __u64 start; /* Start address of removed area */\n" " __u64 end; /* End address of removed area */\n" " } remove;\n" " ...\n" " } arg;\n" msgstr "" " struct { /* начиная с Linux 4.11 */\n" " __u64 start; /* начальный адрес удаляемой области */\n" " __u64 end; /* конечный адрес удаляемой области */\n" " } remove;\n" " ...\n" " } arg;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Padding fields omitted */\n" "} __packed;\n" msgstr "" " /* поля-заполнители не показаны */\n" "} __packed;\n" #. type: SH #: debian-bookworm #, no-wrap msgid "VERSIONS" msgstr "ВЕРСИИ" #. type: Plain text #: debian-bookworm msgid "The B() system call first appeared in Linux 4.3." msgstr "Системный вызов B() впервые появился в Linux 4.3." #. type: Plain text #: debian-bookworm msgid "" "The support for hugetlbfs and shared memory areas and non-page-fault events " "was added in Linux 4.11" msgstr "" "Поддержка hugetlbfs и общих областей памяти, а также событий, не относящихся " "к страничным ошибкам, была добавлена в Linux 4.11." #. type: Plain text #: debian-bookworm msgid "" "B() is Linux-specific and should not be used in programs " "intended to be portable." msgstr "" "Вызов B() есть только в Linux и поэтому не должен " "использоваться в программах, предназначенных для переноса на другие " "платформы." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "$ B<./userfaultfd_demo 3>\n" "Address returned by mmap() = 0x7fd30106c000\n" msgstr "" "$ B<./userfaultfd_demo 3>\n" "Адрес, возвращённый mmap() = 0x7fd30106c000\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106c00f in main(): A\n" "Read address 0x7fd30106c40f in main(): A\n" "Read address 0x7fd30106c80f in main(): A\n" "Read address 0x7fd30106cc0f in main(): A\n" msgstr "" "fault_handler_thread():\n" " poll() вернул: nready = 1; POLLIN = 1; POLLERR = 0\n" " событие UFFD_EVENT_PAGEFAULT: флаги = 0; адрес = 7fd30106c00f\n" " (uffdio_copy.copy равно 4096)\n" "Чтение по адресу 0x7fd30106c00f в main(): A\n" "Чтение по адресу 0x7fd30106c40f в main(): A\n" "Чтение по адресу 0x7fd30106c80f в main(): A\n" "Чтение по адресу 0x7fd30106cc0f в main(): A\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106d00f in main(): B\n" "Read address 0x7fd30106d40f in main(): B\n" "Read address 0x7fd30106d80f in main(): B\n" "Read address 0x7fd30106dc0f in main(): B\n" msgstr "" "fault_handler_thread():\n" " poll() вернул: nready = 1; POLLIN = 1; POLLERR = 0\n" " событие UFFD_EVENT_PAGEFAULT: флаги = 0; адрес = 7fd30106d00f\n" " (uffdio_copy.copy равно 4096)\n" "Чтение по адресу 0x7fd30106d00f в main(): B\n" "Чтение по адресу 0x7fd30106d40f в main(): B\n" "Чтение по адресу 0x7fd30106d80f в main(): B\n" "Чтение по адресу 0x7fd30106dc0f в main(): B\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" "fault_handler_thread():\n" " poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" " UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" " (uffdio_copy.copy returned 4096)\n" "Read address 0x7fd30106e00f in main(): C\n" "Read address 0x7fd30106e40f in main(): C\n" "Read address 0x7fd30106e80f in main(): C\n" "Read address 0x7fd30106ec0f in main(): C\n" msgstr "" "fault_handler_thread():\n" " poll() вернул: nready = 1; POLLIN = 1; POLLERR = 0\n" " событие UFFD_EVENT_PAGEFAULT: флаги = 0; адрес = 7fd30106e00f\n" " (uffdio_copy.copy равно 4096)\n" "Чтение по адресу 0x7fd30106e00f в main(): C\n" "Чтение по адресу 0x7fd30106e40f в main(): C\n" "Чтение по адресу 0x7fd30106e80f в main(): C\n" "Чтение по адресу 0x7fd30106ec0f в main(): C\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "/* userfaultfd_demo.c\n" msgstr "/* userfaultfd_demo.c\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " Licensed under the GNU General Public License version 2 or later.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Einttypes.hE\n" "#include Elinux/userfaultfd.hE\n" "#include Epoll.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/ioctl.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Eunistd.hE\n" msgstr "" " распространяется по лицензии GNU General Public License version 2 и новее.\n" "*/\n" "#define _GNU_SOURCE\n" "#include Eerr.hE\n" "#include Eerrno.hE\n" "#include Efcntl.hE\n" "#include Einttypes.hE\n" "#include Elinux/userfaultfd.hE\n" "#include Epoll.hE\n" "#include Epthread.hE\n" "#include Estdio.hE\n" "#include Estdlib.hE\n" "#include Estring.hE\n" "#include Esys/ioctl.hE\n" "#include Esys/mman.hE\n" "#include Esys/syscall.hE\n" "#include Eunistd.hE\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "static int page_size;\n" msgstr "static int page_size;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| "static void *\n" #| "fault_handler_thread(void *arg)\n" #| "{\n" #| " static struct uffd_msg msg; /* Data read from userfaultfd */\n" #| " static int fault_cnt = 0; /* Number of faults so far handled */\n" #| " long uffd; /* userfaultfd file descriptor */\n" #| " static char *page = NULL;\n" #| " struct uffdio_copy uffdio_copy;\n" #| " ssize_t nread;\n" msgid "" "static void *\n" "fault_handler_thread(void *arg)\n" "{\n" " int nready;\n" " long uffd; /* userfaultfd file descriptor */\n" " ssize_t nread;\n" " struct pollfd pollfd;\n" " struct uffdio_copy uffdio_copy;\n" msgstr "" "static void *\n" "fault_handler_thread(void *arg)\n" "{\n" " static struct uffd_msg msg; /* данные, прочитанные из userfaultfd */\n" " static int fault_cnt = 0; /* количество обработанных ошибок */\n" " long uffd; /* файловый дескриптор userfaultfd */\n" " static char *page = NULL;\n" " struct uffdio_copy uffdio_copy;\n" " ssize_t nread;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " static int fault_cnt = 0; /* Number of faults so far handled */\n" " static char *page = NULL;\n" " static struct uffd_msg msg; /* Data read from userfaultfd */\n" msgstr "" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " uffd = (long) arg;\n" msgstr " uffd = (long) arg;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Create a page that will be copied into the faulting region. */\n" msgstr " /* создаём страницу, которая будет копироваться в ошибочную область */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (page == NULL) {\n" " page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (page == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" " }\n" msgstr "" " if (page == NULL) {\n" " page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (page == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Loop, handling incoming events on the userfaultfd\n" " file descriptor. */\n" msgstr "" " /* циклически обрабатываем входные сообщения в\n" " файловом дескрипторе userfaultfd */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " for (;;) {\n" msgstr " for (;;) {\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* See what poll() tells us about the userfaultfd. */\n" msgstr " /* С помощью poll() проверяем userfaultfd. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " pollfd.fd = uffd;\n" " pollfd.events = POLLIN;\n" " nready = poll(&pollfd, 1, -1);\n" " if (nready == -1)\n" " err(EXIT_FAILURE, \"poll\");\n" msgstr "" " pollfd.fd = uffd;\n" " pollfd.events = POLLIN;\n" " nready = poll(&pollfd, 1, -1);\n" " if (nready == -1)\n" " err(EXIT_FAILURE, \"poll\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\"\\enfault_handler_thread():\\en\");\n" " printf(\" poll() returns: nready = %d; \"\n" " \"POLLIN = %d; POLLERR = %d\\en\", nready,\n" " (pollfd.revents & POLLIN) != 0,\n" " (pollfd.revents & POLLERR) != 0);\n" msgstr "" " printf(\"\\enfault_handler_thread():\\en\");\n" " printf(\" poll() вернул: nready = %d; \"\n" " \"POLLIN = %d; POLLERR = %d\\en\", nready,\n" " (pollfd.revents & POLLIN) != 0,\n" " (pollfd.revents & POLLERR) != 0);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Read an event from the userfaultfd. */\n" msgstr " /* читаем событие из userfaultfd */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " nread = read(uffd, &msg, sizeof(msg));\n" " if (nread == 0) {\n" " printf(\"EOF on userfaultfd!\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " nread = read(uffd, &msg, sizeof(msg));\n" " if (nread == 0) {\n" " printf(\"EOF в userfaultfd!\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" msgstr "" " if (nread == -1)\n" " err(EXIT_FAILURE, \"read\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* We expect only one kind of event; verify that assumption. */\n" msgstr " /* ожидаем только один тип событий; проверяем, что это так */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" " fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" " fprintf(stderr, \"Неожидаемый тип события в userfaultfd\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Display info about the page-fault event. */\n" msgstr " /* показываем информацию о событии страничной ошибки */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" " printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" " printf(\"address = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n" msgstr "" " printf(\" событие UFFD_EVENT_PAGEFAULT: \");\n" " printf(\"флаги = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" " printf(\"адрес = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " /* Copy the page pointed to by \\(aqpage\\(aq into the faulting\n" #| " region. Vary the contents that are copied in, so that it\n" #| " is more obvious that each fault is handled separately. */\n" msgid "" " /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" " region. Vary the contents that are copied in, so that it\n" " is more obvious that each fault is handled separately. */\n" msgstr "" " /* копируем страницу, на которую указывает \\(aqpage\\(aq, в ошибочную\n" " область. Меняем содержимое, которое копируем для того, чтобы\n" " было более очевидно, что каждая ошибка обрабатывается отдельно. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " memset(page, \\(aqA\\(aq + fault_cnt % 20, page_size);\n" #| " fault_cnt++;\n" msgid "" " memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" " fault_cnt++;\n" msgstr "" " memset(page, \\(aqA\\(aq + fault_cnt % 20, page_size);\n" " fault_cnt++;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " uffdio_copy.src = (unsigned long) page;\n" msgstr " uffdio_copy.src = (unsigned long) page;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* We need to handle page faults in units of pages(!).\n" " So, round faulting address down to page boundary. */\n" msgstr "" " /* мы должны обрабатывать страничные ошибки в единицах страниц(!).\n" " поэтому округляем адрес ошибки по нижней границы страницы */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" #| " \\(ti(page_size - 1);\n" #| " uffdio_copy.len = page_size;\n" #| " uffdio_copy.mode = 0;\n" #| " uffdio_copy.copy = 0;\n" #| " if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" #| " err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" msgid "" " uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" " \\[ti](page_size - 1);\n" " uffdio_copy.len = page_size;\n" " uffdio_copy.mode = 0;\n" " uffdio_copy.copy = 0;\n" " if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" msgstr "" " uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" " \\(ti(page_size - 1);\n" " uffdio_copy.len = page_size;\n" " uffdio_copy.mode = 0;\n" " uffdio_copy.copy = 0;\n" " if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " printf(\" (uffdio_copy.copy returned %\"PRId64\")\\en\",\n" " uffdio_copy.copy);\n" " }\n" "}\n" msgstr "" " printf(\" (uffdio_copy.copy равно %\"PRId64\")\\en\",\n" " uffdio_copy.copy);\n" " }\n" "}\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| "int\n" #| "main(int argc, char *argv[])\n" #| "{\n" #| " long uffd; /* userfaultfd file descriptor */\n" #| " char *addr; /* Start of region handled by userfaultfd */\n" #| " unsigned long len; /* Length of region handled by userfaultfd */\n" #| " pthread_t thr; /* ID of thread that handles page faults */\n" #| " struct uffdio_api uffdio_api;\n" #| " struct uffdio_register uffdio_register;\n" #| " int s;\n" msgid "" "int\n" "main(int argc, char *argv[])\n" "{\n" " int s;\n" " char c;\n" " char *addr; /* Start of region handled by userfaultfd */\n" " long uffd; /* userfaultfd file descriptor */\n" " size_t len, l; /* Length of region handled by userfaultfd */\n" " pthread_t thr; /* ID of thread that handles page faults */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\n" msgstr "" "int\n" "main(int argc, char *argv[])\n" "{\n" " long uffd; /* файловый дескриптор userfaultfd */\n" " char *addr; /* Начало области, обрабатываемое userfaultfd */\n" " unsigned long len; /* Размер области, обрабатываемой userfaultfd */\n" " pthread_t thr; /* ID нити, обрабатывающей страничные ошибки */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\n" " int s;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " if (argc != 2) {\n" " fprintf(stderr, \"Usage: %s num-pages\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" msgstr "" " if (argc != 2) {\n" " fprintf(stderr, \"Использование: %s количество-страниц\\en\", argv[0]);\n" " exit(EXIT_FAILURE);\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " page_size = sysconf(_SC_PAGE_SIZE);\n" " len = strtoull(argv[1], NULL, 0) * page_size;\n" msgstr "" " page_size = sysconf(_SC_PAGE_SIZE);\n" " len = strtoull(argv[1], NULL, 0) * page_size;\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Create and enable userfaultfd object. */\n" msgstr " /* создаём и включаем объект userfaultfd */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" " if (uffd == -1)\n" " err(EXIT_FAILURE, \"userfaultfd\");\n" msgstr "" " uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" " if (uffd == -1)\n" " err(EXIT_FAILURE, \"userfaultfd\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " uffdio_api.api = UFFD_API;\n" " uffdio_api.features = 0;\n" " if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" msgstr "" " uffdio_api.api = UFFD_API;\n" " uffdio_api.features = 0;\n" " if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Create a private anonymous mapping. The memory will be\n" " demand-zero paged--that is, not yet allocated. When we\n" " actually touch the memory, it will be allocated via\n" " the userfaultfd. */\n" msgstr "" " /* Копируем частное анонимное отображение. Память будет\n" " выделена по требованию, то есть реально не выделяется. Когда мы\n" " обратимся к памяти, она будет выделена с помощью\n" " userfaultfd. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (addr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" msgstr "" " addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" " MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" " if (addr == MAP_FAILED)\n" " err(EXIT_FAILURE, \"mmap\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " printf(\"Address returned by mmap() = %p\\en\", addr);\n" msgstr " printf(\"Адрес, возвращённый mmap() = %p\\en\", addr);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Register the memory range of the mapping we just created for\n" " handling by the userfaultfd object. In mode, we request to track\n" " missing pages (i.e., pages that have not yet been faulted in). */\n" msgstr "" " /* Регистрируем в объекте userfaultfd область памяти отображения\n" " которое мы только что создали. Запрашиваем режим слежения\n" " за отсутствующими страницами (т. е., которые пока не\n" " были заполнены). */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " uffdio_register.range.start = (unsigned long) addr;\n" " uffdio_register.range.len = len;\n" " uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" " if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" msgstr "" " uffdio_register.range.start = (unsigned long) addr;\n" " uffdio_register.range.len = len;\n" " uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" " if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" " err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid " /* Create a thread that will process the userfaultfd events. */\n" msgstr " /* Создаём нить, которая будет обрабатывать события userfaultfd. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" " if (s != 0) {\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" " }\n" msgstr "" " s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" " if (s != 0) {\n" " errc(EXIT_FAILURE, s, \"pthread_create\");\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Main thread now touches memory in the mapping, touching\n" " locations 1024 bytes apart. This will trigger userfaultfd\n" " events for all pages in the region. */\n" msgstr "" " /* Теперь главная нить обращается к памяти в отображении c\n" " интервалом в 1024 байта. Это создаст события в userfaultfd\n" " для всех страниц в области. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, fuzzy, no-wrap #| msgid "" #| " int l;\n" #| " l = 0xf; /* Ensure that faulting address is not on a page\n" #| " boundary, in order to test that we correctly\n" #| " handle that case in fault_handling_thread() */\n" #| " while (l E len) {\n" #| " char c = addr[l];\n" #| " printf(\"Read address %p in main(): \", addr + l);\n" #| " printf(\"%c\\en\", c);\n" #| " l += 1024;\n" #| " usleep(100000); /* Slow things down a little */\n" #| " }\n" msgid "" " l = 0xf; /* Ensure that faulting address is not on a page\n" " boundary, in order to test that we correctly\n" " handle that case in fault_handling_thread(). */\n" " while (l E len) {\n" " c = addr[l];\n" " printf(\"Read address %p in %s(): \", addr + l, __func__);\n" " printf(\"%c\\en\", c);\n" " l += 1024;\n" " usleep(100000); /* Slow things down a little */\n" " }\n" msgstr "" " int l;\n" " l = 0xf; /* Гарантируем, что ошибочный адрес не на границе\n" " страницы, чтобы протестировать что, мы правильно\n" " обрабатываем этот случай в fault_handling_thread() */\n" " while (l E len) {\n" " char c = addr[l];\n" " printf(\"Чтение по адресу %p в main(): \", addr + l);\n" " printf(\"%c\\en\", c);\n" " l += 1024;\n" " usleep(100000); /* замедлим программу */\n" " }\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " exit(EXIT_SUCCESS);\n" "}\n" msgstr "" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2024-02-12" msgstr "12 февраля 2024 г." #. type: TH #: fedora-40 mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "Linux man-pages 6.06" #. type: TH #: fedora-rawhide #, no-wrap msgid "Linux man-pages 6.7" msgstr "Linux man-pages 6.7" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "30 марта 2023 г." #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "Linux man-pages 6.04" #. type: TH #: opensuse-tumbleweed #, fuzzy, no-wrap #| msgid "Linux man-pages 6.7" msgid "Linux man-pages (unreleased)" msgstr "Linux man-pages 6.7"