File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -585,6 +585,8 @@ grantpt
585
585
group
586
586
hostent
587
587
hstrerror
588
+ htonl
589
+ htons
588
590
if_indextoname
589
591
if_nametoindex
590
592
in6_addr
@@ -655,6 +657,8 @@ munmap
655
657
nanosleep
656
658
nfds_t
657
659
nlink_t
660
+ ntohl
661
+ ntohs
658
662
off_t
659
663
open
660
664
opendir
Original file line number Diff line number Diff line change @@ -1398,6 +1398,23 @@ extern "C" {
1398
1398
1399
1399
}
1400
1400
1401
+ safe_f ! {
1402
+ // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's
1403
+ // reimplement them for all UNIX platforms
1404
+ pub { const } fn htonl( hostlong: u32 ) -> u32 {
1405
+ u32 :: to_be( hostlong)
1406
+ }
1407
+ pub { const } fn htons( hostshort: u16 ) -> u16 {
1408
+ u16 :: to_be( hostshort)
1409
+ }
1410
+ pub { const } fn ntohl( netlong: u32 ) -> u32 {
1411
+ u32 :: from_be( netlong)
1412
+ }
1413
+ pub { const } fn ntohs( netshort: u16 ) -> u16 {
1414
+ u16 :: from_be( netshort)
1415
+ }
1416
+ }
1417
+
1401
1418
cfg_if ! {
1402
1419
if #[ cfg( not( any( target_os = "emscripten" ,
1403
1420
target_os = "android" ,
You can’t perform that action at this time.
0 commit comments