]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man2/userfaultfd.2
ioctl_console.2, ioctl_getfsmap.2, ioctl_iflags.2, ioctl_list.2, ioctl_ns.2, kcmp...
[thirdparty/man-pages.git] / man2 / userfaultfd.2
1 .\" Copyright (c) 2016, IBM Corporation.
2 .\" Written by Mike Rapoport <rppt@linux.vnet.ibm.com>
3 .\" and Copyright (C) 2017 Michael Kerrisk <mtk.manpages@gmail.com>
4 .\"
5 .\" %%%LICENSE_START(VERBATIM)
6 .\" Permission is granted to make and distribute verbatim copies of this
7 .\" manual provided the copyright notice and this permission notice are
8 .\" preserved on all copies.
9 .\"
10 .\" Permission is granted to copy and distribute modified versions of this
11 .\" manual under the conditions for verbatim copying, provided that the
12 .\" entire resulting derived work is distributed under the terms of a
13 .\" permission notice identical to this one.
14 .\"
15 .\" Since the Linux kernel and libraries are constantly changing, this
16 .\" manual page may be incorrect or out-of-date. The author(s) assume no
17 .\" responsibility for errors or omissions, or for damages resulting from
18 .\" the use of the information contained herein. The author(s) may not
19 .\" have taken the same level of care in the production of this manual,
20 .\" which is licensed free of charge, as they might when working
21 .\" professionally.
22 .\"
23 .\" Formatted or processed versions of this manual, if unaccompanied by
24 .\" the source, must acknowledge the copyright and authors of this work.
25 .\" %%%LICENSE_END
26 .\"
27 .TH USERFAULTFD 2 2017-05-03 "Linux" "Linux Programmer's Manual"
28 .SH NAME
29 userfaultfd \- create a file descriptor for handling page faults in user space
30 .SH SYNOPSIS
31 .nf
32 .B #include <sys/types.h>
33 .B #include <linux/userfaultfd.h>
34 .PP
35 .BI "int userfaultfd(int " flags );
36 .fi
37 .PP
38 .IR Note :
39 There is no glibc wrapper for this system call; see NOTES.
40 .SH DESCRIPTION
41 .BR userfaultfd ()
42 creates a new userfaultfd object that can be used for delegation of page-fault
43 handling to a user-space application,
44 and returns a file descriptor that refers to the new object.
45 The new userfaultfd object is configured using
46 .BR ioctl (2).
47 .PP
48 Once the userfaultfd object is configured, the application can use
49 .BR read (2)
50 to receive userfaultfd notifications.
51 The reads from userfaultfd may be blocking or non-blocking,
52 depending on the value of
53 .I flags
54 used for the creation of the userfaultfd or subsequent calls to
55 .BR fcntl (2).
56 .PP
57 The following values may be bitwise ORed in
58 .IR flags
59 to change the behavior of
60 .BR userfaultfd ():
61 .TP
62 .BR O_CLOEXEC
63 Enable the close-on-exec flag for the new userfaultfd file descriptor.
64 See the description of the
65 .B O_CLOEXEC
66 flag in
67 .BR open (2).
68 .TP
69 .BR O_NONBLOCK
70 Enables non-blocking operation for the userfaultfd object.
71 See the description of the
72 .BR O_NONBLOCK
73 flag in
74 .BR open (2).
75 .PP
76 When the last file descriptor referring to a userfaultfd object is closed,
77 all memory ranges that were registered with the object are unregistered
78 and unread events are flushed.
79 .\"
80 .SS Usage
81 The userfaultfd mechanism is designed to allow a thread in a multithreaded
82 program to perform user-space paging for the other threads in the process.
83 When a page fault occurs for one of the regions registered
84 to the userfaultfd object,
85 the faulting thread is put to sleep and
86 an event is generated that can be read via the userfaultfd file descriptor.
87 The fault-handling thread reads events from this file descriptor and services
88 them using the operations described in
89 .BR ioctl_userfaultfd (2).
90 When servicing the page fault events,
91 the fault-handling thread can trigger a wake-up for the sleeping thread.
92 .PP
93 It is possible for the faulting threads and the fault-handling threads
94 to run in the context of different processes.
95 In this case, these threads may belong to different programs,
96 and the program that executes the faulting threads
97 will not necessarily cooperate with the program that handles the page faults.
98 In such non-cooperative mode,
99 the process that monitors userfaultfd and handles page faults
100 needs to be aware of the changes in the virtual memory layout
101 of the faulting process to avoid memory corruption.
102 .PP
103 Starting from Linux 4.11,
104 userfaultfd can also notify the fault-handling threads about changes
105 in the virtual memory layout of the faulting process.
106 In addition, if the faulting process invokes
107 .BR fork (2),
108 the userfaultfd objects associated with the parent may be duplicated
109 into the child process and the userfaultfd monitor will be notified
110 (via the
111 .B UFFD_EVENT_FORK
112 described below)
113 about the file descriptor associated with the userfault objects
114 created for the child process,
115 which allows the userfaultfd monitor to perform user-space paging
116 for the child process.
117 Unlike page faults which have to be synchronous and require an
118 explicit or implicit wakeup,
119 all other events are delivered asynchronously and
120 the non-cooperative process resumes execution as
121 soon as the userfaultfd manager executes
122 .BR read (2).
123 The userfaultfd manager should carefully synchronize calls to
124 .B UFFDIO_COPY
125 with the processing of events.
126 .PP
127 The current asynchronous model of the event delivery is optimal for
128 single threaded non-cooperative userfaultfd manager implementations.
129 .\" Regarding the preceding sentence, Mike Rapoport says:
130 .\" The major point here is that current events delivery model could be
131 .\" problematic for multi-threaded monitor. I even suspect that it would be
132 .\" impossible to ensure synchronization between page faults and non-page
133 .\" fault events in multi-threaded monitor.
134 .PP
135 .\" FIXME elaborate about non-cooperating mode, describe its limitations
136 .\" for kernels before 4.11, features added in 4.11
137 .\" and limitations remaining in 4.11
138 .\" Maybe it's worth adding a dedicated sub-section...
139 .\"
140 .SS Userfaultfd operation
141 After the userfaultfd object is created with
142 .BR userfaultfd (),
143 the application must enable it using the
144 .B UFFDIO_API
145 .BR ioctl (2)
146 operation.
147 This operation allows a handshake between the kernel and user space
148 to determine the API version and supported features.
149 This operation must be performed before any of the other
150 .BR ioctl (2)
151 operations described below (or those operations fail with the
152 .BR EINVAL
153 error).
154 .PP
155 After a successful
156 .B UFFDIO_API
157 operation,
158 the application then registers memory address ranges using the
159 .B UFFDIO_REGISTER
160 .BR ioctl (2)
161 operation.
162 After successful completion of a
163 .B UFFDIO_REGISTER
164 operation,
165 a page fault occurring in the requested memory range, and satisfying
166 the mode defined at the registration time, will be forwarded by the kernel to
167 the user-space application.
168 The application can then use the
169 .B UFFDIO_COPY
170 or
171 .B UFFDIO_ZERO
172 .BR ioctl (2)
173 operations to resolve the page fault.
174 .PP
175 Details of the various
176 .BR ioctl (2)
177 operations can be found in
178 .BR ioctl_userfaultfd (2).
179 .PP
180 Since Linux 4.11, events other than page-fault may enabled during
181 .B UFFDIO_API
182 operation.
183 .PP
184 Up to Linux 4.11,
185 userfaultfd can be used only with anonymous private memory mappings.
186 Since Linux 4.11,
187 userfaultfd can be also used with hugetlbfs and shared memory mappings.
188 .PP
189 .\"
190 .SS Reading from the userfaultfd structure
191 Each
192 .BR read (2)
193 from the userfaultfd file descriptor returns one or more
194 .I uffd_msg
195 structures, each of which describes a page-fault event
196 or an event required for the non-cooperative userfaultfd usage:
197 .PP
198 .in +4n
199 .nf
200 struct uffd_msg {
201 __u8 event; /* Type of event */
202 ...
203 union {
204 struct {
205 __u64 flags; /* Flags describing fault */
206 __u64 address; /* Faulting address */
207 } pagefault;
208
209 struct { /* Since Linux 4.11 */
210 __u32 ufd; /* Userfault file descriptor
211 of the child process */
212 } fork;
213
214 struct { /* Since Linux 4.11 */
215 __u64 from; /* Old address of remapped area */
216 __u64 to; /* New address of remapped area */
217 __u64 len; /* Original mapping length */
218 } remap;
219
220 struct { /* Since Linux 4.11 */
221 __u64 start; /* Start address of removed area */
222 __u64 end; /* End address of removed area */
223 } remove;
224 ...
225 } arg;
226
227 /* Padding fields omitted */
228 } __packed;
229 .fi
230 .in
231 .PP
232 If multiple events are available and the supplied buffer is large enough,
233 .BR read (2)
234 returns as many events as will fit in the supplied buffer.
235 If the buffer supplied to
236 .BR read (2)
237 is smaller than the size of the
238 .I uffd_msg
239 structure, the
240 .BR read (2)
241 fails with the error
242 .BR EINVAL .
243 .PP
244 The fields set in the
245 .I uffd_msg
246 structure are as follows:
247 .TP
248 .I event
249 The type of event.
250 Depending of the event type,
251 different fields of the
252 .I arg
253 union represent details required for the event processing.
254 The non-page-fault events are generated only when appropriate feature
255 is enabled during API handshake with
256 .B UFFDIO_API
257 .BR ioctl (2).
258 .IP
259 The following values can appear in the
260 .I event
261 field:
262 .RS
263 .TP
264 .BR UFFD_EVENT_PAGEFAULT " (since Linux 4.3)"
265 A page-fault event.
266 The page-fault details are available in the
267 .I pagefault
268 field.
269 .TP
270 .BR UFFD_EVENT_FORK " (since Linux 4.11)"
271 Generated when the faulting process invokes
272 .BR fork (2)
273 (or
274 .BR clone (2)
275 without the
276 .BR CLONE_VM
277 flag).
278 The event details are available in the
279 .I fork
280 field.
281 .\" FIXME describe duplication of userfault file descriptor during fork
282 .TP
283 .BR UFFD_EVENT_REMAP " (since Linux 4.11)"
284 Generated when the faulting process invokes
285 .BR mremap (2).
286 The event details are available in the
287 .I remap
288 field.
289 .TP
290 .BR UFFD_EVENT_REMOVE " (since Linux 4.11)"
291 Generated when the faulting process invokes
292 .BR madvise (2)
293 with
294 .BR MADV_DONTNEED
295 or
296 .BR MADV_REMOVE
297 advice.
298 The event details are available in the
299 .I remove
300 field.
301 .TP
302 .BR UFFD_EVENT_UNMAP " (since Linux 4.11)"
303 Generated when the faulting process unmaps a memory range,
304 either explicitly using
305 .BR munmap (2)
306 or implicitly during
307 .BR mmap (2)
308 or
309 .BR mremap (2).
310 The event details are available in the
311 .I remove
312 field.
313 .RE
314 .TP
315 .I pagefault.address
316 The address that triggered the page fault.
317 .TP
318 .I pagefault.flags
319 A bit mask of flags that describe the event.
320 For
321 .BR UFFD_EVENT_PAGEFAULT ,
322 the following flag may appear:
323 .RS
324 .TP
325 .B UFFD_PAGEFAULT_FLAG_WRITE
326 If the address is in a range that was registered with the
327 .B UFFDIO_REGISTER_MODE_MISSING
328 flag (see
329 .BR ioctl_userfaultfd (2))
330 and this flag is set, this a write fault;
331 otherwise it is a read fault.
332 .\"
333 .\" UFFD_PAGEFAULT_FLAG_WP is not yet supported.
334 .RE
335 .TP
336 .I fork.ufd
337 The file descriptor associated with the userfault object
338 created for the child created by
339 .BR fork (2).
340 .TP
341 .I remap.from
342 The original address of the memory range that was remapped using
343 .BR mremap (2).
344 .TP
345 .I remap.to
346 The new address of the memory range that was remapped using
347 .BR mremap (2).
348 .TP
349 .I remap.len
350 The original length of the memory range that was remapped using
351 .BR mremap (2).
352 .TP
353 .I remove.start
354 The start address of the memory range that was freed using
355 .BR madvise (2)
356 or unmapped
357 .TP
358 .I remove.end
359 The end address of the memory range that was freed using
360 .BR madvise (2)
361 or unmapped
362 .PP
363 A
364 .BR read (2)
365 on a userfaultfd file descriptor can fail with the following errors:
366 .TP
367 .B EINVAL
368 The userfaultfd object has not yet been enabled using the
369 .BR UFFDIO_API
370 .BR ioctl (2)
371 operation
372 .PP
373 If the
374 .B O_NONBLOCK
375 flag is enabled in the associated open file description,
376 the userfaultfd file descriptor can be monitored with
377 .BR poll (2),
378 .BR select (2),
379 and
380 .BR epoll (7).
381 When events are available, the file descriptor indicates as readable.
382 If the
383 .B O_NONBLOCK
384 flag is not enabled, then
385 .BR poll (2)
386 (always) indicates the file as having a
387 .BR POLLERR
388 condition, and
389 .BR select (2)
390 indicates the file descriptor as both readable and writable.
391 .\" FIXME What is the reason for this seemingly odd behavior with respect
392 .\" to the O_NONBLOCK flag? (see userfaultfd_poll() in fs/userfaultfd.c).
393 .\" Something needs to be said about this.
394 .SH RETURN VALUE
395 On success,
396 .BR userfaultfd ()
397 returns a new file descriptor that refers to the userfaultfd object.
398 On error, \-1 is returned, and
399 .I errno
400 is set appropriately.
401 .SH ERRORS
402 .TP
403 .B EINVAL
404 An unsupported value was specified in
405 .IR flags .
406 .TP
407 .BR EMFILE
408 The per-process limit on the number of open file descriptors has been
409 reached
410 .TP
411 .B ENFILE
412 The system-wide limit on the total number of open files has been
413 reached.
414 .TP
415 .B ENOMEM
416 Insufficient kernel memory was available.
417 .SH VERSIONS
418 The
419 .BR userfaultfd ()
420 system call first appeared in Linux 4.3.
421 .PP
422 The support for hugetlbfs and shared memory areas and
423 non-page-fault events was added in Linux 4.11
424 .SH CONFORMING TO
425 .BR userfaultfd ()
426 is Linux-specific and should not be used in programs intended to be
427 portable.
428 .SH NOTES
429 Glibc does not provide a wrapper for this system call; call it using
430 .BR syscall (2).
431 .PP
432 The userfaultfd mechanism can be used as an alternative to
433 traditional user-space paging techniques based on the use of the
434 .BR SIGSEGV
435 signal and
436 .BR mmap (2).
437 It can also be used to implement lazy restore
438 for checkpoint/restore mechanisms,
439 as well as post-copy migration to allow (nearly) uninterrupted execution
440 when transferring virtual machines and Linux containers
441 from one host to another.
442 .SH EXAMPLE
443 The program below demonstrates the use of the userfaultfd mechanism.
444 The program creates two threads, one of which acts as the
445 page-fault handler for the process, for the pages in a demand-page zero
446 region created using
447 .BR mmap (2).
448 .PP
449 The program takes one command-line argument,
450 which is the number of pages that will be created in a mapping
451 whose page faults will be handled via userfaultfd.
452 After creating a userfaultfd object,
453 the program then creates an anonymous private mapping of the specified size
454 and registers the address range of that mapping using the
455 .B UFFDIO_REGISTER
456 .BR ioctl (2)
457 operation.
458 The program then creates a second thread that will perform the
459 task of handling page faults.
460 .PP
461 The main thread then walks through the pages of the mapping fetching
462 bytes from successive pages.
463 Because the pages have not yet been accessed,
464 the first access of a byte in each page will trigger a page-fault event
465 on the userfaultfd file descriptor.
466 .PP
467 Each of the page-fault events is handled by the second thread,
468 which sits in a loop processing input from the userfaultfd file descriptor.
469 In each loop iteration, the second thread first calls
470 .BR poll (2)
471 to check the state of the file descriptor,
472 and then reads an event from the file descriptor.
473 All such events should be
474 .B UFFD_EVENT_PAGEFAULT
475 events,
476 which the thread handles by copying a page of data into
477 the faulting region using the
478 .B UFFDIO_COPY
479 .BR ioctl (2)
480 operation.
481 .PP
482 The following is an example of what we see when running the program:
483 .PP
484 .in +4n
485 .nf
486 $ \fB./userfaultfd_demo 3\fP
487 Address returned by mmap() = 0x7fd30106c000
488
489 fault_handler_thread():
490 poll() returns: nready = 1; POLLIN = 1; POLLERR = 0
491 UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f
492 (uffdio_copy.copy returned 4096)
493 Read address 0x7fd30106c00f in main(): A
494 Read address 0x7fd30106c40f in main(): A
495 Read address 0x7fd30106c80f in main(): A
496 Read address 0x7fd30106cc0f in main(): A
497
498 fault_handler_thread():
499 poll() returns: nready = 1; POLLIN = 1; POLLERR = 0
500 UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f
501 (uffdio_copy.copy returned 4096)
502 Read address 0x7fd30106d00f in main(): B
503 Read address 0x7fd30106d40f in main(): B
504 Read address 0x7fd30106d80f in main(): B
505 Read address 0x7fd30106dc0f in main(): B
506
507 fault_handler_thread():
508 poll() returns: nready = 1; POLLIN = 1; POLLERR = 0
509 UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f
510 (uffdio_copy.copy returned 4096)
511 Read address 0x7fd30106e00f in main(): C
512 Read address 0x7fd30106e40f in main(): C
513 Read address 0x7fd30106e80f in main(): C
514 Read address 0x7fd30106ec0f in main(): C
515 .fi
516 .in
517 .SS Program source
518 \&
519 .EX
520 /* userfaultfd_demo.c
521
522 Licensed under the GNU General Public License version 2 or later.
523 */
524 #define _GNU_SOURCE
525 #include <sys/types.h>
526 #include <stdio.h>
527 #include <linux/userfaultfd.h>
528 #include <pthread.h>
529 #include <errno.h>
530 #include <unistd.h>
531 #include <stdlib.h>
532 #include <fcntl.h>
533 #include <signal.h>
534 #include <poll.h>
535 #include <string.h>
536 #include <sys/mman.h>
537 #include <sys/syscall.h>
538 #include <sys/ioctl.h>
539 #include <poll.h>
540
541 #define errExit(msg) do { perror(msg); exit(EXIT_FAILURE); \\
542 } while (0)
543
544 static int page_size;
545
546 static void *
547 fault_handler_thread(void *arg)
548 {
549 static struct uffd_msg msg; /* Data read from userfaultfd */
550 static int fault_cnt = 0; /* Number of faults so far handled */
551 long uffd; /* userfaultfd file descriptor */
552 static char *page = NULL;
553 struct uffdio_copy uffdio_copy;
554 ssize_t nread;
555
556 uffd = (long) arg;
557
558 /* Create a page that will be copied into the faulting region */
559
560 if (page == NULL) {
561 page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,
562 MAP_PRIVATE | MAP_ANONYMOUS, \-1, 0);
563 if (page == MAP_FAILED)
564 errExit("mmap");
565 }
566
567 /* Loop, handling incoming events on the userfaultfd
568 file descriptor */
569
570 for (;;) {
571
572 /* See what poll() tells us about the userfaultfd */
573
574 struct pollfd pollfd;
575 int nready;
576 pollfd.fd = uffd;
577 pollfd.events = POLLIN;
578 nready = poll(&pollfd, 1, \-1);
579 if (nready == \-1)
580 errExit("poll");
581
582 printf("\\nfault_handler_thread():\\n");
583 printf(" poll() returns: nready = %d; "
584 "POLLIN = %d; POLLERR = %d\\n", nready,
585 (pollfd.revents & POLLIN) != 0,
586 (pollfd.revents & POLLERR) != 0);
587
588 /* Read an event from the userfaultfd */
589
590 nread = read(uffd, &msg, sizeof(msg));
591 if (nread == 0) {
592 printf("EOF on userfaultfd!\\n");
593 exit(EXIT_FAILURE);
594 }
595
596 if (nread == \-1)
597 errExit("read");
598
599 /* We expect only one kind of event; verify that assumption */
600
601 if (msg.event != UFFD_EVENT_PAGEFAULT) {
602 fprintf(stderr, "Unexpected event on userfaultfd\\n");
603 exit(EXIT_FAILURE);
604 }
605
606 /* Display info about the page\-fault event */
607
608 printf(" UFFD_EVENT_PAGEFAULT event: ");
609 printf("flags = %llx; ", msg.arg.pagefault.flags);
610 printf("address = %llx\\n", msg.arg.pagefault.address);
611
612 /* Copy the page pointed to by \(aqpage\(aq into the faulting
613 region. Vary the contents that are copied in, so that it
614 is more obvious that each fault is handled separately. */
615
616 memset(page, \(aqA\(aq + fault_cnt % 20, page_size);
617 fault_cnt++;
618
619 uffdio_copy.src = (unsigned long) page;
620
621 /* We need to handle page faults in units of pages(!).
622 So, round faulting address down to page boundary */
623
624 uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &
625 ~(page_size \- 1);
626 uffdio_copy.len = page_size;
627 uffdio_copy.mode = 0;
628 uffdio_copy.copy = 0;
629 if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == \-1)
630 errExit("ioctl\-UFFDIO_COPY");
631
632 printf(" (uffdio_copy.copy returned %lld)\\n",
633 uffdio_copy.copy);
634 }
635 }
636
637 int
638 main(int argc, char *argv[])
639 {
640 long uffd; /* userfaultfd file descriptor */
641 char *addr; /* Start of region handled by userfaultfd */
642 unsigned long len; /* Length of region handled by userfaultfd */
643 pthread_t thr; /* ID of thread that handles page faults */
644 struct uffdio_api uffdio_api;
645 struct uffdio_register uffdio_register;
646 int s;
647
648 if (argc != 2) {
649 fprintf(stderr, "Usage: %s num\-pages\\n", argv[0]);
650 exit(EXIT_FAILURE);
651 }
652
653 page_size = sysconf(_SC_PAGE_SIZE);
654 len = strtoul(argv[1], NULL, 0) * page_size;
655
656 /* Create and enable userfaultfd object */
657
658 uffd = syscall(__NR_userfaultfd, O_CLOEXEC | O_NONBLOCK);
659 if (uffd == \-1)
660 errExit("userfaultfd");
661
662 uffdio_api.api = UFFD_API;
663 uffdio_api.features = 0;
664 if (ioctl(uffd, UFFDIO_API, &uffdio_api) == \-1)
665 errExit("ioctl\-UFFDIO_API");
666
667 /* Create a private anonymous mapping. The memory will be
668 demand\-zero paged\-\-that is, not yet allocated. When we
669 actually touch the memory, it will be allocated via
670 the userfaultfd. */
671
672 addr = mmap(NULL, len, PROT_READ | PROT_WRITE,
673 MAP_PRIVATE | MAP_ANONYMOUS, \-1, 0);
674 if (addr == MAP_FAILED)
675 errExit("mmap");
676
677 printf("Address returned by mmap() = %p\\n", addr);
678
679 /* Register the memory range of the mapping we just created for
680 handling by the userfaultfd object. In mode, we request to track
681 missing pages (i.e., pages that have not yet been faulted in). */
682
683 uffdio_register.range.start = (unsigned long) addr;
684 uffdio_register.range.len = len;
685 uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;
686 if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == \-1)
687 errExit("ioctl\-UFFDIO_REGISTER");
688
689 /* Create a thread that will process the userfaultfd events */
690
691 s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);
692 if (s != 0) {
693 errno = s;
694 errExit("pthread_create");
695 }
696
697 /* Main thread now touches memory in the mapping, touching
698 locations 1024 bytes apart. This will trigger userfaultfd
699 events for all pages in the region. */
700
701 int l;
702 l = 0xf; /* Ensure that faulting address is not on a page
703 boundary, in order to test that we correctly
704 handle that case in fault_handling_thread() */
705 while (l < len) {
706 char c = addr[l];
707 printf("Read address %p in main(): ", addr + l);
708 printf("%c\\n", c);
709 l += 1024;
710 usleep(100000); /* Slow things down a little */
711 }
712
713 exit(EXIT_SUCCESS);
714 }
715 .EE
716 .SH SEE ALSO
717 .BR fcntl (2),
718 .BR ioctl (2),
719 .BR ioctl_userfaultfd (2),
720 .BR madvise (2),
721 .BR mmap (2)
722 .PP
723 .IR Documentation/vm/userfaultfd.txt
724 in the Linux kernel source tree
725 .PP