summaryrefslogtreecommitdiffstats
path: root/debian/patches/vendor/u-hurd-libc.3.patch
blob: 2d14daf98ab10e5bdf0490ef3db89d01325e345b (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
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
From: Samuel Thibault <samuel.thibault@ens-lyon.org>
Date: Thu, 9 Nov 2023 03:34:21 +0100
Subject: hurd: Complete C API interface    This aligns it on what can be
 found for linux.

---
 vendor/libc/src/unix/hurd/b32.rs |    2 +
 vendor/libc/src/unix/hurd/b64.rs |    2 +
 vendor/libc/src/unix/hurd/mod.rs | 1902 ++++++++++++++++++++++++++++++++------
 3 files changed, 1647 insertions(+), 259 deletions(-)

diff --git a/vendor/libc/src/unix/hurd/b32.rs b/vendor/libc/src/unix/hurd/b32.rs
index 7e83ed93..7e82a91 100644
--- a/vendor/libc/src/unix/hurd/b32.rs
+++ b/vendor/libc/src/unix/hurd/b32.rs
@@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_ulong;
 pub type __s64_type = ::__int64_t;
 pub type __u64_type = ::__uint64_t;
 
+pub type __ipc_pid_t = ::c_ushort;
+
 pub type Elf32_Half = u16;
 pub type Elf32_Word = u32;
 pub type Elf32_Off = u32;
diff --git a/vendor/libc/src/unix/hurd/b64.rs b/vendor/libc/src/unix/hurd/b64.rs
index 3b171f1..e2e502a 100644
--- a/vendor/libc/src/unix/hurd/b64.rs
+++ b/vendor/libc/src/unix/hurd/b64.rs
@@ -25,6 +25,8 @@ pub type __ulong32_type = ::c_uint;
 pub type __s64_type = ::c_long;
 pub type __u64_type = ::c_ulong;
 
+pub type __ipc_pid_t = ::c_int;
+
 pub type Elf64_Half = u16;
 pub type Elf64_Word = u32;
 pub type Elf64_Off = u64;
diff --git a/vendor/libc/src/unix/hurd/mod.rs b/vendor/libc/src/unix/hurd/mod.rs
index 05d7585..75a272e 100644
--- a/vendor/libc/src/unix/hurd/mod.rs
+++ b/vendor/libc/src/unix/hurd/mod.rs
@@ -215,6 +215,10 @@ pub type tcp_ca_state = ::c_uint;
 
 pub type idtype_t = ::c_uint;
 
+pub type regoff_t = ::c_int;
+
+pub type iconv_t = *mut ::c_void;
+
 // structs
 s! {
     pub struct ip_mreq {
@@ -228,6 +232,12 @@ s! {
         pub imr_ifindex: ::c_int,
     }
 
+    pub struct ip_mreq_source {
+        pub imr_multiaddr: in_addr,
+        pub imr_interface: in_addr,
+        pub imr_sourceaddr: in_addr,
+    }
+
     pub struct sockaddr {
         pub sa_len: ::c_uchar,
         pub sa_family: sa_family_t,
@@ -322,6 +332,12 @@ s! {
         pub msg_flags: ::c_int,
     }
 
+    pub struct cmsghdr {
+        pub cmsg_len: ::socklen_t,
+        pub cmsg_level: ::c_int,
+        pub cmsg_type: ::c_int,
+    }
+
     pub struct dirent {
         pub d_ino: __ino_t,
         pub d_reclen: ::c_ushort,
@@ -343,13 +359,39 @@ s! {
     }
 
     pub struct termios {
-        pub c_iflag: tcflag_t,
-        pub c_oflag: tcflag_t,
-        pub c_cflag: tcflag_t,
-        pub c_lflag: tcflag_t,
-        pub c_cc: [cc_t; 20usize],
-        pub __ispeed: speed_t,
-        pub __ospeed: speed_t,
+        pub c_iflag: ::tcflag_t,
+        pub c_oflag: ::tcflag_t,
+        pub c_cflag: ::tcflag_t,
+        pub c_lflag: ::tcflag_t,
+        pub c_cc: [::cc_t; 20usize],
+        pub __ispeed: ::speed_t,
+        pub __ospeed: ::speed_t,
+    }
+
+    pub struct mallinfo {
+        pub arena: ::c_int,
+        pub ordblks: ::c_int,
+        pub smblks: ::c_int,
+        pub hblks: ::c_int,
+        pub hblkhd: ::c_int,
+        pub usmblks: ::c_int,
+        pub fsmblks: ::c_int,
+        pub uordblks: ::c_int,
+        pub fordblks: ::c_int,
+        pub keepcost: ::c_int,
+    }
+
+    pub struct mallinfo2 {
+        pub arena: ::size_t,
+        pub ordblks: ::size_t,
+        pub smblks: ::size_t,
+        pub hblks: ::size_t,
+        pub hblkhd: ::size_t,
+        pub usmblks: ::size_t,
+        pub fsmblks: ::size_t,
+        pub uordblks: ::size_t,
+        pub fordblks: ::size_t,
+        pub keepcost: ::size_t,
     }
 
     pub struct sigaction {
@@ -429,6 +471,36 @@ s! {
         pub st_spare: [::c_int; 8usize],
     }
 
+    pub struct statx {
+        pub stx_mask: u32,
+        pub stx_blksize: u32,
+        pub stx_attributes: u64,
+        pub stx_nlink: u32,
+        pub stx_uid: u32,
+        pub stx_gid: u32,
+        pub stx_mode: u16,
+        __statx_pad1: [u16; 1],
+        pub stx_ino: u64,
+        pub stx_size: u64,
+        pub stx_blocks: u64,
+        pub stx_attributes_mask: u64,
+        pub stx_atime: ::statx_timestamp,
+        pub stx_btime: ::statx_timestamp,
+        pub stx_ctime: ::statx_timestamp,
+        pub stx_mtime: ::statx_timestamp,
+        pub stx_rdev_major: u32,
+        pub stx_rdev_minor: u32,
+        pub stx_dev_major: u32,
+        pub stx_dev_minor: u32,
+        __statx_pad2: [u64; 14],
+    }
+
+    pub struct statx_timestamp {
+        pub tv_sec: i64,
+        pub tv_nsec: u32,
+        pub __statx_timestamp_pad1: [i32; 1],
+    }
+
     pub struct statfs {
         pub f_type: ::c_uint,
         pub f_bsize: ::c_ulong,
@@ -493,6 +565,24 @@ s! {
         pub f_spare: [::c_uint; 3usize],
     }
 
+    pub struct aiocb {
+        pub aio_fildes: ::c_int,
+        pub aio_lio_opcode: ::c_int,
+        pub aio_reqprio: ::c_int,
+        pub aio_buf: *mut ::c_void,
+        pub aio_nbytes: ::size_t,
+        pub aio_sigevent: ::sigevent,
+        __next_prio: *mut aiocb,
+        __abs_prio: ::c_int,
+        __policy: ::c_int,
+        __error_code: ::c_int,
+        __return_value: ::ssize_t,
+        pub aio_offset: off_t,
+        #[cfg(all(not(target_arch = "x86_64"), target_pointer_width = "32"))]
+        __unused1: [::c_char; 4],
+        __glibc_reserved: [::c_char; 32]
+    }
+
     #[cfg_attr(target_pointer_width = "32",
                repr(align(4)))]
     #[cfg_attr(target_pointer_width = "64",
@@ -549,7 +639,7 @@ s! {
     }
 
     pub struct __pthread_attr {
-        pub __schedparam: __sched_param,
+        pub __schedparam: sched_param,
         pub __stackaddr: *mut ::c_void,
         pub __stacksize: size_t,
         pub __guardsize: size_t,
@@ -578,12 +668,25 @@ s! {
         pub __data: *mut ::c_void,
     }
 
+    pub struct seminfo {
+        pub semmap: ::c_int,
+        pub semmni: ::c_int,
+        pub semmns: ::c_int,
+        pub semmnu: ::c_int,
+        pub semmsl: ::c_int,
+        pub semopm: ::c_int,
+        pub semume: ::c_int,
+        pub semusz: ::c_int,
+        pub semvmx: ::c_int,
+        pub semaem: ::c_int,
+    }
+
     pub struct _IO_FILE {
         _unused: [u8; 0],
     }
 
-    pub struct __sched_param {
-        pub __sched_priority: ::c_int,
+    pub struct sched_param {
+        pub sched_priority: ::c_int,
     }
 
     pub struct iovec {
@@ -601,6 +704,23 @@ s! {
         pub pw_shell: *mut ::c_char,
     }
 
+    pub struct spwd {
+        pub sp_namp: *mut ::c_char,
+        pub sp_pwdp: *mut ::c_char,
+        pub sp_lstchg: ::c_long,
+        pub sp_min: ::c_long,
+        pub sp_max: ::c_long,
+        pub sp_warn: ::c_long,
+        pub sp_inact: ::c_long,
+        pub sp_expire: ::c_long,
+        pub sp_flag: ::c_ulong,
+    }
+
+    pub struct itimerspec {
+        pub it_interval: ::timespec,
+        pub it_value: ::timespec,
+    }
+
     pub struct tm {
         pub tm_sec: ::c_int,
         pub tm_min: ::c_int,
@@ -649,6 +769,59 @@ s! {
         pub dli_saddr: *mut ::c_void,
     }
 
+    pub struct ifaddrs {
+        pub ifa_next: *mut ifaddrs,
+        pub ifa_name: *mut c_char,
+        pub ifa_flags: ::c_uint,
+        pub ifa_addr: *mut ::sockaddr,
+        pub ifa_netmask: *mut ::sockaddr,
+        pub ifa_ifu: *mut ::sockaddr, // FIXME This should be a union
+        pub ifa_data: *mut ::c_void
+    }
+
+    pub struct arpreq {
+        pub arp_pa: ::sockaddr,
+        pub arp_ha: ::sockaddr,
+        pub arp_flags: ::c_int,
+        pub arp_netmask: ::sockaddr,
+        pub arp_dev: [::c_char; 16],
+    }
+
+    pub struct arpreq_old {
+        pub arp_pa: ::sockaddr,
+        pub arp_ha: ::sockaddr,
+        pub arp_flags: ::c_int,
+        pub arp_netmask: ::sockaddr,
+    }
+
+    pub struct arphdr {
+        pub ar_hrd: u16,
+        pub ar_pro: u16,
+        pub ar_hln: u8,
+        pub ar_pln: u8,
+        pub ar_op: u16,
+    }
+
+    pub struct arpd_request {
+        pub req: ::c_ushort,
+        pub ip: u32,
+        pub dev: ::c_ulong,
+        pub stamp: ::c_ulong,
+        pub updated: ::c_ulong,
+        pub ha: [::c_uchar; ::MAX_ADDR_LEN],
+    }
+
+    pub struct mmsghdr {
+        pub msg_hdr: ::msghdr,
+        pub msg_len: ::c_uint,
+    }
+
+    pub struct ifreq {
+        /// interface name, e.g. "en0"
+        pub ifr_name: [::c_char; ::IFNAMSIZ],
+        pub ifr_ifru: ::sockaddr,
+    }
+
     pub struct __locale_struct {
         pub __locales: [*mut __locale_data; 13usize],
         pub __ctype_b: *const ::c_ushort,
@@ -715,6 +888,114 @@ s! {
         pub l_len : __off64_t,
         pub l_pid : __pid_t,
     }
+
+    pub struct glob_t {
+        pub gl_pathc: ::size_t,
+        pub gl_pathv: *mut *mut c_char,
+        pub gl_offs: ::size_t,
+        pub gl_flags: ::c_int,
+
+        __unused1: *mut ::c_void,
+        __unused2: *mut ::c_void,
+        __unused3: *mut ::c_void,
+        __unused4: *mut ::c_void,
+        __unused5: *mut ::c_void,
+    }
+
+    pub struct glob64_t {
+        pub gl_pathc: ::size_t,
+        pub gl_pathv: *mut *mut ::c_char,
+        pub gl_offs: ::size_t,
+        pub gl_flags: ::c_int,
+
+        __unused1: *mut ::c_void,
+        __unused2: *mut ::c_void,
+        __unused3: *mut ::c_void,
+        __unused4: *mut ::c_void,
+        __unused5: *mut ::c_void,
+    }
+
+    pub struct regex_t {
+        __buffer: *mut ::c_void,
+        __allocated: ::size_t,
+        __used: ::size_t,
+        __syntax: ::c_ulong,
+        __fastmap: *mut ::c_char,
+        __translate: *mut ::c_char,
+        __re_nsub: ::size_t,
+        __bitfield: u8,
+    }
+
+    pub struct cpu_set_t {
+        #[cfg(all(target_pointer_width = "32",
+                  not(target_arch = "x86_64")))]
+        bits: [u32; 32],
+        #[cfg(not(all(target_pointer_width = "32",
+                      not(target_arch = "x86_64"))))]
+        bits: [u64; 16],
+    }
+
+    pub struct if_nameindex {
+        pub if_index: ::c_uint,
+        pub if_name: *mut ::c_char,
+    }
+
+    // System V IPC
+    pub struct msginfo {
+        pub msgpool: ::c_int,
+        pub msgmap: ::c_int,
+        pub msgmax: ::c_int,
+        pub msgmnb: ::c_int,
+        pub msgmni: ::c_int,
+        pub msgssz: ::c_int,
+        pub msgtql: ::c_int,
+        pub msgseg: ::c_ushort,
+    }
+
+    pub struct sembuf {
+        pub sem_num: ::c_ushort,
+        pub sem_op: ::c_short,
+        pub sem_flg: ::c_short,
+    }
+
+    pub struct mntent {
+        pub mnt_fsname: *mut ::c_char,
+        pub mnt_dir: *mut ::c_char,
+        pub mnt_type: *mut ::c_char,
+        pub mnt_opts: *mut ::c_char,
+        pub mnt_freq: ::c_int,
+        pub mnt_passno: ::c_int,
+    }
+
+    pub struct posix_spawn_file_actions_t {
+        __allocated: ::c_int,
+        __used: ::c_int,
+        __actions: *mut ::c_int,
+        __pad: [::c_int; 16],
+    }
+
+    pub struct posix_spawnattr_t {
+        __flags: ::c_short,
+        __pgrp: ::pid_t,
+        __sd: ::sigset_t,
+        __ss: ::sigset_t,
+        __sp: ::sched_param,
+        __policy: ::c_int,
+        __pad: [::c_int; 16],
+    }
+
+    pub struct regmatch_t {
+        pub rm_so: regoff_t,
+        pub rm_eo: regoff_t,
+    }
+
+    pub struct option {
+        pub name: *const ::c_char,
+        pub has_arg: ::c_int,
+        pub flag: *mut ::c_int,
+        pub val: ::c_int,
+    }
+
 }
 
 impl siginfo_t {
@@ -740,16 +1021,69 @@ impl siginfo_t {
 }
 
 // const
-pub const IPOPT_COPY: u8 = 0x80;
-pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
-pub const IPOPT_CLASS_MASK: u8 = 0x60;
-pub const IPTOS_ECN_MASK: u8 = 0x03;
-pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
 
+// aio.h
+pub const AIO_CANCELED: ::c_int = 0;
+pub const AIO_NOTCANCELED: ::c_int = 1;
+pub const AIO_ALLDONE: ::c_int = 2;
+pub const LIO_READ: ::c_int = 0;
+pub const LIO_WRITE: ::c_int = 1;
+pub const LIO_NOP: ::c_int = 2;
+pub const LIO_WAIT: ::c_int = 0;
+pub const LIO_NOWAIT: ::c_int = 1;
+
+// glob.h
+pub const GLOB_ERR: ::c_int = 1 << 0;
+pub const GLOB_MARK: ::c_int = 1 << 1;
+pub const GLOB_NOSORT: ::c_int = 1 << 2;
+pub const GLOB_DOOFFS: ::c_int = 1 << 3;
+pub const GLOB_NOCHECK: ::c_int = 1 << 4;
+pub const GLOB_APPEND: ::c_int = 1 << 5;
+pub const GLOB_NOESCAPE: ::c_int = 1 << 6;
+
+pub const GLOB_NOSPACE: ::c_int = 1;
+pub const GLOB_ABORTED: ::c_int = 2;
+pub const GLOB_NOMATCH: ::c_int = 3;
+
+pub const GLOB_PERIOD: ::c_int = 1 << 7;
+pub const GLOB_ALTDIRFUNC: ::c_int = 1 << 9;
+pub const GLOB_BRACE: ::c_int = 1 << 10;
+pub const GLOB_NOMAGIC: ::c_int = 1 << 11;
+pub const GLOB_TILDE: ::c_int = 1 << 12;
+pub const GLOB_ONLYDIR: ::c_int = 1 << 13;
+pub const GLOB_TILDE_CHECK: ::c_int = 1 << 14;
+
+// ipc.h
+pub const IPC_PRIVATE: ::key_t = 0;
+
+pub const IPC_CREAT: ::c_int = 0o1000;
+pub const IPC_EXCL: ::c_int = 0o2000;
+pub const IPC_NOWAIT: ::c_int = 0o4000;
+
+pub const IPC_RMID: ::c_int = 0;
+pub const IPC_SET: ::c_int = 1;
+pub const IPC_STAT: ::c_int = 2;
+pub const IPC_INFO: ::c_int = 3;
+pub const MSG_STAT: ::c_int = 11;
+pub const MSG_INFO: ::c_int = 12;
+
+pub const MSG_NOERROR: ::c_int = 0o10000;
+pub const MSG_EXCEPT: ::c_int = 0o20000;
+
+// shm.h
+pub const SHM_R: ::c_int = 0o400;
+pub const SHM_W: ::c_int = 0o200;
+
+pub const SHM_RDONLY: ::c_int = 0o10000;
+pub const SHM_RND: ::c_int = 0o20000;
+pub const SHM_REMAP: ::c_int = 0o40000;
+
+pub const SHM_LOCK: ::c_int = 11;
+pub const SHM_UNLOCK: ::c_int = 12;
 // unistd.h
-pub const STDIN_FILENO: c_long = 0;
-pub const STDOUT_FILENO: c_long = 1;
-pub const STDERR_FILENO: c_long = 2;
+pub const STDIN_FILENO: ::c_int = 0;
+pub const STDOUT_FILENO: ::c_int = 1;
+pub const STDERR_FILENO: ::c_int = 2;
 pub const __FD_SETSIZE: usize = 256;
 pub const R_OK: ::c_int = 4;
 pub const W_OK: ::c_int = 2;
@@ -769,6 +1103,9 @@ pub const F_TLOCK: ::c_int = 2;
 pub const F_TEST: ::c_int = 3;
 pub const CLOSE_RANGE_CLOEXEC: ::c_int = 4;
 
+// stdio.h
+pub const EOF: ::c_int = -1;
+
 // stdlib.h
 pub const WNOHANG: ::c_int = 1;
 pub const WUNTRACED: ::c_int = 2;
@@ -884,8 +1221,17 @@ pub const _SS_SIZE: usize = 128;
 pub const CMGROUP_MAX: usize = 16;
 pub const SOL_SOCKET: ::c_int = 65535;
 
+// sys/time.h
+pub const ITIMER_REAL: ::c_int = 0;
+pub const ITIMER_VIRTUAL: ::c_int = 1;
+pub const ITIMER_PROF: ::c_int = 2;
+
 // netinet/in.h
 pub const SOL_IP: ::c_int = 0;
+pub const SOL_TCP: ::c_int = 6;
+pub const SOL_UDP: ::c_int = 17;
+pub const SOL_IPV6: ::c_int = 41;
+pub const SOL_ICMPV6: ::c_int = 58;
 pub const IP_OPTIONS: ::c_int = 1;
 pub const IP_HDRINCL: ::c_int = 2;
 pub const IP_TOS: ::c_int = 3;
@@ -899,8 +1245,6 @@ pub const IP_MULTICAST_TTL: ::c_int = 10;
 pub const IP_MULTICAST_LOOP: ::c_int = 11;
 pub const IP_ADD_MEMBERSHIP: ::c_int = 12;
 pub const IP_DROP_MEMBERSHIP: ::c_int = 13;
-pub const SOL_IPV6: ::c_int = 41;
-pub const SOL_ICMPV6: ::c_int = 58;
 pub const IPV6_ADDRFORM: ::c_int = 1;
 pub const IPV6_2292PKTINFO: ::c_int = 2;
 pub const IPV6_2292HOPOPTS: ::c_int = 3;
@@ -965,6 +1309,134 @@ pub const IN_LOOPBACKNET: u32 = 127;
 pub const INET_ADDRSTRLEN: usize = 16;
 pub const INET6_ADDRSTRLEN: usize = 46;
 
+// netinet/ip.h
+pub const IPTOS_ECN_MASK: u8 = 0x03;
+
+pub const IPTOS_LOWDELAY: u8 = 0x10;
+pub const IPTOS_THROUGHPUT: u8 = 0x08;
+pub const IPTOS_RELIABILITY: u8 = 0x04;
+pub const IPTOS_MINCOST: u8 = 0x02;
+
+pub const IPTOS_PREC_NETCONTROL: u8 = 0xe0;
+pub const IPTOS_PREC_INTERNETCONTROL: u8 = 0xc0;
+pub const IPTOS_PREC_CRITIC_ECP: u8 = 0xa0;
+pub const IPTOS_PREC_FLASHOVERRIDE: u8 = 0x80;
+pub const IPTOS_PREC_FLASH: u8 = 0x60;
+pub const IPTOS_PREC_IMMEDIATE: u8 = 0x40;
+pub const IPTOS_PREC_PRIORITY: u8 = 0x20;
+pub const IPTOS_PREC_ROUTINE: u8 = 0x00;
+
+pub const IPTOS_ECN_MASK: u8 = 0x03;
+pub const IPTOS_ECN_ECT1: u8 = 0x01;
+pub const IPTOS_ECN_ECT0: u8 = 0x02;
+pub const IPTOS_ECN_CE: u8 = 0x03;
+
+pub const IPOPT_COPY: u8 = 0x80;
+pub const IPOPT_CLASS_MASK: u8 = 0x60;
+pub const IPOPT_NUMBER_MASK: u8 = 0x1f;
+
+pub const IPOPT_CONTROL: u8 = 0x00;
+pub const IPOPT_RESERVED1: u8 = 0x20;
+pub const IPOPT_MEASUREMENT: u8 = 0x40;
+pub const IPOPT_RESERVED2: u8 = 0x60;
+pub const IPOPT_END: u8 = 0 | IPOPT_CONTROL;
+pub const IPOPT_NOOP: u8 = 1 | IPOPT_CONTROL;
+pub const IPOPT_SEC: u8 = 2 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_LSRR: u8 = 3 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_TIMESTAMP: u8 = 4 | IPOPT_MEASUREMENT;
+pub const IPOPT_RR: u8 = 7 | IPOPT_CONTROL;
+pub const IPOPT_SID: u8 = 8 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_SSRR: u8 = 9 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPOPT_RA: u8 = 20 | IPOPT_CONTROL | IPOPT_COPY;
+pub const IPVERSION: u8 = 4;
+pub const MAXTTL: u8 = 255;
+pub const IPDEFTTL: u8 = 64;
+pub const IPOPT_OPTVAL: u8 = 0;
+pub const IPOPT_OLEN: u8 = 1;
+pub const IPOPT_OFFSET: u8 = 2;
+pub const IPOPT_MINOFF: u8 = 4;
+pub const MAX_IPOPTLEN: u8 = 40;
+pub const IPOPT_NOP: u8 = IPOPT_NOOP;
+pub const IPOPT_EOL: u8 = IPOPT_END;
+pub const IPOPT_TS: u8 = IPOPT_TIMESTAMP;
+pub const IPOPT_TS_TSONLY: u8 = 0;
+pub const IPOPT_TS_TSANDADDR: u8 = 1;
+pub const IPOPT_TS_PRESPEC: u8 = 3;
+
+// net/if_arp.h
+pub const ARPOP_REQUEST: u16 = 1;
+pub const ARPOP_REPLY: u16 = 2;
+pub const ARPOP_RREQUEST: u16 = 3;
+pub const ARPOP_RREPLY: u16 = 4;
+pub const ARPOP_InREQUEST: u16 = 8;
+pub const ARPOP_InREPLY: u16 = 9;
+pub const ARPOP_NAK: u16 = 10;
+
+pub const ATF_NETMASK: ::c_int = 0x20;
+pub const ATF_DONTPUB: ::c_int = 0x40;
+
+pub const ARPHRD_NETROM: u16 = 0;
+pub const ARPHRD_ETHER: u16 = 1;
+pub const ARPHRD_EETHER: u16 = 2;
+pub const ARPHRD_AX25: u16 = 3;
+pub const ARPHRD_PRONET: u16 = 4;
+pub const ARPHRD_CHAOS: u16 = 5;
+pub const ARPHRD_IEEE802: u16 = 6;
+pub const ARPHRD_ARCNET: u16 = 7;
+pub const ARPHRD_APPLETLK: u16 = 8;
+pub const ARPHRD_DLCI: u16 = 15;
+pub const ARPHRD_ATM: u16 = 19;
+pub const ARPHRD_METRICOM: u16 = 23;
+pub const ARPHRD_IEEE1394: u16 = 24;
+pub const ARPHRD_EUI64: u16 = 27;
+pub const ARPHRD_INFINIBAND: u16 = 32;
+
+pub const ARPHRD_SLIP: u16 = 256;
+pub const ARPHRD_CSLIP: u16 = 257;
+pub const ARPHRD_SLIP6: u16 = 258;
+pub const ARPHRD_CSLIP6: u16 = 259;
+pub const ARPHRD_RSRVD: u16 = 260;
+pub const ARPHRD_ADAPT: u16 = 264;
+pub const ARPHRD_ROSE: u16 = 270;
+pub const ARPHRD_X25: u16 = 271;
+pub const ARPHRD_HWX25: u16 = 272;
+pub const ARPHRD_CAN: u16 = 280;
+pub const ARPHRD_PPP: u16 = 512;
+pub const ARPHRD_CISCO: u16 = 513;
+pub const ARPHRD_HDLC: u16 = ARPHRD_CISCO;
+pub const ARPHRD_LAPB: u16 = 516;
+pub const ARPHRD_DDCMP: u16 = 517;
+pub const ARPHRD_RAWHDLC: u16 = 518;
+
+pub const ARPHRD_TUNNEL: u16 = 768;
+pub const ARPHRD_TUNNEL6: u16 = 769;
+pub const ARPHRD_FRAD: u16 = 770;
+pub const ARPHRD_SKIP: u16 = 771;
+pub const ARPHRD_LOOPBACK: u16 = 772;
+pub const ARPHRD_LOCALTLK: u16 = 773;
+pub const ARPHRD_FDDI: u16 = 774;
+pub const ARPHRD_BIF: u16 = 775;
+pub const ARPHRD_SIT: u16 = 776;
+pub const ARPHRD_IPDDP: u16 = 777;
+pub const ARPHRD_IPGRE: u16 = 778;
+pub const ARPHRD_PIMREG: u16 = 779;
+pub const ARPHRD_HIPPI: u16 = 780;
+pub const ARPHRD_ASH: u16 = 781;
+pub const ARPHRD_ECONET: u16 = 782;
+pub const ARPHRD_IRDA: u16 = 783;
+pub const ARPHRD_FCPP: u16 = 784;
+pub const ARPHRD_FCAL: u16 = 785;
+pub const ARPHRD_FCPL: u16 = 786;
+pub const ARPHRD_FCFABRIC: u16 = 787;
+pub const ARPHRD_IEEE802_TR: u16 = 800;
+pub const ARPHRD_IEEE80211: u16 = 801;
+pub const ARPHRD_IEEE80211_PRISM: u16 = 802;
+pub const ARPHRD_IEEE80211_RADIOTAP: u16 = 803;
+pub const ARPHRD_IEEE802154: u16 = 804;
+
+pub const ARPHRD_VOID: u16 = 0xFFFF;
+pub const ARPHRD_NONE: u16 = 0xFFFE;
+
 // bits/posix1_lim.h
 pub const _POSIX_AIO_LISTIO_MAX: usize = 2;
 pub const _POSIX_AIO_MAX: usize = 1;
@@ -1063,13 +1535,13 @@ pub const NI_DGRAM: ::c_int = 16;
 pub const NI_IDN: ::c_int = 32;
 
 // time.h
-pub const CLOCK_REALTIME: clockid_t = 0;
-pub const CLOCK_MONOTONIC: clockid_t = 1;
-pub const CLOCK_PROCESS_CPUTIME_ID: clockid_t = 2;
-pub const CLOCK_THREAD_CPUTIME_ID: clockid_t = 3;
-pub const CLOCK_MONOTONIC_RAW: clockid_t = 4;
-pub const CLOCK_REALTIME_COARSE: clockid_t = 5;
-pub const CLOCK_MONOTONIC_COARSE: clockid_t = 6;
+pub const CLOCK_REALTIME: ::clockid_t = 0;
+pub const CLOCK_MONOTONIC: ::clockid_t = 1;
+pub const CLOCK_PROCESS_CPUTIME_ID: ::clockid_t = 2;
+pub const CLOCK_THREAD_CPUTIME_ID: ::clockid_t = 3;
+pub const CLOCK_MONOTONIC_RAW: ::clockid_t = 4;
+pub const CLOCK_REALTIME_COARSE: ::clockid_t = 5;
+pub const CLOCK_MONOTONIC_COARSE: ::clockid_t = 6;
 pub const TIMER_ABSTIME: ::c_int = 1;
 pub const TIME_UTC: ::c_int = 1;
 
@@ -1126,155 +1598,169 @@ pub const LC_MEASUREMENT_MASK: ::c_int = 2048;
 pub const LC_IDENTIFICATION_MASK: ::c_int = 4096;
 pub const LC_ALL_MASK: ::c_int = 8127;
 
+// reboot.h
+pub const RB_AUTOBOOT: ::c_int = 0x0;
+pub const RB_ASKNAME: ::c_int = 0x1;
+pub const RB_SINGLE: ::c_int = 0x2;
+pub const RB_KBD: ::c_int = 0x4;
+pub const RB_HALT: ::c_int = 0x8;
+pub const RB_INITNAME: ::c_int = 0x10;
+pub const RB_DFLTROOT: ::c_int = 0x20;
+pub const RB_NOBOOTRC: ::c_int = 0x20;
+pub const RB_ALTBOOT: ::c_int = 0x40;
+pub const RB_UNIPROC: ::c_int = 0x80;
+pub const RB_DEBUGGER: ::c_int = 0x1000;
+
 // semaphore.h
 pub const __SIZEOF_SEM_T: usize = 20;
+pub const SEM_FAILED: *mut ::sem_t = 0 as *mut sem_t;
 
 // termios.h
-pub const IGNBRK: tcflag_t = 1;
-pub const BRKINT: tcflag_t = 2;
-pub const IGNPAR: tcflag_t = 4;
-pub const PARMRK: tcflag_t = 8;
-pub const INPCK: tcflag_t = 16;
-pub const ISTRIP: tcflag_t = 32;
-pub const INLCR: tcflag_t = 64;
-pub const IGNCR: tcflag_t = 128;
-pub const ICRNL: tcflag_t = 256;
-pub const IXON: tcflag_t = 512;
-pub const IXOFF: tcflag_t = 1024;
-pub const IXANY: tcflag_t = 2048;
-pub const IMAXBEL: tcflag_t = 8192;
-pub const IUCLC: tcflag_t = 16384;
-pub const OPOST: tcflag_t = 1;
-pub const ONLCR: tcflag_t = 2;
-pub const ONOEOT: tcflag_t = 8;
-pub const OCRNL: tcflag_t = 16;
-pub const ONOCR: tcflag_t = 32;
-pub const ONLRET: tcflag_t = 64;
-pub const NLDLY: tcflag_t = 768;
-pub const NL0: tcflag_t = 0;
-pub const NL1: tcflag_t = 256;
-pub const TABDLY: tcflag_t = 3076;
-pub const TAB0: tcflag_t = 0;
-pub const TAB1: tcflag_t = 1024;
-pub const TAB2: tcflag_t = 2048;
-pub const TAB3: tcflag_t = 4;
-pub const CRDLY: tcflag_t = 12288;
-pub const CR0: tcflag_t = 0;
-pub const CR1: tcflag_t = 4096;
-pub const CR2: tcflag_t = 8192;
-pub const CR3: tcflag_t = 12288;
-pub const FFDLY: tcflag_t = 16384;
-pub const FF0: tcflag_t = 0;
-pub const FF1: tcflag_t = 16384;
-pub const BSDLY: tcflag_t = 32768;
-pub const BS0: tcflag_t = 0;
-pub const BS1: tcflag_t = 32768;
-pub const VTDLY: tcflag_t = 65536;
-pub const VT0: tcflag_t = 0;
-pub const VT1: tcflag_t = 65536;
-pub const OLCUC: tcflag_t = 131072;
-pub const OFILL: tcflag_t = 262144;
-pub const OFDEL: tcflag_t = 524288;
-pub const CIGNORE: tcflag_t = 1;
-pub const CSIZE: tcflag_t = 768;
-pub const CS5: tcflag_t = 0;
-pub const CS6: tcflag_t = 256;
-pub const CS7: tcflag_t = 512;
-pub const CS8: tcflag_t = 768;
-pub const CSTOPB: tcflag_t = 1024;
-pub const CREAD: tcflag_t = 2048;
-pub const PARENB: tcflag_t = 4096;
-pub const PARODD: tcflag_t = 8192;
-pub const HUPCL: tcflag_t = 16384;
-pub const CLOCAL: tcflag_t = 32768;
-pub const CRTSCTS: tcflag_t = 65536;
-pub const CRTS_IFLOW: tcflag_t = 65536;
-pub const CCTS_OFLOW: tcflag_t = 65536;
-pub const CDTRCTS: tcflag_t = 131072;
-pub const MDMBUF: tcflag_t = 1048576;
-pub const CHWFLOW: tcflag_t = 1245184;
-pub const ECHOKE: tcflag_t = 1;
-pub const _ECHOE: tcflag_t = 2;
-pub const ECHOE: tcflag_t = 2;
-pub const _ECHOK: tcflag_t = 4;
-pub const ECHOK: tcflag_t = 4;
-pub const _ECHO: tcflag_t = 8;
-pub const ECHO: tcflag_t = 8;
-pub const _ECHONL: tcflag_t = 16;
-pub const ECHONL: tcflag_t = 16;
-pub const ECHOPRT: tcflag_t = 32;
-pub const ECHOCTL: tcflag_t = 64;
-pub const _ISIG: tcflag_t = 128;
-pub const ISIG: tcflag_t = 128;
-pub const _ICANON: tcflag_t = 256;
-pub const ICANON: tcflag_t = 256;
-pub const ALTWERASE: tcflag_t = 512;
-pub const _IEXTEN: tcflag_t = 1024;
-pub const IEXTEN: tcflag_t = 1024;
-pub const EXTPROC: tcflag_t = 2048;
-pub const _TOSTOP: tcflag_t = 4194304;
-pub const TOSTOP: tcflag_t = 4194304;
-pub const FLUSHO: tcflag_t = 8388608;
-pub const NOKERNINFO: tcflag_t = 33554432;
-pub const PENDIN: tcflag_t = 536870912;
-pub const _NOFLSH: tcflag_t = 2147483648;
-pub const NOFLSH: tcflag_t = 2147483648;
-pub const VEOF: cc_t = 0;
-pub const VEOL: cc_t = 1;
-pub const VEOL2: cc_t = 2;
-pub const VERASE: cc_t = 3;
-pub const VWERASE: cc_t = 4;
-pub const VKILL: cc_t = 5;
-pub const VREPRINT: cc_t = 6;
-pub const VINTR: cc_t = 8;
-pub const VQUIT: cc_t = 9;
-pub const VSUSP: cc_t = 10;
-pub const VDSUSP: cc_t = 11;
-pub const VSTART: cc_t = 12;
-pub const VSTOP: cc_t = 13;
-pub const VLNEXT: cc_t = 14;
-pub const VDISCARD: cc_t = 15;
-pub const VMIN: cc_t = 16;
-pub const VTIME: cc_t = 17;
-pub const VSTATUS: cc_t = 18;
+pub const IGNBRK: ::tcflag_t = 1;
+pub const BRKINT: ::tcflag_t = 2;
+pub const IGNPAR: ::tcflag_t = 4;
+pub const PARMRK: ::tcflag_t = 8;
+pub const INPCK: ::tcflag_t = 16;
+pub const ISTRIP: ::tcflag_t = 32;
+pub const INLCR: ::tcflag_t = 64;
+pub const IGNCR: ::tcflag_t = 128;
+pub const ICRNL: ::tcflag_t = 256;
+pub const IXON: ::tcflag_t = 512;
+pub const IXOFF: ::tcflag_t = 1024;
+pub const IXANY: ::tcflag_t = 2048;
+pub const IMAXBEL: ::tcflag_t = 8192;
+pub const IUCLC: ::tcflag_t = 16384;
+pub const OPOST: ::tcflag_t = 1;
+pub const ONLCR: ::tcflag_t = 2;
+pub const ONOEOT: ::tcflag_t = 8;
+pub const OCRNL: ::tcflag_t = 16;
+pub const ONOCR: ::tcflag_t = 32;
+pub const ONLRET: ::tcflag_t = 64;
+pub const NLDLY: ::tcflag_t = 768;
+pub const NL0: ::tcflag_t = 0;
+pub const NL1: ::tcflag_t = 256;
+pub const TABDLY: ::tcflag_t = 3076;
+pub const TAB0: ::tcflag_t = 0;
+pub const TAB1: ::tcflag_t = 1024;
+pub const TAB2: ::tcflag_t = 2048;
+pub const TAB3: ::tcflag_t = 4;
+pub const CRDLY: ::tcflag_t = 12288;
+pub const CR0: ::tcflag_t = 0;
+pub const CR1: ::tcflag_t = 4096;
+pub const CR2: ::tcflag_t = 8192;
+pub const CR3: ::tcflag_t = 12288;
+pub const FFDLY: ::tcflag_t = 16384;
+pub const FF0: ::tcflag_t = 0;
+pub const FF1: ::tcflag_t = 16384;
+pub const BSDLY: ::tcflag_t = 32768;
+pub const BS0: ::tcflag_t = 0;
+pub const BS1: ::tcflag_t = 32768;
+pub const VTDLY: ::tcflag_t = 65536;
+pub const VT0: ::tcflag_t = 0;
+pub const VT1: ::tcflag_t = 65536;
+pub const OLCUC: ::tcflag_t = 131072;
+pub const OFILL: ::tcflag_t = 262144;
+pub const OFDEL: ::tcflag_t = 524288;
+pub const CIGNORE: ::tcflag_t = 1;
+pub const CSIZE: ::tcflag_t = 768;
+pub const CS5: ::tcflag_t = 0;
+pub const CS6: ::tcflag_t = 256;
+pub const CS7: ::tcflag_t = 512;
+pub const CS8: ::tcflag_t = 768;
+pub const CSTOPB: ::tcflag_t = 1024;
+pub const CREAD: ::tcflag_t = 2048;
+pub const PARENB: ::tcflag_t = 4096;
+pub const PARODD: ::tcflag_t = 8192;
+pub const HUPCL: ::tcflag_t = 16384;
+pub const CLOCAL: ::tcflag_t = 32768;
+pub const CRTSCTS: ::tcflag_t = 65536;
+pub const CRTS_IFLOW: ::tcflag_t = 65536;
+pub const CCTS_OFLOW: ::tcflag_t = 65536;
+pub const CDTRCTS: ::tcflag_t = 131072;
+pub const MDMBUF: ::tcflag_t = 1048576;
+pub const CHWFLOW: ::tcflag_t = 1245184;
+pub const ECHOKE: ::tcflag_t = 1;
+pub const _ECHOE: ::tcflag_t = 2;
+pub const ECHOE: ::tcflag_t = 2;
+pub const _ECHOK: ::tcflag_t = 4;
+pub const ECHOK: ::tcflag_t = 4;
+pub const _ECHO: ::tcflag_t = 8;
+pub const ECHO: ::tcflag_t = 8;
+pub const _ECHONL: ::tcflag_t = 16;
+pub const ECHONL: ::tcflag_t = 16;
+pub const ECHOPRT: ::tcflag_t = 32;
+pub const ECHOCTL: ::tcflag_t = 64;
+pub const _ISIG: ::tcflag_t = 128;
+pub const ISIG: ::tcflag_t = 128;
+pub const _ICANON: ::tcflag_t = 256;
+pub const ICANON: ::tcflag_t = 256;
+pub const ALTWERASE: ::tcflag_t = 512;
+pub const _IEXTEN: ::tcflag_t = 1024;
+pub const IEXTEN: ::tcflag_t = 1024;
+pub const EXTPROC: ::tcflag_t = 2048;
+pub const _TOSTOP: ::tcflag_t = 4194304;
+pub const TOSTOP: ::tcflag_t = 4194304;
+pub const FLUSHO: ::tcflag_t = 8388608;
+pub const NOKERNINFO: ::tcflag_t = 33554432;
+pub const PENDIN: ::tcflag_t = 536870912;
+pub const _NOFLSH: ::tcflag_t = 2147483648;
+pub const NOFLSH: ::tcflag_t = 2147483648;
+pub const VEOF: usize = 0;
+pub const VEOL: usize = 1;
+pub const VEOL2: usize = 2;
+pub const VERASE: usize = 3;
+pub const VWERASE: usize = 4;
+pub const VKILL: usize = 5;
+pub const VREPRINT: usize = 6;
+pub const VINTR: usize = 8;
+pub const VQUIT: usize = 9;
+pub const VSUSP: usize = 10;
+pub const VDSUSP: usize = 11;
+pub const VSTART: usize = 12;
+pub const VSTOP: usize = 13;
+pub const VLNEXT: usize = 14;
+pub const VDISCARD: usize = 15;
+pub const VMIN: usize = 16;
+pub const VTIME: usize = 17;
+pub const VSTATUS: usize = 18;
 pub const NCCS: usize = 20;
-pub const B0: speed_t = 0;
-pub const B50: speed_t = 50;
-pub const B75: speed_t = 75;
-pub const B110: speed_t = 110;
-pub const B134: speed_t = 134;
-pub const B150: speed_t = 150;
-pub const B200: speed_t = 200;
-pub const B300: speed_t = 300;
-pub const B600: speed_t = 600;
-pub const B1200: speed_t = 1200;
-pub const B1800: speed_t = 1800;
-pub const B2400: speed_t = 2400;
-pub const B4800: speed_t = 4800;
-pub const B9600: speed_t = 9600;
-pub const B7200: speed_t = 7200;
-pub const B14400: speed_t = 14400;
-pub const B19200: speed_t = 19200;
-pub const B28800: speed_t = 28800;
-pub const B38400: speed_t = 38400;
-pub const EXTA: speed_t = 19200;
-pub const EXTB: speed_t = 38400;
-pub const B57600: speed_t = 57600;
-pub const B76800: speed_t = 76800;
-pub const B115200: speed_t = 115200;
-pub const B230400: speed_t = 230400;
-pub const B460800: speed_t = 460800;
-pub const B500000: speed_t = 500000;
-pub const B576000: speed_t = 576000;
-pub const B921600: speed_t = 921600;
-pub const B1000000: speed_t = 1000000;
-pub const B1152000: speed_t = 1152000;
-pub const B1500000: speed_t = 1500000;
-pub const B2000000: speed_t = 2000000;
-pub const B2500000: speed_t = 2500000;
-pub const B3000000: speed_t = 3000000;
-pub const B3500000: speed_t = 3500000;
-pub const B4000000: speed_t = 4000000;
+pub const B0: ::speed_t = 0;
+pub const B50: ::speed_t = 50;
+pub const B75: ::speed_t = 75;
+pub const B110: ::speed_t = 110;
+pub const B134: ::speed_t = 134;
+pub const B150: ::speed_t = 150;
+pub const B200: ::speed_t = 200;
+pub const B300: ::speed_t = 300;
+pub const B600: ::speed_t = 600;
+pub const B1200: ::speed_t = 1200;
+pub const B1800: ::speed_t = 1800;
+pub const B2400: ::speed_t = 2400;
+pub const B4800: ::speed_t = 4800;
+pub const B9600: ::speed_t = 9600;
+pub const B7200: ::speed_t = 7200;
+pub const B14400: ::speed_t = 14400;
+pub const B19200: ::speed_t = 19200;
+pub const B28800: ::speed_t = 28800;
+pub const B38400: ::speed_t = 38400;
+pub const EXTA: ::speed_t = B19200;
+pub const EXTB: ::speed_t = B38400;
+pub const B57600: ::speed_t = 57600;
+pub const B76800: ::speed_t = 76800;
+pub const B115200: ::speed_t = 115200;
+pub const B230400: ::speed_t = 230400;
+pub const B460800: ::speed_t = 460800;
+pub const B500000: ::speed_t = 500000;
+pub const B576000: ::speed_t = 576000;
+pub const B921600: ::speed_t = 921600;
+pub const B1000000: ::speed_t = 1000000;
+pub const B1152000: ::speed_t = 1152000;
+pub const B1500000: ::speed_t = 1500000;
+pub const B2000000: ::speed_t = 2000000;
+pub const B2500000: ::speed_t = 2500000;
+pub const B3000000: ::speed_t = 3000000;
+pub const B3500000: ::speed_t = 3500000;
+pub const B4000000: ::speed_t = 4000000;
 pub const TCSANOW: ::c_int = 0;
 pub const TCSADRAIN: ::c_int = 1;
 pub const TCSAFLUSH: ::c_int = 2;
@@ -1286,10 +1772,10 @@ pub const TCOOFF: ::c_int = 1;
 pub const TCOON: ::c_int = 2;
 pub const TCIOFF: ::c_int = 3;
 pub const TCION: ::c_int = 4;
-pub const TTYDEF_IFLAG: tcflag_t = 11042;
-pub const TTYDEF_LFLAG: tcflag_t = 1483;
-pub const TTYDEF_CFLAG: tcflag_t = 23040;
-pub const TTYDEF_SPEED: tcflag_t = 9600;
+pub const TTYDEF_IFLAG: ::tcflag_t = 11042;
+pub const TTYDEF_LFLAG: ::tcflag_t = 1483;
+pub const TTYDEF_CFLAG: ::tcflag_t = 23040;
+pub const TTYDEF_SPEED: ::tcflag_t = 9600;
 pub const CEOL: u8 = 0u8;
 pub const CERASE: u8 = 127;
 pub const CMIN: u8 = 1;
@@ -1467,35 +1953,35 @@ pub const SF_NOUNLINK: ::c_uint = 1048576;
 pub const SF_SNAPSHOT: ::c_uint = 2097152;
 pub const UTIME_NOW: ::c_long = -1;
 pub const UTIME_OMIT: ::c_long = -2;
-pub const S_IFMT: mode_t = 61440;
-pub const S_IFDIR: mode_t = 16384;
-pub const S_IFCHR: mode_t = 8192;
-pub const S_IFBLK: mode_t = 24576;
-pub const S_IFREG: mode_t = 32768;
-pub const S_IFIFO: mode_t = 4096;
-pub const S_IFLNK: mode_t = 40960;
-pub const S_IFSOCK: mode_t = 49152;
-pub const S_ISUID: mode_t = 2048;
-pub const S_ISGID: mode_t = 1024;
-pub const S_ISVTX: mode_t = 512;
-pub const S_IRUSR: mode_t = 256;
-pub const S_IWUSR: mode_t = 128;
-pub const S_IXUSR: mode_t = 64;
-pub const S_IRWXU: mode_t = 448;
-pub const S_IREAD: mode_t = 256;
-pub const S_IWRITE: mode_t = 128;
-pub const S_IEXEC: mode_t = 64;
-pub const S_IRGRP: mode_t = 32;
-pub const S_IWGRP: mode_t = 16;
-pub const S_IXGRP: mode_t = 8;
-pub const S_IRWXG: mode_t = 56;
-pub const S_IROTH: mode_t = 4;
-pub const S_IWOTH: mode_t = 2;
-pub const S_IXOTH: mode_t = 1;
-pub const S_IRWXO: mode_t = 7;
-pub const ACCESSPERMS: mode_t = 511;
-pub const ALLPERMS: mode_t = 4095;
-pub const DEFFILEMODE: mode_t = 438;
+pub const S_IFMT: ::mode_t = 61440;
+pub const S_IFDIR: ::mode_t = 16384;
+pub const S_IFCHR: ::mode_t = 8192;
+pub const S_IFBLK: ::mode_t = 24576;
+pub const S_IFREG: ::mode_t = 32768;
+pub const S_IFIFO: ::mode_t = 4096;
+pub const S_IFLNK: ::mode_t = 40960;
+pub const S_IFSOCK: ::mode_t = 49152;
+pub const S_ISUID: ::mode_t = 2048;
+pub const S_ISGID: ::mode_t = 1024;
+pub const S_ISVTX: ::mode_t = 512;
+pub const S_IRUSR: ::mode_t = 256;
+pub const S_IWUSR: ::mode_t = 128;
+pub const S_IXUSR: ::mode_t = 64;
+pub const S_IRWXU: ::mode_t = 448;
+pub const S_IREAD: ::mode_t = 256;
+pub const S_IWRITE: ::mode_t = 128;
+pub const S_IEXEC: ::mode_t = 64;
+pub const S_IRGRP: ::mode_t = 32;
+pub const S_IWGRP: ::mode_t = 16;
+pub const S_IXGRP: ::mode_t = 8;
+pub const S_IRWXG: ::mode_t = 56;
+pub const S_IROTH: ::mode_t = 4;
+pub const S_IWOTH: ::mode_t = 2;
+pub const S_IXOTH: ::mode_t = 1;
+pub const S_IRWXO: ::mode_t = 7;
+pub const ACCESSPERMS: ::mode_t = 511;
+pub const ALLPERMS: ::mode_t = 4095;
+pub const DEFFILEMODE: ::mode_t = 438;
 pub const S_BLKSIZE: usize = 512;
 pub const STATX_TYPE: ::c_uint = 1;
 pub const STATX_MODE: ::c_uint = 2;
@@ -1547,34 +2033,34 @@ pub const TIOCPKT_IOCTL: ::c_int = 64;
 pub const TTYDISC: ::c_int = 0;
 pub const TABLDISC: ::c_int = 3;
 pub const SLIPDISC: ::c_int = 4;
-pub const TANDEM: tcflag_t = 1;
-pub const CBREAK: tcflag_t = 2;
-pub const LCASE: tcflag_t = 4;
-pub const CRMOD: tcflag_t = 16;
-pub const RAW: tcflag_t = 32;
-pub const ODDP: tcflag_t = 64;
-pub const EVENP: tcflag_t = 128;
-pub const ANYP: tcflag_t = 192;
-pub const NLDELAY: tcflag_t = 768;
-pub const NL2: tcflag_t = 512;
-pub const NL3: tcflag_t = 768;
-pub const TBDELAY: tcflag_t = 3072;
-pub const XTABS: tcflag_t = 3072;
-pub const CRDELAY: tcflag_t = 12288;
-pub const VTDELAY: tcflag_t = 16384;
-pub const BSDELAY: tcflag_t = 32768;
-pub const ALLDELAY: tcflag_t = 65280;
-pub const CRTBS: tcflag_t = 65536;
-pub const PRTERA: tcflag_t = 131072;
-pub const CRTERA: tcflag_t = 262144;
-pub const TILDE: tcflag_t = 524288;
-pub const LITOUT: tcflag_t = 2097152;
-pub const NOHANG: tcflag_t = 16777216;
-pub const L001000: tcflag_t = 33554432;
-pub const CRTKIL: tcflag_t = 67108864;
-pub const PASS8: tcflag_t = 134217728;
-pub const CTLECH: tcflag_t = 268435456;
-pub const DECCTQ: tcflag_t = 1073741824;
+pub const TANDEM: ::tcflag_t = 1;
+pub const CBREAK: ::tcflag_t = 2;
+pub const LCASE: ::tcflag_t = 4;
+pub const CRMOD: ::tcflag_t = 16;
+pub const RAW: ::tcflag_t = 32;
+pub const ODDP: ::tcflag_t = 64;
+pub const EVENP: ::tcflag_t = 128;
+pub const ANYP: ::tcflag_t = 192;
+pub const NLDELAY: ::tcflag_t = 768;
+pub const NL2: ::tcflag_t = 512;
+pub const NL3: ::tcflag_t = 768;
+pub const TBDELAY: ::tcflag_t = 3072;
+pub const XTABS: ::tcflag_t = 3072;
+pub const CRDELAY: ::tcflag_t = 12288;
+pub const VTDELAY: ::tcflag_t = 16384;
+pub const BSDELAY: ::tcflag_t = 32768;
+pub const ALLDELAY: ::tcflag_t = 65280;
+pub const CRTBS: ::tcflag_t = 65536;
+pub const PRTERA: ::tcflag_t = 131072;
+pub const CRTERA: ::tcflag_t = 262144;
+pub const TILDE: ::tcflag_t = 524288;
+pub const LITOUT: ::tcflag_t = 2097152;
+pub const NOHANG: ::tcflag_t = 16777216;
+pub const L001000: ::tcflag_t = 33554432;
+pub const CRTKIL: ::tcflag_t = 67108864;
+pub const PASS8: ::tcflag_t = 134217728;
+pub const CTLECH: ::tcflag_t = 268435456;
+pub const DECCTQ: ::tcflag_t = 1073741824;
 
 pub const FIONBIO: ::c_ulong = 0xa008007e;
 pub const FIONREAD: ::c_ulong = 0x6008007f;
@@ -2007,7 +2493,6 @@ pub const TCPOPT_TSTAMP_HDR: u32 = 16844810;
 pub const TCP_MSS: usize = 512;
 pub const TCP_MAXWIN: usize = 65535;
 pub const TCP_MAX_WINSHIFT: usize = 14;
-pub const SOL_TCP: ::c_int = 6;
 pub const TCPI_OPT_TIMESTAMPS: u8 = 1;
 pub const TCPI_OPT_SACK: u8 = 2;
 pub const TCPI_OPT_WSCALE: u8 = 4;
@@ -2042,21 +2527,64 @@ pub const PROT_NONE: ::c_int = 0;
 pub const PROT_READ: ::c_int = 4;
 pub const PROT_WRITE: ::c_int = 2;
 pub const PROT_EXEC: ::c_int = 1;
-pub const MAP_PRIVATE: ::c_int = 0;
 pub const MAP_FILE: ::c_int = 1;
 pub const MAP_ANON: ::c_int = 2;
-pub const MAP_SHARED: ::c_int = 16;
+pub const MAP_ANONYMOUS: ::c_int = MAP_ANON;
+pub const MAP_TYPE: ::c_int = 15;
 pub const MAP_COPY: ::c_int = 32;
+pub const MAP_SHARED: ::c_int = 16;
+pub const MAP_PRIVATE: ::c_int = 0;
 pub const MAP_FIXED: ::c_int = 256;
+pub const MAP_NOEXTEND: ::c_int = 512;
+pub const MAP_HASSEMPHORE: ::c_int = 1024;
+pub const MAP_INHERIT: ::c_int = 2048;
 pub const MAP_FAILED: *mut ::c_void = !0 as *mut ::c_void;
-pub const MS_SYNC: ::c_int = 0;
-pub const MS_ASYNC: ::c_int = 1;
-pub const MS_INVALIDATE: ::c_int = 2;
 pub const MADV_NORMAL: ::c_int = 0;
 pub const MADV_RANDOM: ::c_int = 1;
 pub const MADV_SEQUENTIAL: ::c_int = 2;
 pub const MADV_WILLNEED: ::c_int = 3;
 pub const MADV_DONTNEED: ::c_int = 4;
+pub const POSIX_MADV_NORMAL: ::c_int = 0;
+pub const POSIX_MADV_RANDOM: ::c_int = 1;
+pub const POSIX_MADV_SEQUENTIAL: ::c_int = 2;
+pub const POSIX_MADV_WILLNEED: ::c_int = 3;
+pub const POSIX_MADV_WONTNEED: ::c_int = 4;
+
+pub const MS_ASYNC: ::c_int = 1;
+pub const MS_SYNC: ::c_int = 0;
+pub const MS_INVALIDATE: ::c_int = 2;
+pub const MREMAP_MAYMOVE: ::c_int = 1;
+pub const MREMAP_FIXED: ::c_int = 2;
+pub const MCL_CURRENT: ::c_int = 0x0001;
+pub const MCL_FUTURE: ::c_int = 0x0002;
+
+// spawn.h
+pub const POSIX_SPAWN_USEVFORK: ::c_int = 64;
+pub const POSIX_SPAWN_SETSID: ::c_int = 128;
+
+// sys/syslog.h
+pub const LOG_CRON: ::c_int = 9 << 3;
+pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
+pub const LOG_FTP: ::c_int = 11 << 3;
+pub const LOG_PERROR: ::c_int = 0x20;
+
+// net/if.h
+pub const IFF_UP: ::c_int = 0x1;
+pub const IFF_BROADCAST: ::c_int = 0x2;
+pub const IFF_DEBUG: ::c_int = 0x4;
+pub const IFF_LOOPBACK: ::c_int = 0x8;
+pub const IFF_POINTOPOINT: ::c_int = 0x10;
+pub const IFF_NOTRAILERS: ::c_int = 0x20;
+pub const IFF_RUNNING: ::c_int = 0x40;
+pub const IFF_NOARP: ::c_int = 0x80;
+pub const IFF_PROMISC: ::c_int = 0x100;
+pub const IFF_ALLMULTI: ::c_int = 0x200;
+pub const IFF_MASTER: ::c_int = 0x400;
+pub const IFF_SLAVE: ::c_int = 0x800;
+pub const IFF_MULTICAST: ::c_int = 0x1000;
+pub const IFF_PORTSEL: ::c_int = 0x2000;
+pub const IFF_AUTOMEDIA: ::c_int = 0x4000;
+pub const IFF_DYNAMIC: ::c_int = 0x8000;
 
 // random.h
 pub const GRND_NONBLOCK: ::c_uint = 1;
@@ -2391,21 +2919,21 @@ pub const PTHREAD_MUTEX_RECURSIVE: __pthread_mutex_type = 2;
 pub const PTHREAD_MUTEX_STALLED: __pthread_mutex_robustness = 0;
 pub const PTHREAD_MUTEX_ROBUST: __pthread_mutex_robustness = 256;
 
-pub const RLIMIT_CPU: __rlimit_resource = 0;
-pub const RLIMIT_FSIZE: __rlimit_resource = 1;
-pub const RLIMIT_DATA: __rlimit_resource = 2;
-pub const RLIMIT_STACK: __rlimit_resource = 3;
-pub const RLIMIT_CORE: __rlimit_resource = 4;
-pub const RLIMIT_RSS: __rlimit_resource = 5;
-pub const RLIMIT_MEMLOCK: __rlimit_resource = 6;
-pub const RLIMIT_NPROC: __rlimit_resource = 7;
-pub const RLIMIT_OFILE: __rlimit_resource = 8;
-pub const RLIMIT_NOFILE: __rlimit_resource = 8;
-pub const RLIMIT_SBSIZE: __rlimit_resource = 9;
-pub const RLIMIT_AS: __rlimit_resource = 10;
-pub const RLIMIT_VMEM: __rlimit_resource = 10;
-pub const RLIMIT_NLIMITS: __rlimit_resource = 11;
-pub const RLIM_NLIMITS: __rlimit_resource = 11;
+pub const RLIMIT_CPU: ::__rlimit_resource_t = 0;
+pub const RLIMIT_FSIZE: ::__rlimit_resource_t = 1;
+pub const RLIMIT_DATA: ::__rlimit_resource_t = 2;
+pub const RLIMIT_STACK: ::__rlimit_resource_t = 3;
+pub const RLIMIT_CORE: ::__rlimit_resource_t = 4;
+pub const RLIMIT_RSS: ::__rlimit_resource_t = 5;
+pub const RLIMIT_MEMLOCK: ::__rlimit_resource_t = 6;
+pub const RLIMIT_NPROC: ::__rlimit_resource_t = 7;
+pub const RLIMIT_OFILE: ::__rlimit_resource_t = 8;
+pub const RLIMIT_NOFILE: ::__rlimit_resource_t = 8;
+pub const RLIMIT_SBSIZE: ::__rlimit_resource_t = 9;
+pub const RLIMIT_AS: ::__rlimit_resource_t = 10;
+pub const RLIMIT_VMEM: ::__rlimit_resource_t = 10;
+pub const RLIMIT_NLIMITS: ::__rlimit_resource_t = 11;
+pub const RLIM_NLIMITS: ::__rlimit_resource_t = 11;
 
 pub const RUSAGE_SELF: __rusage_who = 0;
 pub const RUSAGE_CHILDREN: __rusage_who = -1;
@@ -2431,6 +2959,7 @@ pub const MSG_CTRUNC: ::c_int = 32;
 pub const MSG_WAITALL: ::c_int = 64;
 pub const MSG_DONTWAIT: ::c_int = 128;
 pub const MSG_NOSIGNAL: ::c_int = 1024;
+pub const MSG_CMSG_CLOEXEC: ::c_int = 0x40000000;
 
 pub const SCM_RIGHTS: ::c_int = 1;
 pub const SCM_TIMESTAMP: ::c_int = 2;
@@ -2550,6 +3079,11 @@ pub const RTLD_DI_TLS_DATA: ::c_int = 10;
 pub const RTLD_DI_PHDR: ::c_int = 11;
 pub const RTLD_DI_MAX: ::c_int = 11;
 
+pub const RTLD_NEXT: *mut ::c_void = -1i64 as *mut ::c_void;
+pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
+pub const RTLD_NODELETE: ::c_int = 0x1000;
+pub const RTLD_NOW: ::c_int = 0x2;
+
 pub const SI_ASYNCIO: ::c_int = -4;
 pub const SI_MESGQ: ::c_int = -3;
 pub const SI_TIMER: ::c_int = -2;
@@ -2693,8 +3227,105 @@ pub const PTHREAD_RWLOCK_INITIALIZER: pthread_rwlock_t = pthread_rwlock_t {
 };
 pub const PTHREAD_STACK_MIN: ::size_t = 0;
 
+const_fn! {
+    {const} fn CMSG_ALIGN(len: usize) -> usize {
+        len + ::mem::size_of::<usize>() - 1 & !(::mem::size_of::<usize>() - 1)
+    }
+}
+
 // functions
 f! {
+    pub fn CMSG_FIRSTHDR(mhdr: *const msghdr) -> *mut cmsghdr {
+        if (*mhdr).msg_controllen as usize >= ::mem::size_of::<cmsghdr>() {
+            (*mhdr).msg_control as *mut cmsghdr
+        } else {
+            0 as *mut cmsghdr
+        }
+    }
+
+    pub fn CMSG_DATA(cmsg: *const cmsghdr) -> *mut ::c_uchar {
+        cmsg.offset(1) as *mut ::c_uchar
+    }
+
+    pub {const} fn CMSG_SPACE(length: ::c_uint) -> ::c_uint {
+        (CMSG_ALIGN(length as usize) + CMSG_ALIGN(::mem::size_of::<cmsghdr>()))
+            as ::c_uint
+    }
+
+    pub {const} fn CMSG_LEN(length: ::c_uint) -> ::c_uint {
+        CMSG_ALIGN(::mem::size_of::<cmsghdr>()) as ::c_uint + length
+    }
+
+    pub fn CMSG_NXTHDR(mhdr: *const msghdr,
+                       cmsg: *const cmsghdr) -> *mut cmsghdr {
+        if ((*cmsg).cmsg_len as usize) < ::mem::size_of::<cmsghdr>() {
+            return 0 as *mut cmsghdr;
+        };
+        let next = (cmsg as usize +
+                    super::CMSG_ALIGN((*cmsg).cmsg_len as usize))
+            as *mut cmsghdr;
+        let max = (*mhdr).msg_control as usize
+            + (*mhdr).msg_controllen as usize;
+        if (next.offset(1)) as usize > max ||
+            next as usize + super::CMSG_ALIGN((*next).cmsg_len as usize) > max
+        {
+            0 as *mut cmsghdr
+        } else {
+            next as *mut cmsghdr
+        }
+    }
+
+    pub fn CPU_ALLOC_SIZE(count: ::c_int) -> ::size_t {
+        let _dummy: cpu_set_t = ::mem::zeroed();
+        let size_in_bits = 8 * ::mem::size_of_val(&_dummy.bits[0]);
+        ((count as ::size_t + size_in_bits - 1) / 8) as ::size_t
+    }
+
+    pub fn CPU_ZERO(cpuset: &mut cpu_set_t) -> () {
+        for slot in cpuset.bits.iter_mut() {
+            *slot = 0;
+        }
+    }
+
+    pub fn CPU_SET(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+        let size_in_bits
+            = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        cpuset.bits[idx] |= 1 << offset;
+        ()
+    }
+
+    pub fn CPU_CLR(cpu: usize, cpuset: &mut cpu_set_t) -> () {
+        let size_in_bits
+            = 8 * ::mem::size_of_val(&cpuset.bits[0]); // 32, 64 etc
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        cpuset.bits[idx] &= !(1 << offset);
+        ()
+    }
+
+    pub fn CPU_ISSET(cpu: usize, cpuset: &cpu_set_t) -> bool {
+        let size_in_bits = 8 * ::mem::size_of_val(&cpuset.bits[0]);
+        let (idx, offset) = (cpu / size_in_bits, cpu % size_in_bits);
+        0 != (cpuset.bits[idx] & (1 << offset))
+    }
+
+    pub fn CPU_COUNT_S(size: usize, cpuset: &cpu_set_t) -> ::c_int {
+        let mut s: u32 = 0;
+        let size_of_mask = ::mem::size_of_val(&cpuset.bits[0]);
+        for i in cpuset.bits[..(size / size_of_mask)].iter() {
+            s += i.count_ones();
+        };
+        s as ::c_int
+    }
+
+    pub fn CPU_COUNT(cpuset: &cpu_set_t) -> ::c_int {
+        CPU_COUNT_S(::mem::size_of::<cpu_set_t>(), cpuset)
+    }
+
+    pub fn CPU_EQUAL(set1: &cpu_set_t, set2: &cpu_set_t) -> bool {
+        set1.bits == set2.bits
+    }
+
     pub fn major(dev: ::dev_t) -> ::c_uint {
          ((dev >> 8) & 0xff) as ::c_uint
     }
@@ -2703,6 +3334,14 @@ f! {
         (dev & 0xffff00ff) as ::c_uint
     }
 
+    pub fn IPTOS_TOS(tos: u8) -> u8 {
+        tos & IPTOS_TOS_MASK
+    }
+
+    pub fn IPTOS_PREC(tos: u8) -> u8 {
+        tos & IPTOS_PREC_MASK
+    }
+
     pub fn FD_CLR(fd: ::c_int, set: *mut fd_set) -> () {
         let fd = fd as usize;
         let size = ::mem::size_of_val(&(*set).fds_bits[0]) * 8;
@@ -2756,11 +3395,26 @@ extern "C" {
 
     pub fn __libc_current_sigrtmax() -> ::c_int;
 
+    pub fn wait4(
+        pid: ::pid_t,
+        status: *mut ::c_int,
+        options: ::c_int,
+        rusage: *mut ::rusage,
+    ) -> ::pid_t;
+
     pub fn waitid(idtype: idtype_t, id: id_t, infop: *mut ::siginfo_t, options: ::c_int)
         -> ::c_int;
 
     pub fn sigwait(__set: *const sigset_t, __sig: *mut ::c_int) -> ::c_int;
 
+    pub fn sigsuspend(mask: *const ::sigset_t) -> ::c_int;
+    pub fn sigtimedwait(
+        set: *const sigset_t,
+        info: *mut siginfo_t,
+        timeout: *const ::timespec,
+    ) -> ::c_int;
+    pub fn sigwaitinfo(set: *const sigset_t, info: *mut siginfo_t) -> ::c_int;
+
     pub fn sigaltstack(ss: *const stack_t, oss: *mut stack_t) -> ::c_int;
 
     pub fn ioctl(__fd: ::c_int, __request: ::c_ulong, ...) -> ::c_int;
@@ -2806,10 +3460,72 @@ extern "C" {
         offset: ::off64_t,
     ) -> ::ssize_t;
 
+    pub fn fread_unlocked(
+        buf: *mut ::c_void,
+        size: ::size_t,
+        nobj: ::size_t,
+        stream: *mut ::FILE,
+    ) -> ::size_t;
+
+    pub fn aio_read(aiocbp: *mut aiocb) -> ::c_int;
+    pub fn aio_write(aiocbp: *mut aiocb) -> ::c_int;
+    pub fn aio_fsync(op: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+    pub fn aio_error(aiocbp: *const aiocb) -> ::c_int;
+    pub fn aio_return(aiocbp: *mut aiocb) -> ::ssize_t;
+    pub fn aio_suspend(
+        aiocb_list: *const *const aiocb,
+        nitems: ::c_int,
+        timeout: *const ::timespec,
+    ) -> ::c_int;
+    pub fn aio_cancel(fd: ::c_int, aiocbp: *mut aiocb) -> ::c_int;
+    pub fn lio_listio(
+        mode: ::c_int,
+        aiocb_list: *const *mut aiocb,
+        nitems: ::c_int,
+        sevp: *mut ::sigevent,
+    ) -> ::c_int;
+
+    pub fn mq_open(name: *const ::c_char, oflag: ::c_int, ...) -> ::mqd_t;
+    pub fn mq_close(mqd: ::mqd_t) -> ::c_int;
+    pub fn mq_unlink(name: *const ::c_char) -> ::c_int;
+    pub fn mq_receive(
+        mqd: ::mqd_t,
+        msg_ptr: *mut ::c_char,
+        msg_len: ::size_t,
+        msg_prio: *mut ::c_uint,
+    ) -> ::ssize_t;
+    pub fn mq_timedreceive(
+        mqd: ::mqd_t,
+        msg_ptr: *mut ::c_char,
+        msg_len: ::size_t,
+        msg_prio: *mut ::c_uint,
+        abs_timeout: *const ::timespec,
+    ) -> ::ssize_t;
+    pub fn mq_send(
+        mqd: ::mqd_t,
+        msg_ptr: *const ::c_char,
+        msg_len: ::size_t,
+        msg_prio: ::c_uint,
+    ) -> ::c_int;
+    pub fn mq_timedsend(
+        mqd: ::mqd_t,
+        msg_ptr: *const ::c_char,
+        msg_len: ::size_t,
+        msg_prio: ::c_uint,
+        abs_timeout: *const ::timespec,
+    ) -> ::c_int;
+    pub fn mq_getattr(mqd: ::mqd_t, attr: *mut ::mq_attr) -> ::c_int;
+    pub fn mq_setattr(mqd: ::mqd_t, newattr: *const ::mq_attr, oldattr: *mut ::mq_attr) -> ::c_int;
+
     pub fn lseek64(__fd: ::c_int, __offset: __off64_t, __whence: ::c_int) -> __off64_t;
 
     pub fn lseek(__fd: ::c_int, __offset: __off_t, __whence: ::c_int) -> __off_t;
 
+    pub fn fgetpos64(stream: *mut ::FILE, ptr: *mut fpos64_t) -> ::c_int;
+    pub fn fseeko64(stream: *mut ::FILE, offset: ::off64_t, whence: ::c_int) -> ::c_int;
+    pub fn fsetpos64(stream: *mut ::FILE, ptr: *const fpos64_t) -> ::c_int;
+    pub fn ftello64(stream: *mut ::FILE) -> ::off64_t;
+
     pub fn bind(__fd: ::c_int, __addr: *const sockaddr, __len: socklen_t) -> ::c_int;
 
     pub fn accept4(
@@ -2819,6 +3535,13 @@ extern "C" {
         flg: ::c_int,
     ) -> ::c_int;
 
+    pub fn ppoll(
+        fds: *mut ::pollfd,
+        nfds: nfds_t,
+        timeout: *const ::timespec,
+        sigmask: *const sigset_t,
+    ) -> ::c_int;
+
     pub fn recvmsg(__fd: ::c_int, __message: *mut msghdr, __flags: ::c_int) -> ::ssize_t;
 
     pub fn sendmsg(__fd: ::c_int, __message: *const msghdr, __flags: ::c_int) -> ssize_t;
@@ -2832,12 +3555,95 @@ extern "C" {
         addrlen: *mut ::socklen_t,
     ) -> ::ssize_t;
 
+    pub fn sendfile(
+        out_fd: ::c_int,
+        in_fd: ::c_int,
+        offset: *mut off_t,
+        count: ::size_t,
+    ) -> ::ssize_t;
+    pub fn sendfile64(
+        out_fd: ::c_int,
+        in_fd: ::c_int,
+        offset: *mut off64_t,
+        count: ::size_t,
+    ) -> ::ssize_t;
+
     pub fn shutdown(__fd: ::c_int, __how: ::c_int) -> ::c_int;
 
     pub fn sethostname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+    pub fn getdomainname(name: *mut ::c_char, len: ::size_t) -> ::c_int;
+    pub fn setdomainname(name: *const ::c_char, len: ::size_t) -> ::c_int;
+    pub fn if_nameindex() -> *mut if_nameindex;
+    pub fn if_freenameindex(ptr: *mut if_nameindex);
+
+    pub fn getnameinfo(
+        sa: *const ::sockaddr,
+        salen: ::socklen_t,
+        host: *mut ::c_char,
+        hostlen: ::socklen_t,
+        serv: *mut ::c_char,
+        sevlen: ::socklen_t,
+        flags: ::c_int,
+    ) -> ::c_int;
+
+    pub fn getifaddrs(ifap: *mut *mut ::ifaddrs) -> ::c_int;
+    pub fn freeifaddrs(ifa: *mut ::ifaddrs);
 
     pub fn uname(buf: *mut ::utsname) -> ::c_int;
 
+    pub fn gethostid() -> ::c_long;
+    pub fn sethostid(hostid: ::c_long) -> ::c_int;
+
+    pub fn setpwent();
+    pub fn endpwent();
+    pub fn getpwent() -> *mut passwd;
+    pub fn setgrent();
+    pub fn endgrent();
+    pub fn getgrent() -> *mut ::group;
+    pub fn setspent();
+    pub fn endspent();
+    pub fn getspent() -> *mut spwd;
+
+    pub fn getspnam(name: *const ::c_char) -> *mut spwd;
+
+    pub fn getpwent_r(
+        pwd: *mut ::passwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::passwd,
+    ) -> ::c_int;
+    pub fn getgrent_r(
+        grp: *mut ::group,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::group,
+    ) -> ::c_int;
+    pub fn fgetpwent_r(
+        stream: *mut ::FILE,
+        pwd: *mut ::passwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::passwd,
+    ) -> ::c_int;
+    pub fn fgetgrent_r(
+        stream: *mut ::FILE,
+        grp: *mut ::group,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::group,
+    ) -> ::c_int;
+
+    pub fn putpwent(p: *const ::passwd, stream: *mut ::FILE) -> ::c_int;
+    pub fn putgrent(grp: *const ::group, stream: *mut ::FILE) -> ::c_int;
+
+    pub fn getpwnam_r(
+        name: *const ::c_char,
+        pwd: *mut passwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut passwd,
+    ) -> ::c_int;
+
     pub fn getpwuid_r(
         uid: ::uid_t,
         pwd: *mut passwd,
@@ -2846,18 +3652,105 @@ extern "C" {
         result: *mut *mut passwd,
     ) -> ::c_int;
 
+    pub fn fgetspent_r(
+        fp: *mut ::FILE,
+        spbuf: *mut ::spwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        spbufp: *mut *mut ::spwd,
+    ) -> ::c_int;
+    pub fn sgetspent_r(
+        s: *const ::c_char,
+        spbuf: *mut ::spwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        spbufp: *mut *mut ::spwd,
+    ) -> ::c_int;
+    pub fn getspent_r(
+        spbuf: *mut ::spwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        spbufp: *mut *mut ::spwd,
+    ) -> ::c_int;
+
+    pub fn getspnam_r(
+        name: *const ::c_char,
+        spbuf: *mut spwd,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        spbufp: *mut *mut spwd,
+    ) -> ::c_int;
+
+    // mntent.h
+    pub fn getmntent_r(
+        stream: *mut ::FILE,
+        mntbuf: *mut ::mntent,
+        buf: *mut ::c_char,
+        buflen: ::c_int,
+    ) -> *mut ::mntent;
+
+    pub fn utmpname(file: *const ::c_char) -> ::c_int;
+    pub fn utmpxname(file: *const ::c_char) -> ::c_int;
+    pub fn getutxent() -> *mut utmpx;
+    pub fn getutxid(ut: *const utmpx) -> *mut utmpx;
+    pub fn getutxline(ut: *const utmpx) -> *mut utmpx;
+    pub fn pututxline(ut: *const utmpx) -> *mut utmpx;
+    pub fn setutxent();
+    pub fn endutxent();
+
+    pub fn getresuid(ruid: *mut ::uid_t, euid: *mut ::uid_t, suid: *mut ::uid_t) -> ::c_int;
+    pub fn getresgid(rgid: *mut ::gid_t, egid: *mut ::gid_t, sgid: *mut ::gid_t) -> ::c_int;
+    pub fn setresuid(ruid: ::uid_t, euid: ::uid_t, suid: ::uid_t) -> ::c_int;
+    pub fn setresgid(rgid: ::gid_t, egid: ::gid_t, sgid: ::gid_t) -> ::c_int;
+
+    pub fn initgroups(user: *const ::c_char, group: ::gid_t) -> ::c_int;
+
+    pub fn getgrgid(gid: ::gid_t) -> *mut ::group;
+    pub fn getgrgid_r(
+        gid: ::gid_t,
+        grp: *mut ::group,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::group,
+    ) -> ::c_int;
+
+    pub fn getgrnam(name: *const ::c_char) -> *mut ::group;
+    pub fn getgrnam_r(
+        name: *const ::c_char,
+        grp: *mut ::group,
+        buf: *mut ::c_char,
+        buflen: ::size_t,
+        result: *mut *mut ::group,
+    ) -> ::c_int;
+
+    pub fn getgrouplist(
+        user: *const ::c_char,
+        group: ::gid_t,
+        groups: *mut ::gid_t,
+        ngroups: *mut ::c_int,
+    ) -> ::c_int;
+
     pub fn setgroups(ngroups: ::size_t, ptr: *const ::gid_t) -> ::c_int;
 
+    pub fn acct(filename: *const ::c_char) -> ::c_int;
+
+    pub fn setmntent(filename: *const ::c_char, ty: *const ::c_char) -> *mut ::FILE;
+    pub fn getmntent(stream: *mut ::FILE) -> *mut ::mntent;
+    pub fn addmntent(stream: *mut ::FILE, mnt: *const ::mntent) -> ::c_int;
+    pub fn endmntent(streamp: *mut ::FILE) -> ::c_int;
+    pub fn hasmntopt(mnt: *const ::mntent, opt: *const ::c_char) -> *mut ::c_char;
+
     pub fn pthread_create(
         native: *mut ::pthread_t,
         attr: *const ::pthread_attr_t,
         f: extern "C" fn(*mut ::c_void) -> *mut ::c_void,
         value: *mut ::c_void,
     ) -> ::c_int;
-    pub fn pthread_kill(__threadid: pthread_t, __signo: ::c_int) -> ::c_int;
+    pub fn pthread_kill(__threadid: ::pthread_t, __signo: ::c_int) -> ::c_int;
+    pub fn pthread_cancel(thread: ::pthread_t) -> ::c_int;
     pub fn __pthread_equal(__t1: __pthread_t, __t2: __pthread_t) -> ::c_int;
 
-    pub fn pthread_getattr_np(__thr: pthread_t, __attr: *mut pthread_attr_t) -> ::c_int;
+    pub fn pthread_getattr_np(__thr: ::pthread_t, __attr: *mut pthread_attr_t) -> ::c_int;
 
     pub fn pthread_attr_getguardsize(
         __attr: *const pthread_attr_t,
@@ -2870,11 +3763,70 @@ extern "C" {
         __stacksize: *mut ::size_t,
     ) -> ::c_int;
 
+    pub fn pthread_attr_getguardsize(
+        attr: *const ::pthread_attr_t,
+        guardsize: *mut ::size_t,
+    ) -> ::c_int;
+    pub fn pthread_attr_setguardsize(attr: *mut ::pthread_attr_t, guardsize: ::size_t) -> ::c_int;
+
+    pub fn pthread_mutexattr_getpshared(
+        attr: *const pthread_mutexattr_t,
+        pshared: *mut ::c_int,
+    ) -> ::c_int;
+    pub fn pthread_mutexattr_setpshared(
+        attr: *mut pthread_mutexattr_t,
+        pshared: ::c_int,
+    ) -> ::c_int;
+
+    pub fn pthread_mutex_timedlock(
+        lock: *mut pthread_mutex_t,
+        abstime: *const ::timespec,
+    ) -> ::c_int;
+
+    pub fn pthread_rwlockattr_getpshared(
+        attr: *const pthread_rwlockattr_t,
+        val: *mut ::c_int,
+    ) -> ::c_int;
+    pub fn pthread_rwlockattr_setpshared(attr: *mut pthread_rwlockattr_t, val: ::c_int) -> ::c_int;
+
+    pub fn pthread_condattr_getclock(
+        attr: *const pthread_condattr_t,
+        clock_id: *mut clockid_t,
+    ) -> ::c_int;
     pub fn pthread_condattr_setclock(
         __attr: *mut pthread_condattr_t,
         __clock_id: __clockid_t,
     ) -> ::c_int;
+    pub fn pthread_condattr_getpshared(
+        attr: *const pthread_condattr_t,
+        pshared: *mut ::c_int,
+    ) -> ::c_int;
+    pub fn pthread_condattr_setpshared(attr: *mut pthread_condattr_t, pshared: ::c_int) -> ::c_int;
+
+    pub fn pthread_once(control: *mut pthread_once_t, routine: extern "C" fn()) -> ::c_int;
 
+    pub fn pthread_barrierattr_init(attr: *mut ::pthread_barrierattr_t) -> ::c_int;
+    pub fn pthread_barrierattr_destroy(attr: *mut ::pthread_barrierattr_t) -> ::c_int;
+    pub fn pthread_barrierattr_getpshared(
+        attr: *const ::pthread_barrierattr_t,
+        shared: *mut ::c_int,
+    ) -> ::c_int;
+    pub fn pthread_barrierattr_setpshared(
+        attr: *mut ::pthread_barrierattr_t,
+        shared: ::c_int,
+    ) -> ::c_int;
+    pub fn pthread_barrier_init(
+        barrier: *mut pthread_barrier_t,
+        attr: *const ::pthread_barrierattr_t,
+        count: ::c_uint,
+    ) -> ::c_int;
+    pub fn pthread_barrier_destroy(barrier: *mut pthread_barrier_t) -> ::c_int;
+    pub fn pthread_barrier_wait(barrier: *mut pthread_barrier_t) -> ::c_int;
+    pub fn pthread_spin_init(lock: *mut ::pthread_spinlock_t, pshared: ::c_int) -> ::c_int;
+    pub fn pthread_spin_destroy(lock: *mut ::pthread_spinlock_t) -> ::c_int;
+    pub fn pthread_spin_lock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
+    pub fn pthread_spin_trylock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
+    pub fn pthread_spin_unlock(lock: *mut ::pthread_spinlock_t) -> ::c_int;
     pub fn pthread_atfork(
         prepare: ::Option<unsafe extern "C" fn()>,
         parent: ::Option<unsafe extern "C" fn()>,
@@ -2887,9 +3839,72 @@ extern "C" {
         __oldmask: *mut __sigset_t,
     ) -> ::c_int;
 
+    pub fn sched_getparam(pid: ::pid_t, param: *mut ::sched_param) -> ::c_int;
+    pub fn sched_setparam(pid: ::pid_t, param: *const ::sched_param) -> ::c_int;
+    pub fn sched_getscheduler(pid: ::pid_t) -> ::c_int;
+    pub fn sched_setscheduler(
+        pid: ::pid_t,
+        policy: ::c_int,
+        param: *const ::sched_param,
+    ) -> ::c_int;
+    pub fn pthread_getschedparam(
+        native: ::pthread_t,
+        policy: *mut ::c_int,
+        param: *mut ::sched_param,
+    ) -> ::c_int;
+    pub fn pthread_setschedparam(
+        native: ::pthread_t,
+        policy: ::c_int,
+        param: *const ::sched_param,
+    ) -> ::c_int;
+
+    pub fn pthread_getcpuclockid(thread: ::pthread_t, clk_id: *mut ::clockid_t) -> ::c_int;
+
+    pub fn sem_init(sem: *mut sem_t, pshared: ::c_int, value: ::c_uint) -> ::c_int;
+    pub fn sem_destroy(sem: *mut sem_t) -> ::c_int;
+    pub fn sem_timedwait(sem: *mut sem_t, abstime: *const ::timespec) -> ::c_int;
+    pub fn sem_getvalue(sem: *mut sem_t, sval: *mut ::c_int) -> ::c_int;
+
     pub fn clock_getres(__clock_id: clockid_t, __res: *mut ::timespec) -> ::c_int;
     pub fn clock_gettime(__clock_id: clockid_t, __tp: *mut ::timespec) -> ::c_int;
     pub fn clock_settime(__clock_id: clockid_t, __tp: *const ::timespec) -> ::c_int;
+    pub fn clock_getcpuclockid(pid: ::pid_t, clk_id: *mut ::clockid_t) -> ::c_int;
+
+    pub fn clock_nanosleep(
+        clk_id: ::clockid_t,
+        flags: ::c_int,
+        rqtp: *const ::timespec,
+        rmtp: *mut ::timespec,
+    ) -> ::c_int;
+
+    pub fn gettimeofday(tp: *mut ::timeval, tz: *mut ::timezone) -> ::c_int;
+    pub fn settimeofday(tv: *const ::timeval, tz: *const ::timezone) -> ::c_int;
+
+    pub fn asctime_r(tm: *const ::tm, buf: *mut ::c_char) -> *mut ::c_char;
+    pub fn ctime_r(timep: *const time_t, buf: *mut ::c_char) -> *mut ::c_char;
+
+    pub fn strftime(
+        s: *mut ::c_char,
+        max: ::size_t,
+        format: *const ::c_char,
+        tm: *const ::tm,
+    ) -> ::size_t;
+    pub fn strptime(s: *const ::c_char, format: *const ::c_char, tm: *mut ::tm) -> *mut ::c_char;
+
+    pub fn timer_create(
+        clockid: ::clockid_t,
+        sevp: *mut ::sigevent,
+        timerid: *mut ::timer_t,
+    ) -> ::c_int;
+    pub fn timer_delete(timerid: ::timer_t) -> ::c_int;
+    pub fn timer_getoverrun(timerid: ::timer_t) -> ::c_int;
+    pub fn timer_gettime(timerid: ::timer_t, curr_value: *mut ::itimerspec) -> ::c_int;
+    pub fn timer_settime(
+        timerid: ::timer_t,
+        flags: ::c_int,
+        new_value: *const ::itimerspec,
+        old_value: *mut ::itimerspec,
+    ) -> ::c_int;
 
     pub fn fstat(__fd: ::c_int, __buf: *mut stat) -> ::c_int;
     pub fn fstat64(__fd: ::c_int, __buf: *mut stat64) -> ::c_int;
@@ -2907,6 +3922,14 @@ extern "C" {
         __flag: ::c_int,
     ) -> ::c_int;
 
+    pub fn statx(
+        dirfd: ::c_int,
+        pathname: *const c_char,
+        flags: ::c_int,
+        mask: ::c_uint,
+        statxbuf: *mut statx,
+    ) -> ::c_int;
+
     pub fn ftruncate(__fd: ::c_int, __length: __off_t) -> ::c_int;
     pub fn ftruncate64(__fd: ::c_int, __length: __off64_t) -> ::c_int;
     pub fn truncate64(__file: *const ::c_char, __length: __off64_t) -> ::c_int;
@@ -2930,6 +3953,175 @@ extern "C" {
     pub fn openat(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
     pub fn openat64(__fd: ::c_int, __file: *const ::c_char, __oflag: ::c_int, ...) -> ::c_int;
 
+    pub fn fopen64(filename: *const c_char, mode: *const c_char) -> *mut ::FILE;
+    pub fn freopen64(
+        filename: *const c_char,
+        mode: *const c_char,
+        file: *mut ::FILE,
+    ) -> *mut ::FILE;
+
+    pub fn creat64(path: *const c_char, mode: mode_t) -> ::c_int;
+
+    pub fn mkostemp(template: *mut ::c_char, flags: ::c_int) -> ::c_int;
+    pub fn mkostemps(template: *mut ::c_char, suffixlen: ::c_int, flags: ::c_int) -> ::c_int;
+    pub fn mkstemps(template: *mut ::c_char, suffixlen: ::c_int) -> ::c_int;
+    pub fn tmpfile64() -> *mut ::FILE;
+
+    pub fn popen(command: *const c_char, mode: *const c_char) -> *mut ::FILE;
+
+    pub fn getdtablesize() -> ::c_int;
+
+    // Added in `glibc` 2.34
+    pub fn close_range(first: ::c_uint, last: ::c_uint, flags: ::c_int) -> ::c_int;
+
+    pub fn openpty(
+        __amaster: *mut ::c_int,
+        __aslave: *mut ::c_int,
+        __name: *mut ::c_char,
+        __termp: *const termios,
+        __winp: *const ::winsize,
+    ) -> ::c_int;
+
+    pub fn forkpty(
+        __amaster: *mut ::c_int,
+        __name: *mut ::c_char,
+        __termp: *const termios,
+        __winp: *const ::winsize,
+    ) -> ::pid_t;
+
+    pub fn getpt() -> ::c_int;
+    pub fn ptsname_r(fd: ::c_int, buf: *mut ::c_char, buflen: ::size_t) -> ::c_int;
+    pub fn login_tty(fd: ::c_int) -> ::c_int;
+
+    pub fn ctermid(s: *mut ::c_char) -> *mut ::c_char;
+
+    pub fn clearenv() -> ::c_int;
+
+    pub fn execveat(
+        dirfd: ::c_int,
+        pathname: *const ::c_char,
+        argv: *const *mut c_char,
+        envp: *const *mut c_char,
+        flags: ::c_int,
+    ) -> ::c_int;
+    pub fn execvpe(
+        file: *const ::c_char,
+        argv: *const *const ::c_char,
+        envp: *const *const ::c_char,
+    ) -> ::c_int;
+    pub fn fexecve(
+        fd: ::c_int,
+        argv: *const *const ::c_char,
+        envp: *const *const ::c_char,
+    ) -> ::c_int;
+
+    pub fn daemon(nochdir: ::c_int, noclose: ::c_int) -> ::c_int;
+
+    // posix/spawn.h
+    pub fn posix_spawn(
+        pid: *mut ::pid_t,
+        path: *const ::c_char,
+        file_actions: *const ::posix_spawn_file_actions_t,
+        attrp: *const ::posix_spawnattr_t,
+        argv: *const *mut ::c_char,
+        envp: *const *mut ::c_char,
+    ) -> ::c_int;
+    pub fn posix_spawnp(
+        pid: *mut ::pid_t,
+        file: *const ::c_char,
+        file_actions: *const ::posix_spawn_file_actions_t,
+        attrp: *const ::posix_spawnattr_t,
+        argv: *const *mut ::c_char,
+        envp: *const *mut ::c_char,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> ::c_int;
+    pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> ::c_int;
+    pub fn posix_spawnattr_getsigdefault(
+        attr: *const posix_spawnattr_t,
+        default: *mut ::sigset_t,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setsigdefault(
+        attr: *mut posix_spawnattr_t,
+        default: *const ::sigset_t,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_getsigmask(
+        attr: *const posix_spawnattr_t,
+        default: *mut ::sigset_t,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setsigmask(
+        attr: *mut posix_spawnattr_t,
+        default: *const ::sigset_t,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_getflags(
+        attr: *const posix_spawnattr_t,
+        flags: *mut ::c_short,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: ::c_short) -> ::c_int;
+    pub fn posix_spawnattr_getpgroup(
+        attr: *const posix_spawnattr_t,
+        flags: *mut ::pid_t,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: ::pid_t) -> ::c_int;
+    pub fn posix_spawnattr_getschedpolicy(
+        attr: *const posix_spawnattr_t,
+        flags: *mut ::c_int,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: ::c_int) -> ::c_int;
+    pub fn posix_spawnattr_getschedparam(
+        attr: *const posix_spawnattr_t,
+        param: *mut ::sched_param,
+    ) -> ::c_int;
+    pub fn posix_spawnattr_setschedparam(
+        attr: *mut posix_spawnattr_t,
+        param: *const ::sched_param,
+    ) -> ::c_int;
+
+    pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
+    pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> ::c_int;
+    pub fn posix_spawn_file_actions_addopen(
+        actions: *mut posix_spawn_file_actions_t,
+        fd: ::c_int,
+        path: *const ::c_char,
+        oflag: ::c_int,
+        mode: ::mode_t,
+    ) -> ::c_int;
+    pub fn posix_spawn_file_actions_addclose(
+        actions: *mut posix_spawn_file_actions_t,
+        fd: ::c_int,
+    ) -> ::c_int;
+    pub fn posix_spawn_file_actions_adddup2(
+        actions: *mut posix_spawn_file_actions_t,
+        fd: ::c_int,
+        newfd: ::c_int,
+    ) -> ::c_int;
+
+    // Added in `glibc` 2.29
+    pub fn posix_spawn_file_actions_addchdir_np(
+        actions: *mut ::posix_spawn_file_actions_t,
+        path: *const ::c_char,
+    ) -> ::c_int;
+    // Added in `glibc` 2.29
+    pub fn posix_spawn_file_actions_addfchdir_np(
+        actions: *mut ::posix_spawn_file_actions_t,
+        fd: ::c_int,
+    ) -> ::c_int;
+    // Added in `glibc` 2.34
+    pub fn posix_spawn_file_actions_addclosefrom_np(
+        actions: *mut ::posix_spawn_file_actions_t,
+        from: ::c_int,
+    ) -> ::c_int;
+    // Added in `glibc` 2.35
+    pub fn posix_spawn_file_actions_addtcsetpgrp_np(
+        actions: *mut ::posix_spawn_file_actions_t,
+        tcfd: ::c_int,
+    ) -> ::c_int;
+
+    pub fn shm_open(name: *const c_char, oflag: ::c_int, mode: mode_t) -> ::c_int;
+    pub fn shm_unlink(name: *const ::c_char) -> ::c_int;
+
+    pub fn euidaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
+    pub fn eaccess(pathname: *const ::c_char, mode: ::c_int) -> ::c_int;
+
     pub fn faccessat(
         dirfd: ::c_int,
         pathname: *const ::c_char,
@@ -2944,6 +4136,13 @@ extern "C" {
     pub fn readdir64(dirp: *mut ::DIR) -> *mut ::dirent64;
     pub fn readdir_r(dirp: *mut ::DIR, entry: *mut ::dirent, result: *mut *mut ::dirent)
         -> ::c_int;
+    pub fn readdir64_r(
+        dirp: *mut ::DIR,
+        entry: *mut ::dirent64,
+        result: *mut *mut ::dirent64,
+    ) -> ::c_int;
+    pub fn seekdir(dirp: *mut ::DIR, loc: ::c_long);
+    pub fn telldir(dirp: *mut ::DIR) -> ::c_long;
 
     pub fn dirfd(dirp: *mut ::DIR) -> ::c_int;
 
@@ -2961,6 +4160,14 @@ extern "C" {
         __offset: __off64_t,
     ) -> *mut ::c_void;
 
+    pub fn mremap(
+        addr: *mut ::c_void,
+        len: ::size_t,
+        new_len: ::size_t,
+        flags: ::c_int,
+        ...
+    ) -> *mut ::c_void;
+
     pub fn mprotect(__addr: *mut ::c_void, __len: ::size_t, __prot: ::c_int) -> ::c_int;
 
     pub fn msync(__addr: *mut ::c_void, __len: ::size_t, __flags: ::c_int) -> ::c_int;
@@ -2983,10 +4190,12 @@ extern "C" {
 
     pub fn madvise(__addr: *mut ::c_void, __len: ::size_t, __advice: ::c_int) -> ::c_int;
 
-    pub fn getrlimit(resource: ::__rlimit_resource, rlim: *mut ::rlimit) -> ::c_int;
-    pub fn getrlimit64(resource: ::__rlimit_resource, rlim: *mut ::rlimit64) -> ::c_int;
-    pub fn setrlimit(resource: ::__rlimit_resource, rlim: *const ::rlimit) -> ::c_int;
-    pub fn setrlimit64(resource: ::__rlimit_resource, rlim: *const ::rlimit64) -> ::c_int;
+    pub fn posix_madvise(addr: *mut ::c_void, len: ::size_t, advice: ::c_int) -> ::c_int;
+
+    pub fn getrlimit(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit) -> ::c_int;
+    pub fn getrlimit64(resource: ::__rlimit_resource_t, rlim: *mut ::rlimit64) -> ::c_int;
+    pub fn setrlimit(resource: ::__rlimit_resource_t, rlim: *const ::rlimit) -> ::c_int;
+    pub fn setrlimit64(resource: ::__rlimit_resource_t, rlim: *const ::rlimit64) -> ::c_int;
 
     pub fn getpriority(which: ::__priority_which, who: ::id_t) -> ::c_int;
     pub fn setpriority(which: ::__priority_which, who: ::id_t, prio: ::c_int) -> ::c_int;
@@ -2994,7 +4203,179 @@ extern "C" {
     pub fn getrandom(__buffer: *mut ::c_void, __length: ::size_t, __flags: ::c_uint) -> ::ssize_t;
     pub fn getentropy(__buffer: *mut ::c_void, __length: ::size_t) -> ::c_int;
 
+    pub fn memrchr(cx: *const ::c_void, c: ::c_int, n: ::size_t) -> *mut ::c_void;
+    pub fn memmem(
+        haystack: *const ::c_void,
+        haystacklen: ::size_t,
+        needle: *const ::c_void,
+        needlelen: ::size_t,
+    ) -> *mut ::c_void;
+    pub fn strchrnul(s: *const ::c_char, c: ::c_int) -> *mut ::c_char;
+
+    pub fn abs(i: ::c_int) -> ::c_int;
+    pub fn labs(i: ::c_long) -> ::c_long;
+    pub fn rand() -> ::c_int;
+    pub fn srand(seed: ::c_uint);
+
+    pub fn drand48() -> ::c_double;
+    pub fn erand48(xseed: *mut ::c_ushort) -> ::c_double;
+    pub fn lrand48() -> ::c_long;
+    pub fn nrand48(xseed: *mut ::c_ushort) -> ::c_long;
+    pub fn mrand48() -> ::c_long;
+    pub fn jrand48(xseed: *mut ::c_ushort) -> ::c_long;
+    pub fn srand48(seed: ::c_long);
+    pub fn seed48(xseed: *mut ::c_ushort) -> *mut ::c_ushort;
+    pub fn lcong48(p: *mut ::c_ushort);
+
+    pub fn qsort_r(
+        base: *mut ::c_void,
+        num: ::size_t,
+        size: ::size_t,
+        compar: ::Option<
+            unsafe extern "C" fn(*const ::c_void, *const ::c_void, *mut ::c_void) -> ::c_int,
+        >,
+        arg: *mut ::c_void,
+    );
+
+    pub fn brk(addr: *mut ::c_void) -> ::c_int;
+    pub fn sbrk(increment: ::intptr_t) -> *mut ::c_void;
+
+    pub fn memalign(align: ::size_t, size: ::size_t) -> *mut ::c_void;
+    pub fn mallopt(param: ::c_int, value: ::c_int) -> ::c_int;
+
+    pub fn mallinfo() -> ::mallinfo;
+    pub fn mallinfo2() -> ::mallinfo2;
+    pub fn malloc_info(options: ::c_int, stream: *mut ::FILE) -> ::c_int;
+    pub fn malloc_usable_size(ptr: *mut ::c_void) -> ::size_t;
+    pub fn malloc_trim(__pad: ::size_t) -> ::c_int;
+
+    pub fn iconv_open(tocode: *const ::c_char, fromcode: *const ::c_char) -> iconv_t;
+    pub fn iconv(
+        cd: iconv_t,
+        inbuf: *mut *mut ::c_char,
+        inbytesleft: *mut ::size_t,
+        outbuf: *mut *mut ::c_char,
+        outbytesleft: *mut ::size_t,
+    ) -> ::size_t;
+    pub fn iconv_close(cd: iconv_t) -> ::c_int;
+
+    pub fn getopt_long(
+        argc: ::c_int,
+        argv: *const *mut c_char,
+        optstring: *const c_char,
+        longopts: *const option,
+        longindex: *mut ::c_int,
+    ) -> ::c_int;
+
     pub fn backtrace(buf: *mut *mut ::c_void, sz: ::c_int) -> ::c_int;
+
+    pub fn reboot(how_to: ::c_int) -> ::c_int;
+
+    pub fn getloadavg(loadavg: *mut ::c_double, nelem: ::c_int) -> ::c_int;
+
+    pub fn regexec(
+        preg: *const ::regex_t,
+        input: *const ::c_char,
+        nmatch: ::size_t,
+        pmatch: *mut regmatch_t,
+        eflags: ::c_int,
+    ) -> ::c_int;
+
+    pub fn regerror(
+        errcode: ::c_int,
+        preg: *const ::regex_t,
+        errbuf: *mut ::c_char,
+        errbuf_size: ::size_t,
+    ) -> ::size_t;
+
+    pub fn regfree(preg: *mut ::regex_t);
+
+    pub fn glob(
+        pattern: *const c_char,
+        flags: ::c_int,
+        errfunc: ::Option<extern "C" fn(epath: *const c_char, errno: ::c_int) -> ::c_int>,
+        pglob: *mut ::glob_t,
+    ) -> ::c_int;
+    pub fn globfree(pglob: *mut ::glob_t);
+
+    pub fn glob64(
+        pattern: *const ::c_char,
+        flags: ::c_int,
+        errfunc: ::Option<extern "C" fn(epath: *const ::c_char, errno: ::c_int) -> ::c_int>,
+        pglob: *mut glob64_t,
+    ) -> ::c_int;
+    pub fn globfree64(pglob: *mut glob64_t);
+
+    pub fn getxattr(
+        path: *const c_char,
+        name: *const c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn lgetxattr(
+        path: *const c_char,
+        name: *const c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn fgetxattr(
+        filedes: ::c_int,
+        name: *const c_char,
+        value: *mut ::c_void,
+        size: ::size_t,
+    ) -> ::ssize_t;
+    pub fn setxattr(
+        path: *const c_char,
+        name: *const c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+        flags: ::c_int,
+    ) -> ::c_int;
+    pub fn lsetxattr(
+        path: *const c_char,
+        name: *const c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+        flags: ::c_int,
+    ) -> ::c_int;
+    pub fn fsetxattr(
+        filedes: ::c_int,
+        name: *const c_char,
+        value: *const ::c_void,
+        size: ::size_t,
+        flags: ::c_int,
+    ) -> ::c_int;
+    pub fn listxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+    pub fn llistxattr(path: *const c_char, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+    pub fn flistxattr(filedes: ::c_int, list: *mut c_char, size: ::size_t) -> ::ssize_t;
+    pub fn removexattr(path: *const c_char, name: *const c_char) -> ::c_int;
+    pub fn lremovexattr(path: *const c_char, name: *const c_char) -> ::c_int;
+    pub fn fremovexattr(filedes: ::c_int, name: *const c_char) -> ::c_int;
+
+    pub fn dirname(path: *mut ::c_char) -> *mut ::c_char;
+    /// POSIX version of `basename(3)`, defined in `libgen.h`.
+    #[link_name = "__xpg_basename"]
+    pub fn posix_basename(path: *mut ::c_char) -> *mut ::c_char;
+    /// GNU version of `basename(3)`, defined in `string.h`.
+    #[link_name = "basename"]
+    pub fn gnu_basename(path: *const ::c_char) -> *mut ::c_char;
+
+    pub fn dlmopen(lmid: Lmid_t, filename: *const ::c_char, flag: ::c_int) -> *mut ::c_void;
+    pub fn dlinfo(handle: *mut ::c_void, request: ::c_int, info: *mut ::c_void) -> ::c_int;
+    pub fn dladdr1(
+        addr: *const ::c_void,
+        info: *mut ::Dl_info,
+        extra_info: *mut *mut ::c_void,
+        flags: ::c_int,
+    ) -> ::c_int;
+
+    pub fn duplocale(base: ::locale_t) -> ::locale_t;
+    pub fn freelocale(loc: ::locale_t);
+    pub fn newlocale(mask: ::c_int, locale: *const ::c_char, base: ::locale_t) -> ::locale_t;
+    pub fn uselocale(loc: ::locale_t) -> ::locale_t;
+    pub fn nl_langinfo(item: ::nl_item) -> *mut ::c_char;
+    pub fn nl_langinfo_l(item: ::nl_item, locale: ::locale_t) -> *mut ::c_char;
+
     pub fn dl_iterate_phdr(
         callback: ::Option<
             unsafe extern "C" fn(
@@ -3005,6 +4386,9 @@ extern "C" {
         >,
         data: *mut ::c_void,
     ) -> ::c_int;
+
+    pub fn gnu_get_libc_release() -> *const ::c_char;
+    pub fn gnu_get_libc_version() -> *const ::c_char;
 }
 
 safe_f! {