# French translation of manpages # This file is distributed under the same license as the manpages-l10n package. # Copyright © of this file: # Christophe Blaess , 1996-2003. # Stéphan Rafin , 2002. # Thierry Vignaud , 1999, 2002. # François Micaux, 2002. # Alain Portal , 2003-2008. # Jean-Philippe Guérard , 2005-2006. # Jean-Luc Coulon (f5ibh) , 2006-2007. # Julien Cristau , 2006-2007. # Thomas Huriaux , 2006-2008. # Nicolas François , 2006-2008. # Florentin Duneau , 2006-2010. # Simon Paillard , 2006, 2013, 2014. # Denis Barbier , 2006, 2010, 2011. # David Prévot , 2010, 2012-2014. # Jean-Pierre Giraud , 2024. msgid "" msgstr "" "Project-Id-Version: manpages-l10n\n" "POT-Creation-Date: 2024-03-01 17:12+0100\n" "PO-Revision-Date: 2024-01-23 22:37+0100\n" "Last-Translator: Jean-Pierre Giraud \n" "Language-Team: French \n" "Language: fr\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=n > 1;\n" "X-Generator: Lokalize 22.12.1\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 fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "2024-02-12" msgstr "12 février 2024" #. type: TH #: archlinux fedora-40 fedora-rawhide mageia-cauldron #, no-wrap msgid "Linux man-pages 6.06" msgstr "Pages du manuel de Linux 6.06" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "NAME" msgstr "NOM" #. 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 - Créer un descripteur de fichier pour gérer les erreurs de page " "en espace utilisateur" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "LIBRARY" msgstr "BIBLIOTHÈQUE" #. 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 "Bibliothèque C standard (I, I<-lc>)" #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "SYNOPSIS" msgstr "SYNOPSIS" #. 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> /* Définition des constantes B */\n" "B<#include Esys/syscall.hE> /* Définition des constantes B */\n" "B<#include Elinux/userfaultfd.hE> /* Définition des constantes 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 "" "I : la glibc ne fournit pas d'enveloppe pour B(), " "imposant l'utilisation de B(2)." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "DESCRIPTION" msgstr "DESCRIPTION" #. 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() crée un nouvel objet userfaultfd qui peut être utilisé pour " "la délégation de la gestion des erreurs de page à une application de " "l'espace utilisateur et renvoie un descripteur de fichier qui fait référence " "au nouvel objet. Le nouvel objet userfaultfd est configuré en utilisant " "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 "" "Une fois l'objet userfaultfd configuré, l'application peut utiliser " "B(2) pour recevoir des notification d'userfaultfd. Les lectures à " "partir d'userfaultfd peuvent être bloquantes ou non bloquantes en fonction " "de la valeur des attributs (I) utilisés pour la création de " "l'userfaultfd ou des appels suivants à 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 "" "Les valeurs suivantes peuvent être combinées dans I par un OU binaire " "pour modifier le comportement d'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 "" "Enable the close-on-exec flag for the new userfaultfd file descriptor. See " "the description of the B flag in B(2)." msgstr "" "Activer l'attribut close-on-exec pour le nouveau descripteur de fichier " "userfaultfd. Consultez la description de l'attribut B dans " "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 "" "Permettre une opération non bloquante pour l'objet userfaultfd. Voir la " "description de l'attribut B dans 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 "" "C'est un attribut spécifique à userfaultfd qui a été introduit dans Linux\\ " "5.11. Quand il est défini, l'objet userfaultfd ne pourra gérer que les " "erreurs de page provenant de l'espace utilisateur dans les régions " "enregistrées. Quand une erreur provenant du noyau est déclenchée dans " "l'intervalle enregistré avec cet userfaultfd, un signal B sera " "envoyé." #. 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 "" "Quand le dernier descripteur de fichier faisant référence à un objet " "userfaultfd est fermé, tous les intervalles de mémoire qui ont été " "enregistrés avec l'objet sont désenregistrés et les événements non lus sont " "vidés." #. 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 "Userfaultfd gère trois modes d'enregistrement :" #. 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.10)" msgstr "B (depuis 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 "" "Quand il est enregistré avec le mode B, " "l'espace utilisateur recevra une notification d'erreur de page lors de " "l'accès à une page manquante. L'exécution du thread fautif sera arrêtée " "jusqu'à ce que l'erreur de page soit résolue à partir de l'espace " "utilisateur par un ioctl B ou B." #. 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.13)" msgstr "B (depuis 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 "" "Quand il est enregistré avec le mode B, l'espace " "utilisateur recevra une notification d'erreur de page lorsqu'une erreur de " "page mineure survient. C'est-à-dire quand une page de sauvegarde est dans le " "cache de page, mais les entrées dans la table de pages n'existent pas " "encore. L'exécution du thread fautif sera arrêtée jusqu'à ce que l'erreur de " "page soit résolue à partir de l'espace utilisateur par un ioctl " "B." #. 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.7)" msgstr "B (depuis 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 "" "Quand il est enregistré avec le mode B, l'espace " "utilisateur recevra une notification d'erreur de page lors d'une écriture " "sur une page protégée en écriture. L'exécution du thread fautif sera arrêtée " "jusqu'à ce que l'espace utilisateur supprime la protection de la page en " "utilisant un ioctl B." #. 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 "" "Plusieurs modes peuvent être activés en même temps pour le même intervalle " "de mémoire." #. 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 "" "Depuis Linux 4.14, une notification d'erreur de page d'userfaultfd peut " "incorporer de façon sélective des informations d'identifiant des threads en " "erreur dans une notification. Il est nécessaire d'activer cette " "fonctionnalité explicitement en utilisant le bit de fonction " "B lors de l'initialisation du contexte " "d'userfaultfd. Par défaut, la déclaration de l'identifiant du thread est " "désactivée." #. type: SS #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "Usage" msgstr "Utilisation" #. 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 "" "Le mécanisme d'userfaultfd est conçu pour permettre à un thread dans un " "programme multi-thread de réaliser la pagination en espace utilisateur pour " "d'autres threads dans le processus. Lorsqu'un erreur de page survient pour " "une des régions enregistrées dans l'objet userfaultfd, le thread en erreur " "est mis en sommeil et un événement est généré qui peut être lu au moyen du " "descripteur de fichier userfaultfd. Le thread de gestion d'erreur lit les " "événements à partir de ce descripteur de fichier et les corrige en utilisant " "les opérations décrites dans B(2). Lors de l'intervention " "sur les événements d'erreur de page, le thread de gestion d'erreur peut " "déclencher le réveil d'un thread endormi." #. 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 "" "Il est possible que les threads en erreur et les threads traitant les " "erreurs soient exécutés dans le contexte de processus différents. Dans ce " "cas, ces threads peuvent appartenir à différents programmes, et le programme " "qui exécute les threads en erreur ne collaborera pas nécessairement avec le " "programme qui gère les erreurs de page. Dans ce mode non coopératif, le " "processus qui contrôle userfaultfd et gère les erreurs de page a besoin " "d'avoir connaissance des modifications dans la disposition de la mémoire " "virtuelle du processus en erreur pour éviter une corruption de mémoire.'" #. 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 "" "Depuis Linux 4.11, userfaultfd peut aussi informer les threads gérant les " "erreurs des modifications dans la disposition de la mémoire virtuelle du " "processus en erreur. De plus, si le processus en erreur invoque B(2), " "les objets userfaultfd associés au parent peuvent être dupliqués dans le " "processus enfant et le contrôleur d'userfaultfd sera informé (au moyen de " "B décrit plus bas) sur le descripteur de fichier associé " "aux objets userfault créés pour le processus enfant, ce qui permet au " "contrôleur d'userfaultfd de réaliser la pagination de l'espace utilisateur " "pour le processus enfant. À la différence des erreurs de page qui doivent " "être synchrones et réclament un réveil explicite ou explicite, tous les " "autres événements sont envoyés de façon asynchrone et le processus non " "coopératif reprend son exécution dès que le gestionnaire d'userfaultfd " "exécute B(2). Le gestionnaire d'userfaultfd doit soigneusement " "synchroniser les appels à B avec le traitement des événements." #. #-#-#-#-# 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. #. .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 #. #-#-#-#-# 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. #. .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 #: 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 "" "Le modèle asynchrone actuel d'envoi d'événement est optimal pour des " "implémentations de gestionnaire userfaultfd non coopératif à thread unique." #. 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 "" "Depuis Linux 5.7, userfaultfd peut effectuer le suivi synchrone de page sale " "en utilisant le nouveau mode d'enregistrement de page protégée en écriture. " "Il faut vérifier le bit de fonction B avant " "d'utiliser cette fonctionnalité. Le mode protection en écriture, similaire " "au mode d'origine page manquante d'userfaultfd, génère une notification " "d'userfaultfd quand la page protégée en écriture est écrite. L'utilisateur " "doit résoudre l'erreur de page en déprotégeant la page fautive et en forçant " "le thread fautif à continuer. Pour plus d'informations, consultez la section " "«\\ Mode protection d'écriture d'userfaultfd\\ »" #. 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 "Fonctionnement d'userfaultfd" #. type: Plain text #: archlinux fedora-40 fedora-rawhide mageia-cauldron #, 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 "" "Après la création de l'objet userfaultfd avec B(), " "l'application doit l'activer en utilisant l'opération B de " "B(2). Cette opération permet une connexion entre le noyau et l'espace " "utilisateur pour déterminer la version de l'API et les fonctions prises en " "charge. Cette opération doit être réalisée avant toutes les autres " "opérations B(2) décrites plus bas (ou ces opérations échouent avec " "l'erreur B.)" #. type: Plain text #: archlinux fedora-40 fedora-rawhide mageia-cauldron #, 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 "" "Après le succès d'une opération B, l'application enregistre " "alors les intervalles d'adresses mémoire en utilisant l'opération " "d'B(2) B. Quand l'opération B s'est " "achevée avec succès, une erreur de page, se produisant dans l'intervalle de " "mémoire requis et satisfaisant au mode défini au moment de l'enregistrement, " "sera transmis par le noyau à l'application de l'espace utilisateur. " "L'application peut alors utiliser les opérations d'B(2) " "B, B ou B pour résoudre " "l'erreur de page." #. 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 "" "Depuis Linux 4.4, si l'application définit le bit de la fonction " "B en utilisant l'B(2) B, aucune " "notification d'erreur d page ne sera transmise à l'espace utilisateur. Un " "signal est envoyé à la place au processus en erreur. Avec cette fonction, " "userfaultfd peut être utilisé à des fins de robustesse pour capturer " "simplement tout accès aux zones dans l'intervalle d'adresses enregistré qui " "n'ont pas de pages allouées sans avoir à écouter les événements " "d'userfaultfd. Aucun contrôleur d'userfaultfd ne sera requis pour traiter ce " "type d'accès mémoire. Par exemple, cette fonction peut être utile à des " "applications qui désirent empêcher le noyau d'allouer des pages " "automatiquement et de remplir des trous dans des fichiers creux quand c'est " "un mappage mémoire qui permet l'accès aux trous." #. 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 "" "La fonction B est héritée de façon implicite avec " "B(2) si elle est utilisée en combinaison avec 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 "" "Des détails sur les différentes opérations d'B(2) sont disponibles " "dans 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 "" "Depuis Linux 4.11, les événements autres que les erreurs de page peuvent " "être activés pendant l'opération 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 "" "Jusqu'à Linux 4.11, userfaultfd ne peut être utilisé qu'avec des mappages de " "mémoire privée anonyme. Depuis Linux 4.11, userfaultfd peut aussi être " "utilisé avec des mappages de mémoire hugelbfs et partagée." #. 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 "Mode protection d'écriture d'userfaultfd (depuis Linux 5.7)" #. 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 "" "Depuis Linux 5.7, userfaultfd prend en charge le mode protection d'écriture " "pour la mémoire anonyme. L'utilisateur doit d'abord vérifier la " "disponibilité de cette fonctionnalité en utilisant l'ioctl B sur " "le bit de fonction B avant d'utiliser cette " "fonctionnalité." #. 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 "" "Depuis Linux 5.19, le mode protection d'écriture est aussi pris en charge " "sur la mémoire de type shmem ou hugetlbfs. Il peut être détecté avec le bit " "de fonction B." #. 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 "" "Pour enregistrer avec le mode page protégée en écriture de userfaultfd, " "l'utilisateur doit initier l'ioctl B avec le mode " "B défini. Notez qu'il est permis de surveiller le " "même intervalle de mémoire avec plusieurs modes. Par exemple, un utilisateur " "peut effectuer B avec le mode défini à " "B. Quand seul le " "mode B est enregistré, l'espace utilisateur ne " "recevra I notification quand une page manquante est écrite. À la " "place, l'espace utilisateur ne recevra une notification d'erreur de page " "protégée en écriture que quand une page existante et protégée en écriture " "est écrite." #. 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 "" "Après que l'ioctl B s'est terminé avec le mode " "B défini, l'utilisateur peut protéger en écriture " "toute mémoire dans l'intervalle en utilisant l'ioctl B " "où I devrait être défini à " "B." #. 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 "" "Quand un événement de protection en écriture survient, l'espace utilisateur " "recevra une notification d'erreur de page dont l'I " "aura l'attribut B défini. Notez : dans la mesure où " "seulement les écritures peuvent déclencher ce genre d'erreur, les " "notifications de protection en écriture auront toujours le bit " "B défini en même temps que le bit " "B." #. 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 "" "Pour résoudre une erreur de page de protection d'écriture, l'utilisateur " "doit initier un autre ioctl B dont l'I doit avoir l'attribut B effacé " "après la page ou l'intervalle fautif." #. 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 "Mode erreur mineure d'userfaultfd (depuis Linux 5.13)" #. 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 "" "Depuis Linux 5.13, userfaultfd prend en charge le mode erreur mineure. Dans " "ce mode, les messages d’erreur ne sont pas produits pour des erreurs " "majeures (où les pages étaient absentes), mais plutôt pour des erreurs " "mineures où une page existe dans le cache de page, mais où les entrées de la " "table de pages ne sont pas encore présentes. L'utilisateur doit d'abord " "vérifier la disponibilité de cette fonctionnalité en utilisant l'ioctl " "B avec les bits de fonction appropriés avant d'utiliser cette " "fonctionnalité : B depuis Linux 5.13 ou " "B depuis Linux 5.14." #. 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 "" "Pour enregistrer avec le mode erreur mineure d'userfaultfd, l'utilisateur " "doit initier l'ioctl B avec le mode " "B défini." #. 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 "" "Quand une erreur mineure survient, l'espace utilisateur recevra une " "notification d'erreur de page dont l'I aura " "l'attribut B défini." #. 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 "" "Pour résoudre une erreur de page mineure, le gestionnaire doit décider si le " "contenu de la page existante doit être modifiée d'abord, ou non. Si c'est le " "cas, cela doit être fait à son emplacement au moyen d'un second mappage non " "enregistré par userfaultfd vers la même page de sauvegarde (par exemple en " "mappant deux fois le fichier shmem ou hugetlbfs). Une fois que la page est " "considérée « à jour », l'erreur peut être résolue en initiant un ioctl " "B qui installe les entrées de la table de pages et (par " "défaut) réveille le ou les threads en erreur." #. 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 "" "Le mode erreur mineure ne prend en charge que la mémoire s'appuyant sur " "hugetlbfs (depuis Linux 5.13) et sur shmem (depuis Linux 5.14)." #. 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 "Lire à partir de la structure 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 "" "Chaque B(2) à partir du descripteur de fichier userfaultfd renvoie une " "ou plusieurs structures I, chacune d'elles décrit un événement " "d'erreur de page ou un événement requis pour l'utilisation non coopérative " "d'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 "" "struct uffd_msg {\n" " __u8 event; /* Type d'événement */\n" " ...\n" " union {\n" " struct {\n" " __u64 flags; /* Attributs décrivant l'erreur */\n" " __u64 address; /* Adresse fautive */\n" " union {\n" " __u32 ptid; /* ID du thread de l'erreur */\n" " } feat;\n" " } pagefault;\n" "\\&\n" " struct { /* Depuis Linux 4.11 */\n" " __u32 ufd; /* Descripteur de ficher d'userfault\n" " du processus enfant */\n" " } fork;\n" "\\&\n" " struct { /* Depuis Linux 4.11 */\n" " __u64 from; /* Ancienne adresse de la zone remappée */\n" " __u64 to; /* Nouvelle adresse de la zone remappée */\n" " __u64 len; /* Taille originale du mappage */\n" " } remap;\n" "\\&\n" " struct { /* Depuis Linux 4.11 */\n" " __u64 start; /* Adresse de début de la zone supprimée */\n" " __u64 end; /* Adresse de fin de la zone supprimée */\n" " } remove;\n" " ...\n" " } arg;\n" "\\&\n" " /* Remplissage des champs omis */\n" "} __packed;\n" #. 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 "" "Si plusieurs événements sont disponibles et si le tampon fourni est " "suffisamment grand, B(2) renvoie autant d'événements qu'il en tient " "dans le tampon fourni. Si le tampon fourni à B(2) est plus petit que " "la taille de la structure I, B(2) échoue avec l'erreur " "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 "Les champs définis dans la structure I sont les suivants :" #. 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 "" "Le type d'événement. Selon le type d'événement, différents champs de l'union " "I représentent les détails nécessaires au traitement de l'événement. " "Les événements qui ne sont pas des erreurs de page ne sont générés que quand " "la fonctionnalité appropriée est activée durant la connexion de l'API à " "l'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 following values can appear in the I field:" msgstr "Les valeurs suivantes peuvent apparaître dans le champ 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 (depuis 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 "" "Un événement d'erreur de page. Les détails de l'erreur de page sont " "disponibles dans le champ 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 (depuis 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 "" "Généré lorsque le processus en erreur invoque B(2) (ou B(2) " "sans l'attribut B). Les détails de l'événement sont disponibles " "dans le champ 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 (depuis 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 "" "Généré lorsque le processus en erreur invoque B(2). Les détails de " "l'événement sont disponibles dans le champ 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 (depuis 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 "" "Généré lorsque le processus en erreur invoque B(2) avec les " "conseils B ou B. Les détails de l'événement sont " "disponibles dans le champ 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 (depuis 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 "" "Généré lorsque le processus en erreur supprime le mappage d'un intervalle de " "mémoire soit explicitement avec B(2), soit implicitement durant " "l'exécution de B(2) ou B(2). Les détails de l'événement sont " "disponibles dans le champ 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 "L'adresse qui a déclenché l'erreur de page." #. 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 "" "Un masque de bits qui décrit l'événement. Pour B, les " "attributs suivants peuvent apparaître :" #. 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 "" "Si cet attribut est défini, alors l'erreur était une erreur de protection en " "écriture." #. 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 "Si cet attribut est défini, alors l'erreur était une erreur mineure." #. 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 "" "Si cet attribut est défini, alors l'erreur était une erreur d'écriture." #. 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 "" "Si ni B ni B ne sont " "définis, l'erreur était une erreur d'absence." #. 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 thread ID that triggered the page fault." msgstr "L'identifiant du thread qui a déclenché l'erreur de page." #. 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 "" "Le descripteur de fichier associé à l'objet userfault créé pour l'enfant " "créé par 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 address of the memory range that was remapped using " "B(2)." msgstr "" "L'adresse d'origine de la plage de mémoire dont le mappage a été modifié en " "utilisant 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 "" "La nouvelle adresse de la plage de mémoire dont le mappage a été modifié en " "utilisant 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 "" "La taille d'origine de la plage de mémoire dont le mappage a été modifié en " "utilisant 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 "" "L'adresse de début de la plage de mémoire qui a été libérée en utilisant " "B(2) ou dont le mappage a été supprimé." #. 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 "" "L'adresse terminale de la plage de mémoire qui a été libérée en utilisant " "B(2) ou dont le mappage a été supprimé." #. 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) sur un descripteur de fichier userfaultfd peut échouer pour les " "raisons suivantes :" #. 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 "" "L'objet userfaultfd n'a pas encore été activé avec l'opération d'B(2) " "B." #. 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 "" "Si l'attribut B est activé dans la description de fichier ouvert " "associée, le descripteur de fichier userfaultfd peut être surveillé avec " "B(2), B(2) indique que le descripteur de fichier est à la fois accessible " "en lecture et en écriture." #. 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 "VALEUR RENVOYÉE" #. type: Plain text #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed 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 "" "En cas de succès, B() renvoie un nouveau descripteur de fichier " "qui fait référence à l'objet userfaultfd. En cas d'erreur, la fonction " "renvoie B<-1> et I est défini pour indiquer l'erreur." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "ERRORS" msgstr "ERREURS" #. 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 "Une valeur non prise en compte a été spécifiée dans 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 "" "La limite par processus du nombre de descripteurs de fichier ouverts a été " "atteinte." #. 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 "" "La limite du nombre total de fichiers ouverts pour le système entier a été " "atteinte." #. 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 "La mémoire disponible du noyau n'était pas suffisante." #. 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 (depuis 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 "" "L'appelant n'est pas privilégié (il n'a pas la capacité B " "dans l'espace de noms initial) et I a " "la valeur B<0>." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "STANDARDS" msgstr "STANDARDS" #. 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 "HISTORIQUE" #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "Linux 4.3." msgstr "Linux 4.3." #. type: Plain text #: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron #: opensuse-leap-15-6 opensuse-tumbleweed msgid "" "Support for hugetlbfs and shared memory areas and non-page-fault events was " "added in Linux 4.11" msgstr "" "La prise en charge des zones de mémoire hugetlbfs et partagée et des " "événements qui ne sont pas des erreurs de page a été ajoutée dans 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 "NOTES" #. 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 "" "Le mécanisme d'userfaultfd peut être utilisé comme une alternative aux " "techniques traditionnelles de pagination de l'espace utilisateur basées sur " "l'utilisation du signal B et de B(2). Il peut aussi être " "utilisé pour implémenter la restauration en mode paresseux (« lazy " "restore ») pour les mécanismes de la fonctionnalité de gel des applications " "(checkpoint/restore), aussi bien que la migration après copie pour permettre " "une exécution (presque) ininterrompue lors du transfert de machines " "virtuelles et de conteneurs Linux d'un hôte à un autre." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "BUGS" msgstr "BOGUES" #. 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 "" "Si B est activé et si un appel système issu de la " "famille de B(2) est interrompu par un signal ou échoue, un descripteur " "périmé d'userfaultfd peut être créé. Dans ce cas, un faux B " "sera fourni au surveillant d'userfaultfd." #. type: SH #: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide #: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed #, no-wrap msgid "EXAMPLES" msgstr "EXEMPLES" #. 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 "" "Le programme ci-dessous démontre l'utilisation du mécanisme userfaultfd. Le " "programme crée deux threads, un qui agit comme gestionnaire d'erreur de page " "pour le processus, pour les pages dans une région sans demande de page en " "utilisant 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 "" "Le programme prend un argument en ligne de commande, qui est le nombre de " "pages qui seront créées dans un mappage dont les erreurs de pages seront " "gérées au moyen d'userfaultfd. Après la création d'un objet userfaultfd, le " "programme crée alors un mappage privé anonyme de la taille spécifiée et " "enregistre l'intervalle d'adresses de ce mappage en utilisant l'opération " "d'B(2) B. Le programme crée alors un second thread " "qui exécutera la tâche de gestion des erreurs de page." #. 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 "" "Le thread principal parcourt les pages du mappage à la recherche des octets " "des pages successives. Comme il n'y a pas eu encore d'accès aux pages, le " "premier accès à un octet de chaque page déclenchera un événement d'erreur de " "page sur le descripteur de fichier 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 "" "Chaque événement d'erreur de page est géré par le second thread qui " "s'installe dans une boucle traitant l'entrée du descripteur de fichier " "userfaultfd. À chaque itération de la boucle, le second thread appelle " "B(2) pour vérifier l'état du descripteur de fichier puis lit un " "événement à partir de ce descripteur de fichier. Tout ce type d'événements " "doit être un événement B que le thread traite en " "copiant un page de données dans la région en erreur en utilisant l'opération " "d'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 following is an example of what we see when running the program:" msgstr "" "La suite est un exemple de ce qui est observé lors de l'exécution du " "programme :" #. 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 "" "$ 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" #. 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 "Source du programme" #. type: Plain text #: archlinux fedora-40 fedora-rawhide mageia-cauldron #, fuzzy, 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" #| " 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" 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 "" "/* 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; /* descripteur du fichier userfaultfd */\n" " ssize_t nread;\n" " struct pollfd pollfd;\n" " struct uffdio_copy uffdio_copy;\n" "\\&\n" " static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" " static char *page = NULL;\n" " static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" "\\&\n" " uffd = (long) arg;\n" "\\&\n" " /* Créer une page qui sera copiée dans la région en erreur. */\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" " /* Boucle gérant les événements entrants sur le descripteur\n" " de fichier userfaultfd. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Voir ce que poll() nous dit sur l'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" " /* Lire un événement à partir de l'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" " /* Un seul type d'événement est attendu ; il faut vérifier\n" " cette supposition. */\n" "\\&\n" " if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" " fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Afficher une information sur l'événement erreur de page. */\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" " /* Copier la page sur laquelle pointe la « page » dans la région\n" " fautive. Varier le contenu copié, afin qu'il soit plus\n" " évident que chaque erreur soit gérée séparément. */\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" " /* Il est nécessaire de gérer les erreurs de page en\n" " unités de pages(!). Aussi, il faut arrondir les\n" " adresses fautives à la limite de page. */\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; /* Début de la région gérée par userfaultfd */\n" " long uffd; /* Descripteur de fichier userfaultfd */\n" " size_t len, l; /* Taille de la région gérée par userfaultfd */\n" " pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Utilisation : %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" " /* Créer et activer un objet userfaultfd. */\n" "\\&\n" " uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" " if (uffd == -1)\n" " err(EXIT_FAILURE, \"userfaultfd\");\n" "\\&\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" " /* Créer un mappage anonyme privé. La mémoire sera paginée\n" " avec aucune demande — c'est-à-dire, sans être encore\n" " allouée. Quand la mémoire sera réellement utilisée,\n" " elle sera allouée au moyen de l'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" " /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" " créé pour le traitement par l'objet userfaultfd. Dans mode,\n" " suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" " pas encore fautives). */\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" " /* Créer un thread qui traitera les événements userfaultfd. */\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" " /* Le thread principal utilise la mémoire dans le mappage,\n" " utilisant des emplacements séparés de 1024 octets. Cela va\n" " déclencher des événements userfaultfd pour toutes les pages\n" " dans la région. */\n" "\\&\n" " l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" " limite de page afin de vérifier que ce cas est\n" " correctement géré dans le 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); /* Ralentir un peu le traitement */\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. 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 "VOIR AUSSI" #. 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 dans l'arborescence des " "sources du noyau Linux" #. type: TH #: debian-bookworm #, no-wrap msgid "2023-02-05" msgstr "5 février 2023" #. type: TH #: debian-bookworm #, no-wrap msgid "Linux man-pages 6.03" msgstr "Pages du manuel de Linux 6.03" #. type: Plain text #: debian-bookworm debian-unstable opensuse-leap-15-6 opensuse-tumbleweed 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 "" "Après la création de l'objet userfaultfd avec B(), " "l'application doit l'activer en utilisant l'opération B de " "B(2). Cette opération permet une connexion entre le noyau et l'espace " "utilisateur pour déterminer la version de l'API et les fonctions prises en " "charge. Cette opération doit être réalisée avant toutes les autres " "opérations B(2) décrites plus bas (ou ces opérations échouent avec " "l'erreur B.)" #. type: Plain text #: debian-bookworm debian-unstable opensuse-leap-15-6 opensuse-tumbleweed 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 "" "Après le succès d'une opération B, l'application enregistre " "alors les intervalles d'adresses mémoire en utilisant l'opération " "d'B(2) B. Quand l'opération B s'est " "achevée avec succès, une erreur de page, se produisant dans l'intervalle de " "mémoire requis et satisfaisant au mode défini au moment de l'enregistrement, " "sera transmis par le noyau à l'application de l'espace utilisateur. " "L'application peut alors utiliser les opérations d'B(2) " "B, B ou B pour résoudre " "l'erreur de page." #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, 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" msgstr "" "struct uffd_msg {\n" " __u8 event; /* Type d'événement */\n" " ...\n" " union {\n" " struct {\n" " __u64 flags; /* Attributs décrivant l'erreur */\n" " __u64 address; /* Adresse fautive */\n" " union {\n" " __u32 ptid; /* ID du thread de l'erreur */\n" " } feat;\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 { /* Depuis Linux 4.11 */\n" " __u32 ufd; /* Descripteur de ficher d'userfault\n" " du processus enfant */\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 { /* Depuis Linux 4.11 */\n" " __u64 from; /* Ancienne adresse de la zone remappée */\n" " __u64 to; /* Nouvelle adresse de la zone remappée */\n" " __u64 len; /* Taille originale du mappage */\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 { /* Depuis Linux 4.11 */\n" " __u64 start; /* Adresse de début de la zone supprimée */\n" " __u64 end; /* Adresse de fin de la zone supprimée */\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 "" " /* Remplissage des champs omis */\n" "} __packed;\n" #. type: SH #: debian-bookworm #, no-wrap msgid "VERSIONS" msgstr "VERSIONS" #. type: Plain text #: debian-bookworm msgid "The B() system call first appeared in Linux 4.3." msgstr "" "L'appel système B() est apparu pour la première fois dans " "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 "" "La prise en charge des zones de mémoire hugetlbfs et partagée et des " "événements qui ne sont pas des erreurs de page a été ajoutée dans 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() est spécifique à Linux et ne devrait pas être employé dans " "des programmes destinés à être portables." #. 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" "Address returned by 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() 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" #. 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() 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" #. 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() 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" #. 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 "" " 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" #. 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 #, no-wrap 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" " int nready;\n" " long uffd; /* descripteur du fichier userfaultfd */\n" " ssize_t nread;\n" " struct pollfd pollfd;\n" " struct uffdio_copy uffdio_copy;\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 "" " static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" " static char *page = NULL;\n" " static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" #. 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 " /* Créer une page qui sera copiée dans la région en erreur. */\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" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " /* Loop, handling incoming events on the userfaultfd\n" " file descriptor. */\n" msgstr "" " /* Boucle gérant les événements entrants sur le descripteur\n" " de fichier 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 " /* Voir ce que poll() nous dit sur l'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() returns: 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 " /* Lire un événement à partir de l'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 on 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 "" " /* Un seul type d'événement est attendu ; il faut vérifier\n" " cette supposition. */\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, \"Unexpected event on 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 " /* Afficher une information sur l'événement erreur de page. */\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 event: \");\n" " printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" " printf(\"address = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap 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 "" " /* Copier la page sur laquelle pointe la « page » dans la région\n" " fautive. Varier le contenu copié, afin qu'il soit plus\n" " évident que chaque erreur soit gérée séparément. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap msgid "" " memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" " fault_cnt++;\n" msgstr "" " memset(page, \\[aq]A\\[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 "" " /* Il est nécessaire de gérer les erreurs de page en\n" " unités de pages(!). Aussi, il faut arrondir les\n" " adresses fautives à la limite de page. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, 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" 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 returned %\"PRId64\")\\en\",\n" " uffdio_copy.copy);\n" " }\n" "}\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap 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" " int s;\n" " char c;\n" " char *addr; /* Début de la région gérée par userfaultfd */\n" " long uffd; /* Descripteur de fichier userfaultfd */\n" " size_t len, l; /* Taille de la région gérée par userfaultfd */\n" " pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\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, \"Utilisation : %s num-pages\\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 " /* Créer et activer un objet 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 "" " /* Créer un mappage anonyme privé. La mémoire sera paginée\n" " avec aucune demande — c'est-à-dire, sans être encore\n" " allouée. Quand la mémoire sera réellement utilisée,\n" " elle sera allouée au moyen de l'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(\"Address returned by 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 "" " /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" " créé pour le traitement par l'objet userfaultfd. Dans mode,\n" " suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" " pas encore fautives). */\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 " /* Créer un thread qui traitera les événements 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 "" " /* Le thread principal utilise la mémoire dans le mappage,\n" " utilisant des emplacements séparés de 1024 octets. Cela va\n" " déclencher des événements userfaultfd pour toutes les pages\n" " dans la région. */\n" #. type: Plain text #: debian-bookworm opensuse-leap-15-6 #, no-wrap 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 "" " l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" " limite de page afin de vérifier que ce cas est\n" " correctement géré dans le 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); /* Ralentir un peu le traitement */\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 #: debian-unstable opensuse-tumbleweed #, no-wrap msgid "2023-05-03" msgstr "3 mai 2023" #. type: TH #: debian-unstable opensuse-tumbleweed #, no-wrap msgid "Linux man-pages 6.05.01" msgstr "Pages du manuel de Linux 6.05.01" #. type: Plain text #: debian-unstable 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" " 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 "" "/* 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; /* descripteur du fichier userfaultfd */\n" " ssize_t nread;\n" " struct pollfd pollfd;\n" " struct uffdio_copy uffdio_copy;\n" "\\&\n" " static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" " static char *page = NULL;\n" " static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" "\\&\n" " uffd = (long) arg;\n" "\\&\n" " /* Créer une page qui sera copiée dans la région en erreur. */\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" " /* Boucle gérant les événements entrants sur le descripteur\n" " de fichier userfaultfd. */\n" "\\&\n" " for (;;) {\n" "\\&\n" " /* Voir ce que poll() nous dit sur l'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" " /* Lire un événement à partir de l'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" " /* Un seul type d'événement est attendu ; il faut vérifier\n" " cette supposition. */\n" "\\&\n" " if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" " fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n" " exit(EXIT_FAILURE);\n" " }\n" "\\&\n" " /* Afficher une information sur l'événement erreur de page. */\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" " /* Copier la page sur laquelle pointe la « page » dans la région\n" " fautive. Varier le contenu copié, afin qu'il soit plus\n" " évident que chaque erreur soit gérée séparément. */\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" " /* Il est nécessaire de gérer les erreurs de page en\n" " unités de pages(!). Aussi, il faut arrondir les\n" " adresses fautives à la limite de page. */\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; /* Début de la région gérée par userfaultfd */\n" " long uffd; /* Descripteur de fichier userfaultfd */\n" " size_t len, l; /* Taille de la région gérée par userfaultfd */\n" " pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" " struct uffdio_api uffdio_api;\n" " struct uffdio_register uffdio_register;\n" "\\&\n" " if (argc != 2) {\n" " fprintf(stderr, \"Utilisation : %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" " /* Créer et activer un objet userfaultfd. */\n" "\\&\n" " uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" " if (uffd == -1)\n" " err(EXIT_FAILURE, \"userfaultfd\");\n" "\\&\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" " /* Créer un mappage anonyme privé. La mémoire sera paginée\n" " avec aucune demande — c'est-à-dire, sans être encore\n" " allouée. Quand la mémoire sera réellement utilisée,\n" " elle sera allouée au moyen de l'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" " /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" " créé pour le traitement par l'objet userfaultfd. Dans mode,\n" " suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" " pas encore fautives). */\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" " /* Créer un thread qui traitera les événements userfaultfd. */\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" " /* Le thread principal utilise la mémoire dans le mappage,\n" " utilisant des emplacements séparés de 1024 octets. Cela va\n" " déclencher des événements userfaultfd pour toutes les pages\n" " dans la région. */\n" "\\&\n" " l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" " limite de page afin de vérifier que ce cas est\n" " correctement géré dans le 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); /* Ralentir un peu le traitement */\n" " }\n" "\\&\n" " exit(EXIT_SUCCESS);\n" "}\n" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "2023-03-30" msgstr "30 mars 2023" #. type: TH #: opensuse-leap-15-6 #, no-wrap msgid "Linux man-pages 6.04" msgstr "Pages du manuel de Linux 6.04"