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 @@ -583,6 +583,8 @@ grantpt
583583group
584584hostent
585585hstrerror
586+ htonl
587+ htons
586588if_indextoname
587589if_nametoindex
588590in6_addr
@@ -651,6 +653,8 @@ munmap
651653nanosleep
652654nfds_t
653655nlink_t
656+ ntohl
657+ ntohs
654658off_t
655659open
656660opendir
Original file line number Diff line number Diff line change @@ -1367,6 +1367,23 @@ extern "C" {
13671367
13681368}
13691369
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+
13701387cfg_if ! {
13711388 if #[ cfg( not( any( target_os = "emscripten" ,
13721389 target_os = "android" ,
You can’t perform that action at this time.
0 commit comments