| 1 |
# French translation of manpages |
| 2 |
# This file is distributed under the same license as the manpages-l10n package. |
| 3 |
# Copyright © of this file: |
| 4 |
# Christophe Blaess <https://www.blaess.fr/christophe/>, 1996-2003. |
| 5 |
# Stéphan Rafin <[email protected]>, 2002. |
| 6 |
# Thierry Vignaud <[email protected]>, 1999, 2002. |
| 7 |
# François Micaux, 2002. |
| 8 |
# Alain Portal <[email protected]>, 2003-2008. |
| 9 |
# Jean-Philippe Guérard <[email protected]>, 2005-2006. |
| 10 |
# Jean-Luc Coulon (f5ibh) <[email protected]>, 2006-2007. |
| 11 |
# Julien Cristau <[email protected]>, 2006-2007. |
| 12 |
# Thomas Huriaux <[email protected]>, 2006-2008. |
| 13 |
# Nicolas François <[email protected]>, 2006-2008. |
| 14 |
# Florentin Duneau <[email protected]>, 2006-2010. |
| 15 |
# Simon Paillard <[email protected]>, 2006, 2013, 2014. |
| 16 |
# Denis Barbier <[email protected]>, 2006, 2010, 2011. |
| 17 |
# David Prévot <[email protected]>, 2010, 2012-2014. |
| 18 |
# Jean-Pierre Giraud <[email protected]>, 2024-2026. |
| 19 |
msgid "" |
| 20 |
msgstr "" |
| 21 |
"Project-Id-Version: manpages-l10n 4.23.0\n" |
| 22 |
"POT-Creation-Date: 2026-06-05 06:50+0200\n" |
| 23 |
"PO-Revision-Date: 2026-03-28 11:56+000\n" |
| 24 |
"Last-Translator: Jean-Pierre Giraud <[email protected]>\n" |
| 25 |
"Language-Team: French <[email protected]>\n" |
| 26 |
"Language: fr\n" |
| 27 |
"MIME-Version: 1.0\n" |
| 28 |
"Content-Type: text/plain; charset=UTF-8\n" |
| 29 |
"Content-Transfer-Encoding: 8bit\n" |
| 30 |
"Plural-Forms: nplurals=2; plural=n > 1;\n" |
| 31 |
"X-Generator: Lokalize 25.04.0\n" |
| 32 |
|
| 33 |
#. type: TH |
| 34 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 35 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 36 |
#, no-wrap |
| 37 |
msgid "userfaultfd" |
| 38 |
msgstr "userfaultfd" |
| 39 |
|
| 40 |
#. type: TH |
| 41 |
#: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed |
| 42 |
#, no-wrap |
| 43 |
msgid "2026-02-16" |
| 44 |
msgstr "16 février 2026" |
| 45 |
|
| 46 |
#. type: TH |
| 47 |
#: archlinux debian-unstable |
| 48 |
#, no-wrap |
| 49 |
msgid "Linux man-pages 6.18" |
| 50 |
msgstr "Pages du manuel de Linux 6.18" |
| 51 |
|
| 52 |
#. type: SH |
| 53 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 54 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 55 |
#, no-wrap |
| 56 |
msgid "NAME" |
| 57 |
msgstr "NOM" |
| 58 |
|
| 59 |
#. type: Plain text |
| 60 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 61 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 62 |
msgid "" |
| 63 |
"userfaultfd - create a file descriptor for handling page faults in user space" |
| 64 |
msgstr "" |
| 65 |
"userfaultfd - Créer un descripteur de fichier pour gérer les erreurs de page " |
| 66 |
"en espace utilisateur" |
| 67 |
|
| 68 |
#. type: SH |
| 69 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 70 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 71 |
#, no-wrap |
| 72 |
msgid "LIBRARY" |
| 73 |
msgstr "BIBLIOTHÈQUE" |
| 74 |
|
| 75 |
#. type: Plain text |
| 76 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 77 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 78 |
msgid "Standard C library (I<libc>,\\ I<-lc>)" |
| 79 |
msgstr "Bibliothèque C standard (I<libc>,\\ I<-lc>)" |
| 80 |
|
| 81 |
#. type: SH |
| 82 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 83 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 84 |
#, no-wrap |
| 85 |
msgid "SYNOPSIS" |
| 86 |
msgstr "SYNOPSIS" |
| 87 |
|
| 88 |
#. type: Plain text |
| 89 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 90 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 91 |
#, no-wrap |
| 92 |
msgid "" |
| 93 |
"B<#include E<lt>fcntl.hE<gt>> /* Definition of B<O_*> constants */\n" |
| 94 |
"B<#include E<lt>sys/syscall.hE<gt>> /* Definition of B<SYS_*> constants */\n" |
| 95 |
"B<#include E<lt>linux/userfaultfd.hE<gt>> /* Definition of B<UFFD_*> constants */\n" |
| 96 |
"B<#include E<lt>unistd.hE<gt>>\n" |
| 97 |
msgstr "" |
| 98 |
"B<#include E<lt>fcntl.hE<gt>> /* Définition des constantes B<O_*> */\n" |
| 99 |
"B<#include E<lt>sys/syscall.hE<gt>> /* Définition des constantes B<SYS_*> */\n" |
| 100 |
"B<#include E<lt>linux/userfaultfd.hE<gt>> /* Définition des constantes B<UFFD_*> */\n" |
| 101 |
"B<#include E<lt>unistd.hE<gt>>\n" |
| 102 |
|
| 103 |
#. type: Plain text |
| 104 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 105 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 106 |
#, no-wrap |
| 107 |
msgid "B<int syscall(SYS_userfaultfd, int >I<flags>B<);>\n" |
| 108 |
msgstr "B<int syscall(SYS_userfaultfd, int >I<flags>B<);>\n" |
| 109 |
|
| 110 |
#. type: Plain text |
| 111 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 112 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 113 |
msgid "" |
| 114 |
"I<Note>: glibc provides no wrapper for B<userfaultfd>(), necessitating the " |
| 115 |
"use of B<syscall>(2)." |
| 116 |
msgstr "" |
| 117 |
"I<Note> : la glibc ne fournit pas d'enveloppe pour B<userfaultfd>(), " |
| 118 |
"imposant l'utilisation de B<syscall>(2)." |
| 119 |
|
| 120 |
#. type: SH |
| 121 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 122 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 123 |
#, no-wrap |
| 124 |
msgid "DESCRIPTION" |
| 125 |
msgstr "DESCRIPTION" |
| 126 |
|
| 127 |
#. type: Plain text |
| 128 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 129 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 130 |
msgid "" |
| 131 |
"B<userfaultfd>() creates a new userfaultfd object that can be used for " |
| 132 |
"delegation of page-fault handling to a user-space application, and returns a " |
| 133 |
"file descriptor that refers to the new object. The new userfaultfd object " |
| 134 |
"is configured using B<ioctl>(2)." |
| 135 |
msgstr "" |
| 136 |
"B<userfaultfd>() crée un nouvel objet userfaultfd qui peut être utilisé pour " |
| 137 |
"la délégation de la gestion des erreurs de page à une application de " |
| 138 |
"l'espace utilisateur et renvoie un descripteur de fichier qui fait référence " |
| 139 |
"au nouvel objet. Le nouvel objet userfaultfd est configuré en utilisant " |
| 140 |
"B<ioctl>(2)." |
| 141 |
|
| 142 |
#. type: Plain text |
| 143 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 144 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 145 |
msgid "" |
| 146 |
"Once the userfaultfd object is configured, the application can use " |
| 147 |
"B<read>(2) to receive userfaultfd notifications. The reads from " |
| 148 |
"userfaultfd may be blocking or non-blocking, depending on the value of " |
| 149 |
"I<flags> used for the creation of the userfaultfd or subsequent calls to " |
| 150 |
"B<fcntl>(2)." |
| 151 |
msgstr "" |
| 152 |
"Une fois l'objet userfaultfd configuré, l'application peut utiliser " |
| 153 |
"B<read>(2) pour recevoir des notification d'userfaultfd. Les lectures à " |
| 154 |
"partir d'userfaultfd peuvent être bloquantes ou non bloquantes en fonction " |
| 155 |
"de la valeur des attributs (I<flags>) utilisés pour la création de " |
| 156 |
"l'userfaultfd ou des appels suivants à B<fcntl>(2)." |
| 157 |
|
| 158 |
#. type: Plain text |
| 159 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 160 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 161 |
msgid "" |
| 162 |
"The following values may be bitwise ORed in I<flags> to change the behavior " |
| 163 |
"of B<userfaultfd>():" |
| 164 |
msgstr "" |
| 165 |
"Les valeurs suivantes peuvent être combinées dans I<flags> par un OU binaire " |
| 166 |
"pour modifier le comportement d'B<userfaultfd>() :" |
| 167 |
|
| 168 |
#. type: TP |
| 169 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 170 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 171 |
#, no-wrap |
| 172 |
msgid "B<O_CLOEXEC>" |
| 173 |
msgstr "B<O_CLOEXEC>" |
| 174 |
|
| 175 |
#. type: Plain text |
| 176 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 177 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 178 |
msgid "" |
| 179 |
"Enable the close-on-exec flag for the new userfaultfd file descriptor. See " |
| 180 |
"the description of the B<O_CLOEXEC> flag in B<open>(2)." |
| 181 |
msgstr "" |
| 182 |
"Activer l'attribut close-on-exec pour le nouveau descripteur de fichier " |
| 183 |
"userfaultfd. Consultez la description de l'attribut B<O_CLOEXEC> dans " |
| 184 |
"B<open>(2)." |
| 185 |
|
| 186 |
#. type: TP |
| 187 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 188 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 189 |
#, no-wrap |
| 190 |
msgid "B<O_NONBLOCK>" |
| 191 |
msgstr "B<O_NONBLOCK>" |
| 192 |
|
| 193 |
#. type: Plain text |
| 194 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 195 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 196 |
msgid "" |
| 197 |
"Enables non-blocking operation for the userfaultfd object. See the " |
| 198 |
"description of the B<O_NONBLOCK> flag in B<open>(2)." |
| 199 |
msgstr "" |
| 200 |
"Permettre une opération non bloquante pour l'objet userfaultfd. Voir la " |
| 201 |
"description de l'attribut B<O_NONBLOCK> dans B<open>(2)." |
| 202 |
|
| 203 |
#. type: TP |
| 204 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 205 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 206 |
#, no-wrap |
| 207 |
msgid "B<UFFD_USER_MODE_ONLY>" |
| 208 |
msgstr "B<UFFD_USER_MODE_ONLY>" |
| 209 |
|
| 210 |
#. type: Plain text |
| 211 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 212 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 213 |
msgid "" |
| 214 |
"This is an userfaultfd-specific flag that was introduced in Linux 5.11. " |
| 215 |
"When set, the userfaultfd object will only be able to handle page faults " |
| 216 |
"originated from the user space on the registered regions. When a kernel-" |
| 217 |
"originated fault was triggered on the registered range with this " |
| 218 |
"userfaultfd, a B<SIGBUS> signal will be delivered." |
| 219 |
msgstr "" |
| 220 |
"C'est un attribut spécifique à userfaultfd qui a été introduit dans Linux\\ " |
| 221 |
"5.11. Quand il est défini, l'objet userfaultfd ne pourra gérer que les " |
| 222 |
"erreurs de page provenant de l'espace utilisateur dans les régions " |
| 223 |
"enregistrées. Quand une erreur provenant du noyau est déclenchée dans " |
| 224 |
"l'intervalle enregistré avec cet userfaultfd, un signal B<SIGBUS> sera " |
| 225 |
"envoyé." |
| 226 |
|
| 227 |
#. type: Plain text |
| 228 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 229 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 230 |
msgid "" |
| 231 |
"When the last file descriptor referring to a userfaultfd object is closed, " |
| 232 |
"all memory ranges that were registered with the object are unregistered and " |
| 233 |
"unread events are flushed." |
| 234 |
msgstr "" |
| 235 |
"Quand le dernier descripteur de fichier faisant référence à un objet " |
| 236 |
"userfaultfd est fermé, tous les intervalles de mémoire qui ont été " |
| 237 |
"enregistrés avec l'objet sont désenregistrés et les événements non lus sont " |
| 238 |
"vidés." |
| 239 |
|
| 240 |
#. type: Plain text |
| 241 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 242 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 243 |
msgid "Userfaultfd supports three modes of registration:" |
| 244 |
msgstr "Userfaultfd gère trois modes d'enregistrement :" |
| 245 |
|
| 246 |
#. type: TP |
| 247 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 248 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 249 |
#, no-wrap |
| 250 |
msgid "B<UFFDIO_REGISTER_MODE_MISSING> (since Linux 4.10)" |
| 251 |
msgstr "B<UFFDIO_REGISTER_MODE_MISSING> (depuis Linux 4.10)" |
| 252 |
|
| 253 |
#. type: Plain text |
| 254 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 255 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 256 |
msgid "" |
| 257 |
"When registered with B<UFFDIO_REGISTER_MODE_MISSING> mode, user-space will " |
| 258 |
"receive a page-fault notification when a missing page is accessed. The " |
| 259 |
"faulted thread will be stopped from execution until the page fault is " |
| 260 |
"resolved from user-space by either an B<UFFDIO_COPY> or an " |
| 261 |
"B<UFFDIO_ZEROPAGE> ioctl." |
| 262 |
msgstr "" |
| 263 |
"Quand il est enregistré avec le mode B<UFFDIO_REGISTER_MODE_MISSING>, " |
| 264 |
"l'espace utilisateur recevra une notification d'erreur de page lors de " |
| 265 |
"l'accès à une page manquante. L'exécution du thread fautif sera arrêtée " |
| 266 |
"jusqu'à ce que l'erreur de page soit résolue à partir de l'espace " |
| 267 |
"utilisateur par un ioctl B<UFFDIO_COPY> ou B<UFFDIO_ZEROPAGE>." |
| 268 |
|
| 269 |
#. type: TP |
| 270 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 271 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 272 |
#, no-wrap |
| 273 |
msgid "B<UFFDIO_REGISTER_MODE_MINOR> (since Linux 5.13)" |
| 274 |
msgstr "B<UFFDIO_REGISTER_MODE_MINOR> (depuis Linux 5.13)" |
| 275 |
|
| 276 |
#. type: Plain text |
| 277 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 278 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 279 |
msgid "" |
| 280 |
"When registered with B<UFFDIO_REGISTER_MODE_MINOR> mode, user-space will " |
| 281 |
"receive a page-fault notification when a minor page fault occurs. That is, " |
| 282 |
"when a backing page is in the page cache, but page table entries don't yet " |
| 283 |
"exist. The faulted thread will be stopped from execution until the page " |
| 284 |
"fault is resolved from user-space by an B<UFFDIO_CONTINUE> ioctl." |
| 285 |
msgstr "" |
| 286 |
"Quand il est enregistré avec le mode B<UFFDIO_REGISTER_MODE_MINOR>, l'espace " |
| 287 |
"utilisateur recevra une notification d'erreur de page lorsqu'une erreur de " |
| 288 |
"page mineure survient. C'est-à-dire quand une page de sauvegarde est dans le " |
| 289 |
"cache de page, mais les entrées dans la table de pages n'existent pas " |
| 290 |
"encore. L'exécution du thread fautif sera arrêtée jusqu'à ce que l'erreur de " |
| 291 |
"page soit résolue à partir de l'espace utilisateur par un ioctl " |
| 292 |
"B<UFFDIO_CONTINUE>." |
| 293 |
|
| 294 |
#. type: TP |
| 295 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 296 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 297 |
#, no-wrap |
| 298 |
msgid "B<UFFDIO_REGISTER_MODE_WP> (since Linux 5.7)" |
| 299 |
msgstr "B<UFFDIO_REGISTER_MODE_WP> (depuis Linux 5.7)" |
| 300 |
|
| 301 |
#. type: Plain text |
| 302 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 303 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 304 |
msgid "" |
| 305 |
"When registered with B<UFFDIO_REGISTER_MODE_WP> mode, user-space will " |
| 306 |
"receive a page-fault notification when a write-protected page is written. " |
| 307 |
"The faulted thread will be stopped from execution until user-space write-" |
| 308 |
"unprotects the page using an B<UFFDIO_WRITEPROTECT> ioctl." |
| 309 |
msgstr "" |
| 310 |
"Quand il est enregistré avec le mode B<UFFDIO_REGISTER_MODE_WP>, l'espace " |
| 311 |
"utilisateur recevra une notification d'erreur de page lors d'une écriture " |
| 312 |
"sur une page protégée en écriture. L'exécution du thread fautif sera arrêtée " |
| 313 |
"jusqu'à ce que l'espace utilisateur supprime la protection de la page en " |
| 314 |
"utilisant un ioctl B<UFFDIO_WRITEPROTECT>." |
| 315 |
|
| 316 |
#. type: Plain text |
| 317 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 318 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 319 |
msgid "" |
| 320 |
"Multiple modes can be enabled at the same time for the same memory range." |
| 321 |
msgstr "" |
| 322 |
"Plusieurs modes peuvent être activés en même temps pour le même intervalle " |
| 323 |
"de mémoire." |
| 324 |
|
| 325 |
#. type: Plain text |
| 326 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 327 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 328 |
msgid "" |
| 329 |
"Since Linux 4.14, a userfaultfd page-fault notification can selectively " |
| 330 |
"embed faulting thread ID information into the notification. One needs to " |
| 331 |
"enable this feature explicitly using the B<UFFD_FEATURE_THREAD_ID> feature " |
| 332 |
"bit when initializing the userfaultfd context. By default, thread ID " |
| 333 |
"reporting is disabled." |
| 334 |
msgstr "" |
| 335 |
"Depuis Linux 4.14, une notification d'erreur de page d'userfaultfd peut " |
| 336 |
"incorporer de façon sélective des informations d'identifiant des threads en " |
| 337 |
"erreur dans une notification. Il est nécessaire d'activer cette " |
| 338 |
"fonctionnalité explicitement en utilisant le bit de fonction " |
| 339 |
"B<UFFD_FEATURE_THREAD_ID> lors de l'initialisation du contexte " |
| 340 |
"d'userfaultfd. Par défaut, la déclaration de l'identifiant du thread est " |
| 341 |
"désactivée." |
| 342 |
|
| 343 |
#. type: SS |
| 344 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 345 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 346 |
#, no-wrap |
| 347 |
msgid "Usage" |
| 348 |
msgstr "Utilisation" |
| 349 |
|
| 350 |
#. type: Plain text |
| 351 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 352 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 353 |
msgid "" |
| 354 |
"The userfaultfd mechanism is designed to allow a thread in a multithreaded " |
| 355 |
"program to perform user-space paging for the other threads in the process. " |
| 356 |
"When a page fault occurs for one of the regions registered to the " |
| 357 |
"userfaultfd object, the faulting thread is put to sleep and an event is " |
| 358 |
"generated that can be read via the userfaultfd file descriptor. The fault-" |
| 359 |
"handling thread reads events from this file descriptor and services them " |
| 360 |
"using the operations described in B<ioctl_userfaultfd>(2). When servicing " |
| 361 |
"the page fault events, the fault-handling thread can trigger a wake-up for " |
| 362 |
"the sleeping thread." |
| 363 |
msgstr "" |
| 364 |
"Le mécanisme d'userfaultfd est conçu pour permettre à un thread dans un " |
| 365 |
"programme multi-thread de réaliser la pagination en espace utilisateur pour " |
| 366 |
"d'autres threads dans le processus. Lorsqu'un erreur de page survient pour " |
| 367 |
"une des régions enregistrées dans l'objet userfaultfd, le thread en erreur " |
| 368 |
"est mis en sommeil et un événement est généré qui peut être lu au moyen du " |
| 369 |
"descripteur de fichier userfaultfd. Le thread de gestion d'erreur lit les " |
| 370 |
"événements à partir de ce descripteur de fichier et les corrige en utilisant " |
| 371 |
"les opérations décrites dans B<ioctl_userfaultfd>(2). Lors de l'intervention " |
| 372 |
"sur les événements d'erreur de page, le thread de gestion d'erreur peut " |
| 373 |
"déclencher le réveil d'un thread endormi." |
| 374 |
|
| 375 |
#. type: Plain text |
| 376 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 377 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 378 |
msgid "" |
| 379 |
"It is possible for the faulting threads and the fault-handling threads to " |
| 380 |
"run in the context of different processes. In this case, these threads may " |
| 381 |
"belong to different programs, and the program that executes the faulting " |
| 382 |
"threads will not necessarily cooperate with the program that handles the " |
| 383 |
"page faults. In such non-cooperative mode, the process that monitors " |
| 384 |
"userfaultfd and handles page faults needs to be aware of the changes in the " |
| 385 |
"virtual memory layout of the faulting process to avoid memory corruption." |
| 386 |
msgstr "" |
| 387 |
"Il est possible que les threads en erreur et les threads traitant les " |
| 388 |
"erreurs soient exécutés dans le contexte de processus différents. Dans ce " |
| 389 |
"cas, ces threads peuvent appartenir à différents programmes, et le programme " |
| 390 |
"qui exécute les threads en erreur ne collaborera pas nécessairement avec le " |
| 391 |
"programme qui gère les erreurs de page. Dans ce mode non coopératif, le " |
| 392 |
"processus qui contrôle userfaultfd et gère les erreurs de page a besoin " |
| 393 |
"d'avoir connaissance des modifications dans la disposition de la mémoire " |
| 394 |
"virtuelle du processus en erreur pour éviter une corruption de mémoire.'" |
| 395 |
|
| 396 |
#. type: Plain text |
| 397 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 398 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 399 |
msgid "" |
| 400 |
"Since Linux 4.11, userfaultfd can also notify the fault-handling threads " |
| 401 |
"about changes in the virtual memory layout of the faulting process. In " |
| 402 |
"addition, if the faulting process invokes B<fork>(2), the userfaultfd " |
| 403 |
"objects associated with the parent may be duplicated into the child process " |
| 404 |
"and the userfaultfd monitor will be notified (via the B<UFFD_EVENT_FORK> " |
| 405 |
"described below) about the file descriptor associated with the userfault " |
| 406 |
"objects created for the child process, which allows the userfaultfd monitor " |
| 407 |
"to perform user-space paging for the child process. Unlike page faults " |
| 408 |
"which have to be synchronous and require an explicit or implicit wakeup, all " |
| 409 |
"other events are delivered asynchronously and the non-cooperative process " |
| 410 |
"resumes execution as soon as the userfaultfd manager executes B<read>(2). " |
| 411 |
"The userfaultfd manager should carefully synchronize calls to B<UFFDIO_COPY> " |
| 412 |
"with the processing of events." |
| 413 |
msgstr "" |
| 414 |
"Depuis Linux 4.11, userfaultfd peut aussi informer les threads gérant les " |
| 415 |
"erreurs des modifications dans la disposition de la mémoire virtuelle du " |
| 416 |
"processus en erreur. De plus, si le processus en erreur invoque B<fork>(2), " |
| 417 |
"les objets userfaultfd associés au parent peuvent être dupliqués dans le " |
| 418 |
"processus enfant et le contrôleur d'userfaultfd sera informé (au moyen de " |
| 419 |
"B<UFFD_EVENT_FORK> décrit plus bas) sur le descripteur de fichier associé " |
| 420 |
"aux objets userfault créés pour le processus enfant, ce qui permet au " |
| 421 |
"contrôleur d'userfaultfd de réaliser la pagination de l'espace utilisateur " |
| 422 |
"pour le processus enfant. À la différence des erreurs de page qui doivent " |
| 423 |
"être synchrones et réclament un réveil explicite ou explicite, tous les " |
| 424 |
"autres événements sont envoyés de façon asynchrone et le processus non " |
| 425 |
"coopératif reprend son exécution dès que le gestionnaire d'userfaultfd " |
| 426 |
"exécute B<read>(2). Le gestionnaire d'userfaultfd doit soigneusement " |
| 427 |
"synchroniser les appels à B<UFFDIO_COPY> avec le traitement des événements." |
| 428 |
|
| 429 |
#. #-#-#-#-# archlinux: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 430 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 431 |
#. The major point here is that current events delivery model could be |
| 432 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 433 |
#. impossible to ensure synchronization between page faults and non-page |
| 434 |
#. fault events in multi-threaded monitor. |
| 435 |
#. .P |
| 436 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 437 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 438 |
#. and limitations remaining in Linux 4.11 |
| 439 |
#. Maybe it's worth adding a dedicated sub-section... |
| 440 |
#. type: Plain text |
| 441 |
#. #-#-#-#-# debian-trixie: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 442 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 443 |
#. The major point here is that current events delivery model could be |
| 444 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 445 |
#. impossible to ensure synchronization between page faults and non-page |
| 446 |
#. fault events in multi-threaded monitor. |
| 447 |
#. .P |
| 448 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 449 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 450 |
#. and limitations remaining in Linux 4.11 |
| 451 |
#. Maybe it's worth adding a dedicated sub-section... |
| 452 |
#. type: Plain text |
| 453 |
#. #-#-#-#-# debian-unstable: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 454 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 455 |
#. The major point here is that current events delivery model could be |
| 456 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 457 |
#. impossible to ensure synchronization between page faults and non-page |
| 458 |
#. fault events in multi-threaded monitor. |
| 459 |
#. .P |
| 460 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 461 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 462 |
#. and limitations remaining in Linux 4.11 |
| 463 |
#. Maybe it's worth adding a dedicated sub-section... |
| 464 |
#. type: Plain text |
| 465 |
#. #-#-#-#-# fedora-44: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 466 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 467 |
#. The major point here is that current events delivery model could be |
| 468 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 469 |
#. impossible to ensure synchronization between page faults and non-page |
| 470 |
#. fault events in multi-threaded monitor. |
| 471 |
#. .P |
| 472 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 473 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 474 |
#. and limitations remaining in Linux 4.11 |
| 475 |
#. Maybe it's worth adding a dedicated sub-section... |
| 476 |
#. type: Plain text |
| 477 |
#. #-#-#-#-# fedora-rawhide: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 478 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 479 |
#. The major point here is that current events delivery model could be |
| 480 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 481 |
#. impossible to ensure synchronization between page faults and non-page |
| 482 |
#. fault events in multi-threaded monitor. |
| 483 |
#. .P |
| 484 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 485 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 486 |
#. and limitations remaining in Linux 4.11 |
| 487 |
#. Maybe it's worth adding a dedicated sub-section... |
| 488 |
#. type: Plain text |
| 489 |
#. #-#-#-#-# mageia-cauldron: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 490 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 491 |
#. The major point here is that current events delivery model could be |
| 492 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 493 |
#. impossible to ensure synchronization between page faults and non-page |
| 494 |
#. fault events in multi-threaded monitor. |
| 495 |
#. .P |
| 496 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 497 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 498 |
#. and limitations remaining in Linux 4.11 |
| 499 |
#. Maybe it's worth adding a dedicated sub-section... |
| 500 |
#. type: Plain text |
| 501 |
#. #-#-#-#-# opensuse-leap-16-1: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 502 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 503 |
#. The major point here is that current events delivery model could be |
| 504 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 505 |
#. impossible to ensure synchronization between page faults and non-page |
| 506 |
#. fault events in multi-threaded monitor. |
| 507 |
#. .P |
| 508 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 509 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 510 |
#. and limitations remaining in Linux 4.11 |
| 511 |
#. Maybe it's worth adding a dedicated sub-section... |
| 512 |
#. type: Plain text |
| 513 |
#. #-#-#-#-# opensuse-tumbleweed: userfaultfd.2.pot (PACKAGE VERSION) #-#-#-#-# |
| 514 |
#. Regarding the preceding sentence, Mike Rapoport says: |
| 515 |
#. The major point here is that current events delivery model could be |
| 516 |
#. problematic for multi-threaded monitor. I even suspect that it would be |
| 517 |
#. impossible to ensure synchronization between page faults and non-page |
| 518 |
#. fault events in multi-threaded monitor. |
| 519 |
#. .P |
| 520 |
#. FIXME elaborate about non-cooperating mode, describe its limitations |
| 521 |
#. for kernels before Linux 4.11, features added in Linux 4.11 |
| 522 |
#. and limitations remaining in Linux 4.11 |
| 523 |
#. Maybe it's worth adding a dedicated sub-section... |
| 524 |
#. type: Plain text |
| 525 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 526 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 527 |
msgid "" |
| 528 |
"The current asynchronous model of the event delivery is optimal for single " |
| 529 |
"threaded non-cooperative userfaultfd manager implementations." |
| 530 |
msgstr "" |
| 531 |
"Le modèle asynchrone actuel d'envoi d'événement est optimal pour des " |
| 532 |
"implémentations de gestionnaire userfaultfd non coopératif à thread unique." |
| 533 |
|
| 534 |
#. type: Plain text |
| 535 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 536 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 537 |
msgid "" |
| 538 |
"Since Linux 5.7, userfaultfd is able to do synchronous page dirty tracking " |
| 539 |
"using the new write-protect register mode. One should check against the " |
| 540 |
"feature bit B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> before using this feature. " |
| 541 |
"Similar to the original userfaultfd missing mode, the write-protect mode " |
| 542 |
"will generate a userfaultfd notification when the protected page is " |
| 543 |
"written. The user needs to resolve the page fault by unprotecting the " |
| 544 |
"faulted page and kicking the faulted thread to continue. For more " |
| 545 |
"information, please refer to the \"Userfaultfd write-protect mode\" section." |
| 546 |
msgstr "" |
| 547 |
"Depuis Linux 5.7, userfaultfd peut effectuer le suivi synchrone de page sale " |
| 548 |
"en utilisant le nouveau mode d'enregistrement de page protégée en écriture. " |
| 549 |
"Il faut vérifier le bit de fonction B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> avant " |
| 550 |
"d'utiliser cette fonctionnalité. Le mode protection en écriture, similaire " |
| 551 |
"au mode d'origine page manquante d'userfaultfd, génère une notification " |
| 552 |
"d'userfaultfd quand la page protégée en écriture est écrite. L'utilisateur " |
| 553 |
"doit résoudre l'erreur de page en déprotégeant la page fautive et en forçant " |
| 554 |
"le thread fautif à continuer. Pour plus d'informations, consultez la section " |
| 555 |
"«\\ Mode protection d'écriture d'userfaultfd\\ »" |
| 556 |
|
| 557 |
#. type: SS |
| 558 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 559 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 560 |
#, no-wrap |
| 561 |
msgid "Userfaultfd operation" |
| 562 |
msgstr "Fonctionnement d'userfaultfd" |
| 563 |
|
| 564 |
#. type: Plain text |
| 565 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 566 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 567 |
msgid "" |
| 568 |
"After the userfaultfd object is created with B<userfaultfd>(), the " |
| 569 |
"application must enable it using the B<UFFDIO_API> B<ioctl>(2) operation. " |
| 570 |
"This operation allows a two-step handshake between the kernel and user space " |
| 571 |
"to determine what API version and features the kernel supports, and then to " |
| 572 |
"enable those features user space wants. This operation must be performed " |
| 573 |
"before any of the other B<ioctl>(2) operations described below (or those " |
| 574 |
"operations fail with the B<EINVAL> error)." |
| 575 |
msgstr "" |
| 576 |
"Après la création de l'objet userfaultfd avec B<userfaultfd>(), " |
| 577 |
"l'application doit l'activer en utilisant l'opération B<UFFDIO_API> de " |
| 578 |
"B<ioctl>(2). Cette opération permet une connexion en deux étapes entre le " |
| 579 |
"noyau et l'espace utilisateur pour déterminer quelle version de l'API et " |
| 580 |
"quelles fonctions sont prises en charge par le noyau. et ensuite pour " |
| 581 |
"activer les fonctions voulues par l'espace utilisateur. Cette opération doit " |
| 582 |
"être réalisée avant toutes les autres opérations B<ioctl>(2) décrites plus " |
| 583 |
"bas (ou ces opérations échouent avec l'erreur B<EINVAL>.)" |
| 584 |
|
| 585 |
#. type: Plain text |
| 586 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 587 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 588 |
msgid "" |
| 589 |
"After a successful B<UFFDIO_API> operation, the application then registers " |
| 590 |
"memory address ranges using the B<UFFDIO_REGISTER> B<ioctl>(2) operation. " |
| 591 |
"After successful completion of a B<UFFDIO_REGISTER> operation, a page fault " |
| 592 |
"occurring in the requested memory range, and satisfying the mode defined at " |
| 593 |
"the registration time, will be forwarded by the kernel to the user-space " |
| 594 |
"application. The application can then use various (e.g., B<UFFDIO_COPY>, " |
| 595 |
"B<UFFDIO_ZEROPAGE>, or B<UFFDIO_CONTINUE>) B<ioctl>(2) operations to " |
| 596 |
"resolve the page fault." |
| 597 |
msgstr "" |
| 598 |
"Après le succès d'une opération B<UFFDIO_API>, l'application enregistre " |
| 599 |
"alors les intervalles d'adresses mémoire en utilisant l'opération " |
| 600 |
"d'B<ioctl>(2) B<UFFDIO_REGISTER>. Quand l'opération B<UFFDIO_REGISTER> s'est " |
| 601 |
"achevée avec succès, une erreur de page, se produisant dans l'intervalle de " |
| 602 |
"mémoire requis et satisfaisant au mode défini au moment de l'enregistrement, " |
| 603 |
"sera transmis par le noyau à l'application de l'espace utilisateur. " |
| 604 |
"L'application peut alors utiliser diverses opérations d'B<ioctl>(2) " |
| 605 |
"(parexemple, B<UFFDIO_COPY>, B<UFFDIO_ZEROPAGE> ou B<UFFDIO_CONTINUE>) pour " |
| 606 |
"résoudre l'erreur de page." |
| 607 |
|
| 608 |
#. type: Plain text |
| 609 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 610 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 611 |
msgid "" |
| 612 |
"Since Linux 4.14, if the application sets the B<UFFD_FEATURE_SIGBUS> feature " |
| 613 |
"bit using the B<UFFDIO_API> B<ioctl>(2), no page-fault notification will be " |
| 614 |
"forwarded to user space. Instead a B<SIGBUS> signal is delivered to the " |
| 615 |
"faulting process. With this feature, userfaultfd can be used for robustness " |
| 616 |
"purposes to simply catch any access to areas within the registered address " |
| 617 |
"range that do not have pages allocated, without having to listen to " |
| 618 |
"userfaultfd events. No userfaultfd monitor will be required for dealing " |
| 619 |
"with such memory accesses. For example, this feature can be useful for " |
| 620 |
"applications that want to prevent the kernel from automatically allocating " |
| 621 |
"pages and filling holes in sparse files when the hole is accessed through a " |
| 622 |
"memory mapping." |
| 623 |
msgstr "" |
| 624 |
"Depuis Linux 4.4, si l'application définit le bit de la fonction " |
| 625 |
"B<UFFD_FEATURE_SIGBUS> en utilisant l'B<ioctl>(2) B<UFFDIO_API>, aucune " |
| 626 |
"notification d'erreur d page ne sera transmise à l'espace utilisateur. Un " |
| 627 |
"signal est envoyé à la place au processus en erreur. Avec cette fonction, " |
| 628 |
"userfaultfd peut être utilisé à des fins de robustesse pour capturer " |
| 629 |
"simplement tout accès aux zones dans l'intervalle d'adresses enregistré qui " |
| 630 |
"n'ont pas de pages allouées sans avoir à écouter les événements " |
| 631 |
"d'userfaultfd. Aucun contrôleur d'userfaultfd ne sera requis pour traiter ce " |
| 632 |
"type d'accès mémoire. Par exemple, cette fonction peut être utile à des " |
| 633 |
"applications qui désirent empêcher le noyau d'allouer des pages " |
| 634 |
"automatiquement et de remplir des trous dans des fichiers creux quand c'est " |
| 635 |
"un mappage mémoire qui permet l'accès aux trous." |
| 636 |
|
| 637 |
#. type: Plain text |
| 638 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 639 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 640 |
msgid "" |
| 641 |
"The B<UFFD_FEATURE_SIGBUS> feature is implicitly inherited through " |
| 642 |
"B<fork>(2) if used in combination with B<UFFD_FEATURE_FORK>." |
| 643 |
msgstr "" |
| 644 |
"La fonction B<UFFD_FEATURE_SIGBUS> est héritée de façon implicite avec " |
| 645 |
"B<fork>(2) si elle est utilisée en combinaison avec B<UFFD_FEATURE_FORK>." |
| 646 |
|
| 647 |
#. type: Plain text |
| 648 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 649 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 650 |
msgid "" |
| 651 |
"Details of the various B<ioctl>(2) operations can be found in " |
| 652 |
"B<ioctl_userfaultfd>(2)." |
| 653 |
msgstr "" |
| 654 |
"Des détails sur les différentes opérations d'B<ioctl>(2) sont disponibles " |
| 655 |
"dans B<ioctl_userfaultfd>(2)." |
| 656 |
|
| 657 |
#. type: Plain text |
| 658 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 659 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 660 |
msgid "" |
| 661 |
"Since Linux 4.11, events other than page-fault may enabled during " |
| 662 |
"B<UFFDIO_API> operation." |
| 663 |
msgstr "" |
| 664 |
"Depuis Linux 4.11, les événements autres que les erreurs de page peuvent " |
| 665 |
"être activés pendant l'opération B<UFFDIO_API>." |
| 666 |
|
| 667 |
#. type: Plain text |
| 668 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 669 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 670 |
msgid "" |
| 671 |
"Up to Linux 4.11, userfaultfd can be used only with anonymous private memory " |
| 672 |
"mappings. Since Linux 4.11, userfaultfd can be also used with hugetlbfs and " |
| 673 |
"shared memory mappings." |
| 674 |
msgstr "" |
| 675 |
"Jusqu'à Linux 4.11, userfaultfd ne peut être utilisé qu'avec des mappages de " |
| 676 |
"mémoire privée anonyme. Depuis Linux 4.11, userfaultfd peut aussi être " |
| 677 |
"utilisé avec des mappages de mémoire hugelbfs et partagée." |
| 678 |
|
| 679 |
#. type: SS |
| 680 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 681 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 682 |
#, no-wrap |
| 683 |
msgid "Userfaultfd write-protect mode (since Linux 5.7)" |
| 684 |
msgstr "Mode protection d'écriture d'userfaultfd (depuis Linux 5.7)" |
| 685 |
|
| 686 |
#. type: Plain text |
| 687 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 688 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 689 |
msgid "" |
| 690 |
"Since Linux 5.7, userfaultfd supports write-protect mode for anonymous " |
| 691 |
"memory. The user needs to first check availability of this feature using " |
| 692 |
"B<UFFDIO_API> ioctl against the feature bit " |
| 693 |
"B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> before using this feature." |
| 694 |
msgstr "" |
| 695 |
"Depuis Linux 5.7, userfaultfd prend en charge le mode protection d'écriture " |
| 696 |
"pour la mémoire anonyme. L'utilisateur doit d'abord vérifier la " |
| 697 |
"disponibilité de cette fonctionnalité en utilisant l'ioctl B<UFFDIO_API> sur " |
| 698 |
"le bit de fonction B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> avant d'utiliser cette " |
| 699 |
"fonctionnalité." |
| 700 |
|
| 701 |
#. type: Plain text |
| 702 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 703 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 704 |
msgid "" |
| 705 |
"Since Linux 5.19, the write-protection mode was also supported on shmem and " |
| 706 |
"hugetlbfs memory types. It can be detected with the feature bit " |
| 707 |
"B<UFFD_FEATURE_WP_HUGETLBFS_SHMEM>." |
| 708 |
msgstr "" |
| 709 |
"Depuis Linux 5.19, le mode protection d'écriture est aussi pris en charge " |
| 710 |
"sur la mémoire de type shmem ou hugetlbfs. Il peut être détecté avec le bit " |
| 711 |
"de fonction B<UFFD_FEATURE_WP_HUGETLBFS_SHMEM>." |
| 712 |
|
| 713 |
#. type: Plain text |
| 714 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 715 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 716 |
msgid "" |
| 717 |
"To register with userfaultfd write-protect mode, the user needs to initiate " |
| 718 |
"the B<UFFDIO_REGISTER> ioctl with mode B<UFFDIO_REGISTER_MODE_WP> set. Note " |
| 719 |
"that it is legal to monitor the same memory range with multiple modes. For " |
| 720 |
"example, the user can do B<UFFDIO_REGISTER> with the mode set to " |
| 721 |
"B<UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP>. When there is " |
| 722 |
"only B<UFFDIO_REGISTER_MODE_WP> registered, user-space will I<not> receive " |
| 723 |
"any notification when a missing page is written. Instead, user-space will " |
| 724 |
"receive a write-protect page-fault notification only when an existing but " |
| 725 |
"write-protected page got written." |
| 726 |
msgstr "" |
| 727 |
"Pour enregistrer avec le mode page protégée en écriture de userfaultfd, " |
| 728 |
"l'utilisateur doit initier l'ioctl B<UFFDIO_REGISTER> avec le mode " |
| 729 |
"B<UFFDIO_REGISTER_MODE_WP> défini. Notez qu'il est permis de surveiller le " |
| 730 |
"même intervalle de mémoire avec plusieurs modes. Par exemple, un utilisateur " |
| 731 |
"peut effectuer B<UFFDIO_REGISTER> avec le mode défini à " |
| 732 |
"B<UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP>. Quand seul le " |
| 733 |
"mode B<UFFDIO_REGISTER_MODE_WP> est enregistré, l'espace utilisateur ne " |
| 734 |
"recevra I<aucune> notification quand une page manquante est écrite. À la " |
| 735 |
"place, l'espace utilisateur ne recevra une notification d'erreur de page " |
| 736 |
"protégée en écriture que quand une page existante et protégée en écriture " |
| 737 |
"est écrite." |
| 738 |
|
| 739 |
#. type: Plain text |
| 740 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 741 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 742 |
msgid "" |
| 743 |
"After the B<UFFDIO_REGISTER> ioctl completed with B<UFFDIO_REGISTER_MODE_WP> " |
| 744 |
"mode set, the user can write-protect any existing memory within the range " |
| 745 |
"using the ioctl B<UFFDIO_WRITEPROTECT> where I<uffdio_writeprotect.mode> " |
| 746 |
"should be set to B<UFFDIO_WRITEPROTECT_MODE_WP>." |
| 747 |
msgstr "" |
| 748 |
"Après que l'ioctl B<UFFDIO_REGISTER> s'est terminé avec le mode " |
| 749 |
"B<UFFDIO_REGISTER_MODE_WP> défini, l'utilisateur peut protéger en écriture " |
| 750 |
"toute mémoire dans l'intervalle en utilisant l'ioctl B<UFFDIO_WRITEPROTECT> " |
| 751 |
"où I<uffdio_writeprotect.mode> devrait être défini à " |
| 752 |
"B<UFFDIO_WRITEPROTECT_MODE_WP>." |
| 753 |
|
| 754 |
#. type: Plain text |
| 755 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 756 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 757 |
msgid "" |
| 758 |
"When a write-protect event happens, user-space will receive a page-fault " |
| 759 |
"notification whose I<uffd_msg.pagefault.flags> will be with " |
| 760 |
"B<UFFD_PAGEFAULT_FLAG_WP> flag set. Note: since only writes can trigger " |
| 761 |
"this kind of fault, write-protect notifications will always have the " |
| 762 |
"B<UFFD_PAGEFAULT_FLAG_WRITE> bit set along with the " |
| 763 |
"B<UFFD_PAGEFAULT_FLAG_WP> bit." |
| 764 |
msgstr "" |
| 765 |
"Quand un événement de protection en écriture survient, l'espace utilisateur " |
| 766 |
"recevra une notification d'erreur de page dont l'I<uffd_msg.pagefault.flags> " |
| 767 |
"aura l'attribut B<UFFD_PAGEFAULT_FLAG_WP> défini. Notez : dans la mesure où " |
| 768 |
"seulement les écritures peuvent déclencher ce genre d'erreur, les " |
| 769 |
"notifications de protection en écriture auront toujours le bit " |
| 770 |
"B<UFFD_PAGEFAULT_FLAG_WRITE> défini en même temps que le bit " |
| 771 |
"B<UFFD_PAGEFAULT_FLAG_WP>." |
| 772 |
|
| 773 |
#. type: Plain text |
| 774 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 775 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 776 |
msgid "" |
| 777 |
"To resolve a write-protection page fault, the user should initiate another " |
| 778 |
"B<UFFDIO_WRITEPROTECT> ioctl, whose I<uffd_msg.pagefault.flags> should have " |
| 779 |
"the flag B<UFFDIO_WRITEPROTECT_MODE_WP> cleared upon the faulted page or " |
| 780 |
"range." |
| 781 |
msgstr "" |
| 782 |
"Pour résoudre une erreur de page de protection d'écriture, l'utilisateur " |
| 783 |
"doit initier un autre ioctl B<UFFDIO_WRITEPROTECT> dont " |
| 784 |
"l'I<uffd_msg.pagefault.flags> doit avoir l'attribut " |
| 785 |
"B<UFFDIO_WRITEPROTECT_MODE_WP> effacé après la page ou l'intervalle fautif." |
| 786 |
|
| 787 |
#. type: SS |
| 788 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 789 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 790 |
#, no-wrap |
| 791 |
msgid "Userfaultfd minor fault mode (since Linux 5.13)" |
| 792 |
msgstr "Mode erreur mineure d'userfaultfd (depuis Linux 5.13)" |
| 793 |
|
| 794 |
#. type: Plain text |
| 795 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 796 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 797 |
msgid "" |
| 798 |
"Since Linux 5.13, userfaultfd supports minor fault mode. In this mode, " |
| 799 |
"fault messages are produced not for major faults (where the page was " |
| 800 |
"missing), but rather for minor faults, where a page exists in the page " |
| 801 |
"cache, but the page table entries are not yet present. The user needs to " |
| 802 |
"first check availability of this feature using the B<UFFDIO_API> ioctl with " |
| 803 |
"the appropriate feature bits set before using this feature: " |
| 804 |
"B<UFFD_FEATURE_MINOR_HUGETLBFS> since Linux 5.13, or " |
| 805 |
"B<UFFD_FEATURE_MINOR_SHMEM> since Linux 5.14." |
| 806 |
msgstr "" |
| 807 |
"Depuis Linux 5.13, userfaultfd prend en charge le mode erreur mineure. Dans " |
| 808 |
"ce mode, les messages d’erreur ne sont pas produits pour des erreurs " |
| 809 |
"majeures (où les pages étaient absentes), mais plutôt pour des erreurs " |
| 810 |
"mineures où une page existe dans le cache de page, mais où les entrées de la " |
| 811 |
"table de pages ne sont pas encore présentes. L'utilisateur doit d'abord " |
| 812 |
"vérifier la disponibilité de cette fonctionnalité en utilisant l'ioctl " |
| 813 |
"B<UFFDIO_API> avec les bits de fonction appropriés avant d'utiliser cette " |
| 814 |
"fonctionnalité : B<UFFD_FEATURE_MINOR_HUGETLBFS> depuis Linux 5.13 ou " |
| 815 |
"B<UFFD_FEATURE_MINOR_SHMEM> depuis Linux 5.14." |
| 816 |
|
| 817 |
#. type: Plain text |
| 818 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 819 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 820 |
msgid "" |
| 821 |
"To register with userfaultfd minor fault mode, the user needs to initiate " |
| 822 |
"the B<UFFDIO_REGISTER> ioctl with mode B<UFFD_REGISTER_MODE_MINOR> set." |
| 823 |
msgstr "" |
| 824 |
"Pour enregistrer avec le mode erreur mineure d'userfaultfd, l'utilisateur " |
| 825 |
"doit initier l'ioctl B<UFFDIO_REGISTER> avec le mode " |
| 826 |
"B<UFFD_REGISTER_MODE_MINOR> défini." |
| 827 |
|
| 828 |
#. type: Plain text |
| 829 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 830 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 831 |
msgid "" |
| 832 |
"When a minor fault occurs, user-space will receive a page-fault notification " |
| 833 |
"whose I<uffd_msg.pagefault.flags> will have the B<UFFD_PAGEFAULT_FLAG_MINOR> " |
| 834 |
"flag set." |
| 835 |
msgstr "" |
| 836 |
"Quand une erreur mineure survient, l'espace utilisateur recevra une " |
| 837 |
"notification d'erreur de page dont l'I<uffd_msg.pagefault.flags> aura " |
| 838 |
"l'attribut B<UFFD_PAGEFAULT_FLAG_MINOR> défini." |
| 839 |
|
| 840 |
#. type: Plain text |
| 841 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 842 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 843 |
msgid "" |
| 844 |
"To resolve a minor page fault, the handler should decide whether or not the " |
| 845 |
"existing page contents need to be modified first. If so, this should be " |
| 846 |
"done in-place via a second, non-userfaultfd-registered mapping to the same " |
| 847 |
"backing page (e.g., by mapping the shmem or hugetlbfs file twice). Once the " |
| 848 |
"page is considered \"up to date\", the fault can be resolved by initiating " |
| 849 |
"an B<UFFDIO_CONTINUE> ioctl, which installs the page table entries and (by " |
| 850 |
"default) wakes up the faulting thread(s)." |
| 851 |
msgstr "" |
| 852 |
"Pour résoudre une erreur de page mineure, le gestionnaire doit décider si le " |
| 853 |
"contenu de la page existante doit être modifiée d'abord, ou non. Si c'est le " |
| 854 |
"cas, cela doit être fait à son emplacement au moyen d'un second mappage non " |
| 855 |
"enregistré par userfaultfd vers la même page de sauvegarde (par exemple en " |
| 856 |
"mappant deux fois le fichier shmem ou hugetlbfs). Une fois que la page est " |
| 857 |
"considérée « à jour », l'erreur peut être résolue en initiant un ioctl " |
| 858 |
"B<UFFDIO_CONTINUE> qui installe les entrées de la table de pages et (par " |
| 859 |
"défaut) réveille le ou les threads en erreur." |
| 860 |
|
| 861 |
#. type: Plain text |
| 862 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 863 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 864 |
msgid "" |
| 865 |
"Minor fault mode supports only hugetlbfs-backed (since Linux 5.13) and " |
| 866 |
"shmem-backed (since Linux 5.14) memory." |
| 867 |
msgstr "" |
| 868 |
"Le mode erreur mineure ne prend en charge que la mémoire s'appuyant sur " |
| 869 |
"hugetlbfs (depuis Linux 5.13) et sur shmem (depuis Linux 5.14)." |
| 870 |
|
| 871 |
#. type: SS |
| 872 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 873 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 874 |
#, no-wrap |
| 875 |
msgid "Reading from the userfaultfd structure" |
| 876 |
msgstr "Lire à partir de la structure userfaultfd" |
| 877 |
|
| 878 |
#. type: Plain text |
| 879 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 880 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 881 |
msgid "" |
| 882 |
"Each B<read>(2) from the userfaultfd file descriptor returns one or more " |
| 883 |
"I<uffd_msg> structures, each of which describes a page-fault event or an " |
| 884 |
"event required for the non-cooperative userfaultfd usage:" |
| 885 |
msgstr "" |
| 886 |
"Chaque B<read>(2) à partir du descripteur de fichier userfaultfd renvoie une " |
| 887 |
"ou plusieurs structures I<uffd_msg>, chacune d'elles décrit un événement " |
| 888 |
"d'erreur de page ou un événement requis pour l'utilisation non coopérative " |
| 889 |
"d'userfaultfd :" |
| 890 |
|
| 891 |
#. type: Plain text |
| 892 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 893 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 894 |
#, no-wrap |
| 895 |
msgid "" |
| 896 |
"struct uffd_msg {\n" |
| 897 |
" __u8 event; /* Type of event */\n" |
| 898 |
" ...\n" |
| 899 |
" union {\n" |
| 900 |
" struct {\n" |
| 901 |
" __u64 flags; /* Flags describing fault */\n" |
| 902 |
" __u64 address; /* Faulting address */\n" |
| 903 |
" union {\n" |
| 904 |
" __u32 ptid; /* Thread ID of the fault */\n" |
| 905 |
" } feat;\n" |
| 906 |
" } pagefault;\n" |
| 907 |
"\\&\n" |
| 908 |
" struct { /* Since Linux 4.11 */\n" |
| 909 |
" __u32 ufd; /* Userfault file descriptor\n" |
| 910 |
" of the child process */\n" |
| 911 |
" } fork;\n" |
| 912 |
"\\&\n" |
| 913 |
" struct { /* Since Linux 4.11 */\n" |
| 914 |
" __u64 from; /* Old address of remapped area */\n" |
| 915 |
" __u64 to; /* New address of remapped area */\n" |
| 916 |
" __u64 len; /* Original mapping size */\n" |
| 917 |
" } remap;\n" |
| 918 |
"\\&\n" |
| 919 |
" struct { /* Since Linux 4.11 */\n" |
| 920 |
" __u64 start; /* Start address of removed area */\n" |
| 921 |
" __u64 end; /* End address of removed area */\n" |
| 922 |
" } remove;\n" |
| 923 |
" ...\n" |
| 924 |
" } arg;\n" |
| 925 |
"\\&\n" |
| 926 |
" /* Padding fields omitted */\n" |
| 927 |
"} __packed;\n" |
| 928 |
msgstr "" |
| 929 |
"struct uffd_msg {\n" |
| 930 |
" __u8 event; /* Type d'événement */\n" |
| 931 |
" ...\n" |
| 932 |
" union {\n" |
| 933 |
" struct {\n" |
| 934 |
" __u64 flags; /* Attributs décrivant l'erreur */\n" |
| 935 |
" __u64 address; /* Adresse fautive */\n" |
| 936 |
" union {\n" |
| 937 |
" __u32 ptid; /* ID du thread de l'erreur */\n" |
| 938 |
" } feat;\n" |
| 939 |
" } pagefault;\n" |
| 940 |
"\\&\n" |
| 941 |
" struct { /* Depuis Linux 4.11 */\n" |
| 942 |
" __u32 ufd; /* Descripteur de ficher d'userfault\n" |
| 943 |
" du processus enfant */\n" |
| 944 |
" } fork;\n" |
| 945 |
"\\&\n" |
| 946 |
" struct { /* Depuis Linux 4.11 */\n" |
| 947 |
" __u64 from; /* Ancienne adresse de la zone remappée */\n" |
| 948 |
" __u64 to; /* Nouvelle adresse de la zone remappée */\n" |
| 949 |
" __u64 len; /* Taille originale du mappage */\n" |
| 950 |
" } remap;\n" |
| 951 |
"\\&\n" |
| 952 |
" struct { /* Depuis Linux 4.11 */\n" |
| 953 |
" __u64 start; /* Adresse de début de la zone supprimée */\n" |
| 954 |
" __u64 end; /* Adresse de fin de la zone supprimée */\n" |
| 955 |
" } remove;\n" |
| 956 |
" ...\n" |
| 957 |
" } arg;\n" |
| 958 |
"\\&\n" |
| 959 |
" /* Remplissage des champs omis */\n" |
| 960 |
"} __packed;\n" |
| 961 |
|
| 962 |
#. type: Plain text |
| 963 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 964 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 965 |
msgid "" |
| 966 |
"If multiple events are available and the supplied buffer is large enough, " |
| 967 |
"B<read>(2) returns as many events as will fit in the supplied buffer. If " |
| 968 |
"the buffer supplied to B<read>(2) is smaller than the size of the " |
| 969 |
"I<uffd_msg> structure, the B<read>(2) fails with the error B<EINVAL>." |
| 970 |
msgstr "" |
| 971 |
"Si plusieurs événements sont disponibles et si le tampon fourni est " |
| 972 |
"suffisamment grand, B<read>(2) renvoie autant d'événements qu'il en tient " |
| 973 |
"dans le tampon fourni. Si le tampon fourni à B<read>(2) est plus petit que " |
| 974 |
"la taille de la structure I<uffd_msg>, B<read>(2) échoue avec l'erreur " |
| 975 |
"B<EINVAL>." |
| 976 |
|
| 977 |
#. type: Plain text |
| 978 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 979 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 980 |
msgid "The fields set in the I<uffd_msg> structure are as follows:" |
| 981 |
msgstr "Les champs définis dans la structure I<uffd_msg> sont les suivants :" |
| 982 |
|
| 983 |
#. type: TP |
| 984 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 985 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 986 |
#, no-wrap |
| 987 |
msgid "I<event>" |
| 988 |
msgstr "I<event>" |
| 989 |
|
| 990 |
#. type: Plain text |
| 991 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 992 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 993 |
msgid "" |
| 994 |
"The type of event. Depending of the event type, different fields of the " |
| 995 |
"I<arg> union represent details required for the event processing. The non-" |
| 996 |
"page-fault events are generated only when appropriate feature is enabled " |
| 997 |
"during API handshake with B<UFFDIO_API> B<ioctl>(2)." |
| 998 |
msgstr "" |
| 999 |
"Le type d'événement. Selon le type d'événement, différents champs de l'union " |
| 1000 |
"I<arg> représentent les détails nécessaires au traitement de l'événement. " |
| 1001 |
"Les événements qui ne sont pas des erreurs de page ne sont générés que quand " |
| 1002 |
"la fonctionnalité appropriée est activée durant la connexion de l'API à " |
| 1003 |
"l'B<ioctl>(2) B<UFFDIO_API>." |
| 1004 |
|
| 1005 |
#. type: Plain text |
| 1006 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1007 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1008 |
msgid "The following values can appear in the I<event> field:" |
| 1009 |
msgstr "Les valeurs suivantes peuvent apparaître dans le champ I<event> :" |
| 1010 |
|
| 1011 |
#. type: TP |
| 1012 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1013 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1014 |
#, no-wrap |
| 1015 |
msgid "B<UFFD_EVENT_PAGEFAULT> (since Linux 4.3)" |
| 1016 |
msgstr "B<UFFD_EVENT_PAGEFAULT> (depuis Linux 4.3)" |
| 1017 |
|
| 1018 |
#. type: Plain text |
| 1019 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1020 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1021 |
msgid "" |
| 1022 |
"A page-fault event. The page-fault details are available in the " |
| 1023 |
"I<pagefault> field." |
| 1024 |
msgstr "" |
| 1025 |
"Un événement d'erreur de page. Les détails de l'erreur de page sont " |
| 1026 |
"disponibles dans le champ I<pagefault>." |
| 1027 |
|
| 1028 |
#. type: TP |
| 1029 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1030 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1031 |
#, no-wrap |
| 1032 |
msgid "B<UFFD_EVENT_FORK> (since Linux 4.11)" |
| 1033 |
msgstr "B<UFFD_EVENT_FORK> (depuis Linux 4.11)" |
| 1034 |
|
| 1035 |
#. FIXME describe duplication of userfault file descriptor during fork |
| 1036 |
#. type: Plain text |
| 1037 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1038 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1039 |
msgid "" |
| 1040 |
"Generated when the faulting process invokes B<fork>(2) (or B<clone>(2) " |
| 1041 |
"without the B<CLONE_VM> flag). The event details are available in the " |
| 1042 |
"I<fork> field." |
| 1043 |
msgstr "" |
| 1044 |
"Généré lorsque le processus en erreur invoque B<fork>(2) (ou B<clone>(2) " |
| 1045 |
"sans l'attribut B<CLONE_VM>). Les détails de l'événement sont disponibles " |
| 1046 |
"dans le champ I<fork>." |
| 1047 |
|
| 1048 |
#. type: TP |
| 1049 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1050 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1051 |
#, no-wrap |
| 1052 |
msgid "B<UFFD_EVENT_REMAP> (since Linux 4.11)" |
| 1053 |
msgstr "B<UFFD_EVENT_REMAP> (depuis Linux 4.11)" |
| 1054 |
|
| 1055 |
#. type: Plain text |
| 1056 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1057 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1058 |
msgid "" |
| 1059 |
"Generated when the faulting process invokes B<mremap>(2). The event details " |
| 1060 |
"are available in the I<remap> field." |
| 1061 |
msgstr "" |
| 1062 |
"Généré lorsque le processus en erreur invoque B<mremap>(2). Les détails de " |
| 1063 |
"l'événement sont disponibles dans le champ I<remap>." |
| 1064 |
|
| 1065 |
#. type: TP |
| 1066 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1067 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1068 |
#, no-wrap |
| 1069 |
msgid "B<UFFD_EVENT_REMOVE> (since Linux 4.11)" |
| 1070 |
msgstr "B<UFFD_EVENT_REMOVE> (depuis Linux 4.11)" |
| 1071 |
|
| 1072 |
#. type: Plain text |
| 1073 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1074 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1075 |
msgid "" |
| 1076 |
"Generated when the faulting process invokes B<madvise>(2) with " |
| 1077 |
"B<MADV_DONTNEED> or B<MADV_REMOVE> advice. The event details are available " |
| 1078 |
"in the I<remove> field." |
| 1079 |
msgstr "" |
| 1080 |
"Généré lorsque le processus en erreur invoque B<madvise>(2) avec les " |
| 1081 |
"conseils B<MADV_DONTNEED> ou B<MADV_REMOVE>. Les détails de l'événement sont " |
| 1082 |
"disponibles dans le champ I<remove>." |
| 1083 |
|
| 1084 |
#. type: TP |
| 1085 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1086 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1087 |
#, no-wrap |
| 1088 |
msgid "B<UFFD_EVENT_UNMAP> (since Linux 4.11)" |
| 1089 |
msgstr "B<UFFD_EVENT_UNMAP> (depuis Linux 4.11)" |
| 1090 |
|
| 1091 |
#. type: Plain text |
| 1092 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1093 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1094 |
msgid "" |
| 1095 |
"Generated when the faulting process unmaps a memory range, either explicitly " |
| 1096 |
"using B<munmap>(2) or implicitly during B<mmap>(2) or B<mremap>(2). The " |
| 1097 |
"event details are available in the I<remove> field." |
| 1098 |
msgstr "" |
| 1099 |
"Généré lorsque le processus en erreur supprime le mappage d'un intervalle de " |
| 1100 |
"mémoire soit explicitement avec B<munmap>(2), soit implicitement durant " |
| 1101 |
"l'exécution de B<mmap>(2) ou B<mremap>(2). Les détails de l'événement sont " |
| 1102 |
"disponibles dans le champ I<remove>." |
| 1103 |
|
| 1104 |
#. type: TP |
| 1105 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1106 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1107 |
#, no-wrap |
| 1108 |
msgid "I<pagefault.address>" |
| 1109 |
msgstr "I<pagefault.address>" |
| 1110 |
|
| 1111 |
#. type: Plain text |
| 1112 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1113 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1114 |
msgid "The address that triggered the page fault." |
| 1115 |
msgstr "L'adresse qui a déclenché l'erreur de page." |
| 1116 |
|
| 1117 |
#. type: TP |
| 1118 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1119 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1120 |
#, no-wrap |
| 1121 |
msgid "I<pagefault.flags>" |
| 1122 |
msgstr "I<pagefault.flags>" |
| 1123 |
|
| 1124 |
#. type: Plain text |
| 1125 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1126 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1127 |
msgid "" |
| 1128 |
"A bit mask of flags that describe the event. For B<UFFD_EVENT_PAGEFAULT>, " |
| 1129 |
"the following flag may appear:" |
| 1130 |
msgstr "" |
| 1131 |
"Un masque de bits qui décrit l'événement. Pour B<UFFD_EVENT_PAGEFAULT>, les " |
| 1132 |
"attributs suivants peuvent apparaître :" |
| 1133 |
|
| 1134 |
#. type: TP |
| 1135 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1136 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1137 |
#, no-wrap |
| 1138 |
msgid "B<UFFD_PAGEFAULT_FLAG_WP>" |
| 1139 |
msgstr "B<UFFD_PAGEFAULT_FLAG_WP>" |
| 1140 |
|
| 1141 |
#. type: Plain text |
| 1142 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1143 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1144 |
msgid "If this flag is set, then the fault was a write-protect fault." |
| 1145 |
msgstr "" |
| 1146 |
"Si cet attribut est défini, alors l'erreur était une erreur de protection en " |
| 1147 |
"écriture." |
| 1148 |
|
| 1149 |
#. type: TP |
| 1150 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1151 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1152 |
#, no-wrap |
| 1153 |
msgid "B<UFFD_PAGEFAULT_FLAG_MINOR>" |
| 1154 |
msgstr "B<UFFD_PAGEFAULT_FLAG_MINOR>" |
| 1155 |
|
| 1156 |
#. type: Plain text |
| 1157 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1158 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1159 |
msgid "If this flag is set, then the fault was a minor fault." |
| 1160 |
msgstr "Si cet attribut est défini, alors l'erreur était une erreur mineure." |
| 1161 |
|
| 1162 |
#. type: TP |
| 1163 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1164 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1165 |
#, no-wrap |
| 1166 |
msgid "B<UFFD_PAGEFAULT_FLAG_WRITE>" |
| 1167 |
msgstr "B<UFFD_PAGEFAULT_FLAG_WRITE>" |
| 1168 |
|
| 1169 |
#. type: Plain text |
| 1170 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1171 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1172 |
msgid "If this flag is set, then the fault was a write fault." |
| 1173 |
msgstr "" |
| 1174 |
"Si cet attribut est défini, alors l'erreur était une erreur d'écriture." |
| 1175 |
|
| 1176 |
#. type: Plain text |
| 1177 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1178 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1179 |
msgid "" |
| 1180 |
"If neither B<UFFD_PAGEFAULT_FLAG_WP> nor B<UFFD_PAGEFAULT_FLAG_MINOR> are " |
| 1181 |
"set, then the fault was a missing fault." |
| 1182 |
msgstr "" |
| 1183 |
"Si ni B<UFFD_PAGEFAULT_FLAG_WP> ni B<UFFD_PAGEFAULT_FLAG_MINOR> ne sont " |
| 1184 |
"définis, l'erreur était une erreur d'absence." |
| 1185 |
|
| 1186 |
#. type: TP |
| 1187 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1188 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1189 |
#, no-wrap |
| 1190 |
msgid "I<pagefault.feat.pid>" |
| 1191 |
msgstr "I<pagefault.feat.pid>" |
| 1192 |
|
| 1193 |
#. type: Plain text |
| 1194 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1195 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1196 |
msgid "The thread ID that triggered the page fault." |
| 1197 |
msgstr "L'identifiant du thread qui a déclenché l'erreur de page." |
| 1198 |
|
| 1199 |
#. type: TP |
| 1200 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1201 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1202 |
#, no-wrap |
| 1203 |
msgid "I<fork.ufd>" |
| 1204 |
msgstr "I<fork.ufd>" |
| 1205 |
|
| 1206 |
#. type: Plain text |
| 1207 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1208 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1209 |
msgid "" |
| 1210 |
"The file descriptor associated with the userfault object created for the " |
| 1211 |
"child created by B<fork>(2)." |
| 1212 |
msgstr "" |
| 1213 |
"Le descripteur de fichier associé à l'objet userfault créé pour l'enfant " |
| 1214 |
"créé par B<fork>(2)." |
| 1215 |
|
| 1216 |
#. type: TP |
| 1217 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1218 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1219 |
#, no-wrap |
| 1220 |
msgid "I<remap.from>" |
| 1221 |
msgstr "I<remap.from>" |
| 1222 |
|
| 1223 |
#. type: Plain text |
| 1224 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1225 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1226 |
msgid "" |
| 1227 |
"The original address of the memory range that was remapped using " |
| 1228 |
"B<mremap>(2)." |
| 1229 |
msgstr "" |
| 1230 |
"L'adresse d'origine de la plage de mémoire dont le mappage a été modifié en " |
| 1231 |
"utilisant B<madvise>(2)." |
| 1232 |
|
| 1233 |
#. type: TP |
| 1234 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1235 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1236 |
#, no-wrap |
| 1237 |
msgid "I<remap.to>" |
| 1238 |
msgstr "I<remap.to>" |
| 1239 |
|
| 1240 |
#. type: Plain text |
| 1241 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1242 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1243 |
msgid "" |
| 1244 |
"The new address of the memory range that was remapped using B<mremap>(2)." |
| 1245 |
msgstr "" |
| 1246 |
"La nouvelle adresse de la plage de mémoire dont le mappage a été modifié en " |
| 1247 |
"utilisant B<madvise>(2)." |
| 1248 |
|
| 1249 |
#. type: TP |
| 1250 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1251 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1252 |
#, no-wrap |
| 1253 |
msgid "I<remap.len>" |
| 1254 |
msgstr "I<remap.len>" |
| 1255 |
|
| 1256 |
#. type: Plain text |
| 1257 |
#: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron |
| 1258 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 1259 |
msgid "" |
| 1260 |
"The original size of the memory range that was remapped using B<mremap>(2)." |
| 1261 |
msgstr "" |
| 1262 |
"La taille d'origine de la plage de mémoire dont le mappage a été modifié en " |
| 1263 |
"utilisant B<madvise>(2)." |
| 1264 |
|
| 1265 |
#. type: TP |
| 1266 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1267 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1268 |
#, no-wrap |
| 1269 |
msgid "I<remove.start>" |
| 1270 |
msgstr "I<remove.start>" |
| 1271 |
|
| 1272 |
#. type: Plain text |
| 1273 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1274 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1275 |
msgid "" |
| 1276 |
"The start address of the memory range that was freed using B<madvise>(2) or " |
| 1277 |
"unmapped" |
| 1278 |
msgstr "" |
| 1279 |
"L'adresse de début de la plage de mémoire qui a été libérée en utilisant " |
| 1280 |
"B<madvise>(2) ou dont le mappage a été supprimé." |
| 1281 |
|
| 1282 |
#. type: TP |
| 1283 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1284 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1285 |
#, no-wrap |
| 1286 |
msgid "I<remove.end>" |
| 1287 |
msgstr "I<remove.end>" |
| 1288 |
|
| 1289 |
#. type: Plain text |
| 1290 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1291 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1292 |
msgid "" |
| 1293 |
"The end address of the memory range that was freed using B<madvise>(2) or " |
| 1294 |
"unmapped" |
| 1295 |
msgstr "" |
| 1296 |
"L'adresse terminale de la plage de mémoire qui a été libérée en utilisant " |
| 1297 |
"B<madvise>(2) ou dont le mappage a été supprimé." |
| 1298 |
|
| 1299 |
#. type: Plain text |
| 1300 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1301 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1302 |
msgid "" |
| 1303 |
"A B<read>(2) on a userfaultfd file descriptor can fail with the following " |
| 1304 |
"errors:" |
| 1305 |
msgstr "" |
| 1306 |
"B<read>(2) sur un descripteur de fichier userfaultfd peut échouer pour les " |
| 1307 |
"raisons suivantes :" |
| 1308 |
|
| 1309 |
#. type: TP |
| 1310 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1311 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1312 |
#, no-wrap |
| 1313 |
msgid "B<EINVAL>" |
| 1314 |
msgstr "B<EINVAL>" |
| 1315 |
|
| 1316 |
#. type: Plain text |
| 1317 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1318 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1319 |
msgid "" |
| 1320 |
"The userfaultfd object has not yet been enabled using the B<UFFDIO_API> " |
| 1321 |
"B<ioctl>(2) operation" |
| 1322 |
msgstr "" |
| 1323 |
"L'objet userfaultfd n'a pas encore été activé avec l'opération d'B<ioctl>(2) " |
| 1324 |
"B<UFFDIO_API>." |
| 1325 |
|
| 1326 |
#. FIXME What is the reason for this seemingly odd behavior with respect |
| 1327 |
#. to the O_NONBLOCK flag? (see userfaultfd_poll() in fs/userfaultfd.c). |
| 1328 |
#. Something needs to be said about this. |
| 1329 |
#. type: Plain text |
| 1330 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1331 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1332 |
msgid "" |
| 1333 |
"If the B<O_NONBLOCK> flag is enabled in the associated open file " |
| 1334 |
"description, the userfaultfd file descriptor can be monitored with " |
| 1335 |
"B<poll>(2), B<select>(2), and B<epoll>(7). When events are available, the " |
| 1336 |
"file descriptor indicates as readable. If the B<O_NONBLOCK> flag is not " |
| 1337 |
"enabled, then B<poll>(2) (always) indicates the file as having a B<POLLERR> " |
| 1338 |
"condition, and B<select>(2) indicates the file descriptor as both readable " |
| 1339 |
"and writable." |
| 1340 |
msgstr "" |
| 1341 |
"Si l'attribut B<O_NONBLOCK> est activé dans la description de fichier ouvert " |
| 1342 |
"associée, le descripteur de fichier userfaultfd peut être surveillé avec " |
| 1343 |
"B<poll>(2), B<select>(2) et B<epoll>(7). Quand les événements sont " |
| 1344 |
"disponibles, le descripteur de fichier l'indique comme lisible. Si " |
| 1345 |
"l'attribut B<O_NONBLOCK> n'est pas activé, alors B<poll>(2) indique " |
| 1346 |
"(toujours) que le fichier comme ayant une condition B<POLLERR> et " |
| 1347 |
"B<select>(2) indique que le descripteur de fichier est à la fois accessible " |
| 1348 |
"en lecture et en écriture." |
| 1349 |
|
| 1350 |
#. type: SH |
| 1351 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1352 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1353 |
#, no-wrap |
| 1354 |
msgid "RETURN VALUE" |
| 1355 |
msgstr "VALEUR RENVOYÉE" |
| 1356 |
|
| 1357 |
#. type: Plain text |
| 1358 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1359 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1360 |
msgid "" |
| 1361 |
"On success, B<userfaultfd>() returns a new file descriptor that refers to " |
| 1362 |
"the userfaultfd object. On error, -1 is returned, and I<errno> is set to " |
| 1363 |
"indicate the error." |
| 1364 |
msgstr "" |
| 1365 |
"En cas de succès, B<userfaultfd>() renvoie un nouveau descripteur de fichier " |
| 1366 |
"qui fait référence à l'objet userfaultfd. En cas d'erreur, la fonction " |
| 1367 |
"renvoie B<-1> et I<errno> est défini pour indiquer l'erreur." |
| 1368 |
|
| 1369 |
#. type: SH |
| 1370 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1371 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1372 |
#, no-wrap |
| 1373 |
msgid "ERRORS" |
| 1374 |
msgstr "ERREURS" |
| 1375 |
|
| 1376 |
#. type: Plain text |
| 1377 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1378 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1379 |
msgid "An unsupported value was specified in I<flags>." |
| 1380 |
msgstr "Une valeur non prise en compte a été spécifiée dans I<flags>." |
| 1381 |
|
| 1382 |
#. type: TP |
| 1383 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1384 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1385 |
#, no-wrap |
| 1386 |
msgid "B<EMFILE>" |
| 1387 |
msgstr "B<EMFILE>" |
| 1388 |
|
| 1389 |
#. type: Plain text |
| 1390 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1391 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1392 |
msgid "" |
| 1393 |
"The per-process limit on the number of open file descriptors has been reached" |
| 1394 |
msgstr "" |
| 1395 |
"La limite par processus du nombre de descripteurs de fichier ouverts a été " |
| 1396 |
"atteinte." |
| 1397 |
|
| 1398 |
#. type: TP |
| 1399 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1400 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1401 |
#, no-wrap |
| 1402 |
msgid "B<ENFILE>" |
| 1403 |
msgstr "B<ENFILE>" |
| 1404 |
|
| 1405 |
#. type: Plain text |
| 1406 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1407 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1408 |
msgid "" |
| 1409 |
"The system-wide limit on the total number of open files has been reached." |
| 1410 |
msgstr "" |
| 1411 |
"La limite du nombre total de fichiers ouverts pour le système entier a été " |
| 1412 |
"atteinte." |
| 1413 |
|
| 1414 |
#. type: TP |
| 1415 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1416 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1417 |
#, no-wrap |
| 1418 |
msgid "B<ENOMEM>" |
| 1419 |
msgstr "B<ENOMEM>" |
| 1420 |
|
| 1421 |
#. type: Plain text |
| 1422 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1423 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1424 |
msgid "Insufficient kernel memory was available." |
| 1425 |
msgstr "La mémoire disponible du noyau n'était pas suffisante." |
| 1426 |
|
| 1427 |
#. type: TP |
| 1428 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1429 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1430 |
#, no-wrap |
| 1431 |
msgid "B<EPERM> (since Linux 5.2)" |
| 1432 |
msgstr "B<EPERM> (depuis Linux 5.2)" |
| 1433 |
|
| 1434 |
#. cefdca0a86be517bc390fc4541e3674b8e7803b0 |
| 1435 |
#. type: Plain text |
| 1436 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1437 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1438 |
msgid "" |
| 1439 |
"The caller is not privileged (does not have the B<CAP_SYS_PTRACE> capability " |
| 1440 |
"in the initial user namespace), and I</proc/sys/vm/unprivileged_userfaultfd> " |
| 1441 |
"has the value 0." |
| 1442 |
msgstr "" |
| 1443 |
"L'appelant n'est pas privilégié (il n'a pas la capacité B<CAP_SYS_PTRACE> " |
| 1444 |
"dans l'espace de noms initial) et I</proc/sys/vm/unprivileged_userfaultfd> a " |
| 1445 |
"la valeur B<0>." |
| 1446 |
|
| 1447 |
#. type: SH |
| 1448 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1449 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1450 |
#, no-wrap |
| 1451 |
msgid "STANDARDS" |
| 1452 |
msgstr "NORMES" |
| 1453 |
|
| 1454 |
#. type: Plain text |
| 1455 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1456 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1457 |
msgid "Linux." |
| 1458 |
msgstr "Linux." |
| 1459 |
|
| 1460 |
#. type: SH |
| 1461 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1462 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1463 |
#, no-wrap |
| 1464 |
msgid "HISTORY" |
| 1465 |
msgstr "HISTORIQUE" |
| 1466 |
|
| 1467 |
#. type: Plain text |
| 1468 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1469 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1470 |
msgid "Linux 4.3." |
| 1471 |
msgstr "Linux 4.3." |
| 1472 |
|
| 1473 |
#. type: Plain text |
| 1474 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1475 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1476 |
msgid "" |
| 1477 |
"Support for hugetlbfs and shared memory areas and non-page-fault events was " |
| 1478 |
"added in Linux 4.11" |
| 1479 |
msgstr "" |
| 1480 |
"La prise en charge des zones de mémoire hugetlbfs et partagée et des " |
| 1481 |
"événements qui ne sont pas des erreurs de page a été ajoutée dans Linux 4.11" |
| 1482 |
|
| 1483 |
#. type: SH |
| 1484 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1485 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1486 |
#, no-wrap |
| 1487 |
msgid "NOTES" |
| 1488 |
msgstr "NOTES" |
| 1489 |
|
| 1490 |
#. type: Plain text |
| 1491 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1492 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1493 |
msgid "" |
| 1494 |
"The userfaultfd mechanism can be used as an alternative to traditional user-" |
| 1495 |
"space paging techniques based on the use of the B<SIGSEGV> signal and " |
| 1496 |
"B<mmap>(2). It can also be used to implement lazy restore for checkpoint/" |
| 1497 |
"restore mechanisms, as well as post-copy migration to allow (nearly) " |
| 1498 |
"uninterrupted execution when transferring virtual machines and Linux " |
| 1499 |
"containers from one host to another." |
| 1500 |
msgstr "" |
| 1501 |
"Le mécanisme d'userfaultfd peut être utilisé comme une alternative aux " |
| 1502 |
"techniques traditionnelles de pagination de l'espace utilisateur basées sur " |
| 1503 |
"l'utilisation du signal B<SIGSEGV> et de B<mmap>(2). Il peut aussi être " |
| 1504 |
"utilisé pour implémenter la restauration en mode paresseux (« lazy " |
| 1505 |
"restore ») pour les mécanismes de la fonctionnalité de gel des applications " |
| 1506 |
"(checkpoint/restore), aussi bien que la migration après copie pour permettre " |
| 1507 |
"une exécution (presque) ininterrompue lors du transfert de machines " |
| 1508 |
"virtuelles et de conteneurs Linux d'un hôte à un autre." |
| 1509 |
|
| 1510 |
#. type: SH |
| 1511 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1512 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1513 |
#, no-wrap |
| 1514 |
msgid "BUGS" |
| 1515 |
msgstr "BOGUES" |
| 1516 |
|
| 1517 |
#. type: Plain text |
| 1518 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1519 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1520 |
msgid "" |
| 1521 |
"If the B<UFFD_FEATURE_EVENT_FORK> is enabled and a system call from the " |
| 1522 |
"B<fork>(2) family is interrupted by a signal or failed, a stale userfaultfd " |
| 1523 |
"descriptor might be created. In this case, a spurious B<UFFD_EVENT_FORK> " |
| 1524 |
"will be delivered to the userfaultfd monitor." |
| 1525 |
msgstr "" |
| 1526 |
"Si B<UFFD_FEATURE_EVENT_FORK> est activé et si un appel système issu de la " |
| 1527 |
"famille de B<fork>(2) est interrompu par un signal ou échoue, un descripteur " |
| 1528 |
"périmé d'userfaultfd peut être créé. Dans ce cas, un faux B<UFFD_EVENT_FORK> " |
| 1529 |
"sera fourni au surveillant d'userfaultfd." |
| 1530 |
|
| 1531 |
#. type: SH |
| 1532 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1533 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1534 |
#, no-wrap |
| 1535 |
msgid "EXAMPLES" |
| 1536 |
msgstr "EXEMPLES" |
| 1537 |
|
| 1538 |
#. type: Plain text |
| 1539 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1540 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1541 |
msgid "" |
| 1542 |
"The program below demonstrates the use of the userfaultfd mechanism. The " |
| 1543 |
"program creates two threads, one of which acts as the page-fault handler for " |
| 1544 |
"the process, for the pages in a demand-page zero region created using " |
| 1545 |
"B<mmap>(2)." |
| 1546 |
msgstr "" |
| 1547 |
"Le programme ci-dessous démontre l'utilisation du mécanisme userfaultfd. Le " |
| 1548 |
"programme crée deux threads, un qui agit comme gestionnaire d'erreur de page " |
| 1549 |
"pour le processus, pour les pages dans une région sans demande de page en " |
| 1550 |
"utilisant B<mmap>(2)." |
| 1551 |
|
| 1552 |
#. type: Plain text |
| 1553 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1554 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1555 |
msgid "" |
| 1556 |
"The program takes one command-line argument, which is the number of pages " |
| 1557 |
"that will be created in a mapping whose page faults will be handled via " |
| 1558 |
"userfaultfd. After creating a userfaultfd object, the program then creates " |
| 1559 |
"an anonymous private mapping of the specified size and registers the address " |
| 1560 |
"range of that mapping using the B<UFFDIO_REGISTER> B<ioctl>(2) operation. " |
| 1561 |
"The program then creates a second thread that will perform the task of " |
| 1562 |
"handling page faults." |
| 1563 |
msgstr "" |
| 1564 |
"Le programme prend un argument en ligne de commande, qui est le nombre de " |
| 1565 |
"pages qui seront créées dans un mappage dont les erreurs de pages seront " |
| 1566 |
"gérées au moyen d'userfaultfd. Après la création d'un objet userfaultfd, le " |
| 1567 |
"programme crée alors un mappage privé anonyme de la taille spécifiée et " |
| 1568 |
"enregistre l'intervalle d'adresses de ce mappage en utilisant l'opération " |
| 1569 |
"d'B<ioctl>(2) B<UFFDIO_REGISTER>. Le programme crée alors un second thread " |
| 1570 |
"qui exécutera la tâche de gestion des erreurs de page." |
| 1571 |
|
| 1572 |
#. type: Plain text |
| 1573 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1574 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1575 |
msgid "" |
| 1576 |
"The main thread then walks through the pages of the mapping fetching bytes " |
| 1577 |
"from successive pages. Because the pages have not yet been accessed, the " |
| 1578 |
"first access of a byte in each page will trigger a page-fault event on the " |
| 1579 |
"userfaultfd file descriptor." |
| 1580 |
msgstr "" |
| 1581 |
"Le thread principal parcourt les pages du mappage à la recherche des octets " |
| 1582 |
"des pages successives. Comme il n'y a pas eu encore d'accès aux pages, le " |
| 1583 |
"premier accès à un octet de chaque page déclenchera un événement d'erreur de " |
| 1584 |
"page sur le descripteur de fichier userfaultfd." |
| 1585 |
|
| 1586 |
#. type: Plain text |
| 1587 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1588 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1589 |
msgid "" |
| 1590 |
"Each of the page-fault events is handled by the second thread, which sits in " |
| 1591 |
"a loop processing input from the userfaultfd file descriptor. In each loop " |
| 1592 |
"iteration, the second thread first calls B<poll>(2) to check the state of " |
| 1593 |
"the file descriptor, and then reads an event from the file descriptor. All " |
| 1594 |
"such events should be B<UFFD_EVENT_PAGEFAULT> events, which the thread " |
| 1595 |
"handles by copying a page of data into the faulting region using the " |
| 1596 |
"B<UFFDIO_COPY> B<ioctl>(2) operation." |
| 1597 |
msgstr "" |
| 1598 |
"Chaque événement d'erreur de page est géré par le second thread qui " |
| 1599 |
"s'installe dans une boucle traitant l'entrée du descripteur de fichier " |
| 1600 |
"userfaultfd. À chaque itération de la boucle, le second thread appelle " |
| 1601 |
"B<poll>(2) pour vérifier l'état du descripteur de fichier puis lit un " |
| 1602 |
"événement à partir de ce descripteur de fichier. Tout ce type d'événements " |
| 1603 |
"doit être un événement B<UFFD_EVENT_PAGEFAULT> que le thread traite en " |
| 1604 |
"copiant un page de données dans la région en erreur en utilisant l'opération " |
| 1605 |
"d'B<ioctl>(2) B<UFFDIO_COPY>." |
| 1606 |
|
| 1607 |
#. type: Plain text |
| 1608 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1609 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1610 |
msgid "The following is an example of what we see when running the program:" |
| 1611 |
msgstr "" |
| 1612 |
"La suite est un exemple de ce qui est observé lors de l'exécution du " |
| 1613 |
"programme :" |
| 1614 |
|
| 1615 |
#. type: Plain text |
| 1616 |
#: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1 |
| 1617 |
#: opensuse-tumbleweed |
| 1618 |
#, no-wrap |
| 1619 |
msgid "" |
| 1620 |
"$B< ./userfaultfd_demo 3>;\n" |
| 1621 |
"Address returned by mmap() = 0x7fd30106c000\n" |
| 1622 |
"\\&\n" |
| 1623 |
"fault_handler_thread():\n" |
| 1624 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1625 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" |
| 1626 |
" (uffdio_copy.copy returned 4096)\n" |
| 1627 |
"Read address 0x7fd30106c00f in main(): A\n" |
| 1628 |
"Read address 0x7fd30106c40f in main(): A\n" |
| 1629 |
"Read address 0x7fd30106c80f in main(): A\n" |
| 1630 |
"Read address 0x7fd30106cc0f in main(): A\n" |
| 1631 |
"\\&\n" |
| 1632 |
"fault_handler_thread():\n" |
| 1633 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1634 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" |
| 1635 |
" (uffdio_copy.copy returned 4096)\n" |
| 1636 |
"Read address 0x7fd30106d00f in main(): B\n" |
| 1637 |
"Read address 0x7fd30106d40f in main(): B\n" |
| 1638 |
"Read address 0x7fd30106d80f in main(): B\n" |
| 1639 |
"Read address 0x7fd30106dc0f in main(): B\n" |
| 1640 |
"\\&\n" |
| 1641 |
"fault_handler_thread():\n" |
| 1642 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1643 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" |
| 1644 |
" (uffdio_copy.copy returned 4096)\n" |
| 1645 |
"Read address 0x7fd30106e00f in main(): C\n" |
| 1646 |
"Read address 0x7fd30106e40f in main(): C\n" |
| 1647 |
"Read address 0x7fd30106e80f in main(): C\n" |
| 1648 |
"Read address 0x7fd30106ec0f in main(): C\n" |
| 1649 |
msgstr "" |
| 1650 |
"$B< ./userfaultfd_demo 3>;\n" |
| 1651 |
"Address returned by mmap() = 0x7fd30106c000\n" |
| 1652 |
"\\&\n" |
| 1653 |
"fault_handler_thread():\n" |
| 1654 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1655 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" |
| 1656 |
" (uffdio_copy.copy returned 4096)\n" |
| 1657 |
"Read address 0x7fd30106c00f in main(): A\n" |
| 1658 |
"Read address 0x7fd30106c40f in main(): A\n" |
| 1659 |
"Read address 0x7fd30106c80f in main(): A\n" |
| 1660 |
"Read address 0x7fd30106cc0f in main(): A\n" |
| 1661 |
"\\&\n" |
| 1662 |
"fault_handler_thread():\n" |
| 1663 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1664 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" |
| 1665 |
" (uffdio_copy.copy returned 4096)\n" |
| 1666 |
"Read address 0x7fd30106d00f in main(): B\n" |
| 1667 |
"Read address 0x7fd30106d40f in main(): B\n" |
| 1668 |
"Read address 0x7fd30106d80f in main(): B\n" |
| 1669 |
"Read address 0x7fd30106dc0f in main(): B\n" |
| 1670 |
"\\&\n" |
| 1671 |
"fault_handler_thread():\n" |
| 1672 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 1673 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" |
| 1674 |
" (uffdio_copy.copy returned 4096)\n" |
| 1675 |
"Read address 0x7fd30106e00f in main(): C\n" |
| 1676 |
"Read address 0x7fd30106e40f in main(): C\n" |
| 1677 |
"Read address 0x7fd30106e80f in main(): C\n" |
| 1678 |
"Read address 0x7fd30106ec0f in main(): C\n" |
| 1679 |
|
| 1680 |
#. type: SS |
| 1681 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 1682 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 1683 |
#, no-wrap |
| 1684 |
msgid "Program source" |
| 1685 |
msgstr "Source du programme" |
| 1686 |
|
| 1687 |
#. type: Plain text |
| 1688 |
#: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed |
| 1689 |
#, no-wrap |
| 1690 |
msgid "" |
| 1691 |
"/* userfaultfd_demo.c\n" |
| 1692 |
"\\&\n" |
| 1693 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 1694 |
"*/\n" |
| 1695 |
"#define _GNU_SOURCE\n" |
| 1696 |
"#include E<lt>err.hE<gt>\n" |
| 1697 |
"#include E<lt>errno.hE<gt>\n" |
| 1698 |
"#include E<lt>fcntl.hE<gt>\n" |
| 1699 |
"#include E<lt>inttypes.hE<gt>\n" |
| 1700 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 1701 |
"#include E<lt>poll.hE<gt>\n" |
| 1702 |
"#include E<lt>pthread.hE<gt>\n" |
| 1703 |
"#include E<lt>stdio.hE<gt>\n" |
| 1704 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1705 |
"#include E<lt>string.hE<gt>\n" |
| 1706 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 1707 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 1708 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 1709 |
"#include E<lt>unistd.hE<gt>\n" |
| 1710 |
"\\&\n" |
| 1711 |
"static int page_size;\n" |
| 1712 |
"\\&\n" |
| 1713 |
"static void *\n" |
| 1714 |
"fault_handler_thread(void *arg)\n" |
| 1715 |
"{\n" |
| 1716 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 1717 |
"\\&\n" |
| 1718 |
" static int fault_cnt = 0; /* Number of faults so far handled */\n" |
| 1719 |
" static char *page = NULL;\n" |
| 1720 |
" static struct uffd_msg msg; /* Data read from userfaultfd */\n" |
| 1721 |
"\\&\n" |
| 1722 |
" uffd = (long) arg;\n" |
| 1723 |
"\\&\n" |
| 1724 |
" /* Create a page that will be copied into the faulting region. */\n" |
| 1725 |
"\\&\n" |
| 1726 |
" if (page == NULL) {\n" |
| 1727 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 1728 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 1729 |
" if (page == MAP_FAILED)\n" |
| 1730 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 1731 |
" }\n" |
| 1732 |
"\\&\n" |
| 1733 |
" /* Loop, handling incoming events on the userfaultfd\n" |
| 1734 |
" file descriptor. */\n" |
| 1735 |
"\\&\n" |
| 1736 |
" for (;;) {\n" |
| 1737 |
" int nready;\n" |
| 1738 |
" ssize_t nread;\n" |
| 1739 |
" struct pollfd pollfd;\n" |
| 1740 |
" struct uffdio_copy uffdio_copy;\n" |
| 1741 |
"\\&\n" |
| 1742 |
" /* See what poll() tells us about the userfaultfd. */\n" |
| 1743 |
"\\&\n" |
| 1744 |
" pollfd.fd = uffd;\n" |
| 1745 |
" pollfd.events = POLLIN;\n" |
| 1746 |
" nready = poll(&pollfd, 1, -1);\n" |
| 1747 |
" if (nready == -1)\n" |
| 1748 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 1749 |
"\\&\n" |
| 1750 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 1751 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 1752 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 1753 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 1754 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 1755 |
"\\&\n" |
| 1756 |
" /* Read an event from the userfaultfd. */\n" |
| 1757 |
"\\&\n" |
| 1758 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 1759 |
" if (nread == 0) {\n" |
| 1760 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 1761 |
" exit(EXIT_FAILURE);\n" |
| 1762 |
" }\n" |
| 1763 |
"\\&\n" |
| 1764 |
" if (nread == -1)\n" |
| 1765 |
" err(EXIT_FAILURE, \"read\");\n" |
| 1766 |
"\\&\n" |
| 1767 |
" /* We expect only one kind of event; verify that assumption. */\n" |
| 1768 |
"\\&\n" |
| 1769 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 1770 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 1771 |
" exit(EXIT_FAILURE);\n" |
| 1772 |
" }\n" |
| 1773 |
"\\&\n" |
| 1774 |
" /* Display info about the page-fault event. */\n" |
| 1775 |
"\\&\n" |
| 1776 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 1777 |
" printf(\"flags = %w64x; \", msg.arg.pagefault.flags);\n" |
| 1778 |
" printf(\"address = %w64x\\[rs]n\", msg.arg.pagefault.address);\n" |
| 1779 |
"\\&\n" |
| 1780 |
" /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" |
| 1781 |
" region. Vary the contents that are copied in, so that it\n" |
| 1782 |
" is more obvious that each fault is handled separately. */\n" |
| 1783 |
"\\&\n" |
| 1784 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 1785 |
" fault_cnt++;\n" |
| 1786 |
"\\&\n" |
| 1787 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 1788 |
"\\&\n" |
| 1789 |
" /* We need to handle page faults in units of pages(!).\n" |
| 1790 |
" So, round faulting address down to page boundary. */\n" |
| 1791 |
"\\&\n" |
| 1792 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 1793 |
" \\[ti](page_size - 1);\n" |
| 1794 |
" uffdio_copy.len = page_size;\n" |
| 1795 |
" uffdio_copy.mode = 0;\n" |
| 1796 |
" uffdio_copy.copy = 0;\n" |
| 1797 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 1798 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 1799 |
"\\&\n" |
| 1800 |
" printf(\" (uffdio_copy.copy returned %w64d)\\[rs]n\",\n" |
| 1801 |
" uffdio_copy.copy);\n" |
| 1802 |
" }\n" |
| 1803 |
"}\n" |
| 1804 |
"\\&\n" |
| 1805 |
"int\n" |
| 1806 |
"main(int argc, char *argv[])\n" |
| 1807 |
"{\n" |
| 1808 |
" int s;\n" |
| 1809 |
" char *addr; /* Start of region handled by userfaultfd */\n" |
| 1810 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 1811 |
" size_t size, i; /* Size of region handled by userfaultfd */\n" |
| 1812 |
" pthread_t thr; /* ID of thread that handles page faults */\n" |
| 1813 |
" struct uffdio_api uffdio_api;\n" |
| 1814 |
" struct uffdio_register uffdio_register;\n" |
| 1815 |
"\\&\n" |
| 1816 |
" if (argc != 2) {\n" |
| 1817 |
" fprintf(stderr, \"Usage: %s num-pages\\[rs]n\", argv[0]);\n" |
| 1818 |
" exit(EXIT_FAILURE);\n" |
| 1819 |
" }\n" |
| 1820 |
"\\&\n" |
| 1821 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 1822 |
" size = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 1823 |
"\\&\n" |
| 1824 |
" /* Create and enable userfaultfd object. */\n" |
| 1825 |
"\\&\n" |
| 1826 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 1827 |
" if (uffd == -1)\n" |
| 1828 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 1829 |
"\\&\n" |
| 1830 |
" /* NOTE: Two-step feature handshake is not needed here, since this\n" |
| 1831 |
" example doesn't require any specific features.\n" |
| 1832 |
"\\&\n" |
| 1833 |
" Programs that *do* should call UFFDIO_API twice: once with\n" |
| 1834 |
" `features = 0` to detect features supported by this kernel, and\n" |
| 1835 |
" again with the subset of features the program actually wants to\n" |
| 1836 |
" enable. */\n" |
| 1837 |
" uffdio_api.api = UFFD_API;\n" |
| 1838 |
" uffdio_api.features = 0;\n" |
| 1839 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 1840 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 1841 |
"\\&\n" |
| 1842 |
" /* Create a private anonymous mapping. The memory will be\n" |
| 1843 |
" demand-zero paged--that is, not yet allocated. When we\n" |
| 1844 |
" actually touch the memory, it will be allocated via\n" |
| 1845 |
" the userfaultfd. */\n" |
| 1846 |
"\\&\n" |
| 1847 |
" addr = mmap(NULL, size, PROT_READ | PROT_WRITE,\n" |
| 1848 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 1849 |
" if (addr == MAP_FAILED)\n" |
| 1850 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 1851 |
"\\&\n" |
| 1852 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 1853 |
"\\&\n" |
| 1854 |
" /* Register the memory range of the mapping we just created for\n" |
| 1855 |
" handling by the userfaultfd object. In mode, we request to track\n" |
| 1856 |
" missing pages (i.e., pages that have not yet been faulted in). */\n" |
| 1857 |
"\\&\n" |
| 1858 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 1859 |
" uffdio_register.range.len = size;\n" |
| 1860 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 1861 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 1862 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 1863 |
"\\&\n" |
| 1864 |
" /* Create a thread that will process the userfaultfd events. */\n" |
| 1865 |
"\\&\n" |
| 1866 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 1867 |
" if (s != 0) {\n" |
| 1868 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 1869 |
" }\n" |
| 1870 |
"\\&\n" |
| 1871 |
" /* Main thread now touches memory in the mapping, touching\n" |
| 1872 |
" locations 1024 bytes apart. This will trigger userfaultfd\n" |
| 1873 |
" events for all pages in the region. */\n" |
| 1874 |
"\\&\n" |
| 1875 |
" i = 0xf; /* Ensure that faulting address is not on a page\n" |
| 1876 |
" boundary, in order to test that we correctly\n" |
| 1877 |
" handle that case in fault_handling_thread(). */\n" |
| 1878 |
" while (i E<lt> size) {\n" |
| 1879 |
" char c;\n" |
| 1880 |
"\\&\n" |
| 1881 |
" c = addr[i];\n" |
| 1882 |
" printf(\"Read address %p in %s(): \", addr + i, __func__);\n" |
| 1883 |
" printf(\"%c\\[rs]n\", c);\n" |
| 1884 |
" i += 1024;\n" |
| 1885 |
" usleep(100000); /* Slow things down a little */\n" |
| 1886 |
" }\n" |
| 1887 |
"\\&\n" |
| 1888 |
" exit(EXIT_SUCCESS);\n" |
| 1889 |
"}\n" |
| 1890 |
msgstr "" |
| 1891 |
"/* userfaultfd_demo.c\n" |
| 1892 |
"\\&\n" |
| 1893 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 1894 |
"*/\n" |
| 1895 |
"#define _GNU_SOURCE\n" |
| 1896 |
"#include E<lt>err.hE<gt>\n" |
| 1897 |
"#include E<lt>errno.hE<gt>\n" |
| 1898 |
"#include E<lt>fcntl.hE<gt>\n" |
| 1899 |
"#include E<lt>inttypes.hE<gt>\n" |
| 1900 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 1901 |
"#include E<lt>poll.hE<gt>\n" |
| 1902 |
"#include E<lt>pthread.hE<gt>\n" |
| 1903 |
"#include E<lt>stdio.hE<gt>\n" |
| 1904 |
"#include E<lt>stdlib.hE<gt>\n" |
| 1905 |
"#include E<lt>string.hE<gt>\n" |
| 1906 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 1907 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 1908 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 1909 |
"#include E<lt>unistd.hE<gt>\n" |
| 1910 |
"\\&\n" |
| 1911 |
"static int page_size;\n" |
| 1912 |
"\\&\n" |
| 1913 |
"static void *\n" |
| 1914 |
"fault_handler_thread(void *arg)\n" |
| 1915 |
"{\n" |
| 1916 |
" long uffd; /* descripteur du fichier userfaultfd */\n" |
| 1917 |
"\\&\n" |
| 1918 |
" static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" |
| 1919 |
" static char *page = NULL;\n" |
| 1920 |
" static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" |
| 1921 |
"\\&\n" |
| 1922 |
" uffd = (long) arg;\n" |
| 1923 |
"\\&\n" |
| 1924 |
" /* Créer une page qui sera copiée dans la région en erreur. */\n" |
| 1925 |
"\\&\n" |
| 1926 |
" if (page == NULL) {\n" |
| 1927 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 1928 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 1929 |
" if (page == MAP_FAILED)\n" |
| 1930 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 1931 |
" }\n" |
| 1932 |
"\\&\n" |
| 1933 |
" /* Boucle gérant les événements entrants sur le descripteur\n" |
| 1934 |
" de fichier userfaultfd. */\n" |
| 1935 |
"\\&\n" |
| 1936 |
" for (;;) {\n" |
| 1937 |
" int nready;\n" |
| 1938 |
" ssize_t nread;\n" |
| 1939 |
" struct pollfd pollfd;\n" |
| 1940 |
" struct uffdio_copy uffdio_copy;\n" |
| 1941 |
"\\&\n" |
| 1942 |
" /* Voir ce que poll() nous dit sur l'userfaultfd. */\n" |
| 1943 |
"\\&\n" |
| 1944 |
" pollfd.fd = uffd;\n" |
| 1945 |
" pollfd.events = POLLIN;\n" |
| 1946 |
" nready = poll(&pollfd, 1, -1);\n" |
| 1947 |
" if (nready == -1)\n" |
| 1948 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 1949 |
"\\&\n" |
| 1950 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 1951 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 1952 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 1953 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 1954 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 1955 |
"\\&\n" |
| 1956 |
" /* Lire un événement à partir de l'userfaultfd. */\n" |
| 1957 |
"\\&\n" |
| 1958 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 1959 |
" if (nread == 0) {\n" |
| 1960 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 1961 |
" exit(EXIT_FAILURE);\n" |
| 1962 |
" }\n" |
| 1963 |
"\\&\n" |
| 1964 |
" if (nread == -1)\n" |
| 1965 |
" err(EXIT_FAILURE, \"read\");\n" |
| 1966 |
"\\&\n" |
| 1967 |
" /* Un seul type d'événement est attendu ; il faut vérifier\n" |
| 1968 |
" cette supposition. */\n" |
| 1969 |
"\\&\n" |
| 1970 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 1971 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 1972 |
" exit(EXIT_FAILURE);\n" |
| 1973 |
" }\n" |
| 1974 |
"\\&\n" |
| 1975 |
" /* Afficher une information sur l'événement erreur de page. */\n" |
| 1976 |
"\\&\n" |
| 1977 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 1978 |
" printf(\"flags = %w64x; \", msg.arg.pagefault.flags);\n" |
| 1979 |
" printf(\"address = %w64x\\[rs]n\", msg.arg.pagefault.address);\n" |
| 1980 |
"\\&\n" |
| 1981 |
" /* Copier la page sur laquelle pointe la « page » dans la région\n" |
| 1982 |
" fautive. Varier le contenu copié, afin qu'il soit plus\n" |
| 1983 |
" évident que chaque erreur soit gérée séparément. */\n" |
| 1984 |
"\\&\n" |
| 1985 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 1986 |
" fault_cnt++;\n" |
| 1987 |
"\\&\n" |
| 1988 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 1989 |
"\\&\n" |
| 1990 |
" /* Il est nécessaire de gérer les erreurs de page en\n" |
| 1991 |
" unités de pages(!). Aussi, il faut arrondir les\n" |
| 1992 |
" adresses fautives à la limite de page. */\n" |
| 1993 |
"\\&\n" |
| 1994 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 1995 |
" \\[ti](page_size - 1);\n" |
| 1996 |
" uffdio_copy.len = page_size;\n" |
| 1997 |
" uffdio_copy.mode = 0;\n" |
| 1998 |
" uffdio_copy.copy = 0;\n" |
| 1999 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 2000 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 2001 |
"\\&\n" |
| 2002 |
" printf(\" (uffdio_copy.copy returned %w64d)\\[rs]n\",\n" |
| 2003 |
" uffdio_copy.copy);\n" |
| 2004 |
" }\n" |
| 2005 |
"}\n" |
| 2006 |
"\\&\n" |
| 2007 |
"int\n" |
| 2008 |
"main(int argc, char *argv[])\n" |
| 2009 |
"{\n" |
| 2010 |
" int s;\n" |
| 2011 |
" char *addr; /* Début de la région gérée par userfaultfd */\n" |
| 2012 |
" long uffd; /* Descripteur de fichier userfaultfd */\n" |
| 2013 |
" size_t len, l; /* Taille de la région gérée par userfaultfd */\n" |
| 2014 |
" pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" |
| 2015 |
" struct uffdio_api uffdio_api;\n" |
| 2016 |
" struct uffdio_register uffdio_register;\n" |
| 2017 |
"\\&\n" |
| 2018 |
" if (argc != 2) {\n" |
| 2019 |
" fprintf(stderr, \"Utilisation : %s num-pages\\[rs]n\", argv[0]);\n" |
| 2020 |
" exit(EXIT_FAILURE);\n" |
| 2021 |
" }\n" |
| 2022 |
"\\&\n" |
| 2023 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 2024 |
" len = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 2025 |
"\\&\n" |
| 2026 |
" /* Créer et activer un objet userfaultfd. */\n" |
| 2027 |
"\\&\n" |
| 2028 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 2029 |
" if (uffd == -1)\n" |
| 2030 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 2031 |
"\\&\n" |
| 2032 |
" /* NOTE : Une connexion de fonction en deux étapes est inutile ici,\n" |
| 2033 |
" dans la mesure où l'exemple n'a besoin d'aucune fonction\n" |
| 2034 |
" particulière.\n" |
| 2035 |
"\\&\n" |
| 2036 |
" Les programmes qui *agissent* doivent appeler UFFDIO_API deux fois :\n" |
| 2037 |
" une fois avec « features = 0 » pour détecter les fonctions prises en\n" |
| 2038 |
" charge par ce noyau, puis avec le sous-ensemble de fonctions que le\n" |
| 2039 |
" programme veut vraiment activer. */\n" |
| 2040 |
"\\&\n" |
| 2041 |
" uffdio_api.api = UFFD_API;\n" |
| 2042 |
" uffdio_api.features = 0;\n" |
| 2043 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 2044 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 2045 |
"\\&\n" |
| 2046 |
" /* Créer un mappage anonyme privé. La mémoire sera paginée\n" |
| 2047 |
" avec aucune demande — c'est-à-dire, sans être encore\n" |
| 2048 |
" allouée. Quand la mémoire sera réellement utilisée,\n" |
| 2049 |
" elle sera allouée au moyen de l'userfaultfd. */\n" |
| 2050 |
"\\&\n" |
| 2051 |
" addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" |
| 2052 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2053 |
" if (addr == MAP_FAILED)\n" |
| 2054 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2055 |
"\\&\n" |
| 2056 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 2057 |
"\\&\n" |
| 2058 |
" /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" |
| 2059 |
" créé pour le traitement par l'objet userfaultfd. Dans mode,\n" |
| 2060 |
" suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" |
| 2061 |
" pas encore fautives). */\n" |
| 2062 |
"\\&\n" |
| 2063 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 2064 |
" uffdio_register.range.len = len;\n" |
| 2065 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 2066 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 2067 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 2068 |
"\\&\n" |
| 2069 |
" /* Créer un thread qui traitera les événements userfaultfd. */\n" |
| 2070 |
"\\&\n" |
| 2071 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 2072 |
" if (s != 0) {\n" |
| 2073 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 2074 |
" }\n" |
| 2075 |
"\\&\n" |
| 2076 |
" /* Le thread principal utilise la mémoire dans le mappage,\n" |
| 2077 |
" utilisant des emplacements séparés de 1024 octets. Cela va\n" |
| 2078 |
" déclencher des événements userfaultfd pour toutes les pages\n" |
| 2079 |
" dans la région. */\n" |
| 2080 |
"\\&\n" |
| 2081 |
" l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" |
| 2082 |
" limite de page afin de vérifier que ce cas est\n" |
| 2083 |
" correctement géré dans le fault_handling_thread(). */\n" |
| 2084 |
" while (l E<lt> size) {\n" |
| 2085 |
" char c;\n" |
| 2086 |
"\\&\n" |
| 2087 |
" c = addr[l];\n" |
| 2088 |
" printf(\"Read address %p in %s(): \", addr + l, __func__);\n" |
| 2089 |
" printf(\"%c\\[rs]n\", c);\n" |
| 2090 |
" l += 1024;\n" |
| 2091 |
" usleep(100000); /* Ralentir un peu le traitement */\n" |
| 2092 |
" }\n" |
| 2093 |
"\\&\n" |
| 2094 |
" exit(EXIT_SUCCESS);\n" |
| 2095 |
"}\n" |
| 2096 |
|
| 2097 |
#. SRC END |
| 2098 |
#. type: SH |
| 2099 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2100 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2101 |
#, no-wrap |
| 2102 |
msgid "SEE ALSO" |
| 2103 |
msgstr "VOIR AUSSI" |
| 2104 |
|
| 2105 |
#. type: Plain text |
| 2106 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2107 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2108 |
msgid "" |
| 2109 |
"B<fcntl>(2), B<ioctl>(2), B<ioctl_userfaultfd>(2), B<madvise>(2), B<mmap>(2)" |
| 2110 |
msgstr "" |
| 2111 |
"B<fcntl>(2), B<ioctl>(2), B<ioctl_userfaultfd>(2), B<madvise>(2), B<mmap>(2)" |
| 2112 |
|
| 2113 |
#. type: Plain text |
| 2114 |
#: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide |
| 2115 |
#: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed |
| 2116 |
msgid "" |
| 2117 |
"I<Documentation/admin-guide/mm/userfaultfd.rst> in the Linux kernel source " |
| 2118 |
"tree" |
| 2119 |
msgstr "" |
| 2120 |
"I<Documentation/admin-guide/mm/userfaultfd.rst> dans l'arborescence des " |
| 2121 |
"sources du noyau Linux" |
| 2122 |
|
| 2123 |
#. type: TH |
| 2124 |
#: debian-trixie |
| 2125 |
#, no-wrap |
| 2126 |
msgid "2024-06-15" |
| 2127 |
msgstr "15 juin 2024" |
| 2128 |
|
| 2129 |
#. type: TH |
| 2130 |
#: debian-trixie |
| 2131 |
#, no-wrap |
| 2132 |
msgid "Linux man-pages 6.9.1" |
| 2133 |
msgstr "Pages du manuel de Linux 6.9.1" |
| 2134 |
|
| 2135 |
#. type: Plain text |
| 2136 |
#: debian-trixie |
| 2137 |
msgid "Standard C library (I<libc>, I<-lc>)" |
| 2138 |
msgstr "Bibliothèque C standard (I<libc>, I<-lc>)" |
| 2139 |
|
| 2140 |
#. type: Plain text |
| 2141 |
#: debian-trixie |
| 2142 |
#, no-wrap |
| 2143 |
msgid "" |
| 2144 |
"struct uffd_msg {\n" |
| 2145 |
" __u8 event; /* Type of event */\n" |
| 2146 |
" ...\n" |
| 2147 |
" union {\n" |
| 2148 |
" struct {\n" |
| 2149 |
" __u64 flags; /* Flags describing fault */\n" |
| 2150 |
" __u64 address; /* Faulting address */\n" |
| 2151 |
" union {\n" |
| 2152 |
" __u32 ptid; /* Thread ID of the fault */\n" |
| 2153 |
" } feat;\n" |
| 2154 |
" } pagefault;\n" |
| 2155 |
"\\&\n" |
| 2156 |
" struct { /* Since Linux 4.11 */\n" |
| 2157 |
" __u32 ufd; /* Userfault file descriptor\n" |
| 2158 |
" of the child process */\n" |
| 2159 |
" } fork;\n" |
| 2160 |
"\\&\n" |
| 2161 |
" struct { /* Since Linux 4.11 */\n" |
| 2162 |
" __u64 from; /* Old address of remapped area */\n" |
| 2163 |
" __u64 to; /* New address of remapped area */\n" |
| 2164 |
" __u64 len; /* Original mapping length */\n" |
| 2165 |
" } remap;\n" |
| 2166 |
"\\&\n" |
| 2167 |
" struct { /* Since Linux 4.11 */\n" |
| 2168 |
" __u64 start; /* Start address of removed area */\n" |
| 2169 |
" __u64 end; /* End address of removed area */\n" |
| 2170 |
" } remove;\n" |
| 2171 |
" ...\n" |
| 2172 |
" } arg;\n" |
| 2173 |
"\\&\n" |
| 2174 |
" /* Padding fields omitted */\n" |
| 2175 |
"} __packed;\n" |
| 2176 |
msgstr "" |
| 2177 |
"struct uffd_msg {\n" |
| 2178 |
" __u8 event; /* Type d'événement */\n" |
| 2179 |
" ...\n" |
| 2180 |
" union {\n" |
| 2181 |
" struct {\n" |
| 2182 |
" __u64 flags; /* Attributs décrivant l'erreur */\n" |
| 2183 |
" __u64 address; /* Adresse fautive */\n" |
| 2184 |
" union {\n" |
| 2185 |
" __u32 ptid; /* ID du thread de l'erreur */\n" |
| 2186 |
" } feat;\n" |
| 2187 |
" } pagefault;\n" |
| 2188 |
"\\&\n" |
| 2189 |
" struct { /* Depuis Linux 4.11 */\n" |
| 2190 |
" __u32 ufd; /* Descripteur de ficher d'userfault\n" |
| 2191 |
" du processus enfant */\n" |
| 2192 |
" } fork;\n" |
| 2193 |
"\\&\n" |
| 2194 |
" struct { /* Depuis Linux 4.11 */\n" |
| 2195 |
" __u64 from; /* Ancienne adresse de la zone remappée */\n" |
| 2196 |
" __u64 to; /* Nouvelle adresse de la zone remappée */\n" |
| 2197 |
" __u64 len; /* Taille originale du mappage */\n" |
| 2198 |
" } remap;\n" |
| 2199 |
"\\&\n" |
| 2200 |
" struct { /* Depuis Linux 4.11 */\n" |
| 2201 |
" __u64 start; /* Adresse de début de la zone supprimée */\n" |
| 2202 |
" __u64 end; /* Adresse de fin de la zone supprimée */\n" |
| 2203 |
" } remove;\n" |
| 2204 |
" ...\n" |
| 2205 |
" } arg;\n" |
| 2206 |
"\\&\n" |
| 2207 |
" /* Remplissage des champs omis */\n" |
| 2208 |
"} __packed;\n" |
| 2209 |
|
| 2210 |
#. type: Plain text |
| 2211 |
#: debian-trixie |
| 2212 |
msgid "" |
| 2213 |
"The original length of the memory range that was remapped using B<mremap>(2)." |
| 2214 |
msgstr "" |
| 2215 |
"La taille d'origine de la plage de mémoire dont le mappage a été modifié en " |
| 2216 |
"utilisant B<madvise>(2)." |
| 2217 |
|
| 2218 |
#. type: Plain text |
| 2219 |
#: debian-trixie fedora-44 fedora-rawhide |
| 2220 |
#, no-wrap |
| 2221 |
msgid "" |
| 2222 |
"$ B<./userfaultfd_demo 3>\n" |
| 2223 |
"Address returned by mmap() = 0x7fd30106c000\n" |
| 2224 |
"\\&\n" |
| 2225 |
"fault_handler_thread():\n" |
| 2226 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2227 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" |
| 2228 |
" (uffdio_copy.copy returned 4096)\n" |
| 2229 |
"Read address 0x7fd30106c00f in main(): A\n" |
| 2230 |
"Read address 0x7fd30106c40f in main(): A\n" |
| 2231 |
"Read address 0x7fd30106c80f in main(): A\n" |
| 2232 |
"Read address 0x7fd30106cc0f in main(): A\n" |
| 2233 |
"\\&\n" |
| 2234 |
"fault_handler_thread():\n" |
| 2235 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2236 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" |
| 2237 |
" (uffdio_copy.copy returned 4096)\n" |
| 2238 |
"Read address 0x7fd30106d00f in main(): B\n" |
| 2239 |
"Read address 0x7fd30106d40f in main(): B\n" |
| 2240 |
"Read address 0x7fd30106d80f in main(): B\n" |
| 2241 |
"Read address 0x7fd30106dc0f in main(): B\n" |
| 2242 |
"\\&\n" |
| 2243 |
"fault_handler_thread():\n" |
| 2244 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2245 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" |
| 2246 |
" (uffdio_copy.copy returned 4096)\n" |
| 2247 |
"Read address 0x7fd30106e00f in main(): C\n" |
| 2248 |
"Read address 0x7fd30106e40f in main(): C\n" |
| 2249 |
"Read address 0x7fd30106e80f in main(): C\n" |
| 2250 |
"Read address 0x7fd30106ec0f in main(): C\n" |
| 2251 |
msgstr "" |
| 2252 |
"$ B<./userfaultfd_demo 3>\n" |
| 2253 |
"Address returned by mmap() = 0x7fd30106c000\n" |
| 2254 |
"\\&\n" |
| 2255 |
"fault_handler_thread():\n" |
| 2256 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2257 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n" |
| 2258 |
" (uffdio_copy.copy returned 4096)\n" |
| 2259 |
"Read address 0x7fd30106c00f in main(): A\n" |
| 2260 |
"Read address 0x7fd30106c40f in main(): A\n" |
| 2261 |
"Read address 0x7fd30106c80f in main(): A\n" |
| 2262 |
"Read address 0x7fd30106cc0f in main(): A\n" |
| 2263 |
"\\&\n" |
| 2264 |
"fault_handler_thread():\n" |
| 2265 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2266 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n" |
| 2267 |
" (uffdio_copy.copy returned 4096)\n" |
| 2268 |
"Read address 0x7fd30106d00f in main(): B\n" |
| 2269 |
"Read address 0x7fd30106d40f in main(): B\n" |
| 2270 |
"Read address 0x7fd30106d80f in main(): B\n" |
| 2271 |
"Read address 0x7fd30106dc0f in main(): B\n" |
| 2272 |
"\\&\n" |
| 2273 |
"fault_handler_thread():\n" |
| 2274 |
" poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n" |
| 2275 |
" UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n" |
| 2276 |
" (uffdio_copy.copy returned 4096)\n" |
| 2277 |
"Read address 0x7fd30106e00f in main(): C\n" |
| 2278 |
"Read address 0x7fd30106e40f in main(): C\n" |
| 2279 |
"Read address 0x7fd30106e80f in main(): C\n" |
| 2280 |
"Read address 0x7fd30106ec0f in main(): C\n" |
| 2281 |
|
| 2282 |
#. type: Plain text |
| 2283 |
#: debian-trixie |
| 2284 |
#, no-wrap |
| 2285 |
msgid "" |
| 2286 |
"/* userfaultfd_demo.c\n" |
| 2287 |
"\\&\n" |
| 2288 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 2289 |
"*/\n" |
| 2290 |
"#define _GNU_SOURCE\n" |
| 2291 |
"#include E<lt>err.hE<gt>\n" |
| 2292 |
"#include E<lt>errno.hE<gt>\n" |
| 2293 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2294 |
"#include E<lt>inttypes.hE<gt>\n" |
| 2295 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 2296 |
"#include E<lt>poll.hE<gt>\n" |
| 2297 |
"#include E<lt>pthread.hE<gt>\n" |
| 2298 |
"#include E<lt>stdio.hE<gt>\n" |
| 2299 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2300 |
"#include E<lt>string.hE<gt>\n" |
| 2301 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 2302 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 2303 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 2304 |
"#include E<lt>unistd.hE<gt>\n" |
| 2305 |
"\\&\n" |
| 2306 |
"static int page_size;\n" |
| 2307 |
"\\&\n" |
| 2308 |
"static void *\n" |
| 2309 |
"fault_handler_thread(void *arg)\n" |
| 2310 |
"{\n" |
| 2311 |
" int nready;\n" |
| 2312 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 2313 |
" ssize_t nread;\n" |
| 2314 |
" struct pollfd pollfd;\n" |
| 2315 |
" struct uffdio_copy uffdio_copy;\n" |
| 2316 |
"\\&\n" |
| 2317 |
" static int fault_cnt = 0; /* Number of faults so far handled */\n" |
| 2318 |
" static char *page = NULL;\n" |
| 2319 |
" static struct uffd_msg msg; /* Data read from userfaultfd */\n" |
| 2320 |
"\\&\n" |
| 2321 |
" uffd = (long) arg;\n" |
| 2322 |
"\\&\n" |
| 2323 |
" /* Create a page that will be copied into the faulting region. */\n" |
| 2324 |
"\\&\n" |
| 2325 |
" if (page == NULL) {\n" |
| 2326 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 2327 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2328 |
" if (page == MAP_FAILED)\n" |
| 2329 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2330 |
" }\n" |
| 2331 |
"\\&\n" |
| 2332 |
" /* Loop, handling incoming events on the userfaultfd\n" |
| 2333 |
" file descriptor. */\n" |
| 2334 |
"\\&\n" |
| 2335 |
" for (;;) {\n" |
| 2336 |
"\\&\n" |
| 2337 |
" /* See what poll() tells us about the userfaultfd. */\n" |
| 2338 |
"\\&\n" |
| 2339 |
" pollfd.fd = uffd;\n" |
| 2340 |
" pollfd.events = POLLIN;\n" |
| 2341 |
" nready = poll(&pollfd, 1, -1);\n" |
| 2342 |
" if (nready == -1)\n" |
| 2343 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 2344 |
"\\&\n" |
| 2345 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 2346 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 2347 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 2348 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 2349 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 2350 |
"\\&\n" |
| 2351 |
" /* Read an event from the userfaultfd. */\n" |
| 2352 |
"\\&\n" |
| 2353 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 2354 |
" if (nread == 0) {\n" |
| 2355 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 2356 |
" exit(EXIT_FAILURE);\n" |
| 2357 |
" }\n" |
| 2358 |
"\\&\n" |
| 2359 |
" if (nread == -1)\n" |
| 2360 |
" err(EXIT_FAILURE, \"read\");\n" |
| 2361 |
"\\&\n" |
| 2362 |
" /* We expect only one kind of event; verify that assumption. */\n" |
| 2363 |
"\\&\n" |
| 2364 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 2365 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 2366 |
" exit(EXIT_FAILURE);\n" |
| 2367 |
" }\n" |
| 2368 |
"\\&\n" |
| 2369 |
" /* Display info about the page-fault event. */\n" |
| 2370 |
"\\&\n" |
| 2371 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 2372 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 2373 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 2374 |
"\\&\n" |
| 2375 |
" /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" |
| 2376 |
" region. Vary the contents that are copied in, so that it\n" |
| 2377 |
" is more obvious that each fault is handled separately. */\n" |
| 2378 |
"\\&\n" |
| 2379 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 2380 |
" fault_cnt++;\n" |
| 2381 |
"\\&\n" |
| 2382 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 2383 |
"\\&\n" |
| 2384 |
" /* We need to handle page faults in units of pages(!).\n" |
| 2385 |
" So, round faulting address down to page boundary. */\n" |
| 2386 |
"\\&\n" |
| 2387 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 2388 |
" \\[ti](page_size - 1);\n" |
| 2389 |
" uffdio_copy.len = page_size;\n" |
| 2390 |
" uffdio_copy.mode = 0;\n" |
| 2391 |
" uffdio_copy.copy = 0;\n" |
| 2392 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 2393 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 2394 |
"\\&\n" |
| 2395 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 2396 |
" uffdio_copy.copy);\n" |
| 2397 |
" }\n" |
| 2398 |
"}\n" |
| 2399 |
"\\&\n" |
| 2400 |
"int\n" |
| 2401 |
"main(int argc, char *argv[])\n" |
| 2402 |
"{\n" |
| 2403 |
" int s;\n" |
| 2404 |
" char c;\n" |
| 2405 |
" char *addr; /* Start of region handled by userfaultfd */\n" |
| 2406 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 2407 |
" size_t len, l; /* Length of region handled by userfaultfd */\n" |
| 2408 |
" pthread_t thr; /* ID of thread that handles page faults */\n" |
| 2409 |
" struct uffdio_api uffdio_api;\n" |
| 2410 |
" struct uffdio_register uffdio_register;\n" |
| 2411 |
"\\&\n" |
| 2412 |
" if (argc != 2) {\n" |
| 2413 |
" fprintf(stderr, \"Usage: %s num-pages\\[rs]n\", argv[0]);\n" |
| 2414 |
" exit(EXIT_FAILURE);\n" |
| 2415 |
" }\n" |
| 2416 |
"\\&\n" |
| 2417 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 2418 |
" len = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 2419 |
"\\&\n" |
| 2420 |
" /* Create and enable userfaultfd object. */\n" |
| 2421 |
"\\&\n" |
| 2422 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 2423 |
" if (uffd == -1)\n" |
| 2424 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 2425 |
"\\&\n" |
| 2426 |
" /* NOTE: Two-step feature handshake is not needed here, since this\n" |
| 2427 |
" example doesn't require any specific features.\n" |
| 2428 |
"\\&\n" |
| 2429 |
" Programs that *do* should call UFFDIO_API twice: once with\n" |
| 2430 |
" `features = 0` to detect features supported by this kernel, and\n" |
| 2431 |
" again with the subset of features the program actually wants to\n" |
| 2432 |
" enable. */\n" |
| 2433 |
" uffdio_api.api = UFFD_API;\n" |
| 2434 |
" uffdio_api.features = 0;\n" |
| 2435 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 2436 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 2437 |
"\\&\n" |
| 2438 |
" /* Create a private anonymous mapping. The memory will be\n" |
| 2439 |
" demand-zero paged--that is, not yet allocated. When we\n" |
| 2440 |
" actually touch the memory, it will be allocated via\n" |
| 2441 |
" the userfaultfd. */\n" |
| 2442 |
"\\&\n" |
| 2443 |
" addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" |
| 2444 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2445 |
" if (addr == MAP_FAILED)\n" |
| 2446 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2447 |
"\\&\n" |
| 2448 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 2449 |
"\\&\n" |
| 2450 |
" /* Register the memory range of the mapping we just created for\n" |
| 2451 |
" handling by the userfaultfd object. In mode, we request to track\n" |
| 2452 |
" missing pages (i.e., pages that have not yet been faulted in). */\n" |
| 2453 |
"\\&\n" |
| 2454 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 2455 |
" uffdio_register.range.len = len;\n" |
| 2456 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 2457 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 2458 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 2459 |
"\\&\n" |
| 2460 |
" /* Create a thread that will process the userfaultfd events. */\n" |
| 2461 |
"\\&\n" |
| 2462 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 2463 |
" if (s != 0) {\n" |
| 2464 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 2465 |
" }\n" |
| 2466 |
"\\&\n" |
| 2467 |
" /* Main thread now touches memory in the mapping, touching\n" |
| 2468 |
" locations 1024 bytes apart. This will trigger userfaultfd\n" |
| 2469 |
" events for all pages in the region. */\n" |
| 2470 |
"\\&\n" |
| 2471 |
" l = 0xf; /* Ensure that faulting address is not on a page\n" |
| 2472 |
" boundary, in order to test that we correctly\n" |
| 2473 |
" handle that case in fault_handling_thread(). */\n" |
| 2474 |
" while (l E<lt> len) {\n" |
| 2475 |
" c = addr[l];\n" |
| 2476 |
" printf(\"Read address %p in %s(): \", addr + l, __func__);\n" |
| 2477 |
" printf(\"%c\\[rs]n\", c);\n" |
| 2478 |
" l += 1024;\n" |
| 2479 |
" usleep(100000); /* Slow things down a little */\n" |
| 2480 |
" }\n" |
| 2481 |
"\\&\n" |
| 2482 |
" exit(EXIT_SUCCESS);\n" |
| 2483 |
"}\n" |
| 2484 |
msgstr "" |
| 2485 |
"/* userfaultfd_demo.c\n" |
| 2486 |
"\\&\n" |
| 2487 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 2488 |
"*/\n" |
| 2489 |
"#define _GNU_SOURCE\n" |
| 2490 |
"#include E<lt>err.hE<gt>\n" |
| 2491 |
"#include E<lt>errno.hE<gt>\n" |
| 2492 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2493 |
"#include E<lt>inttypes.hE<gt>\n" |
| 2494 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 2495 |
"#include E<lt>poll.hE<gt>\n" |
| 2496 |
"#include E<lt>pthread.hE<gt>\n" |
| 2497 |
"#include E<lt>stdio.hE<gt>\n" |
| 2498 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2499 |
"#include E<lt>string.hE<gt>\n" |
| 2500 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 2501 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 2502 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 2503 |
"#include E<lt>unistd.hE<gt>\n" |
| 2504 |
"\\&\n" |
| 2505 |
"static int page_size;\n" |
| 2506 |
"\\&\n" |
| 2507 |
"static void *\n" |
| 2508 |
"fault_handler_thread(void *arg)\n" |
| 2509 |
"{\n" |
| 2510 |
" int nready;\n" |
| 2511 |
" long uffd; /* descripteur du fichier userfaultfd */\n" |
| 2512 |
" ssize_t nread;\n" |
| 2513 |
" struct pollfd pollfd;\n" |
| 2514 |
" struct uffdio_copy uffdio_copy;\n" |
| 2515 |
"\\&\n" |
| 2516 |
" static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" |
| 2517 |
" static char *page = NULL;\n" |
| 2518 |
" static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" |
| 2519 |
"\\&\n" |
| 2520 |
" uffd = (long) arg;\n" |
| 2521 |
"\\&\n" |
| 2522 |
" /* Créer une page qui sera copiée dans la région en erreur. */\n" |
| 2523 |
"\\&\n" |
| 2524 |
" if (page == NULL) {\n" |
| 2525 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 2526 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2527 |
" if (page == MAP_FAILED)\n" |
| 2528 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2529 |
" }\n" |
| 2530 |
"\\&\n" |
| 2531 |
" /* Boucle gérant les événements entrants sur le descripteur\n" |
| 2532 |
" de fichier userfaultfd. */\n" |
| 2533 |
"\\&\n" |
| 2534 |
" for (;;) {\n" |
| 2535 |
"\\&\n" |
| 2536 |
" /* Voir ce que poll() nous dit sur l'userfaultfd. */\n" |
| 2537 |
"\\&\n" |
| 2538 |
" pollfd.fd = uffd;\n" |
| 2539 |
" pollfd.events = POLLIN;\n" |
| 2540 |
" nready = poll(&pollfd, 1, -1);\n" |
| 2541 |
" if (nready == -1)\n" |
| 2542 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 2543 |
"\\&\n" |
| 2544 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 2545 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 2546 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 2547 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 2548 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 2549 |
"\\&\n" |
| 2550 |
" /* Lire un événement à partir de l'userfaultfd. */\n" |
| 2551 |
"\\&\n" |
| 2552 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 2553 |
" if (nread == 0) {\n" |
| 2554 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 2555 |
" exit(EXIT_FAILURE);\n" |
| 2556 |
" }\n" |
| 2557 |
"\\&\n" |
| 2558 |
" if (nread == -1)\n" |
| 2559 |
" err(EXIT_FAILURE, \"read\");\n" |
| 2560 |
"\\&\n" |
| 2561 |
" /* Un seul type d'événement est attendu ; il faut vérifier\n" |
| 2562 |
" cette supposition. */\n" |
| 2563 |
"\\&\n" |
| 2564 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 2565 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 2566 |
" exit(EXIT_FAILURE);\n" |
| 2567 |
" }\n" |
| 2568 |
"\\&\n" |
| 2569 |
" /* Afficher une information sur l'événement erreur de page. */\n" |
| 2570 |
"\\&\n" |
| 2571 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 2572 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 2573 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 2574 |
"\\&\n" |
| 2575 |
" /* Copier la page sur laquelle pointe la « page » dans la région\n" |
| 2576 |
" fautive. Varier le contenu copié, afin qu'il soit plus\n" |
| 2577 |
" évident que chaque erreur soit gérée séparément. */\n" |
| 2578 |
"\\&\n" |
| 2579 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 2580 |
" fault_cnt++;\n" |
| 2581 |
"\\&\n" |
| 2582 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 2583 |
"\\&\n" |
| 2584 |
" /* Il est nécessaire de gérer les erreurs de page en\n" |
| 2585 |
" unités de pages(!). Aussi, il faut arrondir les\n" |
| 2586 |
" adresses fautives à la limite de page. */\n" |
| 2587 |
"\\&\n" |
| 2588 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 2589 |
" \\[ti](page_size - 1);\n" |
| 2590 |
" uffdio_copy.len = page_size;\n" |
| 2591 |
" uffdio_copy.mode = 0;\n" |
| 2592 |
" uffdio_copy.copy = 0;\n" |
| 2593 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 2594 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 2595 |
"\\&\n" |
| 2596 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 2597 |
" uffdio_copy.copy);\n" |
| 2598 |
" }\n" |
| 2599 |
"}\n" |
| 2600 |
"\\&\n" |
| 2601 |
"int\n" |
| 2602 |
"main(int argc, char *argv[])\n" |
| 2603 |
"{\n" |
| 2604 |
" int s;\n" |
| 2605 |
" char c;\n" |
| 2606 |
" char *addr; /* Début de la région gérée par userfaultfd */\n" |
| 2607 |
" long uffd; /* Descripteur de fichier userfaultfd */\n" |
| 2608 |
" size_t len, l; /* Taille de la région gérée par userfaultfd */\n" |
| 2609 |
" pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" |
| 2610 |
" struct uffdio_api uffdio_api;\n" |
| 2611 |
" struct uffdio_register uffdio_register;\n" |
| 2612 |
"\\&\n" |
| 2613 |
" if (argc != 2) {\n" |
| 2614 |
" fprintf(stderr, \"Utilisation : %s num-pages\\[rs]n\", argv[0]);\n" |
| 2615 |
" exit(EXIT_FAILURE);\n" |
| 2616 |
" }\n" |
| 2617 |
"\\&\n" |
| 2618 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 2619 |
" len = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 2620 |
"\\&\n" |
| 2621 |
" /* Créer et activer un objet userfaultfd. */\n" |
| 2622 |
"\\&\n" |
| 2623 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 2624 |
" if (uffd == -1)\n" |
| 2625 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 2626 |
"\\&\n" |
| 2627 |
" /* NOTE : Une connexion de fonction en deux étapes est inutile ici,\n" |
| 2628 |
" dans la mesure où l'exemple n'a besoin d'aucune fonction\n" |
| 2629 |
" particulière.\n" |
| 2630 |
"\\&\n" |
| 2631 |
" Les programmes qui *agissent* doivent appeler UFFDIO_API deux fois :\n" |
| 2632 |
" une fois avec « features = 0 » pour détecter les fonctions prises en\n" |
| 2633 |
" charge par ce noyau, puis avec le sous-ensemble de fonctions que le\n" |
| 2634 |
" programme veut vraiment activer. */\n" |
| 2635 |
"\\&\n" |
| 2636 |
" uffdio_api.api = UFFD_API;\n" |
| 2637 |
" uffdio_api.features = 0;\n" |
| 2638 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 2639 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 2640 |
"\\&\n" |
| 2641 |
" /* Créer un mappage anonyme privé. La mémoire sera paginée\n" |
| 2642 |
" avec aucune demande — c'est-à-dire, sans être encore\n" |
| 2643 |
" allouée. Quand la mémoire sera réellement utilisée,\n" |
| 2644 |
" elle sera allouée au moyen de l'userfaultfd. */\n" |
| 2645 |
"\\&\n" |
| 2646 |
" addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" |
| 2647 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2648 |
" if (addr == MAP_FAILED)\n" |
| 2649 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2650 |
"\\&\n" |
| 2651 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 2652 |
"\\&\n" |
| 2653 |
" /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" |
| 2654 |
" créé pour le traitement par l'objet userfaultfd. Dans mode,\n" |
| 2655 |
" suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" |
| 2656 |
" pas encore fautives). */\n" |
| 2657 |
"\\&\n" |
| 2658 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 2659 |
" uffdio_register.range.len = len;\n" |
| 2660 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 2661 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 2662 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 2663 |
"\\&\n" |
| 2664 |
" /* Créer un thread qui traitera les événements userfaultfd. */\n" |
| 2665 |
"\\&\n" |
| 2666 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 2667 |
" if (s != 0) {\n" |
| 2668 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 2669 |
" }\n" |
| 2670 |
"\\&\n" |
| 2671 |
" /* Le thread principal utilise la mémoire dans le mappage,\n" |
| 2672 |
" utilisant des emplacements séparés de 1024 octets. Cela va\n" |
| 2673 |
" déclencher des événements userfaultfd pour toutes les pages\n" |
| 2674 |
" dans la région. */\n" |
| 2675 |
"\\&\n" |
| 2676 |
" l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" |
| 2677 |
" limite de page afin de vérifier que ce cas est\n" |
| 2678 |
" correctement géré dans le fault_handling_thread(). */\n" |
| 2679 |
" while (l E<lt> len) {\n" |
| 2680 |
" c = addr[l];\n" |
| 2681 |
" printf(\"Read address %p in %s(): \", addr + l, __func__);\n" |
| 2682 |
" printf(\"%c\\[rs]n\", c);\n" |
| 2683 |
" l += 1024;\n" |
| 2684 |
" usleep(100000); /* Ralentir un peu le traitement */\n" |
| 2685 |
" }\n" |
| 2686 |
"\\&\n" |
| 2687 |
" exit(EXIT_SUCCESS);\n" |
| 2688 |
"}\n" |
| 2689 |
|
| 2690 |
#. type: TH |
| 2691 |
#: fedora-44 fedora-rawhide |
| 2692 |
#, no-wrap |
| 2693 |
msgid "2024-11-17" |
| 2694 |
msgstr "17 novembre 2024" |
| 2695 |
|
| 2696 |
#. type: TH |
| 2697 |
#: fedora-44 fedora-rawhide |
| 2698 |
#, no-wrap |
| 2699 |
msgid "Linux man-pages 6.13" |
| 2700 |
msgstr "Pages du manuel de Linux 6.13" |
| 2701 |
|
| 2702 |
#. type: Plain text |
| 2703 |
#: fedora-44 fedora-rawhide |
| 2704 |
#, no-wrap |
| 2705 |
msgid "" |
| 2706 |
"/* userfaultfd_demo.c\n" |
| 2707 |
"\\&\n" |
| 2708 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 2709 |
"*/\n" |
| 2710 |
"#define _GNU_SOURCE\n" |
| 2711 |
"#include E<lt>err.hE<gt>\n" |
| 2712 |
"#include E<lt>errno.hE<gt>\n" |
| 2713 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2714 |
"#include E<lt>inttypes.hE<gt>\n" |
| 2715 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 2716 |
"#include E<lt>poll.hE<gt>\n" |
| 2717 |
"#include E<lt>pthread.hE<gt>\n" |
| 2718 |
"#include E<lt>stdio.hE<gt>\n" |
| 2719 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2720 |
"#include E<lt>string.hE<gt>\n" |
| 2721 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 2722 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 2723 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 2724 |
"#include E<lt>unistd.hE<gt>\n" |
| 2725 |
"\\&\n" |
| 2726 |
"static int page_size;\n" |
| 2727 |
"\\&\n" |
| 2728 |
"static void *\n" |
| 2729 |
"fault_handler_thread(void *arg)\n" |
| 2730 |
"{\n" |
| 2731 |
" int nready;\n" |
| 2732 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 2733 |
" ssize_t nread;\n" |
| 2734 |
" struct pollfd pollfd;\n" |
| 2735 |
" struct uffdio_copy uffdio_copy;\n" |
| 2736 |
"\\&\n" |
| 2737 |
" static int fault_cnt = 0; /* Number of faults so far handled */\n" |
| 2738 |
" static char *page = NULL;\n" |
| 2739 |
" static struct uffd_msg msg; /* Data read from userfaultfd */\n" |
| 2740 |
"\\&\n" |
| 2741 |
" uffd = (long) arg;\n" |
| 2742 |
"\\&\n" |
| 2743 |
" /* Create a page that will be copied into the faulting region. */\n" |
| 2744 |
"\\&\n" |
| 2745 |
" if (page == NULL) {\n" |
| 2746 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 2747 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2748 |
" if (page == MAP_FAILED)\n" |
| 2749 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2750 |
" }\n" |
| 2751 |
"\\&\n" |
| 2752 |
" /* Loop, handling incoming events on the userfaultfd\n" |
| 2753 |
" file descriptor. */\n" |
| 2754 |
"\\&\n" |
| 2755 |
" for (;;) {\n" |
| 2756 |
"\\&\n" |
| 2757 |
" /* See what poll() tells us about the userfaultfd. */\n" |
| 2758 |
"\\&\n" |
| 2759 |
" pollfd.fd = uffd;\n" |
| 2760 |
" pollfd.events = POLLIN;\n" |
| 2761 |
" nready = poll(&pollfd, 1, -1);\n" |
| 2762 |
" if (nready == -1)\n" |
| 2763 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 2764 |
"\\&\n" |
| 2765 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 2766 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 2767 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 2768 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 2769 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 2770 |
"\\&\n" |
| 2771 |
" /* Read an event from the userfaultfd. */\n" |
| 2772 |
"\\&\n" |
| 2773 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 2774 |
" if (nread == 0) {\n" |
| 2775 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 2776 |
" exit(EXIT_FAILURE);\n" |
| 2777 |
" }\n" |
| 2778 |
"\\&\n" |
| 2779 |
" if (nread == -1)\n" |
| 2780 |
" err(EXIT_FAILURE, \"read\");\n" |
| 2781 |
"\\&\n" |
| 2782 |
" /* We expect only one kind of event; verify that assumption. */\n" |
| 2783 |
"\\&\n" |
| 2784 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 2785 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 2786 |
" exit(EXIT_FAILURE);\n" |
| 2787 |
" }\n" |
| 2788 |
"\\&\n" |
| 2789 |
" /* Display info about the page-fault event. */\n" |
| 2790 |
"\\&\n" |
| 2791 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 2792 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 2793 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 2794 |
"\\&\n" |
| 2795 |
" /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" |
| 2796 |
" region. Vary the contents that are copied in, so that it\n" |
| 2797 |
" is more obvious that each fault is handled separately. */\n" |
| 2798 |
"\\&\n" |
| 2799 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 2800 |
" fault_cnt++;\n" |
| 2801 |
"\\&\n" |
| 2802 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 2803 |
"\\&\n" |
| 2804 |
" /* We need to handle page faults in units of pages(!).\n" |
| 2805 |
" So, round faulting address down to page boundary. */\n" |
| 2806 |
"\\&\n" |
| 2807 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 2808 |
" \\[ti](page_size - 1);\n" |
| 2809 |
" uffdio_copy.len = page_size;\n" |
| 2810 |
" uffdio_copy.mode = 0;\n" |
| 2811 |
" uffdio_copy.copy = 0;\n" |
| 2812 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 2813 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 2814 |
"\\&\n" |
| 2815 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 2816 |
" uffdio_copy.copy);\n" |
| 2817 |
" }\n" |
| 2818 |
"}\n" |
| 2819 |
"\\&\n" |
| 2820 |
"int\n" |
| 2821 |
"main(int argc, char *argv[])\n" |
| 2822 |
"{\n" |
| 2823 |
" int s;\n" |
| 2824 |
" char c;\n" |
| 2825 |
" char *addr; /* Start of region handled by userfaultfd */\n" |
| 2826 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 2827 |
" size_t size, i; /* Size of region handled by userfaultfd */\n" |
| 2828 |
" pthread_t thr; /* ID of thread that handles page faults */\n" |
| 2829 |
" struct uffdio_api uffdio_api;\n" |
| 2830 |
" struct uffdio_register uffdio_register;\n" |
| 2831 |
"\\&\n" |
| 2832 |
" if (argc != 2) {\n" |
| 2833 |
" fprintf(stderr, \"Usage: %s num-pages\\[rs]n\", argv[0]);\n" |
| 2834 |
" exit(EXIT_FAILURE);\n" |
| 2835 |
" }\n" |
| 2836 |
"\\&\n" |
| 2837 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 2838 |
" size = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 2839 |
"\\&\n" |
| 2840 |
" /* Create and enable userfaultfd object. */\n" |
| 2841 |
"\\&\n" |
| 2842 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 2843 |
" if (uffd == -1)\n" |
| 2844 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 2845 |
"\\&\n" |
| 2846 |
" /* NOTE: Two-step feature handshake is not needed here, since this\n" |
| 2847 |
" example doesn't require any specific features.\n" |
| 2848 |
"\\&\n" |
| 2849 |
" Programs that *do* should call UFFDIO_API twice: once with\n" |
| 2850 |
" `features = 0` to detect features supported by this kernel, and\n" |
| 2851 |
" again with the subset of features the program actually wants to\n" |
| 2852 |
" enable. */\n" |
| 2853 |
" uffdio_api.api = UFFD_API;\n" |
| 2854 |
" uffdio_api.features = 0;\n" |
| 2855 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 2856 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 2857 |
"\\&\n" |
| 2858 |
" /* Create a private anonymous mapping. The memory will be\n" |
| 2859 |
" demand-zero paged--that is, not yet allocated. When we\n" |
| 2860 |
" actually touch the memory, it will be allocated via\n" |
| 2861 |
" the userfaultfd. */\n" |
| 2862 |
"\\&\n" |
| 2863 |
" addr = mmap(NULL, size, PROT_READ | PROT_WRITE,\n" |
| 2864 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2865 |
" if (addr == MAP_FAILED)\n" |
| 2866 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2867 |
"\\&\n" |
| 2868 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 2869 |
"\\&\n" |
| 2870 |
" /* Register the memory range of the mapping we just created for\n" |
| 2871 |
" handling by the userfaultfd object. In mode, we request to track\n" |
| 2872 |
" missing pages (i.e., pages that have not yet been faulted in). */\n" |
| 2873 |
"\\&\n" |
| 2874 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 2875 |
" uffdio_register.range.len = size;\n" |
| 2876 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 2877 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 2878 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 2879 |
"\\&\n" |
| 2880 |
" /* Create a thread that will process the userfaultfd events. */\n" |
| 2881 |
"\\&\n" |
| 2882 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 2883 |
" if (s != 0) {\n" |
| 2884 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 2885 |
" }\n" |
| 2886 |
"\\&\n" |
| 2887 |
" /* Main thread now touches memory in the mapping, touching\n" |
| 2888 |
" locations 1024 bytes apart. This will trigger userfaultfd\n" |
| 2889 |
" events for all pages in the region. */\n" |
| 2890 |
"\\&\n" |
| 2891 |
" i = 0xf; /* Ensure that faulting address is not on a page\n" |
| 2892 |
" boundary, in order to test that we correctly\n" |
| 2893 |
" handle that case in fault_handling_thread(). */\n" |
| 2894 |
" while (i E<lt> size) {\n" |
| 2895 |
" c = addr[i];\n" |
| 2896 |
" printf(\"Read address %p in %s(): \", addr + i, __func__);\n" |
| 2897 |
" printf(\"%c\\[rs]n\", c);\n" |
| 2898 |
" i += 1024;\n" |
| 2899 |
" usleep(100000); /* Slow things down a little */\n" |
| 2900 |
" }\n" |
| 2901 |
"\\&\n" |
| 2902 |
" exit(EXIT_SUCCESS);\n" |
| 2903 |
"}\n" |
| 2904 |
msgstr "" |
| 2905 |
"/* userfaultfd_demo.c\n" |
| 2906 |
"\\&\n" |
| 2907 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 2908 |
"*/\n" |
| 2909 |
"#define _GNU_SOURCE\n" |
| 2910 |
"#include E<lt>err.hE<gt>\n" |
| 2911 |
"#include E<lt>errno.hE<gt>\n" |
| 2912 |
"#include E<lt>fcntl.hE<gt>\n" |
| 2913 |
"#include E<lt>inttypes.hE<gt>\n" |
| 2914 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 2915 |
"#include E<lt>poll.hE<gt>\n" |
| 2916 |
"#include E<lt>pthread.hE<gt>\n" |
| 2917 |
"#include E<lt>stdio.hE<gt>\n" |
| 2918 |
"#include E<lt>stdlib.hE<gt>\n" |
| 2919 |
"#include E<lt>string.hE<gt>\n" |
| 2920 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 2921 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 2922 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 2923 |
"#include E<lt>unistd.hE<gt>\n" |
| 2924 |
"\\&\n" |
| 2925 |
"static int page_size;\n" |
| 2926 |
"\\&\n" |
| 2927 |
"static void *\n" |
| 2928 |
"fault_handler_thread(void *arg)\n" |
| 2929 |
"{\n" |
| 2930 |
" long uffd; /* descripteur du fichier userfaultfd */\n" |
| 2931 |
"\\&\n" |
| 2932 |
" static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" |
| 2933 |
" static char *page = NULL;\n" |
| 2934 |
" static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" |
| 2935 |
"\\&\n" |
| 2936 |
" uffd = (long) arg;\n" |
| 2937 |
"\\&\n" |
| 2938 |
" /* Créer une page qui sera copiée dans la région en erreur. */\n" |
| 2939 |
"\\&\n" |
| 2940 |
" if (page == NULL) {\n" |
| 2941 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 2942 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 2943 |
" if (page == MAP_FAILED)\n" |
| 2944 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 2945 |
" }\n" |
| 2946 |
"\\&\n" |
| 2947 |
" /* Boucle gérant les événements entrants sur le descripteur\n" |
| 2948 |
" de fichier userfaultfd. */\n" |
| 2949 |
"\\&\n" |
| 2950 |
" for (;;) {\n" |
| 2951 |
" int nready;\n" |
| 2952 |
" ssize_t nread;\n" |
| 2953 |
" struct pollfd pollfd;\n" |
| 2954 |
" struct uffdio_copy uffdio_copy;\n" |
| 2955 |
"\\&\n" |
| 2956 |
" /* Voir ce que poll() nous dit sur l'userfaultfd. */\n" |
| 2957 |
"\\&\n" |
| 2958 |
" pollfd.fd = uffd;\n" |
| 2959 |
" pollfd.events = POLLIN;\n" |
| 2960 |
" nready = poll(&pollfd, 1, -1);\n" |
| 2961 |
" if (nready == -1)\n" |
| 2962 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 2963 |
"\\&\n" |
| 2964 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 2965 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 2966 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 2967 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 2968 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 2969 |
"\\&\n" |
| 2970 |
" /* Lire un événement à partir de l'userfaultfd. */\n" |
| 2971 |
"\\&\n" |
| 2972 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 2973 |
" if (nread == 0) {\n" |
| 2974 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 2975 |
" exit(EXIT_FAILURE);\n" |
| 2976 |
" }\n" |
| 2977 |
"\\&\n" |
| 2978 |
" if (nread == -1)\n" |
| 2979 |
" err(EXIT_FAILURE, \"read\");\n" |
| 2980 |
"\\&\n" |
| 2981 |
" /* Un seul type d'événement est attendu ; il faut vérifier\n" |
| 2982 |
" cette supposition. */\n" |
| 2983 |
"\\&\n" |
| 2984 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 2985 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 2986 |
" exit(EXIT_FAILURE);\n" |
| 2987 |
" }\n" |
| 2988 |
"\\&\n" |
| 2989 |
" /* Afficher une information sur l'événement erreur de page. */\n" |
| 2990 |
"\\&\n" |
| 2991 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 2992 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 2993 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 2994 |
"\\&\n" |
| 2995 |
" /* Copier la page sur laquelle pointe la « page » dans la région\n" |
| 2996 |
" fautive. Varier le contenu copié, afin qu'il soit plus\n" |
| 2997 |
" évident que chaque erreur soit gérée séparément. */\n" |
| 2998 |
"\\&\n" |
| 2999 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 3000 |
" fault_cnt++;\n" |
| 3001 |
"\\&\n" |
| 3002 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 3003 |
"\\&\n" |
| 3004 |
" /* Il est nécessaire de gérer les erreurs de page en\n" |
| 3005 |
" unités de pages(!). Aussi, il faut arrondir les\n" |
| 3006 |
" adresses fautives à la limite de page. */\n" |
| 3007 |
"\\&\n" |
| 3008 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 3009 |
" \\[ti](page_size - 1);\n" |
| 3010 |
" uffdio_copy.len = page_size;\n" |
| 3011 |
" uffdio_copy.mode = 0;\n" |
| 3012 |
" uffdio_copy.copy = 0;\n" |
| 3013 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 3014 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 3015 |
"\\&\n" |
| 3016 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 3017 |
" uffdio_copy.copy);\n" |
| 3018 |
" }\n" |
| 3019 |
"}\n" |
| 3020 |
"\\&\n" |
| 3021 |
"int\n" |
| 3022 |
"main(int argc, char *argv[])\n" |
| 3023 |
"{\n" |
| 3024 |
" int s;\n" |
| 3025 |
" char *addr; /* Début de la région gérée par userfaultfd */\n" |
| 3026 |
" long uffd; /* Descripteur de fichier userfaultfd */\n" |
| 3027 |
" size_t len, l; /* Taille de la région gérée par userfaultfd */\n" |
| 3028 |
" pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" |
| 3029 |
" struct uffdio_api uffdio_api;\n" |
| 3030 |
" struct uffdio_register uffdio_register;\n" |
| 3031 |
"\\&\n" |
| 3032 |
" if (argc != 2) {\n" |
| 3033 |
" fprintf(stderr, \"Utilisation : %s num-pages\\[rs]n\", argv[0]);\n" |
| 3034 |
" exit(EXIT_FAILURE);\n" |
| 3035 |
" }\n" |
| 3036 |
"\\&\n" |
| 3037 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 3038 |
" len = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 3039 |
"\\&\n" |
| 3040 |
" /* Créer et activer un objet userfaultfd. */\n" |
| 3041 |
"\\&\n" |
| 3042 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 3043 |
" if (uffd == -1)\n" |
| 3044 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 3045 |
"\\&\n" |
| 3046 |
" /* NOTE : Une connexion de fonction en deux étapes est inutile ici,\n" |
| 3047 |
" dans la mesure où l'exemple n'a besoin d'aucune fonction\n" |
| 3048 |
" particulière.\n" |
| 3049 |
"\\&\n" |
| 3050 |
" Les programmes qui *agissent* doivent appeler UFFDIO_API deux fois :\n" |
| 3051 |
" une fois avec « features = 0 » pour détecter les fonctions prises en\n" |
| 3052 |
" charge par ce noyau, puis avec le sous-ensemble de fonctions que le\n" |
| 3053 |
" programme veut vraiment activer. */\n" |
| 3054 |
"\\&\n" |
| 3055 |
" uffdio_api.api = UFFD_API;\n" |
| 3056 |
" uffdio_api.features = 0;\n" |
| 3057 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 3058 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 3059 |
"\\&\n" |
| 3060 |
" /* Créer un mappage anonyme privé. La mémoire sera paginée\n" |
| 3061 |
" avec aucune demande — c'est-à-dire, sans être encore\n" |
| 3062 |
" allouée. Quand la mémoire sera réellement utilisée,\n" |
| 3063 |
" elle sera allouée au moyen de l'userfaultfd. */\n" |
| 3064 |
"\\&\n" |
| 3065 |
" addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" |
| 3066 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 3067 |
" if (addr == MAP_FAILED)\n" |
| 3068 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 3069 |
"\\&\n" |
| 3070 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 3071 |
"\\&\n" |
| 3072 |
" /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" |
| 3073 |
" créé pour le traitement par l'objet userfaultfd. Dans mode,\n" |
| 3074 |
" suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" |
| 3075 |
" pas encore fautives). */\n" |
| 3076 |
"\\&\n" |
| 3077 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 3078 |
" uffdio_register.range.len = len;\n" |
| 3079 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 3080 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 3081 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 3082 |
"\\&\n" |
| 3083 |
" /* Créer un thread qui traitera les événements userfaultfd. */\n" |
| 3084 |
"\\&\n" |
| 3085 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 3086 |
" if (s != 0) {\n" |
| 3087 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 3088 |
" }\n" |
| 3089 |
"\\&\n" |
| 3090 |
" /* Le thread principal utilise la mémoire dans le mappage,\n" |
| 3091 |
" utilisant des emplacements séparés de 1024 octets. Cela va\n" |
| 3092 |
" déclencher des événements userfaultfd pour toutes les pages\n" |
| 3093 |
" dans la région. */\n" |
| 3094 |
"\\&\n" |
| 3095 |
" l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" |
| 3096 |
" limite de page afin de vérifier que ce cas est\n" |
| 3097 |
" correctement géré dans le fault_handling_thread(). */\n" |
| 3098 |
" while (l E<lt> size) {\n" |
| 3099 |
" char c;\n" |
| 3100 |
"\\&\n" |
| 3101 |
" c = addr[l];\n" |
| 3102 |
" printf(\"Read address %p in %s(): \", addr + l, __func__);\n" |
| 3103 |
" printf(\"%c\\[rs]n\", c);\n" |
| 3104 |
" l += 1024;\n" |
| 3105 |
" usleep(100000); /* Ralentir un peu le traitement */\n" |
| 3106 |
" }\n" |
| 3107 |
"\\&\n" |
| 3108 |
" exit(EXIT_SUCCESS);\n" |
| 3109 |
"}\n" |
| 3110 |
|
| 3111 |
#. type: TH |
| 3112 |
#: mageia-cauldron |
| 3113 |
#, no-wrap |
| 3114 |
msgid "2026-02-08" |
| 3115 |
msgstr "8 février 2026" |
| 3116 |
|
| 3117 |
#. type: TH |
| 3118 |
#: mageia-cauldron |
| 3119 |
#, no-wrap |
| 3120 |
msgid "Linux man-pages 6.17" |
| 3121 |
msgstr "Pages du manuel de Linux 6.17" |
| 3122 |
|
| 3123 |
#. type: Plain text |
| 3124 |
#: mageia-cauldron |
| 3125 |
#, no-wrap |
| 3126 |
msgid "" |
| 3127 |
"/* userfaultfd_demo.c\n" |
| 3128 |
"\\&\n" |
| 3129 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 3130 |
"*/\n" |
| 3131 |
"#define _GNU_SOURCE\n" |
| 3132 |
"#include E<lt>err.hE<gt>\n" |
| 3133 |
"#include E<lt>errno.hE<gt>\n" |
| 3134 |
"#include E<lt>fcntl.hE<gt>\n" |
| 3135 |
"#include E<lt>inttypes.hE<gt>\n" |
| 3136 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 3137 |
"#include E<lt>poll.hE<gt>\n" |
| 3138 |
"#include E<lt>pthread.hE<gt>\n" |
| 3139 |
"#include E<lt>stdio.hE<gt>\n" |
| 3140 |
"#include E<lt>stdlib.hE<gt>\n" |
| 3141 |
"#include E<lt>string.hE<gt>\n" |
| 3142 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 3143 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 3144 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 3145 |
"#include E<lt>unistd.hE<gt>\n" |
| 3146 |
"\\&\n" |
| 3147 |
"static int page_size;\n" |
| 3148 |
"\\&\n" |
| 3149 |
"static void *\n" |
| 3150 |
"fault_handler_thread(void *arg)\n" |
| 3151 |
"{\n" |
| 3152 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 3153 |
"\\&\n" |
| 3154 |
" static int fault_cnt = 0; /* Number of faults so far handled */\n" |
| 3155 |
" static char *page = NULL;\n" |
| 3156 |
" static struct uffd_msg msg; /* Data read from userfaultfd */\n" |
| 3157 |
"\\&\n" |
| 3158 |
" uffd = (long) arg;\n" |
| 3159 |
"\\&\n" |
| 3160 |
" /* Create a page that will be copied into the faulting region. */\n" |
| 3161 |
"\\&\n" |
| 3162 |
" if (page == NULL) {\n" |
| 3163 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 3164 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 3165 |
" if (page == MAP_FAILED)\n" |
| 3166 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 3167 |
" }\n" |
| 3168 |
"\\&\n" |
| 3169 |
" /* Loop, handling incoming events on the userfaultfd\n" |
| 3170 |
" file descriptor. */\n" |
| 3171 |
"\\&\n" |
| 3172 |
" for (;;) {\n" |
| 3173 |
" int nready;\n" |
| 3174 |
" ssize_t nread;\n" |
| 3175 |
" struct pollfd pollfd;\n" |
| 3176 |
" struct uffdio_copy uffdio_copy;\n" |
| 3177 |
"\\&\n" |
| 3178 |
" /* See what poll() tells us about the userfaultfd. */\n" |
| 3179 |
"\\&\n" |
| 3180 |
" pollfd.fd = uffd;\n" |
| 3181 |
" pollfd.events = POLLIN;\n" |
| 3182 |
" nready = poll(&pollfd, 1, -1);\n" |
| 3183 |
" if (nready == -1)\n" |
| 3184 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 3185 |
"\\&\n" |
| 3186 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 3187 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 3188 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 3189 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 3190 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 3191 |
"\\&\n" |
| 3192 |
" /* Read an event from the userfaultfd. */\n" |
| 3193 |
"\\&\n" |
| 3194 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 3195 |
" if (nread == 0) {\n" |
| 3196 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 3197 |
" exit(EXIT_FAILURE);\n" |
| 3198 |
" }\n" |
| 3199 |
"\\&\n" |
| 3200 |
" if (nread == -1)\n" |
| 3201 |
" err(EXIT_FAILURE, \"read\");\n" |
| 3202 |
"\\&\n" |
| 3203 |
" /* We expect only one kind of event; verify that assumption. */\n" |
| 3204 |
"\\&\n" |
| 3205 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 3206 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 3207 |
" exit(EXIT_FAILURE);\n" |
| 3208 |
" }\n" |
| 3209 |
"\\&\n" |
| 3210 |
" /* Display info about the page-fault event. */\n" |
| 3211 |
"\\&\n" |
| 3212 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 3213 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 3214 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 3215 |
"\\&\n" |
| 3216 |
" /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n" |
| 3217 |
" region. Vary the contents that are copied in, so that it\n" |
| 3218 |
" is more obvious that each fault is handled separately. */\n" |
| 3219 |
"\\&\n" |
| 3220 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 3221 |
" fault_cnt++;\n" |
| 3222 |
"\\&\n" |
| 3223 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 3224 |
"\\&\n" |
| 3225 |
" /* We need to handle page faults in units of pages(!).\n" |
| 3226 |
" So, round faulting address down to page boundary. */\n" |
| 3227 |
"\\&\n" |
| 3228 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 3229 |
" \\[ti](page_size - 1);\n" |
| 3230 |
" uffdio_copy.len = page_size;\n" |
| 3231 |
" uffdio_copy.mode = 0;\n" |
| 3232 |
" uffdio_copy.copy = 0;\n" |
| 3233 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 3234 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 3235 |
"\\&\n" |
| 3236 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 3237 |
" uffdio_copy.copy);\n" |
| 3238 |
" }\n" |
| 3239 |
"}\n" |
| 3240 |
"\\&\n" |
| 3241 |
"int\n" |
| 3242 |
"main(int argc, char *argv[])\n" |
| 3243 |
"{\n" |
| 3244 |
" int s;\n" |
| 3245 |
" char *addr; /* Start of region handled by userfaultfd */\n" |
| 3246 |
" long uffd; /* userfaultfd file descriptor */\n" |
| 3247 |
" size_t size, i; /* Size of region handled by userfaultfd */\n" |
| 3248 |
" pthread_t thr; /* ID of thread that handles page faults */\n" |
| 3249 |
" struct uffdio_api uffdio_api;\n" |
| 3250 |
" struct uffdio_register uffdio_register;\n" |
| 3251 |
"\\&\n" |
| 3252 |
" if (argc != 2) {\n" |
| 3253 |
" fprintf(stderr, \"Usage: %s num-pages\\[rs]n\", argv[0]);\n" |
| 3254 |
" exit(EXIT_FAILURE);\n" |
| 3255 |
" }\n" |
| 3256 |
"\\&\n" |
| 3257 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 3258 |
" size = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 3259 |
"\\&\n" |
| 3260 |
" /* Create and enable userfaultfd object. */\n" |
| 3261 |
"\\&\n" |
| 3262 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 3263 |
" if (uffd == -1)\n" |
| 3264 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 3265 |
"\\&\n" |
| 3266 |
" /* NOTE: Two-step feature handshake is not needed here, since this\n" |
| 3267 |
" example doesn't require any specific features.\n" |
| 3268 |
"\\&\n" |
| 3269 |
" Programs that *do* should call UFFDIO_API twice: once with\n" |
| 3270 |
" `features = 0` to detect features supported by this kernel, and\n" |
| 3271 |
" again with the subset of features the program actually wants to\n" |
| 3272 |
" enable. */\n" |
| 3273 |
" uffdio_api.api = UFFD_API;\n" |
| 3274 |
" uffdio_api.features = 0;\n" |
| 3275 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 3276 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 3277 |
"\\&\n" |
| 3278 |
" /* Create a private anonymous mapping. The memory will be\n" |
| 3279 |
" demand-zero paged--that is, not yet allocated. When we\n" |
| 3280 |
" actually touch the memory, it will be allocated via\n" |
| 3281 |
" the userfaultfd. */\n" |
| 3282 |
"\\&\n" |
| 3283 |
" addr = mmap(NULL, size, PROT_READ | PROT_WRITE,\n" |
| 3284 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 3285 |
" if (addr == MAP_FAILED)\n" |
| 3286 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 3287 |
"\\&\n" |
| 3288 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 3289 |
"\\&\n" |
| 3290 |
" /* Register the memory range of the mapping we just created for\n" |
| 3291 |
" handling by the userfaultfd object. In mode, we request to track\n" |
| 3292 |
" missing pages (i.e., pages that have not yet been faulted in). */\n" |
| 3293 |
"\\&\n" |
| 3294 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 3295 |
" uffdio_register.range.len = size;\n" |
| 3296 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 3297 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 3298 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 3299 |
"\\&\n" |
| 3300 |
" /* Create a thread that will process the userfaultfd events. */\n" |
| 3301 |
"\\&\n" |
| 3302 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 3303 |
" if (s != 0) {\n" |
| 3304 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 3305 |
" }\n" |
| 3306 |
"\\&\n" |
| 3307 |
" /* Main thread now touches memory in the mapping, touching\n" |
| 3308 |
" locations 1024 bytes apart. This will trigger userfaultfd\n" |
| 3309 |
" events for all pages in the region. */\n" |
| 3310 |
"\\&\n" |
| 3311 |
" i = 0xf; /* Ensure that faulting address is not on a page\n" |
| 3312 |
" boundary, in order to test that we correctly\n" |
| 3313 |
" handle that case in fault_handling_thread(). */\n" |
| 3314 |
" while (i E<lt> size) {\n" |
| 3315 |
" char c;\n" |
| 3316 |
"\\&\n" |
| 3317 |
" c = addr[i];\n" |
| 3318 |
" printf(\"Read address %p in %s(): \", addr + i, __func__);\n" |
| 3319 |
" printf(\"%c\\[rs]n\", c);\n" |
| 3320 |
" i += 1024;\n" |
| 3321 |
" usleep(100000); /* Slow things down a little */\n" |
| 3322 |
" }\n" |
| 3323 |
"\\&\n" |
| 3324 |
" exit(EXIT_SUCCESS);\n" |
| 3325 |
"}\n" |
| 3326 |
msgstr "" |
| 3327 |
"/* userfaultfd_demo.c\n" |
| 3328 |
"\\&\n" |
| 3329 |
" Licensed under the GNU General Public License version 2 or later.\n" |
| 3330 |
"*/\n" |
| 3331 |
"#define _GNU_SOURCE\n" |
| 3332 |
"#include E<lt>err.hE<gt>\n" |
| 3333 |
"#include E<lt>errno.hE<gt>\n" |
| 3334 |
"#include E<lt>fcntl.hE<gt>\n" |
| 3335 |
"#include E<lt>inttypes.hE<gt>\n" |
| 3336 |
"#include E<lt>linux/userfaultfd.hE<gt>\n" |
| 3337 |
"#include E<lt>poll.hE<gt>\n" |
| 3338 |
"#include E<lt>pthread.hE<gt>\n" |
| 3339 |
"#include E<lt>stdio.hE<gt>\n" |
| 3340 |
"#include E<lt>stdlib.hE<gt>\n" |
| 3341 |
"#include E<lt>string.hE<gt>\n" |
| 3342 |
"#include E<lt>sys/ioctl.hE<gt>\n" |
| 3343 |
"#include E<lt>sys/mman.hE<gt>\n" |
| 3344 |
"#include E<lt>sys/syscall.hE<gt>\n" |
| 3345 |
"#include E<lt>unistd.hE<gt>\n" |
| 3346 |
"\\&\n" |
| 3347 |
"static int page_size;\n" |
| 3348 |
"\\&\n" |
| 3349 |
"static void *\n" |
| 3350 |
"fault_handler_thread(void *arg)\n" |
| 3351 |
"{\n" |
| 3352 |
" long uffd; /* descripteur du fichier userfaultfd */\n" |
| 3353 |
"\\&\n" |
| 3354 |
" static int fault_cnt = 0; /* Nombres d'erreurs déjà gérées */\n" |
| 3355 |
" static char *page = NULL;\n" |
| 3356 |
" static struct uffd_msg msg; /* Données lues à partir de userfaultfd */\n" |
| 3357 |
"\\&\n" |
| 3358 |
" uffd = (long) arg;\n" |
| 3359 |
"\\&\n" |
| 3360 |
" /* Créer une page qui sera copiée dans la région en erreur. */\n" |
| 3361 |
"\\&\n" |
| 3362 |
" if (page == NULL) {\n" |
| 3363 |
" page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n" |
| 3364 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 3365 |
" if (page == MAP_FAILED)\n" |
| 3366 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 3367 |
" }\n" |
| 3368 |
"\\&\n" |
| 3369 |
" /* Boucle gérant les événements entrants sur le descripteur\n" |
| 3370 |
" de fichier userfaultfd. */\n" |
| 3371 |
"\\&\n" |
| 3372 |
" for (;;) {\n" |
| 3373 |
" int nready;\n" |
| 3374 |
" ssize_t nread;\n" |
| 3375 |
" struct pollfd pollfd;\n" |
| 3376 |
" struct uffdio_copy uffdio_copy;\n" |
| 3377 |
"\\&\n" |
| 3378 |
" /* Voir ce que poll() nous dit sur l'userfaultfd. */\n" |
| 3379 |
"\\&\n" |
| 3380 |
" pollfd.fd = uffd;\n" |
| 3381 |
" pollfd.events = POLLIN;\n" |
| 3382 |
" nready = poll(&pollfd, 1, -1);\n" |
| 3383 |
" if (nready == -1)\n" |
| 3384 |
" err(EXIT_FAILURE, \"poll\");\n" |
| 3385 |
"\\&\n" |
| 3386 |
" printf(\"\\[rs]nfault_handler_thread():\\[rs]n\");\n" |
| 3387 |
" printf(\" poll() returns: nready = %d; \"\n" |
| 3388 |
" \"POLLIN = %d; POLLERR = %d\\[rs]n\", nready,\n" |
| 3389 |
" (pollfd.revents & POLLIN) != 0,\n" |
| 3390 |
" (pollfd.revents & POLLERR) != 0);\n" |
| 3391 |
"\\&\n" |
| 3392 |
" /* Lire un événement à partir de l'userfaultfd. */\n" |
| 3393 |
"\\&\n" |
| 3394 |
" nread = read(uffd, &msg, sizeof(msg));\n" |
| 3395 |
" if (nread == 0) {\n" |
| 3396 |
" printf(\"EOF on userfaultfd!\\[rs]n\");\n" |
| 3397 |
" exit(EXIT_FAILURE);\n" |
| 3398 |
" }\n" |
| 3399 |
"\\&\n" |
| 3400 |
" if (nread == -1)\n" |
| 3401 |
" err(EXIT_FAILURE, \"read\");\n" |
| 3402 |
"\\&\n" |
| 3403 |
" /* Un seul type d'événement est attendu ; il faut vérifier\n" |
| 3404 |
" cette supposition. */\n" |
| 3405 |
"\\&\n" |
| 3406 |
" if (msg.event != UFFD_EVENT_PAGEFAULT) {\n" |
| 3407 |
" fprintf(stderr, \"Unexpected event on userfaultfd\\[rs]n\");\n" |
| 3408 |
" exit(EXIT_FAILURE);\n" |
| 3409 |
" }\n" |
| 3410 |
"\\&\n" |
| 3411 |
" /* Afficher une information sur l'événement erreur de page. */\n" |
| 3412 |
"\\&\n" |
| 3413 |
" printf(\" UFFD_EVENT_PAGEFAULT event: \");\n" |
| 3414 |
" printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n" |
| 3415 |
" printf(\"address = %\"PRIx64\"\\[rs]n\", msg.arg.pagefault.address);\n" |
| 3416 |
"\\&\n" |
| 3417 |
" /* Copier la page sur laquelle pointe la « page » dans la région\n" |
| 3418 |
" fautive. Varier le contenu copié, afin qu'il soit plus\n" |
| 3419 |
" évident que chaque erreur soit gérée séparément. */\n" |
| 3420 |
"\\&\n" |
| 3421 |
" memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n" |
| 3422 |
" fault_cnt++;\n" |
| 3423 |
"\\&\n" |
| 3424 |
" uffdio_copy.src = (unsigned long) page;\n" |
| 3425 |
"\\&\n" |
| 3426 |
" /* Il est nécessaire de gérer les erreurs de page en\n" |
| 3427 |
" unités de pages(!). Aussi, il faut arrondir les\n" |
| 3428 |
" adresses fautives à la limite de page. */\n" |
| 3429 |
"\\&\n" |
| 3430 |
" uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n" |
| 3431 |
" \\[ti](page_size - 1);\n" |
| 3432 |
" uffdio_copy.len = page_size;\n" |
| 3433 |
" uffdio_copy.mode = 0;\n" |
| 3434 |
" uffdio_copy.copy = 0;\n" |
| 3435 |
" if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n" |
| 3436 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n" |
| 3437 |
"\\&\n" |
| 3438 |
" printf(\" (uffdio_copy.copy returned %\"PRId64\")\\[rs]n\",\n" |
| 3439 |
" uffdio_copy.copy);\n" |
| 3440 |
" }\n" |
| 3441 |
"}\n" |
| 3442 |
"\\&\n" |
| 3443 |
"int\n" |
| 3444 |
"main(int argc, char *argv[])\n" |
| 3445 |
"{\n" |
| 3446 |
" int s;\n" |
| 3447 |
" char *addr; /* Début de la région gérée par userfaultfd */\n" |
| 3448 |
" long uffd; /* Descripteur de fichier userfaultfd */\n" |
| 3449 |
" size_t len, l; /* Taille de la région gérée par userfaultfd */\n" |
| 3450 |
" pthread_t thr; /* ID du thread qui gère les erreurs de page */\n" |
| 3451 |
" struct uffdio_api uffdio_api;\n" |
| 3452 |
" struct uffdio_register uffdio_register;\n" |
| 3453 |
"\\&\n" |
| 3454 |
" if (argc != 2) {\n" |
| 3455 |
" fprintf(stderr, \"Utilisation : %s num-pages\\[rs]n\", argv[0]);\n" |
| 3456 |
" exit(EXIT_FAILURE);\n" |
| 3457 |
" }\n" |
| 3458 |
"\\&\n" |
| 3459 |
" page_size = sysconf(_SC_PAGE_SIZE);\n" |
| 3460 |
" len = strtoull(argv[1], NULL, 0) * page_size;\n" |
| 3461 |
"\\&\n" |
| 3462 |
" /* Créer et activer un objet userfaultfd. */\n" |
| 3463 |
"\\&\n" |
| 3464 |
" uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n" |
| 3465 |
" if (uffd == -1)\n" |
| 3466 |
" err(EXIT_FAILURE, \"userfaultfd\");\n" |
| 3467 |
"\\&\n" |
| 3468 |
" /* NOTE : Une connexion de fonction en deux étapes est inutile ici,\n" |
| 3469 |
" dans la mesure où l'exemple n'a besoin d'aucune fonction\n" |
| 3470 |
" particulière.\n" |
| 3471 |
"\\&\n" |
| 3472 |
" Les programmes qui *agissent* doivent appeler UFFDIO_API deux fois :\n" |
| 3473 |
" une fois avec « features = 0 » pour détecter les fonctions prises en\n" |
| 3474 |
" charge par ce noyau, puis avec le sous-ensemble de fonctions que le\n" |
| 3475 |
" programme veut vraiment activer. */\n" |
| 3476 |
"\\&\n" |
| 3477 |
" uffdio_api.api = UFFD_API;\n" |
| 3478 |
" uffdio_api.features = 0;\n" |
| 3479 |
" if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n" |
| 3480 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n" |
| 3481 |
"\\&\n" |
| 3482 |
" /* Créer un mappage anonyme privé. La mémoire sera paginée\n" |
| 3483 |
" avec aucune demande — c'est-à-dire, sans être encore\n" |
| 3484 |
" allouée. Quand la mémoire sera réellement utilisée,\n" |
| 3485 |
" elle sera allouée au moyen de l'userfaultfd. */\n" |
| 3486 |
"\\&\n" |
| 3487 |
" addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n" |
| 3488 |
" MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n" |
| 3489 |
" if (addr == MAP_FAILED)\n" |
| 3490 |
" err(EXIT_FAILURE, \"mmap\");\n" |
| 3491 |
"\\&\n" |
| 3492 |
" printf(\"Address returned by mmap() = %p\\[rs]n\", addr);\n" |
| 3493 |
"\\&\n" |
| 3494 |
" /* Enregistrer l'intervalle de mémoire du mappage qui vient d'être\n" |
| 3495 |
" créé pour le traitement par l'objet userfaultfd. Dans mode,\n" |
| 3496 |
" suivre les pages manquantes (c'est-à-dire, les pages qui ne sont\n" |
| 3497 |
" pas encore fautives). */\n" |
| 3498 |
"\\&\n" |
| 3499 |
" uffdio_register.range.start = (unsigned long) addr;\n" |
| 3500 |
" uffdio_register.range.len = len;\n" |
| 3501 |
" uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n" |
| 3502 |
" if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n" |
| 3503 |
" err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n" |
| 3504 |
"\\&\n" |
| 3505 |
" /* Créer un thread qui traitera les événements userfaultfd. */\n" |
| 3506 |
"\\&\n" |
| 3507 |
" s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n" |
| 3508 |
" if (s != 0) {\n" |
| 3509 |
" errc(EXIT_FAILURE, s, \"pthread_create\");\n" |
| 3510 |
" }\n" |
| 3511 |
"\\&\n" |
| 3512 |
" /* Le thread principal utilise la mémoire dans le mappage,\n" |
| 3513 |
" utilisant des emplacements séparés de 1024 octets. Cela va\n" |
| 3514 |
" déclencher des événements userfaultfd pour toutes les pages\n" |
| 3515 |
" dans la région. */\n" |
| 3516 |
"\\&\n" |
| 3517 |
" l = 0xf; /* Assurer que l'adresse fautive n'est pas sur une\n" |
| 3518 |
" limite de page afin de vérifier que ce cas est\n" |
| 3519 |
" correctement géré dans le fault_handling_thread(). */\n" |
| 3520 |
" while (l E<lt> size) {\n" |
| 3521 |
" char c;\n" |
| 3522 |
"\\&\n" |
| 3523 |
" c = addr[l];\n" |
| 3524 |
" printf(\"Read address %p in %s(): \", addr + l, __func__);\n" |
| 3525 |
" printf(\"%c\\[rs]n\", c);\n" |
| 3526 |
" l += 1024;\n" |
| 3527 |
" usleep(100000); /* Ralentir un peu le traitement */\n" |
| 3528 |
" }\n" |
| 3529 |
"\\&\n" |
| 3530 |
" exit(EXIT_SUCCESS);\n" |
| 3531 |
"}\n" |
| 3532 |
|
| 3533 |
#. type: TH |
| 3534 |
#: opensuse-leap-16-1 opensuse-tumbleweed |
| 3535 |
#, no-wrap |
| 3536 |
msgid "Linux man-pages (unreleased)" |
| 3537 |
msgstr "Pages du manuel de Linux (non publiées)" |