This repository has been archived by the owner on Aug 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: compat: remove unnecessary hardcoded platform check for some s…
…tubs Signed-off-by: Ookiineko <[email protected]>
- Loading branch information
Ookiineko
committed
Apr 7, 2024
1 parent
15f31a3
commit c727748
Showing
14 changed files
with
129 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include <errno.h> | ||
|
||
int *__errno (void) { | ||
#ifdef HAVE___errno_location | ||
return __errno_location(); | ||
#elif defined(HAVE___error) | ||
return __error(); | ||
#elif defined(HAVE__errno) | ||
return _errno(); | ||
#else | ||
# error "Unreachable" | ||
#endif | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
#[macro_use] | ||
mod stubs; | ||
|
||
pub use stubs::*; | ||
|
||
#[macro_use] | ||
mod overrides; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
macro_rules! post_defs_overrides { | ||
() => { | ||
add_sendfile_stubs_if_needed!(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,6 @@ | ||
// android (bionic libc) errno | ||
|
||
#[cfg(any(target_os = "linux", target_os = "emscripten"))] | ||
#[cfg(mbb_stubs___errno)] | ||
extern "C" { | ||
#[link_name = "__errno_location"] | ||
pub fn __errno() -> *mut crate::c_int; | ||
} | ||
|
||
#[cfg(target_vendor = "apple")] | ||
extern "C" { | ||
#[link_name = "__error"] | ||
pub fn __errno() -> *mut crate::c_int; | ||
} | ||
|
||
#[cfg(target_os = "windows")] | ||
extern "cdecl" { | ||
#[link_name = "_errno"] | ||
pub fn __errno() -> *mut crate::c_int; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// for platform those doesn't have O_PATH | ||
|
||
#[cfg(mbb_stubs_O_PATH)] | ||
pub const O_PATH: crate::c_int = 0; // no-op |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,14 @@ | ||
#[cfg(not(any(target_os = "android", target_os = "cygwin")))] | ||
mod errno; | ||
|
||
#[cfg(not(any(target_os = "android", target_os = "cygwin")))] | ||
pub use errno::*; | ||
|
||
#[cfg(any(target_vendor = "apple", target_os = "windows"))] | ||
mod fcntl; | ||
|
||
#[cfg(any(target_vendor = "apple", target_os = "windows"))] | ||
pub use fcntl::*; | ||
|
||
#[cfg(any(target_os = "cygwin", target_vendor = "apple"))] | ||
mod lfs64; | ||
|
||
#[cfg(any(target_os = "cygwin", target_vendor = "apple"))] | ||
pub use lfs64::*; | ||
|
||
#[cfg(any(target_os = "cygwin", target_vendor = "apple", | ||
target_os = "emscripten", target_os = "windows"))] | ||
mod sc_num; | ||
|
||
#[cfg(any(target_os = "cygwin", target_vendor = "apple", | ||
target_os = "emscripten", target_os = "windows"))] | ||
pub use sc_num::*; | ||
|
||
#[cfg(any(target_os = "cygwin", target_os = "emscripten", | ||
target_os = "windows"))] | ||
#[macro_use] | ||
mod sendfile; | ||
|
||
#[cfg(any(target_os = "cygwin", target_os = "emscripten", | ||
target_os = "windows"))] | ||
pub use sendfile::*; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// no actually used, just for passing build | ||
|
||
#[cfg(mbb_stubs_SYS_dup3)] | ||
pub const SYS_dup3: crate::c_int = 0; // stub |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,34 @@ | ||
// defined in libc-compat/non-linux/sendfile_fallback.c | ||
|
||
extern "C" { | ||
#[link_name = "__sendfile_stub"] | ||
fn real_sendfile( | ||
out_fd: crate::c_int, | ||
in_fd: crate::c_int, | ||
count: crate::size_t | ||
); | ||
} | ||
macro_rules! add_sendfile_stubs_if_needed { | ||
() => { | ||
cfg_if::cfg_if! { | ||
if #[cfg(mbb_stubs_sendfile)] { | ||
extern "C" { | ||
#[link_name = "__sendfile_stub"] | ||
fn real_sendfile( | ||
out_fd: crate::c_int, | ||
in_fd: crate::c_int, | ||
count: crate::size_t | ||
); | ||
} | ||
|
||
f! { | ||
pub fn sendfile( | ||
out_fd: crate::c_int, | ||
in_fd: crate::c_int, | ||
offset: *mut crate::off_t, | ||
count: crate::size_t | ||
) -> crate::ssize_t { | ||
if offset.is_null() { | ||
real_sendfile(out_fd, in_fd, count); | ||
0 | ||
} else { | ||
panic!("unreachable code") | ||
f! { | ||
pub fn sendfile( | ||
out_fd: crate::c_int, | ||
in_fd: crate::c_int, | ||
offset: *mut crate::off_t, | ||
count: crate::size_t | ||
) -> crate::ssize_t { | ||
if offset.is_null() { | ||
real_sendfile(out_fd, in_fd, count); | ||
0 | ||
} else { | ||
panic!("unreachable code") | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters