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 @@ -585,6 +585,8 @@ grantpt
585585group
586586hostent
587587hstrerror
588+ htonl
589+ htons
588590if_indextoname
589591if_nametoindex
590592in6_addr
@@ -655,6 +657,8 @@ munmap
655657nanosleep
656658nfds_t
657659nlink_t
660+ ntohl
661+ ntohs
658662off_t
659663open
660664opendir
Original file line number Diff line number Diff line change @@ -1398,6 +1398,23 @@ extern "C" {
13981398
13991399}
14001400
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+
14011418cfg_if ! {
14021419 if #[ cfg( not( any( target_os = "emscripten" ,
14031420 target_os = "android" ,
You can’t perform that action at this time.
0 commit comments