Skip to content

Commit

Permalink
Add htonl, htons, ntohl, ntohs
Browse files Browse the repository at this point in the history
  • Loading branch information
Askar Safin committed Apr 28, 2024
1 parent 2fd2b60 commit a3a9105
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
9 changes: 9 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ fn test_apple(target: &str) {

headers! { cfg:
"aio.h",
"arpa/inet.h",
"CommonCrypto/CommonCrypto.h",
"CommonCrypto/CommonRandom.h",
"copyfile.h",
Expand All @@ -192,6 +193,14 @@ fn test_apple(target: &str) {
"grp.h",
"iconv.h",
"ifaddrs.h",

"stdio.h",
"unistd.h",
"sys/socket.h",
"netinet/tcp.h",
"netinet/in.h",
"arpa/inet.h",

"langinfo.h",
"libgen.h",
"libproc.h",
Expand Down
4 changes: 4 additions & 0 deletions libc-test/semver/unix.txt
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,8 @@ grantpt
group
hostent
hstrerror
htonl
htons
if_indextoname
if_nametoindex
in6_addr
Expand Down Expand Up @@ -651,6 +653,8 @@ munmap
nanosleep
nfds_t
nlink_t
ntohl
ntohs
off_t
open
opendir
Expand Down
4 changes: 4 additions & 0 deletions src/unix/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,10 @@ extern "C" {
) -> ::ssize_t;
#[cfg_attr(target_os = "espidf", link_name = "lwip_shutdown")]
pub fn shutdown(socket: ::c_int, how: ::c_int) -> ::c_int;
pub fn htonl(hostlong: u32) -> u32;
pub fn htons(hostshort: u16) -> u16;
pub fn ntohl(netlong: u32) -> u32;
pub fn ntohs(netshort: u16) -> u16;

#[cfg_attr(
all(target_os = "macos", target_arch = "x86"),
Expand Down

0 comments on commit a3a9105

Please sign in to comment.