@@ -28,7 +28,7 @@ unsafe fn errno_location() -> *mut c_int {
28
28
__dfly_error ( )
29
29
}
30
30
31
- #[ cfg( target_os = "openbsd" ) ]
31
+ #[ cfg( any ( target_os = "openbsd" , target_os = "netbsd" ) ) ]
32
32
unsafe fn errno_location ( ) -> * mut c_int {
33
33
extern { fn __errno ( ) -> * mut c_int ; }
34
34
__errno ( )
@@ -280,7 +280,7 @@ fn desc(errno: Errno) -> &'static str {
280
280
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
281
281
EUSERS => "Too many users" ,
282
282
283
- #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
283
+ #[ cfg( any( target_os = "linux" , target_os = "android" , target_os = "netbsd" ) ) ]
284
284
EOPNOTSUPP => "Operation not supported on transport endpoint" ,
285
285
286
286
#[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
@@ -352,22 +352,22 @@ fn desc(errno: Errno) -> &'static str {
352
352
#[ cfg( target_os = "freebsd" ) ]
353
353
ECAPMODE => "Not permitted in capability mode" ,
354
354
355
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
355
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
356
356
ENEEDAUTH => "Need authenticator" ,
357
357
358
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
358
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
359
359
EOVERFLOW => "Value too large to be stored in data type" ,
360
360
361
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" ) ) ]
361
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "netbsd" ) ) ]
362
362
EILSEQ => "Illegal byte sequence" ,
363
363
364
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
364
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
365
365
ENOATTR => "Attribute not found" ,
366
366
367
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" ) ) ]
367
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "netbsd" ) ) ]
368
368
EBADMSG => "Bad message" ,
369
369
370
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" ) ) ]
370
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "netbsd" ) ) ]
371
371
EPROTO => "Protocol error" ,
372
372
373
373
#[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "ios" ) ) ]
@@ -376,46 +376,46 @@ fn desc(errno: Errno) -> &'static str {
376
376
#[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "ios" ) ) ]
377
377
EOWNERDEAD => "Previous owner died" ,
378
378
379
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
379
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
380
380
ENOTSUP => "Operation not supported" ,
381
381
382
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
382
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
383
383
EPROCLIM => "Too many processes" ,
384
384
385
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
385
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
386
386
EUSERS => "Too many users" ,
387
387
388
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
388
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
389
389
EDQUOT => "Disc quota exceeded" ,
390
390
391
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
391
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
392
392
ESTALE => "Stale NFS file handle" ,
393
393
394
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
394
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
395
395
EREMOTE => "Too many levels of remote in path" ,
396
396
397
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
397
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
398
398
EBADRPC => "RPC struct is bad" ,
399
399
400
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
400
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
401
401
ERPCMISMATCH => "RPC version wrong" ,
402
402
403
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
403
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
404
404
EPROGUNAVAIL => "RPC prog. not avail" ,
405
405
406
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
406
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
407
407
EPROGMISMATCH => "Program version wrong" ,
408
408
409
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
409
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
410
410
EPROCUNAVAIL => "Bad procedure for program" ,
411
411
412
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
412
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
413
413
EFTYPE => "Inappropriate file type or format" ,
414
414
415
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
415
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
416
416
EAUTH => "Authentication error" ,
417
417
418
- #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" ) ) ]
418
+ #[ cfg( any( target_os = "macos" , target_os = "freebsd" , target_os = "dragonfly" , target_os = "ios" , target_os = "openbsd" , target_os = "netbsd" ) ) ]
419
419
ECANCELED => "Operation canceled" ,
420
420
421
421
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -436,22 +436,22 @@ fn desc(errno: Errno) -> &'static str {
436
436
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
437
437
EBADMACHO => "Malformed Macho file" ,
438
438
439
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
439
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
440
440
EMULTIHOP => "Reserved" ,
441
441
442
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
442
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
443
443
ENODATA => "No message available on STREAM" ,
444
444
445
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
445
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
446
446
ENOLINK => "Reserved" ,
447
447
448
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
448
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
449
449
ENOSR => "No STREAM resources" ,
450
450
451
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
451
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
452
452
ENOSTR => "Not a STREAM" ,
453
453
454
- #[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
454
+ #[ cfg( any( target_os = "macos" , target_os = "ios" , target_os = "netbsd" ) ) ]
455
455
ETIME => "STREAM ioctl timeout" ,
456
456
457
457
#[ cfg( any( target_os = "macos" , target_os = "ios" ) ) ]
@@ -1655,6 +1655,222 @@ mod consts {
1655
1655
}
1656
1656
}
1657
1657
1658
+ #[ cfg( target_os = "netbsd" ) ]
1659
+ mod consts {
1660
+ #[ derive( Copy , Debug , Clone , PartialEq ) ]
1661
+ pub enum Errno {
1662
+ UnknownErrno = 0 ,
1663
+ EPERM = 1 ,
1664
+ ENOENT = 2 ,
1665
+ ESRCH = 3 ,
1666
+ EINTR = 4 ,
1667
+ EIO = 5 ,
1668
+ ENXIO = 6 ,
1669
+ E2BIG = 7 ,
1670
+ ENOEXEC = 8 ,
1671
+ EBADF = 9 ,
1672
+ ECHILD = 10 ,
1673
+ EDEADLK = 11 ,
1674
+ ENOMEM = 12 ,
1675
+ EACCES = 13 ,
1676
+ EFAULT = 14 ,
1677
+ ENOTBLK = 15 ,
1678
+ EBUSY = 16 ,
1679
+ EEXIST = 17 ,
1680
+ EXDEV = 18 ,
1681
+ ENODEV = 19 ,
1682
+ ENOTDIR = 20 ,
1683
+ EISDIR = 21 ,
1684
+ EINVAL = 22 ,
1685
+ ENFILE = 23 ,
1686
+ EMFILE = 24 ,
1687
+ ENOTTY = 25 ,
1688
+ ETXTBSY = 26 ,
1689
+ EFBIG = 27 ,
1690
+ ENOSPC = 28 ,
1691
+ ESPIPE = 29 ,
1692
+ EROFS = 30 ,
1693
+ EMLINK = 31 ,
1694
+ EPIPE = 32 ,
1695
+ EDOM = 33 ,
1696
+ ERANGE = 34 ,
1697
+ EAGAIN = 35 ,
1698
+ EINPROGRESS = 36 ,
1699
+ EALREADY = 37 ,
1700
+ ENOTSOCK = 38 ,
1701
+ EDESTADDRREQ = 39 ,
1702
+ EMSGSIZE = 40 ,
1703
+ EPROTOTYPE = 41 ,
1704
+ ENOPROTOOPT = 42 ,
1705
+ EPROTONOSUPPORT = 43 ,
1706
+ ESOCKTNOSUPPORT = 44 ,
1707
+ EOPNOTSUPP = 45 ,
1708
+ EPFNOSUPPORT = 46 ,
1709
+ EAFNOSUPPORT = 47 ,
1710
+ EADDRINUSE = 48 ,
1711
+ EADDRNOTAVAIL = 49 ,
1712
+ ENETDOWN = 50 ,
1713
+ ENETUNREACH = 51 ,
1714
+ ENETRESET = 52 ,
1715
+ ECONNABORTED = 53 ,
1716
+ ECONNRESET = 54 ,
1717
+ ENOBUFS = 55 ,
1718
+ EISCONN = 56 ,
1719
+ ENOTCONN = 57 ,
1720
+ ESHUTDOWN = 58 ,
1721
+ ETOOMANYREFS = 59 ,
1722
+ ETIMEDOUT = 60 ,
1723
+ ECONNREFUSED = 61 ,
1724
+ ELOOP = 62 ,
1725
+ ENAMETOOLONG = 63 ,
1726
+ EHOSTDOWN = 64 ,
1727
+ EHOSTUNREACH = 65 ,
1728
+ ENOTEMPTY = 66 ,
1729
+ EPROCLIM = 67 ,
1730
+ EUSERS = 68 ,
1731
+ EDQUOT = 69 ,
1732
+ ESTALE = 70 ,
1733
+ EREMOTE = 71 ,
1734
+ EBADRPC = 72 ,
1735
+ ERPCMISMATCH = 73 ,
1736
+ EPROGUNAVAIL = 74 ,
1737
+ EPROGMISMATCH = 75 ,
1738
+ EPROCUNAVAIL = 76 ,
1739
+ ENOLCK = 77 ,
1740
+ ENOSYS = 78 ,
1741
+ EFTYPE = 79 ,
1742
+ EAUTH = 80 ,
1743
+ ENEEDAUTH = 81 ,
1744
+ EIDRM = 82 ,
1745
+ ENOMSG = 83 ,
1746
+ EOVERFLOW = 84 ,
1747
+ EILSEQ = 85 ,
1748
+ ENOTSUP = 86 ,
1749
+ ECANCELED = 87 ,
1750
+ EBADMSG = 88 ,
1751
+ ENODATA = 89 ,
1752
+ ENOSR = 90 ,
1753
+ ENOSTR = 91 ,
1754
+ ETIME = 92 ,
1755
+ ENOATTR = 93 ,
1756
+ EMULTIHOP = 94 ,
1757
+ ENOLINK = 95 ,
1758
+ EPROTO = 96 ,
1759
+ }
1760
+
1761
+ impl_errno ! ( Errno ) ;
1762
+
1763
+ pub const ELAST : Errno = Errno :: ENOTSUP ;
1764
+ pub const EWOULDBLOCK : Errno = Errno :: EAGAIN ;
1765
+
1766
+ pub const EL2NSYNC : Errno = Errno :: UnknownErrno ;
1767
+
1768
+ pub fn from_i32 ( e : i32 ) -> Errno {
1769
+ use self :: Errno :: * ;
1770
+
1771
+ match e {
1772
+ 0 => UnknownErrno ,
1773
+ 1 => EPERM ,
1774
+ 2 => ENOENT ,
1775
+ 3 => ESRCH ,
1776
+ 4 => EINTR ,
1777
+ 5 => EIO ,
1778
+ 6 => ENXIO ,
1779
+ 7 => E2BIG ,
1780
+ 8 => ENOEXEC ,
1781
+ 9 => EBADF ,
1782
+ 10 => ECHILD ,
1783
+ 11 => EDEADLK ,
1784
+ 12 => ENOMEM ,
1785
+ 13 => EACCES ,
1786
+ 14 => EFAULT ,
1787
+ 15 => ENOTBLK ,
1788
+ 16 => EBUSY ,
1789
+ 17 => EEXIST ,
1790
+ 18 => EXDEV ,
1791
+ 19 => ENODEV ,
1792
+ 20 => ENOTDIR ,
1793
+ 21 => EISDIR ,
1794
+ 22 => EINVAL ,
1795
+ 23 => ENFILE ,
1796
+ 24 => EMFILE ,
1797
+ 25 => ENOTTY ,
1798
+ 26 => ETXTBSY ,
1799
+ 27 => EFBIG ,
1800
+ 28 => ENOSPC ,
1801
+ 29 => ESPIPE ,
1802
+ 30 => EROFS ,
1803
+ 31 => EMLINK ,
1804
+ 32 => EPIPE ,
1805
+ 33 => EDOM ,
1806
+ 34 => ERANGE ,
1807
+ 35 => EAGAIN ,
1808
+ 36 => EINPROGRESS ,
1809
+ 37 => EALREADY ,
1810
+ 38 => ENOTSOCK ,
1811
+ 39 => EDESTADDRREQ ,
1812
+ 40 => EMSGSIZE ,
1813
+ 41 => EPROTOTYPE ,
1814
+ 42 => ENOPROTOOPT ,
1815
+ 43 => EPROTONOSUPPORT ,
1816
+ 44 => ESOCKTNOSUPPORT ,
1817
+ 45 => EOPNOTSUPP ,
1818
+ 46 => EPFNOSUPPORT ,
1819
+ 47 => EAFNOSUPPORT ,
1820
+ 48 => EADDRINUSE ,
1821
+ 49 => EADDRNOTAVAIL ,
1822
+ 50 => ENETDOWN ,
1823
+ 51 => ENETUNREACH ,
1824
+ 52 => ENETRESET ,
1825
+ 53 => ECONNABORTED ,
1826
+ 54 => ECONNRESET ,
1827
+ 55 => ENOBUFS ,
1828
+ 56 => EISCONN ,
1829
+ 57 => ENOTCONN ,
1830
+ 58 => ESHUTDOWN ,
1831
+ 59 => ETOOMANYREFS ,
1832
+ 60 => ETIMEDOUT ,
1833
+ 61 => ECONNREFUSED ,
1834
+ 62 => ELOOP ,
1835
+ 63 => ENAMETOOLONG ,
1836
+ 64 => EHOSTDOWN ,
1837
+ 65 => EHOSTUNREACH ,
1838
+ 66 => ENOTEMPTY ,
1839
+ 67 => EPROCLIM ,
1840
+ 68 => EUSERS ,
1841
+ 69 => EDQUOT ,
1842
+ 70 => ESTALE ,
1843
+ 71 => EREMOTE ,
1844
+ 72 => EBADRPC ,
1845
+ 73 => ERPCMISMATCH ,
1846
+ 74 => EPROGUNAVAIL ,
1847
+ 75 => EPROGMISMATCH ,
1848
+ 76 => EPROCUNAVAIL ,
1849
+ 77 => ENOLCK ,
1850
+ 78 => ENOSYS ,
1851
+ 79 => EFTYPE ,
1852
+ 80 => EAUTH ,
1853
+ 81 => ENEEDAUTH ,
1854
+ 82 => EIDRM ,
1855
+ 83 => ENOMSG ,
1856
+ 84 => EOVERFLOW ,
1857
+ 85 => EILSEQ ,
1858
+ 86 => ENOTSUP ,
1859
+ 87 => ECANCELED ,
1860
+ 88 => EBADMSG ,
1861
+ 89 => ENODATA ,
1862
+ 90 => ENOSR ,
1863
+ 91 => ENOSTR ,
1864
+ 92 => ETIME ,
1865
+ 93 => ENOATTR ,
1866
+ 94 => EMULTIHOP ,
1867
+ 95 => ENOLINK ,
1868
+ 96 => EPROTO ,
1869
+ _ => UnknownErrno ,
1870
+ }
1871
+ }
1872
+ }
1873
+
1658
1874
1659
1875
#[ cfg( test) ]
1660
1876
mod test {
0 commit comments