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 @@ -583,6 +583,8 @@ grantpt
583
583
group
584
584
hostent
585
585
hstrerror
586
+ htonl
587
+ htons
586
588
if_indextoname
587
589
if_nametoindex
588
590
in6_addr
@@ -651,6 +653,8 @@ munmap
651
653
nanosleep
652
654
nfds_t
653
655
nlink_t
656
+ ntohl
657
+ ntohs
654
658
off_t
655
659
open
656
660
opendir
Original file line number Diff line number Diff line change @@ -1367,6 +1367,23 @@ extern "C" {
1367
1367
1368
1368
}
1369
1369
1370
+ safe_f ! {
1371
+ // It seems htonl, etc are macros on macOS. So we have to reimplement them. So let's
1372
+ // reimplement them for all UNIX platforms
1373
+ pub { const } fn htonl( hostlong: u32 ) -> u32 {
1374
+ u32 :: to_be( hostlong)
1375
+ }
1376
+ pub { const } fn htons( hostshort: u16 ) -> u16 {
1377
+ u16 :: to_be( hostshort)
1378
+ }
1379
+ pub { const } fn ntohl( netlong: u32 ) -> u32 {
1380
+ u32 :: from_be( netlong)
1381
+ }
1382
+ pub { const } fn ntohs( netshort: u16 ) -> u16 {
1383
+ u16 :: from_be( netshort)
1384
+ }
1385
+ }
1386
+
1370
1387
cfg_if ! {
1371
1388
if #[ cfg( not( any( target_os = "emscripten" ,
1372
1389
target_os = "android" ,
You can’t perform that action at this time.
0 commit comments