Skip to content

Commit

Permalink
Auto merge of #2396 - ivmarkov:master, r=JohnTitor
Browse files Browse the repository at this point in the history
Support for the ESP-IDF framework - 3 forgotten mappings

When implementing [the initial support for ESP-IDF](#2310) a month ago, I managed to forget to properly decorate these 3 libc bindings for the ESP-IDF.

So now we are in the uncomfortable situation that using STD's `TcpListener::bind` results in a linkage error.

This PR is fixing this, as well as properly exposing two additional ESP-IDF APIs, implemented via LwIP.
  • Loading branch information
bors committed Sep 12, 2021
2 parents 8c5efbf + 7e83ba0 commit fe6531e
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/unix/newlib/mod.rs
Expand Up @@ -611,17 +611,20 @@ extern "C" {
target_arch = "powerpc",
target_vendor = "nintendo"
)))]
#[cfg_attr(target_os = "espidf", link_name = "lwip_bind")]
pub fn bind(fd: ::c_int, addr: *const sockaddr, len: socklen_t) -> ::c_int;
pub fn clock_settime(clock_id: ::clockid_t, tp: *const ::timespec) -> ::c_int;
pub fn clock_gettime(clock_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int;
pub fn clock_getres(clock_id: ::clockid_t, res: *mut ::timespec) -> ::c_int;
#[cfg_attr(target_os = "espidf", link_name = "lwip_close")]
pub fn closesocket(sockfd: ::c_int) -> ::c_int;
pub fn ioctl(fd: ::c_int, request: ::c_ulong, ...) -> ::c_int;
#[cfg(not(all(
libc_cfg_target_vendor,
target_arch = "powerpc",
target_vendor = "nintendo"
)))]
#[cfg_attr(target_os = "espidf", link_name = "lwip_recvfrom")]
pub fn recvfrom(
fd: ::c_int,
buf: *mut ::c_void,
Expand Down

0 comments on commit fe6531e

Please sign in to comment.