summaryrefslogtreecommitdiffstats
path: root/templates/man2/userfaultfd.2.pot
blob: f03d619d31fd653b009e42991d00f1d229f474a4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
# SOME DESCRIPTIVE TITLE
# Copyright (C) YEAR Free Software Foundation, Inc.
# This file is distributed under the same license as the PACKAGE package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
#, fuzzy
msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"POT-Creation-Date: 2024-06-01 06:33+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#. type: TH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "userfaultfd"
msgstr ""

#. type: TH
#: archlinux debian-unstable opensuse-tumbleweed
#, no-wrap
msgid "2024-05-02"
msgstr ""

#. type: TH
#: archlinux debian-unstable
#, no-wrap
msgid "Linux man-pages 6.8"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "NAME"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"userfaultfd - create a file descriptor for handling page faults in user space"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "LIBRARY"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Standard C library (I<libc>, I<-lc>)"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "SYNOPSIS"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid ""
"B<#include E<lt>fcntl.hE<gt>>             /* Definition of B<O_*> constants */\n"
"B<#include E<lt>sys/syscall.hE<gt>>       /* Definition of B<SYS_*> constants */\n"
"B<#include E<lt>linux/userfaultfd.hE<gt>> /* Definition of B<UFFD_*> constants */\n"
"B<#include E<lt>unistd.hE<gt>>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<int syscall(SYS_userfaultfd, int >I<flags>B<);>\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"I<Note>: glibc provides no wrapper for B<userfaultfd>(), necessitating the "
"use of B<syscall>(2)."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "DESCRIPTION"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"B<userfaultfd>()  creates a new userfaultfd object that can be used for "
"delegation of page-fault handling to a user-space application, and returns a "
"file descriptor that refers to the new object.  The new userfaultfd object "
"is configured using B<ioctl>(2)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Once the userfaultfd object is configured, the application can use "
"B<read>(2)  to receive userfaultfd notifications.  The reads from "
"userfaultfd may be blocking or non-blocking, depending on the value of "
"I<flags> used for the creation of the userfaultfd or subsequent calls to "
"B<fcntl>(2)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The following values may be bitwise ORed in I<flags> to change the behavior "
"of B<userfaultfd>():"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<O_CLOEXEC>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Enable the close-on-exec flag for the new userfaultfd file descriptor.  See "
"the description of the B<O_CLOEXEC> flag in B<open>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<O_NONBLOCK>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Enables non-blocking operation for the userfaultfd object.  See the "
"description of the B<O_NONBLOCK> flag in B<open>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_USER_MODE_ONLY>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"This is an userfaultfd-specific flag that was introduced in Linux 5.11.  "
"When set, the userfaultfd object will only be able to handle page faults "
"originated from the user space on the registered regions.  When a kernel-"
"originated fault was triggered on the registered range with this "
"userfaultfd, a B<SIGBUS> signal will be delivered."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When the last file descriptor referring to a userfaultfd object is closed, "
"all memory ranges that were registered with the object are unregistered and "
"unread events are flushed."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Userfaultfd supports three modes of registration:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFDIO_REGISTER_MODE_MISSING> (since Linux 4.10)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When registered with B<UFFDIO_REGISTER_MODE_MISSING> mode, user-space will "
"receive a page-fault notification when a missing page is accessed.  The "
"faulted thread will be stopped from execution until the page fault is "
"resolved from user-space by either an B<UFFDIO_COPY> or an "
"B<UFFDIO_ZEROPAGE> ioctl."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFDIO_REGISTER_MODE_MINOR> (since Linux 5.13)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When registered with B<UFFDIO_REGISTER_MODE_MINOR> mode, user-space will "
"receive a page-fault notification when a minor page fault occurs.  That is, "
"when a backing page is in the page cache, but page table entries don't yet "
"exist.  The faulted thread will be stopped from execution until the page "
"fault is resolved from user-space by an B<UFFDIO_CONTINUE> ioctl."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFDIO_REGISTER_MODE_WP> (since Linux 5.7)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When registered with B<UFFDIO_REGISTER_MODE_WP> mode, user-space will "
"receive a page-fault notification when a write-protected page is written.  "
"The faulted thread will be stopped from execution until user-space write-"
"unprotects the page using an B<UFFDIO_WRITEPROTECT> ioctl."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Multiple modes can be enabled at the same time for the same memory range."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 4.14, a userfaultfd page-fault notification can selectively "
"embed faulting thread ID information into the notification.  One needs to "
"enable this feature explicitly using the B<UFFD_FEATURE_THREAD_ID> feature "
"bit when initializing the userfaultfd context.  By default, thread ID "
"reporting is disabled."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Usage"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The userfaultfd mechanism is designed to allow a thread in a multithreaded "
"program to perform user-space paging for the other threads in the process.  "
"When a page fault occurs for one of the regions registered to the "
"userfaultfd object, the faulting thread is put to sleep and an event is "
"generated that can be read via the userfaultfd file descriptor.  The fault-"
"handling thread reads events from this file descriptor and services them "
"using the operations described in B<ioctl_userfaultfd>(2).  When servicing "
"the page fault events, the fault-handling thread can trigger a wake-up for "
"the sleeping thread."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"It is possible for the faulting threads and the fault-handling threads to "
"run in the context of different processes.  In this case, these threads may "
"belong to different programs, and the program that executes the faulting "
"threads will not necessarily cooperate with the program that handles the "
"page faults.  In such non-cooperative mode, the process that monitors "
"userfaultfd and handles page faults needs to be aware of the changes in the "
"virtual memory layout of the faulting process to avoid memory corruption."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 4.11, userfaultfd can also notify the fault-handling threads "
"about changes in the virtual memory layout of the faulting process.  In "
"addition, if the faulting process invokes B<fork>(2), the userfaultfd "
"objects associated with the parent may be duplicated into the child process "
"and the userfaultfd monitor will be notified (via the B<UFFD_EVENT_FORK> "
"described below)  about the file descriptor associated with the userfault "
"objects created for the child process, which allows the userfaultfd monitor "
"to perform user-space paging for the child process.  Unlike page faults "
"which have to be synchronous and require an explicit or implicit wakeup, all "
"other events are delivered asynchronously and the non-cooperative process "
"resumes execution as soon as the userfaultfd manager executes B<read>(2).  "
"The userfaultfd manager should carefully synchronize calls to B<UFFDIO_COPY> "
"with the processing of events."
msgstr ""

#. #-#-#-#-#  archlinux: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  debian-bookworm: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .PP
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  debian-unstable: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  fedora-40: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  fedora-rawhide: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  mageia-cauldron: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  opensuse-leap-15-6: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .PP
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#. #-#-#-#-#  opensuse-tumbleweed: userfaultfd.2.pot (PACKAGE VERSION)  #-#-#-#-#
#.  Regarding the preceding sentence, Mike Rapoport says:
#.      The major point here is that current events delivery model could be
#.      problematic for multi-threaded monitor. I even suspect that it would be
#.      impossible to ensure synchronization between page faults and non-page
#.      fault events in multi-threaded monitor.
#.  .P
#.  FIXME elaborate about non-cooperating mode, describe its limitations
#.  for kernels before Linux 4.11, features added in Linux 4.11
#.  and limitations remaining in Linux 4.11
#.  Maybe it's worth adding a dedicated sub-section...
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The current asynchronous model of the event delivery is optimal for single "
"threaded non-cooperative userfaultfd manager implementations."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 5.7, userfaultfd is able to do synchronous page dirty tracking "
"using the new write-protect register mode.  One should check against the "
"feature bit B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> before using this feature.  "
"Similar to the original userfaultfd missing mode, the write-protect mode "
"will generate a userfaultfd notification when the protected page is "
"written.  The user needs to resolve the page fault by unprotecting the "
"faulted page and kicking the faulted thread to continue.  For more "
"information, please refer to the \"Userfaultfd write-protect mode\" section."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Userfaultfd operation"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"After the userfaultfd object is created with B<userfaultfd>(), the "
"application must enable it using the B<UFFDIO_API> B<ioctl>(2)  operation.  "
"This operation allows a two-step handshake between the kernel and user space "
"to determine what API version and features the kernel supports, and then to "
"enable those features user space wants.  This operation must be performed "
"before any of the other B<ioctl>(2)  operations described below (or those "
"operations fail with the B<EINVAL> error)."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
msgid ""
"After a successful B<UFFDIO_API> operation, the application then registers "
"memory address ranges using the B<UFFDIO_REGISTER> B<ioctl>(2)  operation.  "
"After successful completion of a B<UFFDIO_REGISTER> operation, a page fault "
"occurring in the requested memory range, and satisfying the mode defined at "
"the registration time, will be forwarded by the kernel to the user-space "
"application.  The application can then use various (e.g., B<UFFDIO_COPY>, "
"B<UFFDIO_ZEROPAGE>, or B<UFFDIO_CONTINUE>)  B<ioctl>(2)  operations to "
"resolve the page fault."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 4.14, if the application sets the B<UFFD_FEATURE_SIGBUS> feature "
"bit using the B<UFFDIO_API> B<ioctl>(2), no page-fault notification will be "
"forwarded to user space.  Instead a B<SIGBUS> signal is delivered to the "
"faulting process.  With this feature, userfaultfd can be used for robustness "
"purposes to simply catch any access to areas within the registered address "
"range that do not have pages allocated, without having to listen to "
"userfaultfd events.  No userfaultfd monitor will be required for dealing "
"with such memory accesses.  For example, this feature can be useful for "
"applications that want to prevent the kernel from automatically allocating "
"pages and filling holes in sparse files when the hole is accessed through a "
"memory mapping."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The B<UFFD_FEATURE_SIGBUS> feature is implicitly inherited through "
"B<fork>(2)  if used in combination with B<UFFD_FEATURE_FORK>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Details of the various B<ioctl>(2)  operations can be found in "
"B<ioctl_userfaultfd>(2)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 4.11, events other than page-fault may enabled during "
"B<UFFDIO_API> operation."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Up to Linux 4.11, userfaultfd can be used only with anonymous private memory "
"mappings.  Since Linux 4.11, userfaultfd can be also used with hugetlbfs and "
"shared memory mappings."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Userfaultfd write-protect mode (since Linux 5.7)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 5.7, userfaultfd supports write-protect mode for anonymous "
"memory.  The user needs to first check availability of this feature using "
"B<UFFDIO_API> ioctl against the feature bit "
"B<UFFD_FEATURE_PAGEFAULT_FLAG_WP> before using this feature."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 5.19, the write-protection mode was also supported on shmem and "
"hugetlbfs memory types.  It can be detected with the feature bit "
"B<UFFD_FEATURE_WP_HUGETLBFS_SHMEM>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"To register with userfaultfd write-protect mode, the user needs to initiate "
"the B<UFFDIO_REGISTER> ioctl with mode B<UFFDIO_REGISTER_MODE_WP> set.  Note "
"that it is legal to monitor the same memory range with multiple modes.  For "
"example, the user can do B<UFFDIO_REGISTER> with the mode set to "
"B<UFFDIO_REGISTER_MODE_MISSING | UFFDIO_REGISTER_MODE_WP>.  When there is "
"only B<UFFDIO_REGISTER_MODE_WP> registered, user-space will I<not> receive "
"any notification when a missing page is written.  Instead, user-space will "
"receive a write-protect page-fault notification only when an existing but "
"write-protected page got written."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"After the B<UFFDIO_REGISTER> ioctl completed with B<UFFDIO_REGISTER_MODE_WP> "
"mode set, the user can write-protect any existing memory within the range "
"using the ioctl B<UFFDIO_WRITEPROTECT> where I<uffdio_writeprotect.mode> "
"should be set to B<UFFDIO_WRITEPROTECT_MODE_WP>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When a write-protect event happens, user-space will receive a page-fault "
"notification whose I<uffd_msg.pagefault.flags> will be with "
"B<UFFD_PAGEFAULT_FLAG_WP> flag set.  Note: since only writes can trigger "
"this kind of fault, write-protect notifications will always have the "
"B<UFFD_PAGEFAULT_FLAG_WRITE> bit set along with the "
"B<UFFD_PAGEFAULT_FLAG_WP> bit."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"To resolve a write-protection page fault, the user should initiate another "
"B<UFFDIO_WRITEPROTECT> ioctl, whose I<uffd_msg.pagefault.flags> should have "
"the flag B<UFFDIO_WRITEPROTECT_MODE_WP> cleared upon the faulted page or "
"range."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Userfaultfd minor fault mode (since Linux 5.13)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Since Linux 5.13, userfaultfd supports minor fault mode.  In this mode, "
"fault messages are produced not for major faults (where the page was "
"missing), but rather for minor faults, where a page exists in the page "
"cache, but the page table entries are not yet present.  The user needs to "
"first check availability of this feature using the B<UFFDIO_API> ioctl with "
"the appropriate feature bits set before using this feature: "
"B<UFFD_FEATURE_MINOR_HUGETLBFS> since Linux 5.13, or "
"B<UFFD_FEATURE_MINOR_SHMEM> since Linux 5.14."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"To register with userfaultfd minor fault mode, the user needs to initiate "
"the B<UFFDIO_REGISTER> ioctl with mode B<UFFD_REGISTER_MODE_MINOR> set."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"When a minor fault occurs, user-space will receive a page-fault notification "
"whose I<uffd_msg.pagefault.flags> will have the B<UFFD_PAGEFAULT_FLAG_MINOR> "
"flag set."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"To resolve a minor page fault, the handler should decide whether or not the "
"existing page contents need to be modified first.  If so, this should be "
"done in-place via a second, non-userfaultfd-registered mapping to the same "
"backing page (e.g., by mapping the shmem or hugetlbfs file twice).  Once the "
"page is considered \"up to date\", the fault can be resolved by initiating "
"an B<UFFDIO_CONTINUE> ioctl, which installs the page table entries and (by "
"default)  wakes up the faulting thread(s)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Minor fault mode supports only hugetlbfs-backed (since Linux 5.13)  and "
"shmem-backed (since Linux 5.14) memory."
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Reading from the userfaultfd structure"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Each B<read>(2)  from the userfaultfd file descriptor returns one or more "
"I<uffd_msg> structures, each of which describes a page-fault event or an "
"event required for the non-cooperative userfaultfd usage:"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
#, no-wrap
msgid ""
"struct uffd_msg {\n"
"    __u8  event;            /* Type of event */\n"
"    ...\n"
"    union {\n"
"        struct {\n"
"            __u64 flags;    /* Flags describing fault */\n"
"            __u64 address;  /* Faulting address */\n"
"            union {\n"
"                __u32 ptid; /* Thread ID of the fault */\n"
"            } feat;\n"
"        } pagefault;\n"
"\\&\n"
"        struct {            /* Since Linux 4.11 */\n"
"            __u32 ufd;      /* Userfault file descriptor\n"
"                               of the child process */\n"
"        } fork;\n"
"\\&\n"
"        struct {            /* Since Linux 4.11 */\n"
"            __u64 from;     /* Old address of remapped area */\n"
"            __u64 to;       /* New address of remapped area */\n"
"            __u64 len;      /* Original mapping length */\n"
"        } remap;\n"
"\\&\n"
"        struct {            /* Since Linux 4.11 */\n"
"            __u64 start;    /* Start address of removed area */\n"
"            __u64 end;      /* End address of removed area */\n"
"        } remove;\n"
"        ...\n"
"    } arg;\n"
"\\&\n"
"    /* Padding fields omitted */\n"
"} __packed;\n"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"If multiple events are available and the supplied buffer is large enough, "
"B<read>(2)  returns as many events as will fit in the supplied buffer.  If "
"the buffer supplied to B<read>(2)  is smaller than the size of the "
"I<uffd_msg> structure, the B<read>(2)  fails with the error B<EINVAL>."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "The fields set in the I<uffd_msg> structure are as follows:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<event>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The type of event.  Depending of the event type, different fields of the "
"I<arg> union represent details required for the event processing.  The non-"
"page-fault events are generated only when appropriate feature is enabled "
"during API handshake with B<UFFDIO_API> B<ioctl>(2)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "The following values can appear in the I<event> field:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_EVENT_PAGEFAULT> (since Linux 4.3)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"A page-fault event.  The page-fault details are available in the "
"I<pagefault> field."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_EVENT_FORK> (since Linux 4.11)"
msgstr ""

#.  FIXME describe duplication of userfault file descriptor during fork
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Generated when the faulting process invokes B<fork>(2)  (or B<clone>(2)  "
"without the B<CLONE_VM> flag).  The event details are available in the "
"I<fork> field."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_EVENT_REMAP> (since Linux 4.11)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Generated when the faulting process invokes B<mremap>(2).  The event details "
"are available in the I<remap> field."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_EVENT_REMOVE> (since Linux 4.11)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Generated when the faulting process invokes B<madvise>(2)  with "
"B<MADV_DONTNEED> or B<MADV_REMOVE> advice.  The event details are available "
"in the I<remove> field."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_EVENT_UNMAP> (since Linux 4.11)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Generated when the faulting process unmaps a memory range, either explicitly "
"using B<munmap>(2)  or implicitly during B<mmap>(2)  or B<mremap>(2).  The "
"event details are available in the I<remove> field."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<pagefault.address>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "The address that triggered the page fault."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<pagefault.flags>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"A bit mask of flags that describe the event.  For B<UFFD_EVENT_PAGEFAULT>, "
"the following flag may appear:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_PAGEFAULT_FLAG_WP>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "If this flag is set, then the fault was a write-protect fault."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_PAGEFAULT_FLAG_MINOR>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "If this flag is set, then the fault was a minor fault."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<UFFD_PAGEFAULT_FLAG_WRITE>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "If this flag is set, then the fault was a write fault."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"If neither B<UFFD_PAGEFAULT_FLAG_WP> nor B<UFFD_PAGEFAULT_FLAG_MINOR> are "
"set, then the fault was a missing fault."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<pagefault.feat.pid>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "The thread ID that triggered the page fault."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<fork.ufd>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The file descriptor associated with the userfault object created for the "
"child created by B<fork>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<remap.from>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The original address of the memory range that was remapped using "
"B<mremap>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<remap.to>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The new address of the memory range that was remapped using B<mremap>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<remap.len>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The original length of the memory range that was remapped using B<mremap>(2)."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<remove.start>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The start address of the memory range that was freed using B<madvise>(2)  or "
"unmapped"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "I<remove.end>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The end address of the memory range that was freed using B<madvise>(2)  or "
"unmapped"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"A B<read>(2)  on a userfaultfd file descriptor can fail with the following "
"errors:"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<EINVAL>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The userfaultfd object has not yet been enabled using the B<UFFDIO_API> "
"B<ioctl>(2)  operation"
msgstr ""

#.  FIXME What is the reason for this seemingly odd behavior with respect
#.  to the O_NONBLOCK flag? (see userfaultfd_poll() in fs/userfaultfd.c).
#.  Something needs to be said about this.
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"If the B<O_NONBLOCK> flag is enabled in the associated open file "
"description, the userfaultfd file descriptor can be monitored with "
"B<poll>(2), B<select>(2), and B<epoll>(7).  When events are available, the "
"file descriptor indicates as readable.  If the B<O_NONBLOCK> flag is not "
"enabled, then B<poll>(2)  (always) indicates the file as having a B<POLLERR> "
"condition, and B<select>(2)  indicates the file descriptor as both readable "
"and writable."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "RETURN VALUE"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"On success, B<userfaultfd>()  returns a new file descriptor that refers to "
"the userfaultfd object.  On error, -1 is returned, and I<errno> is set to "
"indicate the error."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "ERRORS"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "An unsupported value was specified in I<flags>."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<EMFILE>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The per-process limit on the number of open file descriptors has been reached"
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<ENFILE>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The system-wide limit on the total number of open files has been reached."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<ENOMEM>"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "Insufficient kernel memory was available."
msgstr ""

#. type: TP
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "B<EPERM> (since Linux 5.2)"
msgstr ""

#.  cefdca0a86be517bc390fc4541e3674b8e7803b0
#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The caller is not privileged (does not have the B<CAP_SYS_PTRACE> capability "
"in the initial user namespace), and I</proc/sys/vm/unprivileged_userfaultfd> "
"has the value 0."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "STANDARDS"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
msgid "Linux."
msgstr ""

#. type: SH
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "HISTORY"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
msgid "Linux 4.3."
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Support for hugetlbfs and shared memory areas and non-page-fault events was "
"added in Linux 4.11"
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "NOTES"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The userfaultfd mechanism can be used as an alternative to traditional user-"
"space paging techniques based on the use of the B<SIGSEGV> signal and "
"B<mmap>(2).  It can also be used to implement lazy restore for checkpoint/"
"restore mechanisms, as well as post-copy migration to allow (nearly) "
"uninterrupted execution when transferring virtual machines and Linux "
"containers from one host to another."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "BUGS"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"If the B<UFFD_FEATURE_EVENT_FORK> is enabled and a system call from the "
"B<fork>(2)  family is interrupted by a signal or failed, a stale userfaultfd "
"descriptor might be created.  In this case, a spurious B<UFFD_EVENT_FORK> "
"will be delivered to the userfaultfd monitor."
msgstr ""

#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "EXAMPLES"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The program below demonstrates the use of the userfaultfd mechanism.  The "
"program creates two threads, one of which acts as the page-fault handler for "
"the process, for the pages in a demand-page zero region created using "
"B<mmap>(2)."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The program takes one command-line argument, which is the number of pages "
"that will be created in a mapping whose page faults will be handled via "
"userfaultfd.  After creating a userfaultfd object, the program then creates "
"an anonymous private mapping of the specified size and registers the address "
"range of that mapping using the B<UFFDIO_REGISTER> B<ioctl>(2)  operation.  "
"The program then creates a second thread that will perform the task of "
"handling page faults."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"The main thread then walks through the pages of the mapping fetching bytes "
"from successive pages.  Because the pages have not yet been accessed, the "
"first access of a byte in each page will trigger a page-fault event on the "
"userfaultfd file descriptor."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"Each of the page-fault events is handled by the second thread, which sits in "
"a loop processing input from the userfaultfd file descriptor.  In each loop "
"iteration, the second thread first calls B<poll>(2)  to check the state of "
"the file descriptor, and then reads an event from the file descriptor.  All "
"such events should be B<UFFD_EVENT_PAGEFAULT> events, which the thread "
"handles by copying a page of data into the faulting region using the "
"B<UFFDIO_COPY> B<ioctl>(2)  operation."
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid "The following is an example of what we see when running the program:"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
#, no-wrap
msgid ""
"$ B<./userfaultfd_demo 3>\n"
"Address returned by mmap() = 0x7fd30106c000\n"
"\\&\n"
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106c00f in main(): A\n"
"Read address 0x7fd30106c40f in main(): A\n"
"Read address 0x7fd30106c80f in main(): A\n"
"Read address 0x7fd30106cc0f in main(): A\n"
"\\&\n"
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106d00f in main(): B\n"
"Read address 0x7fd30106d40f in main(): B\n"
"Read address 0x7fd30106d80f in main(): B\n"
"Read address 0x7fd30106dc0f in main(): B\n"
"\\&\n"
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106e00f in main(): C\n"
"Read address 0x7fd30106e40f in main(): C\n"
"Read address 0x7fd30106e80f in main(): C\n"
"Read address 0x7fd30106ec0f in main(): C\n"
msgstr ""

#. type: SS
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "Program source"
msgstr ""

#. type: Plain text
#: archlinux debian-unstable fedora-40 fedora-rawhide mageia-cauldron
#: opensuse-tumbleweed
#, no-wrap
msgid ""
"/* userfaultfd_demo.c\n"
"\\&\n"
"   Licensed under the GNU General Public License version 2 or later.\n"
"*/\n"
"#define _GNU_SOURCE\n"
"#include E<lt>err.hE<gt>\n"
"#include E<lt>errno.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>inttypes.hE<gt>\n"
"#include E<lt>linux/userfaultfd.hE<gt>\n"
"#include E<lt>poll.hE<gt>\n"
"#include E<lt>pthread.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>string.hE<gt>\n"
"#include E<lt>sys/ioctl.hE<gt>\n"
"#include E<lt>sys/mman.hE<gt>\n"
"#include E<lt>sys/syscall.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
"\\&\n"
"static int page_size;\n"
"\\&\n"
"static void *\n"
"fault_handler_thread(void *arg)\n"
"{\n"
"    int                 nready;\n"
"    long                uffd;   /* userfaultfd file descriptor */\n"
"    ssize_t             nread;\n"
"    struct pollfd       pollfd;\n"
"    struct uffdio_copy  uffdio_copy;\n"
"\\&\n"
"    static int      fault_cnt = 0; /* Number of faults so far handled */\n"
"    static char     *page = NULL;\n"
"    static struct uffd_msg  msg;  /* Data read from userfaultfd */\n"
"\\&\n"
"    uffd = (long) arg;\n"
"\\&\n"
"    /* Create a page that will be copied into the faulting region. */\n"
"\\&\n"
"    if (page == NULL) {\n"
"        page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n"
"                    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n"
"        if (page == MAP_FAILED)\n"
"            err(EXIT_FAILURE, \"mmap\");\n"
"    }\n"
"\\&\n"
"    /* Loop, handling incoming events on the userfaultfd\n"
"       file descriptor. */\n"
"\\&\n"
"    for (;;) {\n"
"\\&\n"
"        /* See what poll() tells us about the userfaultfd. */\n"
"\\&\n"
"        pollfd.fd = uffd;\n"
"        pollfd.events = POLLIN;\n"
"        nready = poll(&pollfd, 1, -1);\n"
"        if (nready == -1)\n"
"            err(EXIT_FAILURE, \"poll\");\n"
"\\&\n"
"        printf(\"\\enfault_handler_thread():\\en\");\n"
"        printf(\"    poll() returns: nready = %d; \"\n"
"               \"POLLIN = %d; POLLERR = %d\\en\", nready,\n"
"               (pollfd.revents & POLLIN) != 0,\n"
"               (pollfd.revents & POLLERR) != 0);\n"
"\\&\n"
"        /* Read an event from the userfaultfd. */\n"
"\\&\n"
"        nread = read(uffd, &msg, sizeof(msg));\n"
"        if (nread == 0) {\n"
"            printf(\"EOF on userfaultfd!\\en\");\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"\\&\n"
"        if (nread == -1)\n"
"            err(EXIT_FAILURE, \"read\");\n"
"\\&\n"
"        /* We expect only one kind of event; verify that assumption. */\n"
"\\&\n"
"        if (msg.event != UFFD_EVENT_PAGEFAULT) {\n"
"            fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
"\\&\n"
"        /* Display info about the page-fault event. */\n"
"\\&\n"
"        printf(\"    UFFD_EVENT_PAGEFAULT event: \");\n"
"        printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n"
"        printf(\"address = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n"
"\\&\n"
"        /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n"
"           region. Vary the contents that are copied in, so that it\n"
"           is more obvious that each fault is handled separately. */\n"
"\\&\n"
"        memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n"
"        fault_cnt++;\n"
"\\&\n"
"        uffdio_copy.src = (unsigned long) page;\n"
"\\&\n"
"        /* We need to handle page faults in units of pages(!).\n"
"           So, round faulting address down to page boundary. */\n"
"\\&\n"
"        uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n"
"                                           \\[ti](page_size - 1);\n"
"        uffdio_copy.len = page_size;\n"
"        uffdio_copy.mode = 0;\n"
"        uffdio_copy.copy = 0;\n"
"        if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n"
"            err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n"
"\\&\n"
"        printf(\"        (uffdio_copy.copy returned %\"PRId64\")\\en\",\n"
"               uffdio_copy.copy);\n"
"    }\n"
"}\n"
"\\&\n"
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int        s;\n"
"    char       c;\n"
"    char       *addr;   /* Start of region handled by userfaultfd */\n"
"    long       uffd;    /* userfaultfd file descriptor */\n"
"    size_t     len, l;  /* Length of region handled by userfaultfd */\n"
"    pthread_t  thr;     /* ID of thread that handles page faults */\n"
"    struct uffdio_api       uffdio_api;\n"
"    struct uffdio_register  uffdio_register;\n"
"\\&\n"
"    if (argc != 2) {\n"
"        fprintf(stderr, \"Usage: %s num-pages\\en\", argv[0]);\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
"\\&\n"
"    page_size = sysconf(_SC_PAGE_SIZE);\n"
"    len = strtoull(argv[1], NULL, 0) * page_size;\n"
"\\&\n"
"    /* Create and enable userfaultfd object. */\n"
"\\&\n"
"    uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n"
"    if (uffd == -1)\n"
"        err(EXIT_FAILURE, \"userfaultfd\");\n"
"\\&\n"
"    /* NOTE: Two-step feature handshake is not needed here, since this\n"
"       example doesn't require any specific features.\n"
"\\&\n"
"       Programs that *do* should call UFFDIO_API twice: once with\n"
"       `features = 0` to detect features supported by this kernel, and\n"
"       again with the subset of features the program actually wants to\n"
"       enable. */\n"
"    uffdio_api.api = UFFD_API;\n"
"    uffdio_api.features = 0;\n"
"    if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n"
"        err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n"
"\\&\n"
"    /* Create a private anonymous mapping. The memory will be\n"
"       demand-zero paged--that is, not yet allocated. When we\n"
"       actually touch the memory, it will be allocated via\n"
"       the userfaultfd. */\n"
"\\&\n"
"    addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n"
"                MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n"
"    if (addr == MAP_FAILED)\n"
"        err(EXIT_FAILURE, \"mmap\");\n"
"\\&\n"
"    printf(\"Address returned by mmap() = %p\\en\", addr);\n"
"\\&\n"
"    /* Register the memory range of the mapping we just created for\n"
"       handling by the userfaultfd object. In mode, we request to track\n"
"       missing pages (i.e., pages that have not yet been faulted in). */\n"
"\\&\n"
"    uffdio_register.range.start = (unsigned long) addr;\n"
"    uffdio_register.range.len = len;\n"
"    uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n"
"    if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n"
"        err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n"
"\\&\n"
"    /* Create a thread that will process the userfaultfd events. */\n"
"\\&\n"
"    s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n"
"    if (s != 0) {\n"
"        errc(EXIT_FAILURE, s, \"pthread_create\");\n"
"    }\n"
"\\&\n"
"    /* Main thread now touches memory in the mapping, touching\n"
"       locations 1024 bytes apart. This will trigger userfaultfd\n"
"       events for all pages in the region. */\n"
"\\&\n"
"    l = 0xf;    /* Ensure that faulting address is not on a page\n"
"                   boundary, in order to test that we correctly\n"
"                   handle that case in fault_handling_thread(). */\n"
"    while (l E<lt> len) {\n"
"        c = addr[l];\n"
"        printf(\"Read address %p in %s(): \", addr + l, __func__);\n"
"        printf(\"%c\\en\", c);\n"
"        l += 1024;\n"
"        usleep(100000);         /* Slow things down a little */\n"
"    }\n"
"\\&\n"
"    exit(EXIT_SUCCESS);\n"
"}\n"
msgstr ""

#.  SRC END
#. type: SH
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
#, no-wrap
msgid "SEE ALSO"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"B<fcntl>(2), B<ioctl>(2), B<ioctl_userfaultfd>(2), B<madvise>(2), B<mmap>(2)"
msgstr ""

#. type: Plain text
#: archlinux debian-bookworm debian-unstable fedora-40 fedora-rawhide
#: mageia-cauldron opensuse-leap-15-6 opensuse-tumbleweed
msgid ""
"I<Documentation/admin-guide/mm/userfaultfd.rst> in the Linux kernel source "
"tree"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "2023-02-05"
msgstr ""

#. type: TH
#: debian-bookworm
#, no-wrap
msgid "Linux man-pages 6.03"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
msgid ""
"After the userfaultfd object is created with B<userfaultfd>(), the "
"application must enable it using the B<UFFDIO_API> B<ioctl>(2)  operation.  "
"This operation allows a handshake between the kernel and user space to "
"determine the API version and supported features.  This operation must be "
"performed before any of the other B<ioctl>(2)  operations described below "
"(or those operations fail with the B<EINVAL> error)."
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
msgid ""
"After a successful B<UFFDIO_API> operation, the application then registers "
"memory address ranges using the B<UFFDIO_REGISTER> B<ioctl>(2)  operation.  "
"After successful completion of a B<UFFDIO_REGISTER> operation, a page fault "
"occurring in the requested memory range, and satisfying the mode defined at "
"the registration time, will be forwarded by the kernel to the user-space "
"application.  The application can then use the B<UFFDIO_COPY ,> "
"B<UFFDIO_ZEROPAGE ,> or B<UFFDIO_CONTINUE> B<ioctl>(2)  operations to "
"resolve the page fault."
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"struct uffd_msg {\n"
"    __u8  event;            /* Type of event */\n"
"    ...\n"
"    union {\n"
"        struct {\n"
"            __u64 flags;    /* Flags describing fault */\n"
"            __u64 address;  /* Faulting address */\n"
"            union {\n"
"                __u32 ptid; /* Thread ID of the fault */\n"
"            } feat;\n"
"        } pagefault;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        struct {            /* Since Linux 4.11 */\n"
"            __u32 ufd;      /* Userfault file descriptor\n"
"                               of the child process */\n"
"        } fork;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        struct {            /* Since Linux 4.11 */\n"
"            __u64 from;     /* Old address of remapped area */\n"
"            __u64 to;       /* New address of remapped area */\n"
"            __u64 len;      /* Original mapping length */\n"
"        } remap;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        struct {            /* Since Linux 4.11 */\n"
"            __u64 start;    /* Start address of removed area */\n"
"            __u64 end;      /* End address of removed area */\n"
"        } remove;\n"
"        ...\n"
"    } arg;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    /* Padding fields omitted */\n"
"} __packed;\n"
msgstr ""

#. type: SH
#: debian-bookworm
#, no-wrap
msgid "VERSIONS"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid "The B<userfaultfd>()  system call first appeared in Linux 4.3."
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"The support for hugetlbfs and shared memory areas and non-page-fault events "
"was added in Linux 4.11"
msgstr ""

#. type: Plain text
#: debian-bookworm
msgid ""
"B<userfaultfd>()  is Linux-specific and should not be used in programs "
"intended to be portable."
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"$ B<./userfaultfd_demo 3>\n"
"Address returned by mmap() = 0x7fd30106c000\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106c00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106c00f in main(): A\n"
"Read address 0x7fd30106c40f in main(): A\n"
"Read address 0x7fd30106c80f in main(): A\n"
"Read address 0x7fd30106cc0f in main(): A\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106d00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106d00f in main(): B\n"
"Read address 0x7fd30106d40f in main(): B\n"
"Read address 0x7fd30106d80f in main(): B\n"
"Read address 0x7fd30106dc0f in main(): B\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"fault_handler_thread():\n"
"    poll() returns: nready = 1; POLLIN = 1; POLLERR = 0\n"
"    UFFD_EVENT_PAGEFAULT event: flags = 0; address = 7fd30106e00f\n"
"        (uffdio_copy.copy returned 4096)\n"
"Read address 0x7fd30106e00f in main(): C\n"
"Read address 0x7fd30106e40f in main(): C\n"
"Read address 0x7fd30106e80f in main(): C\n"
"Read address 0x7fd30106ec0f in main(): C\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "/* userfaultfd_demo.c\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"   Licensed under the GNU General Public License version 2 or later.\n"
"*/\n"
"#define _GNU_SOURCE\n"
"#include E<lt>err.hE<gt>\n"
"#include E<lt>errno.hE<gt>\n"
"#include E<lt>fcntl.hE<gt>\n"
"#include E<lt>inttypes.hE<gt>\n"
"#include E<lt>linux/userfaultfd.hE<gt>\n"
"#include E<lt>poll.hE<gt>\n"
"#include E<lt>pthread.hE<gt>\n"
"#include E<lt>stdio.hE<gt>\n"
"#include E<lt>stdlib.hE<gt>\n"
"#include E<lt>string.hE<gt>\n"
"#include E<lt>sys/ioctl.hE<gt>\n"
"#include E<lt>sys/mman.hE<gt>\n"
"#include E<lt>sys/syscall.hE<gt>\n"
"#include E<lt>unistd.hE<gt>\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "static int page_size;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"static void *\n"
"fault_handler_thread(void *arg)\n"
"{\n"
"    int                 nready;\n"
"    long                uffd;   /* userfaultfd file descriptor */\n"
"    ssize_t             nread;\n"
"    struct pollfd       pollfd;\n"
"    struct uffdio_copy  uffdio_copy;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    static int      fault_cnt = 0; /* Number of faults so far handled */\n"
"    static char     *page = NULL;\n"
"    static struct uffd_msg  msg;  /* Data read from userfaultfd */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    uffd = (long) arg;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    /* Create a page that will be copied into the faulting region. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    if (page == NULL) {\n"
"        page = mmap(NULL, page_size, PROT_READ | PROT_WRITE,\n"
"                    MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n"
"        if (page == MAP_FAILED)\n"
"            err(EXIT_FAILURE, \"mmap\");\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    /* Loop, handling incoming events on the userfaultfd\n"
"       file descriptor. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    for (;;) {\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "        /* See what poll() tells us about the userfaultfd. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        pollfd.fd = uffd;\n"
"        pollfd.events = POLLIN;\n"
"        nready = poll(&pollfd, 1, -1);\n"
"        if (nready == -1)\n"
"            err(EXIT_FAILURE, \"poll\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        printf(\"\\enfault_handler_thread():\\en\");\n"
"        printf(\"    poll() returns: nready = %d; \"\n"
"               \"POLLIN = %d; POLLERR = %d\\en\", nready,\n"
"               (pollfd.revents & POLLIN) != 0,\n"
"               (pollfd.revents & POLLERR) != 0);\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "        /* Read an event from the userfaultfd. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        nread = read(uffd, &msg, sizeof(msg));\n"
"        if (nread == 0) {\n"
"            printf(\"EOF on userfaultfd!\\en\");\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        if (nread == -1)\n"
"            err(EXIT_FAILURE, \"read\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "        /* We expect only one kind of event; verify that assumption. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        if (msg.event != UFFD_EVENT_PAGEFAULT) {\n"
"            fprintf(stderr, \"Unexpected event on userfaultfd\\en\");\n"
"            exit(EXIT_FAILURE);\n"
"        }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "        /* Display info about the page-fault event. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        printf(\"    UFFD_EVENT_PAGEFAULT event: \");\n"
"        printf(\"flags = %\"PRIx64\"; \", msg.arg.pagefault.flags);\n"
"        printf(\"address = %\"PRIx64\"\\en\", msg.arg.pagefault.address);\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        /* Copy the page pointed to by \\[aq]page\\[aq] into the faulting\n"
"           region. Vary the contents that are copied in, so that it\n"
"           is more obvious that each fault is handled separately. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        memset(page, \\[aq]A\\[aq] + fault_cnt % 20, page_size);\n"
"        fault_cnt++;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "        uffdio_copy.src = (unsigned long) page;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        /* We need to handle page faults in units of pages(!).\n"
"           So, round faulting address down to page boundary. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        uffdio_copy.dst = (unsigned long) msg.arg.pagefault.address &\n"
"                                           \\[ti](page_size - 1);\n"
"        uffdio_copy.len = page_size;\n"
"        uffdio_copy.mode = 0;\n"
"        uffdio_copy.copy = 0;\n"
"        if (ioctl(uffd, UFFDIO_COPY, &uffdio_copy) == -1)\n"
"            err(EXIT_FAILURE, \"ioctl-UFFDIO_COPY\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"        printf(\"        (uffdio_copy.copy returned %\"PRId64\")\\en\",\n"
"               uffdio_copy.copy);\n"
"    }\n"
"}\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"int\n"
"main(int argc, char *argv[])\n"
"{\n"
"    int        s;\n"
"    char       c;\n"
"    char       *addr;   /* Start of region handled by userfaultfd */\n"
"    long       uffd;    /* userfaultfd file descriptor */\n"
"    size_t     len, l;  /* Length of region handled by userfaultfd */\n"
"    pthread_t  thr;     /* ID of thread that handles page faults */\n"
"    struct uffdio_api       uffdio_api;\n"
"    struct uffdio_register  uffdio_register;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    if (argc != 2) {\n"
"        fprintf(stderr, \"Usage: %s num-pages\\en\", argv[0]);\n"
"        exit(EXIT_FAILURE);\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    page_size = sysconf(_SC_PAGE_SIZE);\n"
"    len = strtoull(argv[1], NULL, 0) * page_size;\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    /* Create and enable userfaultfd object. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    uffd = syscall(SYS_userfaultfd, O_CLOEXEC | O_NONBLOCK);\n"
"    if (uffd == -1)\n"
"        err(EXIT_FAILURE, \"userfaultfd\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    uffdio_api.api = UFFD_API;\n"
"    uffdio_api.features = 0;\n"
"    if (ioctl(uffd, UFFDIO_API, &uffdio_api) == -1)\n"
"        err(EXIT_FAILURE, \"ioctl-UFFDIO_API\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    /* Create a private anonymous mapping. The memory will be\n"
"       demand-zero paged--that is, not yet allocated. When we\n"
"       actually touch the memory, it will be allocated via\n"
"       the userfaultfd. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    addr = mmap(NULL, len, PROT_READ | PROT_WRITE,\n"
"                MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);\n"
"    if (addr == MAP_FAILED)\n"
"        err(EXIT_FAILURE, \"mmap\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    printf(\"Address returned by mmap() = %p\\en\", addr);\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    /* Register the memory range of the mapping we just created for\n"
"       handling by the userfaultfd object. In mode, we request to track\n"
"       missing pages (i.e., pages that have not yet been faulted in). */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    uffdio_register.range.start = (unsigned long) addr;\n"
"    uffdio_register.range.len = len;\n"
"    uffdio_register.mode = UFFDIO_REGISTER_MODE_MISSING;\n"
"    if (ioctl(uffd, UFFDIO_REGISTER, &uffdio_register) == -1)\n"
"        err(EXIT_FAILURE, \"ioctl-UFFDIO_REGISTER\");\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid "    /* Create a thread that will process the userfaultfd events. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    s = pthread_create(&thr, NULL, fault_handler_thread, (void *) uffd);\n"
"    if (s != 0) {\n"
"        errc(EXIT_FAILURE, s, \"pthread_create\");\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    /* Main thread now touches memory in the mapping, touching\n"
"       locations 1024 bytes apart. This will trigger userfaultfd\n"
"       events for all pages in the region. */\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    l = 0xf;    /* Ensure that faulting address is not on a page\n"
"                   boundary, in order to test that we correctly\n"
"                   handle that case in fault_handling_thread(). */\n"
"    while (l E<lt> len) {\n"
"        c = addr[l];\n"
"        printf(\"Read address %p in %s(): \", addr + l, __func__);\n"
"        printf(\"%c\\en\", c);\n"
"        l += 1024;\n"
"        usleep(100000);         /* Slow things down a little */\n"
"    }\n"
msgstr ""

#. type: Plain text
#: debian-bookworm opensuse-leap-15-6
#, no-wrap
msgid ""
"    exit(EXIT_SUCCESS);\n"
"}\n"
msgstr ""

#. type: TH
#: fedora-40 fedora-rawhide mageia-cauldron
#, no-wrap
msgid "2024-02-12"
msgstr ""

#. type: TH
#: fedora-40 mageia-cauldron
#, no-wrap
msgid "Linux man-pages 6.06"
msgstr ""

#. type: TH
#: fedora-rawhide
#, no-wrap
msgid "Linux man-pages 6.7"
msgstr ""

#. type: TH
#: opensuse-leap-15-6
#, no-wrap
msgid "2023-03-30"
msgstr ""

#. type: TH
#: opensuse-leap-15-6
#, no-wrap
msgid "Linux man-pages 6.04"
msgstr ""

#. type: TH
#: opensuse-tumbleweed
#, no-wrap
msgid "Linux man-pages (unreleased)"
msgstr ""