]> git.ipfire.org Git - thirdparty/man-pages.git/blobdiff - man2/userfaultfd.2
prctl.2: Fix mis-description of thread ID values in procfs
[thirdparty/man-pages.git] / man2 / userfaultfd.2
index 08c41e160c4545e54768c8bd313ae668ccc27722..ba21ae29ba2da333ff7bda66f8fd55d84af7c13a 100644 (file)
@@ -24,7 +24,7 @@
 .\" the source, must acknowledge the copyright and authors of this work.
 .\" %%%LICENSE_END
 .\"
-.TH USERFAULTFD 2 2017-09-15 "Linux" "Linux Programmer's Manual"
+.TH USERFAULTFD 2 2020-02-09 "Linux" "Linux Programmer's Manual"
 .SH NAME
 userfaultfd \- create a file descriptor for handling page faults in user space
 .SH SYNOPSIS
@@ -168,7 +168,7 @@ the user-space application.
 The application can then use the
 .B UFFDIO_COPY
 or
-.B UFFDIO_ZERO
+.B UFFDIO_ZEROPAGE
 .BR ioctl (2)
 operations to resolve the page fault.
 .PP
@@ -440,6 +440,14 @@ reached.
 .TP
 .B ENOMEM
 Insufficient kernel memory was available.
+.TP
+.BR EPERM " (since Linux 5.2)"
+.\" cefdca0a86be517bc390fc4541e3674b8e7803b0
+The caller is not privileged (does not have the
+.B CAP_SYS_PTRACE
+capability in the initial user namespace), and
+.I /proc/sys/vm/unprivileged_userfaultfd
+has the value 0.
 .SH VERSIONS
 The
 .BR userfaultfd ()
@@ -470,9 +478,9 @@ If the
 .B UFFD_FEATURE_EVENT_FORK
 is enabled and a system call from the
 .BR fork (2)
-family is interrupted by a signal or failed,q a stale userfaultfd descriptor
+family is interrupted by a signal or failed, a stale userfaultfd descriptor
 might be created.
-In this case a spurious
+In this case, a spurious
 .B UFFD_EVENT_FORK
 will be delivered to the userfaultfd monitor.
 .SH EXAMPLE
@@ -574,7 +582,7 @@ Read address 0x7fd30106ec0f in main(): C
 #include <sys/ioctl.h>
 #include <poll.h>
 
-#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \\
+#define errExit(msg)    do { perror(msg); exit(EXIT_FAILURE); \e
                         } while (0)
 
 static int page_size;
@@ -615,9 +623,9 @@ fault_handler_thread(void *arg)
         if (nready == \-1)
             errExit("poll");
 
-        printf("\\nfault_handler_thread():\\n");
+        printf("\enfault_handler_thread():\en");
         printf("    poll() returns: nready = %d; "
-                "POLLIN = %d; POLLERR = %d\\n", nready,
+                "POLLIN = %d; POLLERR = %d\en", nready,
                 (pollfd.revents & POLLIN) != 0,
                 (pollfd.revents & POLLERR) != 0);
 
@@ -625,7 +633,7 @@ fault_handler_thread(void *arg)
 
         nread = read(uffd, &msg, sizeof(msg));
         if (nread == 0) {
-            printf("EOF on userfaultfd!\\n");
+            printf("EOF on userfaultfd!\en");
             exit(EXIT_FAILURE);
         }
 
@@ -635,7 +643,7 @@ fault_handler_thread(void *arg)
         /* We expect only one kind of event; verify that assumption */
 
         if (msg.event != UFFD_EVENT_PAGEFAULT) {
-            fprintf(stderr, "Unexpected event on userfaultfd\\n");
+            fprintf(stderr, "Unexpected event on userfaultfd\en");
             exit(EXIT_FAILURE);
         }
 
@@ -643,7 +651,7 @@ fault_handler_thread(void *arg)
 
         printf("    UFFD_EVENT_PAGEFAULT event: ");
         printf("flags = %llx; ", msg.arg.pagefault.flags);
-        printf("address = %llx\\n", msg.arg.pagefault.address);
+        printf("address = %llx\en", msg.arg.pagefault.address);
 
         /* Copy the page pointed to by \(aqpage\(aq into the faulting
            region. Vary the contents that are copied in, so that it
@@ -665,7 +673,7 @@ fault_handler_thread(void *arg)
         if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == \-1)
             errExit("ioctl\-UFFDIO_COPY");
 
-        printf("        (uffdio_copy.copy returned %lld)\\n",
+        printf("        (uffdio_copy.copy returned %lld)\en",
                 uffdio_copy.copy);
     }
 }
@@ -682,7 +690,7 @@ main(int argc, char *argv[])
     int s;
 
     if (argc != 2) {
-        fprintf(stderr, "Usage: %s num\-pages\\n", argv[0]);
+        fprintf(stderr, "Usage: %s num\-pages\en", argv[0]);
         exit(EXIT_FAILURE);
     }
 
@@ -710,7 +718,7 @@ main(int argc, char *argv[])
     if (addr == MAP_FAILED)
         errExit("mmap");
 
-    printf("Address returned by mmap() = %p\\n", addr);
+    printf("Address returned by mmap() = %p\en", addr);
 
     /* Register the memory range of the mapping we just created for
        handling by the userfaultfd object. In mode, we request to track
@@ -741,7 +749,7 @@ main(int argc, char *argv[])
     while (l < len) {
         char c = addr[l];
         printf("Read address %p in main(): ", addr + l);
-        printf("%c\\n", c);
+        printf("%c\en", c);
         l += 1024;
         usleep(100000);         /* Slow things down a little */
     }
@@ -756,6 +764,6 @@ main(int argc, char *argv[])
 .BR madvise (2),
 .BR mmap (2)
 .PP
-.IR Documentation/vm/userfaultfd.txt
+.IR Documentation/admin-guide/mm/userfaultfd.rst
 in the Linux kernel source tree
 .PP