@@ -48,6 +48,10 @@ cfg_if! {
48
48
unsafe fn errno_location( ) -> * mut c_int {
49
49
unsafe { libc:: _Errno( ) }
50
50
}
51
+ } else if #[ cfg( target_os = "nto" ) ] {
52
+ unsafe fn errno_location( ) -> * mut c_int {
53
+ unsafe { libc:: __get_errno_ptr( ) }
54
+ }
51
55
}
52
56
}
53
57
@@ -603,10 +607,20 @@ fn desc(errno: Errno) -> &'static str {
603
607
#[ cfg( freebsdlike) ]
604
608
EDOOFUS => "Programming error" ,
605
609
606
- #[ cfg( any( freebsdlike, target_os = "hurd" , target_os = "redox" ) ) ]
610
+ #[ cfg( any(
611
+ freebsdlike,
612
+ target_os = "hurd" ,
613
+ target_os = "redox" ,
614
+ target_os = "nto" ,
615
+ ) ) ]
607
616
EMULTIHOP => "Multihop attempted" ,
608
617
609
- #[ cfg( any( freebsdlike, target_os = "hurd" , target_os = "redox" ) ) ]
618
+ #[ cfg( any(
619
+ freebsdlike,
620
+ target_os = "hurd" ,
621
+ target_os = "redox" ,
622
+ target_os = "nto" ,
623
+ ) ) ]
610
624
ENOLINK => "Link has been severed" ,
611
625
612
626
#[ cfg( target_os = "freebsd" ) ]
@@ -615,7 +629,7 @@ fn desc(errno: Errno) -> &'static str {
615
629
#[ cfg( target_os = "freebsd" ) ]
616
630
ECAPMODE => "Not permitted in capability mode" ,
617
631
618
- #[ cfg( any( bsd, target_os = "hurd" ) ) ]
632
+ #[ cfg( all ( not ( target_os = "nto" ) , any( bsd, target_os = "hurd" ) ) ) ]
619
633
ENEEDAUTH => "Need authenticator" ,
620
634
621
635
#[ cfg( any( bsd, target_os = "redox" , solarish) ) ]
@@ -627,17 +641,19 @@ fn desc(errno: Errno) -> &'static str {
627
641
target_os = "netbsd" ,
628
642
target_os = "redox" ,
629
643
target_os = "haiku" ,
644
+ target_os = "nto" ,
630
645
target_os = "hurd"
631
646
) ) ]
632
647
EILSEQ => "Illegal byte sequence" ,
633
648
634
- #[ cfg( any( bsd, target_os = "haiku" ) ) ]
649
+ #[ cfg( all ( not ( target_os = "nto" ) , any( bsd, target_os = "haiku" ) ) ) ]
635
650
ENOATTR => "Attribute not found" ,
636
651
637
652
#[ cfg( any(
638
653
bsd,
639
654
target_os = "redox" ,
640
655
target_os = "haiku" ,
656
+ target_os = "nto" ,
641
657
target_os = "hurd"
642
658
) ) ]
643
659
EBADMSG => "Bad message" ,
@@ -670,7 +686,10 @@ fn desc(errno: Errno) -> &'static str {
670
686
) ) ]
671
687
ENOTSUP => "Operation not supported" ,
672
688
673
- #[ cfg( any( bsd, target_os = "aix" , target_os = "hurd" ) ) ]
689
+ #[ cfg( all(
690
+ not( target_os = "nto" ) ,
691
+ any( bsd, target_os = "aix" , target_os = "hurd" )
692
+ ) ) ]
674
693
EPROCLIM => "Too many processes" ,
675
694
676
695
#[ cfg( any(
@@ -718,10 +737,10 @@ fn desc(errno: Errno) -> &'static str {
718
737
#[ cfg( any( bsd, target_os = "hurd" ) ) ]
719
738
EPROCUNAVAIL => "Bad procedure for program" ,
720
739
721
- #[ cfg( any( bsd, target_os = "hurd" ) ) ]
740
+ #[ cfg( all ( not ( target_os = "nto" ) , any( bsd, target_os = "hurd" ) ) ) ]
722
741
EFTYPE => "Inappropriate file type or format" ,
723
742
724
- #[ cfg( any( bsd, target_os = "hurd" ) ) ]
743
+ #[ cfg( all ( not ( target_os = "nto" ) , any( bsd, target_os = "hurd" ) ) ) ]
725
744
EAUTH => "Authentication error" ,
726
745
727
746
#[ cfg( any(
@@ -757,7 +776,8 @@ fn desc(errno: Errno) -> &'static str {
757
776
apple_targets,
758
777
target_os = "aix" ,
759
778
target_os = "netbsd" ,
760
- target_os = "redox"
779
+ target_os = "redox" ,
780
+ target_os = "nto" ,
761
781
) ) ]
762
782
ENODATA => "No message available on STREAM" ,
763
783
@@ -768,23 +788,26 @@ fn desc(errno: Errno) -> &'static str {
768
788
apple_targets,
769
789
target_os = "aix" ,
770
790
target_os = "netbsd" ,
771
- target_os = "redox"
791
+ target_os = "redox" ,
792
+ target_os = "nto" ,
772
793
) ) ]
773
794
ENOSR => "No STREAM resources" ,
774
795
775
796
#[ cfg( any(
776
797
apple_targets,
777
798
target_os = "aix" ,
778
799
target_os = "netbsd" ,
779
- target_os = "redox"
800
+ target_os = "redox" ,
801
+ target_os = "nto" ,
780
802
) ) ]
781
803
ENOSTR => "Not a STREAM" ,
782
804
783
805
#[ cfg( any(
784
806
apple_targets,
785
807
target_os = "aix" ,
786
808
target_os = "netbsd" ,
787
- target_os = "redox"
809
+ target_os = "redox" ,
810
+ target_os = "nto" ,
788
811
) ) ]
789
812
ETIME => "STREAM ioctl timeout" ,
790
813
@@ -797,7 +820,11 @@ fn desc(errno: Errno) -> &'static str {
797
820
#[ cfg( apple_targets) ]
798
821
EQFULL => "Interface output queue is full" ,
799
822
800
- #[ cfg( any( target_os = "openbsd" , target_os = "hurd" ) ) ]
823
+ #[ cfg( any(
824
+ target_os = "openbsd" ,
825
+ target_os = "hurd" ,
826
+ target_os = "nto" ,
827
+ ) ) ]
801
828
EOPNOTSUPP => "Operation not supported" ,
802
829
803
830
#[ cfg( target_os = "openbsd" ) ]
@@ -3334,3 +3361,212 @@ mod consts {
3334
3361
}
3335
3362
}
3336
3363
}
3364
+
3365
+ #[ cfg( target_os = "nto" ) ]
3366
+ mod consts {
3367
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
3368
+ #[ repr( i32 ) ]
3369
+ #[ non_exhaustive]
3370
+ pub enum Errno {
3371
+ UnknownErrno = 0 ,
3372
+ EPERM = libc:: EPERM ,
3373
+ ENOENT = libc:: ENOENT ,
3374
+ ESRCH = libc:: ESRCH ,
3375
+ EINTR = libc:: EINTR ,
3376
+ EIO = libc:: EIO ,
3377
+ ENXIO = libc:: ENXIO ,
3378
+ E2BIG = libc:: E2BIG ,
3379
+ ENOEXEC = libc:: ENOEXEC ,
3380
+ EBADF = libc:: EBADF ,
3381
+ ECHILD = libc:: ECHILD ,
3382
+ EDEADLK = libc:: EDEADLK ,
3383
+ ENOMEM = libc:: ENOMEM ,
3384
+ EACCES = libc:: EACCES ,
3385
+ EFAULT = libc:: EFAULT ,
3386
+ ENOTBLK = libc:: ENOTBLK ,
3387
+ EBUSY = libc:: EBUSY ,
3388
+ EEXIST = libc:: EEXIST ,
3389
+ EXDEV = libc:: EXDEV ,
3390
+ ENODEV = libc:: ENODEV ,
3391
+ ENOTDIR = libc:: ENOTDIR ,
3392
+ EISDIR = libc:: EISDIR ,
3393
+ EINVAL = libc:: EINVAL ,
3394
+ ENFILE = libc:: ENFILE ,
3395
+ EMFILE = libc:: EMFILE ,
3396
+ ENOTTY = libc:: ENOTTY ,
3397
+ ETXTBSY = libc:: ETXTBSY ,
3398
+ EFBIG = libc:: EFBIG ,
3399
+ ENOSPC = libc:: ENOSPC ,
3400
+ ESPIPE = libc:: ESPIPE ,
3401
+ EROFS = libc:: EROFS ,
3402
+ EMLINK = libc:: EMLINK ,
3403
+ EPIPE = libc:: EPIPE ,
3404
+ EDOM = libc:: EDOM ,
3405
+ ERANGE = libc:: ERANGE ,
3406
+ EAGAIN = libc:: EAGAIN ,
3407
+ EINPROGRESS = libc:: EINPROGRESS ,
3408
+ EALREADY = libc:: EALREADY ,
3409
+ ENOTSOCK = libc:: ENOTSOCK ,
3410
+ EDESTADDRREQ = libc:: EDESTADDRREQ ,
3411
+ EMSGSIZE = libc:: EMSGSIZE ,
3412
+ EPROTOTYPE = libc:: EPROTOTYPE ,
3413
+ ENOPROTOOPT = libc:: ENOPROTOOPT ,
3414
+ EPROTONOSUPPORT = libc:: EPROTONOSUPPORT ,
3415
+ ESOCKTNOSUPPORT = libc:: ESOCKTNOSUPPORT ,
3416
+ EOPNOTSUPP = libc:: EOPNOTSUPP ,
3417
+ EPFNOSUPPORT = libc:: EPFNOSUPPORT ,
3418
+ EAFNOSUPPORT = libc:: EAFNOSUPPORT ,
3419
+ EADDRINUSE = libc:: EADDRINUSE ,
3420
+ EADDRNOTAVAIL = libc:: EADDRNOTAVAIL ,
3421
+ ENETDOWN = libc:: ENETDOWN ,
3422
+ ENETUNREACH = libc:: ENETUNREACH ,
3423
+ ENETRESET = libc:: ENETRESET ,
3424
+ ECONNABORTED = libc:: ECONNABORTED ,
3425
+ ECONNRESET = libc:: ECONNRESET ,
3426
+ ENOBUFS = libc:: ENOBUFS ,
3427
+ EISCONN = libc:: EISCONN ,
3428
+ ENOTCONN = libc:: ENOTCONN ,
3429
+ ESHUTDOWN = libc:: ESHUTDOWN ,
3430
+ ETOOMANYREFS = libc:: ETOOMANYREFS ,
3431
+ ETIMEDOUT = libc:: ETIMEDOUT ,
3432
+ ECONNREFUSED = libc:: ECONNREFUSED ,
3433
+ ELOOP = libc:: ELOOP ,
3434
+ ENAMETOOLONG = libc:: ENAMETOOLONG ,
3435
+ EHOSTDOWN = libc:: EHOSTDOWN ,
3436
+ EHOSTUNREACH = libc:: EHOSTUNREACH ,
3437
+ ENOTEMPTY = libc:: ENOTEMPTY ,
3438
+ EUSERS = libc:: EUSERS ,
3439
+ EDQUOT = libc:: EDQUOT ,
3440
+ ESTALE = libc:: ESTALE ,
3441
+ EREMOTE = libc:: EREMOTE ,
3442
+ EBADRPC = libc:: EBADRPC ,
3443
+ ERPCMISMATCH = libc:: ERPCMISMATCH ,
3444
+ EPROGUNAVAIL = libc:: EPROGUNAVAIL ,
3445
+ EPROGMISMATCH = libc:: EPROGMISMATCH ,
3446
+ EPROCUNAVAIL = libc:: EPROCUNAVAIL ,
3447
+ ENOLCK = libc:: ENOLCK ,
3448
+ ENOSYS = libc:: ENOSYS ,
3449
+ EIDRM = libc:: EIDRM ,
3450
+ ENOMSG = libc:: ENOMSG ,
3451
+ EOVERFLOW = libc:: EOVERFLOW ,
3452
+ EILSEQ = libc:: EILSEQ ,
3453
+ ENOTSUP = libc:: ENOTSUP ,
3454
+ ECANCELED = libc:: ECANCELED ,
3455
+ EBADMSG = libc:: EBADMSG ,
3456
+ ENODATA = libc:: ENODATA ,
3457
+ ENOSR = libc:: ENOSR ,
3458
+ ENOSTR = libc:: ENOSTR ,
3459
+ ETIME = libc:: ETIME ,
3460
+ EMULTIHOP = libc:: EMULTIHOP ,
3461
+ ENOLINK = libc:: ENOLINK ,
3462
+ EPROTO = libc:: EPROTO ,
3463
+ }
3464
+
3465
+ impl Errno {
3466
+ pub const ELAST : Errno = Errno :: ENOTSUP ;
3467
+ pub const EWOULDBLOCK : Errno = Errno :: EAGAIN ;
3468
+ }
3469
+
3470
+ #[ deprecated(
3471
+ since = "0.28.0" ,
3472
+ note = "please use `Errno::from_raw()` instead"
3473
+ ) ]
3474
+ pub const fn from_i32 ( e : i32 ) -> Errno {
3475
+ use self :: Errno :: * ;
3476
+
3477
+ match e {
3478
+ libc:: EPERM => EPERM ,
3479
+ libc:: ENOENT => ENOENT ,
3480
+ libc:: ESRCH => ESRCH ,
3481
+ libc:: EINTR => EINTR ,
3482
+ libc:: EIO => EIO ,
3483
+ libc:: ENXIO => ENXIO ,
3484
+ libc:: E2BIG => E2BIG ,
3485
+ libc:: ENOEXEC => ENOEXEC ,
3486
+ libc:: EBADF => EBADF ,
3487
+ libc:: ECHILD => ECHILD ,
3488
+ libc:: EDEADLK => EDEADLK ,
3489
+ libc:: ENOMEM => ENOMEM ,
3490
+ libc:: EACCES => EACCES ,
3491
+ libc:: EFAULT => EFAULT ,
3492
+ libc:: ENOTBLK => ENOTBLK ,
3493
+ libc:: EBUSY => EBUSY ,
3494
+ libc:: EEXIST => EEXIST ,
3495
+ libc:: EXDEV => EXDEV ,
3496
+ libc:: ENODEV => ENODEV ,
3497
+ libc:: ENOTDIR => ENOTDIR ,
3498
+ libc:: EISDIR => EISDIR ,
3499
+ libc:: EINVAL => EINVAL ,
3500
+ libc:: ENFILE => ENFILE ,
3501
+ libc:: EMFILE => EMFILE ,
3502
+ libc:: ENOTTY => ENOTTY ,
3503
+ libc:: ETXTBSY => ETXTBSY ,
3504
+ libc:: EFBIG => EFBIG ,
3505
+ libc:: ENOSPC => ENOSPC ,
3506
+ libc:: ESPIPE => ESPIPE ,
3507
+ libc:: EROFS => EROFS ,
3508
+ libc:: EMLINK => EMLINK ,
3509
+ libc:: EPIPE => EPIPE ,
3510
+ libc:: EDOM => EDOM ,
3511
+ libc:: ERANGE => ERANGE ,
3512
+ libc:: EAGAIN => EAGAIN ,
3513
+ libc:: EINPROGRESS => EINPROGRESS ,
3514
+ libc:: EALREADY => EALREADY ,
3515
+ libc:: ENOTSOCK => ENOTSOCK ,
3516
+ libc:: EDESTADDRREQ => EDESTADDRREQ ,
3517
+ libc:: EMSGSIZE => EMSGSIZE ,
3518
+ libc:: EPROTOTYPE => EPROTOTYPE ,
3519
+ libc:: ENOPROTOOPT => ENOPROTOOPT ,
3520
+ libc:: EPROTONOSUPPORT => EPROTONOSUPPORT ,
3521
+ libc:: ESOCKTNOSUPPORT => ESOCKTNOSUPPORT ,
3522
+ libc:: EOPNOTSUPP => EOPNOTSUPP ,
3523
+ libc:: EPFNOSUPPORT => EPFNOSUPPORT ,
3524
+ libc:: EAFNOSUPPORT => EAFNOSUPPORT ,
3525
+ libc:: EADDRINUSE => EADDRINUSE ,
3526
+ libc:: EADDRNOTAVAIL => EADDRNOTAVAIL ,
3527
+ libc:: ENETDOWN => ENETDOWN ,
3528
+ libc:: ENETUNREACH => ENETUNREACH ,
3529
+ libc:: ENETRESET => ENETRESET ,
3530
+ libc:: ECONNABORTED => ECONNABORTED ,
3531
+ libc:: ECONNRESET => ECONNRESET ,
3532
+ libc:: ENOBUFS => ENOBUFS ,
3533
+ libc:: EISCONN => EISCONN ,
3534
+ libc:: ENOTCONN => ENOTCONN ,
3535
+ libc:: ESHUTDOWN => ESHUTDOWN ,
3536
+ libc:: ETOOMANYREFS => ETOOMANYREFS ,
3537
+ libc:: ETIMEDOUT => ETIMEDOUT ,
3538
+ libc:: ECONNREFUSED => ECONNREFUSED ,
3539
+ libc:: ELOOP => ELOOP ,
3540
+ libc:: ENAMETOOLONG => ENAMETOOLONG ,
3541
+ libc:: EHOSTDOWN => EHOSTDOWN ,
3542
+ libc:: EHOSTUNREACH => EHOSTUNREACH ,
3543
+ libc:: ENOTEMPTY => ENOTEMPTY ,
3544
+ libc:: EUSERS => EUSERS ,
3545
+ libc:: EDQUOT => EDQUOT ,
3546
+ libc:: ESTALE => ESTALE ,
3547
+ libc:: EREMOTE => EREMOTE ,
3548
+ libc:: EBADRPC => EBADRPC ,
3549
+ libc:: ERPCMISMATCH => ERPCMISMATCH ,
3550
+ libc:: EPROGUNAVAIL => EPROGUNAVAIL ,
3551
+ libc:: EPROGMISMATCH => EPROGMISMATCH ,
3552
+ libc:: EPROCUNAVAIL => EPROCUNAVAIL ,
3553
+ libc:: ENOLCK => ENOLCK ,
3554
+ libc:: ENOSYS => ENOSYS ,
3555
+ libc:: EIDRM => EIDRM ,
3556
+ libc:: ENOMSG => ENOMSG ,
3557
+ libc:: EOVERFLOW => EOVERFLOW ,
3558
+ libc:: EILSEQ => EILSEQ ,
3559
+ libc:: ENOTSUP => ENOTSUP ,
3560
+ libc:: ECANCELED => ECANCELED ,
3561
+ libc:: EBADMSG => EBADMSG ,
3562
+ libc:: ENODATA => ENODATA ,
3563
+ libc:: ENOSR => ENOSR ,
3564
+ libc:: ENOSTR => ENOSTR ,
3565
+ libc:: ETIME => ETIME ,
3566
+ libc:: EMULTIHOP => EMULTIHOP ,
3567
+ libc:: ENOLINK => ENOLINK ,
3568
+ libc:: EPROTO => EPROTO ,
3569
+ _ => UnknownErrno ,
3570
+ }
3571
+ }
3572
+ }
0 commit comments