@@ -30,6 +30,10 @@ cfg_if! {
30
30
unsafe fn errno_location( ) -> * mut c_int {
31
31
libc:: ___errno( )
32
32
}
33
+ } else if #[ cfg( any( target_os = "haiku" , ) ) ] {
34
+ unsafe fn errno_location( ) -> * mut c_int {
35
+ libc:: _errnop( )
36
+ }
33
37
}
34
38
}
35
39
@@ -201,6 +205,7 @@ fn desc(errno: Errno) -> &'static str {
201
205
ENOMEM => "Out of memory" ,
202
206
EACCES => "Permission denied" ,
203
207
EFAULT => "Bad address" ,
208
+ #[ cfg( not( target_os = "haiku" ) ) ]
204
209
ENOTBLK => "Block device required" ,
205
210
EBUSY => "Device or resource busy" ,
206
211
EEXIST => "File exists" ,
@@ -237,8 +242,11 @@ fn desc(errno: Errno) -> &'static str {
237
242
EPROTOTYPE => "Protocol wrong type for socket" ,
238
243
ENOPROTOOPT => "Protocol not available" ,
239
244
EPROTONOSUPPORT => "Protocol not supported" ,
245
+ #[ cfg( not( target_os = "haiku" ) ) ]
240
246
ESOCKTNOSUPPORT => "Socket type not supported" ,
247
+ #[ cfg( not( target_os = "haiku" ) ) ]
241
248
EPFNOSUPPORT => "Protocol family not supported" ,
249
+ #[ cfg( not( target_os = "haiku" ) ) ]
242
250
EAFNOSUPPORT => "Address family not supported by protocol" ,
243
251
EADDRINUSE => "Address already in use" ,
244
252
EADDRNOTAVAIL => "Cannot assign requested address" ,
@@ -251,6 +259,7 @@ fn desc(errno: Errno) -> &'static str {
251
259
EISCONN => "Transport endpoint is already connected" ,
252
260
ENOTCONN => "Transport endpoint is not connected" ,
253
261
ESHUTDOWN => "Cannot send after transport endpoint shutdown" ,
262
+ #[ cfg( not( target_os = "haiku" ) ) ]
254
263
ETOOMANYREFS => "Too many references: cannot splice" ,
255
264
ETIMEDOUT => "Connection timed out" ,
256
265
ECONNREFUSED => "Connection refused" ,
@@ -409,7 +418,7 @@ fn desc(errno: Errno) -> &'static str {
409
418
EBADMSG => "Trying to read unreadable message" ,
410
419
411
420
#[ cfg( any( target_os = "linux" , target_os = "android" ,
412
- target_os = "fuchsia" ) ) ]
421
+ target_os = "fuchsia" , target_os = "haiku" ) ) ]
413
422
EOVERFLOW => "Value too large for defined data type" ,
414
423
415
424
#[ cfg( any( target_os = "linux" , target_os = "android" ,
@@ -516,7 +525,7 @@ fn desc(errno: Errno) -> &'static str {
516
525
517
526
#[ cfg( any( target_os = "linux" , target_os = "android" ,
518
527
target_os = "illumos" , target_os = "solaris" ,
519
- target_os = "fuchsia" ) ) ]
528
+ target_os = "fuchsia" , target_os = "haiku" ) ) ]
520
529
ECANCELED => "Operation canceled" ,
521
530
522
531
#[ cfg( any( target_os = "linux" , target_os = "android" ,
@@ -587,24 +596,26 @@ fn desc(errno: Errno) -> &'static str {
587
596
588
597
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
589
598
target_os = "dragonfly" , target_os = "ios" ,
590
- target_os = "netbsd" , target_os = "redox" ) ) ]
599
+ target_os = "netbsd" , target_os = "redox" ,
600
+ target_os = "haiku" ) ) ]
591
601
EILSEQ => "Illegal byte sequence" ,
592
602
593
603
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
594
604
target_os = "dragonfly" , target_os = "ios" ,
595
- target_os = "openbsd" , target_os = "netbsd" ) ) ]
605
+ target_os = "openbsd" , target_os = "netbsd" ,
606
+ target_os = "haiku" ) ) ]
596
607
ENOATTR => "Attribute not found" ,
597
608
598
609
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
599
610
target_os = "dragonfly" , target_os = "ios" ,
600
611
target_os = "openbsd" , target_os = "netbsd" ,
601
- target_os = "redox" ) ) ]
612
+ target_os = "redox" , target_os = "haiku" ) ) ]
602
613
EBADMSG => "Bad message" ,
603
614
604
615
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
605
616
target_os = "dragonfly" , target_os = "ios" ,
606
617
target_os = "openbsd" , target_os = "netbsd" ,
607
- target_os = "redox" ) ) ]
618
+ target_os = "redox" , target_os = "haiku" ) ) ]
608
619
EPROTO => "Protocol error" ,
609
620
610
621
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -620,7 +631,8 @@ fn desc(errno: Errno) -> &'static str {
620
631
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
621
632
target_os = "dragonfly" , target_os = "ios" ,
622
633
target_os = "openbsd" , target_os = "netbsd" ,
623
- target_os = "illumos" , target_os = "solaris" ) ) ]
634
+ target_os = "illumos" , target_os = "solaris" ,
635
+ target_os = "haiku" ) ) ]
624
636
ENOTSUP => "Operation not supported" ,
625
637
626
638
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -638,14 +650,14 @@ fn desc(errno: Errno) -> &'static str {
638
650
target_os = "dragonfly" , target_os = "ios" ,
639
651
target_os = "openbsd" , target_os = "netbsd" ,
640
652
target_os = "redox" , target_os = "illumos" ,
641
- target_os = "solaris" ) ) ]
653
+ target_os = "solaris" , target_os = "haiku" ) ) ]
642
654
EDQUOT => "Disc quota exceeded" ,
643
655
644
656
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
645
657
target_os = "dragonfly" , target_os = "ios" ,
646
658
target_os = "openbsd" , target_os = "netbsd" ,
647
659
target_os = "redox" , target_os = "illumos" ,
648
- target_os = "solaris" ) ) ]
660
+ target_os = "solaris" , target_os = "haiku" ) ) ]
649
661
ESTALE => "Stale NFS file handle" ,
650
662
651
663
#[ cfg( any( target_os = "macos" , target_os = "freebsd" ,
@@ -714,15 +726,15 @@ fn desc(errno: Errno) -> &'static str {
714
726
EBADMACHO => "Malformed Macho file" ,
715
727
716
728
#[ cfg( any( target_os = "macos" , target_os = "ios" ,
717
- target_os = "netbsd" ) ) ]
729
+ target_os = "netbsd" , target_os = "haiku" ) ) ]
718
730
EMULTIHOP => "Reserved" ,
719
731
720
732
#[ cfg( any( target_os = "macos" , target_os = "ios" ,
721
733
target_os = "netbsd" , target_os = "redox" ) ) ]
722
734
ENODATA => "No message available on STREAM" ,
723
735
724
736
#[ cfg( any( target_os = "macos" , target_os = "ios" ,
725
- target_os = "netbsd" ) ) ]
737
+ target_os = "netbsd" , target_os = "haiku" ) ) ]
726
738
ENOLINK => "Reserved" ,
727
739
728
740
#[ cfg( any( target_os = "macos" , target_os = "ios" ,
@@ -2725,3 +2737,178 @@ mod consts {
2725
2737
}
2726
2738
}
2727
2739
}
2740
+
2741
+ #[ cfg( target_os = "haiku" ) ]
2742
+ mod consts {
2743
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
2744
+ #[ repr( i32 ) ]
2745
+ #[ non_exhaustive]
2746
+ pub enum Errno {
2747
+ UnknownErrno = 0 ,
2748
+ EPERM = libc:: EPERM ,
2749
+ ENOENT = libc:: ENOENT ,
2750
+ ESRCH = libc:: ESRCH ,
2751
+ EINTR = libc:: EINTR ,
2752
+ EIO = libc:: EIO ,
2753
+ ENXIO = libc:: ENXIO ,
2754
+ E2BIG = libc:: E2BIG ,
2755
+ ENOEXEC = libc:: ENOEXEC ,
2756
+ EBADF = libc:: EBADF ,
2757
+ ECHILD = libc:: ECHILD ,
2758
+ EDEADLK = libc:: EDEADLK ,
2759
+ ENOMEM = libc:: ENOMEM ,
2760
+ EACCES = libc:: EACCES ,
2761
+ EFAULT = libc:: EFAULT ,
2762
+ EBUSY = libc:: EBUSY ,
2763
+ EEXIST = libc:: EEXIST ,
2764
+ EXDEV = libc:: EXDEV ,
2765
+ ENODEV = libc:: ENODEV ,
2766
+ ENOTDIR = libc:: ENOTDIR ,
2767
+ EISDIR = libc:: EISDIR ,
2768
+ EINVAL = libc:: EINVAL ,
2769
+ ENFILE = libc:: ENFILE ,
2770
+ EMFILE = libc:: EMFILE ,
2771
+ ENOTTY = libc:: ENOTTY ,
2772
+ ETXTBSY = libc:: ETXTBSY ,
2773
+ EFBIG = libc:: EFBIG ,
2774
+ ENOSPC = libc:: ENOSPC ,
2775
+ ESPIPE = libc:: ESPIPE ,
2776
+ EROFS = libc:: EROFS ,
2777
+ EMLINK = libc:: EMLINK ,
2778
+ EPIPE = libc:: EPIPE ,
2779
+ EDOM = libc:: EDOM ,
2780
+ ERANGE = libc:: ERANGE ,
2781
+ EAGAIN = libc:: EAGAIN ,
2782
+ EINPROGRESS = libc:: EINPROGRESS ,
2783
+ EALREADY = libc:: EALREADY ,
2784
+ ENOTSOCK = libc:: ENOTSOCK ,
2785
+ EDESTADDRREQ = libc:: EDESTADDRREQ ,
2786
+ EMSGSIZE = libc:: EMSGSIZE ,
2787
+ EPROTOTYPE = libc:: EPROTOTYPE ,
2788
+ ENOPROTOOPT = libc:: ENOPROTOOPT ,
2789
+ EPROTONOSUPPORT = libc:: EPROTONOSUPPORT ,
2790
+ ENOTSUP = libc:: ENOTSUP ,
2791
+ EADDRINUSE = libc:: EADDRINUSE ,
2792
+ EADDRNOTAVAIL = libc:: EADDRNOTAVAIL ,
2793
+ ENETDOWN = libc:: ENETDOWN ,
2794
+ ENETUNREACH = libc:: ENETUNREACH ,
2795
+ ENETRESET = libc:: ENETRESET ,
2796
+ ECONNABORTED = libc:: ECONNABORTED ,
2797
+ ECONNRESET = libc:: ECONNRESET ,
2798
+ ENOBUFS = libc:: ENOBUFS ,
2799
+ EISCONN = libc:: EISCONN ,
2800
+ ENOTCONN = libc:: ENOTCONN ,
2801
+ ESHUTDOWN = libc:: ESHUTDOWN ,
2802
+ ETIMEDOUT = libc:: ETIMEDOUT ,
2803
+ ECONNREFUSED = libc:: ECONNREFUSED ,
2804
+ ELOOP = libc:: ELOOP ,
2805
+ ENAMETOOLONG = libc:: ENAMETOOLONG ,
2806
+ EHOSTDOWN = libc:: EHOSTDOWN ,
2807
+ EHOSTUNREACH = libc:: EHOSTUNREACH ,
2808
+ ENOTEMPTY = libc:: ENOTEMPTY ,
2809
+ EDQUOT = libc:: EDQUOT ,
2810
+ ESTALE = libc:: ESTALE ,
2811
+ ENOLCK = libc:: ENOLCK ,
2812
+ ENOSYS = libc:: ENOSYS ,
2813
+ EIDRM = libc:: EIDRM ,
2814
+ ENOMSG = libc:: ENOMSG ,
2815
+ EOVERFLOW = libc:: EOVERFLOW ,
2816
+ ECANCELED = libc:: ECANCELED ,
2817
+ EILSEQ = libc:: EILSEQ ,
2818
+ ENOATTR = libc:: ENOATTR ,
2819
+ EBADMSG = libc:: EBADMSG ,
2820
+ EMULTIHOP = libc:: EMULTIHOP ,
2821
+ ENOLINK = libc:: ENOLINK ,
2822
+ EPROTO = libc:: EPROTO ,
2823
+ }
2824
+
2825
+ impl Errno {
2826
+ pub const EWOULDBLOCK : Errno = Errno :: EAGAIN ;
2827
+ pub const EDEADLOCK : Errno = Errno :: EDEADLK ;
2828
+ pub const EOPNOTSUPP : Errno = Errno :: ENOTSUP ;
2829
+ }
2830
+
2831
+ pub const fn from_i32 ( e : i32 ) -> Errno {
2832
+ use self :: Errno :: * ;
2833
+
2834
+ match e {
2835
+ libc:: EPERM => EPERM ,
2836
+ libc:: ENOENT => ENOENT ,
2837
+ libc:: ESRCH => ESRCH ,
2838
+ libc:: EINTR => EINTR ,
2839
+ libc:: EIO => EIO ,
2840
+ libc:: ENXIO => ENXIO ,
2841
+ libc:: E2BIG => E2BIG ,
2842
+ libc:: ENOEXEC => ENOEXEC ,
2843
+ libc:: EBADF => EBADF ,
2844
+ libc:: ECHILD => ECHILD ,
2845
+ libc:: EDEADLK => EDEADLK ,
2846
+ libc:: ENOMEM => ENOMEM ,
2847
+ libc:: EACCES => EACCES ,
2848
+ libc:: EFAULT => EFAULT ,
2849
+ libc:: EBUSY => EBUSY ,
2850
+ libc:: EEXIST => EEXIST ,
2851
+ libc:: EXDEV => EXDEV ,
2852
+ libc:: ENODEV => ENODEV ,
2853
+ libc:: ENOTDIR => ENOTDIR ,
2854
+ libc:: EISDIR => EISDIR ,
2855
+ libc:: EINVAL => EINVAL ,
2856
+ libc:: ENFILE => ENFILE ,
2857
+ libc:: EMFILE => EMFILE ,
2858
+ libc:: ENOTTY => ENOTTY ,
2859
+ libc:: ETXTBSY => ETXTBSY ,
2860
+ libc:: EFBIG => EFBIG ,
2861
+ libc:: ENOSPC => ENOSPC ,
2862
+ libc:: ESPIPE => ESPIPE ,
2863
+ libc:: EROFS => EROFS ,
2864
+ libc:: EMLINK => EMLINK ,
2865
+ libc:: EPIPE => EPIPE ,
2866
+ libc:: EDOM => EDOM ,
2867
+ libc:: ERANGE => ERANGE ,
2868
+ libc:: EAGAIN => EAGAIN ,
2869
+ libc:: EINPROGRESS => EINPROGRESS ,
2870
+ libc:: EALREADY => EALREADY ,
2871
+ libc:: ENOTSOCK => ENOTSOCK ,
2872
+ libc:: EDESTADDRREQ => EDESTADDRREQ ,
2873
+ libc:: EMSGSIZE => EMSGSIZE ,
2874
+ libc:: EPROTOTYPE => EPROTOTYPE ,
2875
+ libc:: ENOPROTOOPT => ENOPROTOOPT ,
2876
+ libc:: EPROTONOSUPPORT => EPROTONOSUPPORT ,
2877
+ libc:: ENOTSUP => ENOTSUP ,
2878
+ libc:: EADDRINUSE => EADDRINUSE ,
2879
+ libc:: EADDRNOTAVAIL => EADDRNOTAVAIL ,
2880
+ libc:: ENETDOWN => ENETDOWN ,
2881
+ libc:: ENETUNREACH => ENETUNREACH ,
2882
+ libc:: ENETRESET => ENETRESET ,
2883
+ libc:: ECONNABORTED => ECONNABORTED ,
2884
+ libc:: ECONNRESET => ECONNRESET ,
2885
+ libc:: ENOBUFS => ENOBUFS ,
2886
+ libc:: EISCONN => EISCONN ,
2887
+ libc:: ENOTCONN => ENOTCONN ,
2888
+ libc:: ESHUTDOWN => ESHUTDOWN ,
2889
+ libc:: ETIMEDOUT => ETIMEDOUT ,
2890
+ libc:: ECONNREFUSED => ECONNREFUSED ,
2891
+ libc:: ELOOP => ELOOP ,
2892
+ libc:: ENAMETOOLONG => ENAMETOOLONG ,
2893
+ libc:: EHOSTDOWN => EHOSTDOWN ,
2894
+ libc:: EHOSTUNREACH => EHOSTUNREACH ,
2895
+ libc:: ENOTEMPTY => ENOTEMPTY ,
2896
+ libc:: EDQUOT => EDQUOT ,
2897
+ libc:: ESTALE => ESTALE ,
2898
+ libc:: ENOLCK => ENOLCK ,
2899
+ libc:: ENOSYS => ENOSYS ,
2900
+ libc:: EIDRM => EIDRM ,
2901
+ libc:: ENOMSG => ENOMSG ,
2902
+ libc:: EOVERFLOW => EOVERFLOW ,
2903
+ libc:: ECANCELED => ECANCELED ,
2904
+ libc:: EILSEQ => EILSEQ ,
2905
+ libc:: ENOATTR => ENOATTR ,
2906
+ libc:: EBADMSG => EBADMSG ,
2907
+ libc:: EMULTIHOP => EMULTIHOP ,
2908
+ libc:: ENOLINK => ENOLINK ,
2909
+ libc:: EPROTO => EPROTO ,
2910
+ _ => UnknownErrno ,
2911
+ }
2912
+ }
2913
+ }
2914
+
0 commit comments