From b10664902074f53b425d18272592df7eb9435737 Mon Sep 17 00:00:00 2001 From: Nikolay Arhipov Date: Tue, 26 Sep 2023 18:33:51 +0300 Subject: [PATCH] Added socketpair and pipe2 to Vita --- src/unix/mod.rs | 29 +++++++++++------------------ src/unix/newlib/vita/mod.rs | 2 ++ 2 files changed, 13 insertions(+), 18 deletions(-) diff --git a/src/unix/mod.rs b/src/unix/mod.rs index 5126940146d6a..003a08f283286 100644 --- a/src/unix/mod.rs +++ b/src/unix/mod.rs @@ -678,6 +678,17 @@ extern "C" { value: *const ::c_void, option_len: socklen_t, ) -> ::c_int; + #[cfg_attr( + all(target_os = "macos", target_arch = "x86"), + link_name = "socketpair$UNIX2003" + )] + #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")] + pub fn socketpair( + domain: ::c_int, + type_: ::c_int, + protocol: ::c_int, + socket_vector: *mut ::c_int, + ) -> ::c_int; #[cfg(not(all( libc_cfg_target_vendor, target_arch = "powerpc", @@ -1402,24 +1413,6 @@ extern "C" { } -cfg_if! { - if #[cfg(not(target_os = "vita"))] { - extern "C" { - #[cfg_attr( - all(target_os = "macos", target_arch = "x86"), - link_name = "socketpair$UNIX2003" - )] - #[cfg_attr(target_os = "illumos", link_name = "__xnet_socketpair")] - pub fn socketpair( - domain: ::c_int, - type_: ::c_int, - protocol: ::c_int, - socket_vector: *mut ::c_int, - ) -> ::c_int; - } - } -} - cfg_if! { if #[cfg(not(any(target_os = "emscripten", target_os = "android", diff --git a/src/unix/newlib/vita/mod.rs b/src/unix/newlib/vita/mod.rs index 51d45f67c9989..e80f061ea0ce5 100644 --- a/src/unix/newlib/vita/mod.rs +++ b/src/unix/newlib/vita/mod.rs @@ -229,4 +229,6 @@ extern "C" { pub fn pthread_getprocessorid_np() -> ::c_int; pub fn getentropy(buf: *mut ::c_void, buflen: ::size_t) -> ::c_int; + + pub fn pipe2(fds: *mut ::c_int, flags: ::c_int) -> ::c_int; }