File tree Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Expand file tree Collapse file tree 2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -588,6 +588,8 @@ grantpt
588
588
group
589
589
hostent
590
590
hstrerror
591
+ htonl
592
+ htons
591
593
if_indextoname
592
594
if_nametoindex
593
595
in6_addr
@@ -658,6 +660,8 @@ munmap
658
660
nanosleep
659
661
nfds_t
660
662
nlink_t
663
+ ntohl
664
+ ntohs
661
665
off_t
662
666
open
663
667
opendir
Original file line number Diff line number Diff line change @@ -1446,6 +1446,23 @@ extern "C" {
1446
1446
1447
1447
}
1448
1448
1449
+ safe_f ! {
1450
+ // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's
1451
+ // reimplement them for all UNIX platforms
1452
+ pub { const } fn htonl( hostlong: u32 ) -> u32 {
1453
+ u32 :: to_be( hostlong)
1454
+ }
1455
+ pub { const } fn htons( hostshort: u16 ) -> u16 {
1456
+ u16 :: to_be( hostshort)
1457
+ }
1458
+ pub { const } fn ntohl( netlong: u32 ) -> u32 {
1459
+ u32 :: from_be( netlong)
1460
+ }
1461
+ pub { const } fn ntohs( netshort: u16 ) -> u16 {
1462
+ u16 :: from_be( netshort)
1463
+ }
1464
+ }
1465
+
1449
1466
cfg_if ! {
1450
1467
if #[ cfg( not( any( target_os = "emscripten" ,
1451
1468
target_os = "android" ,
You can’t perform that action at this time.
0 commit comments