Skip to content

Commit

Permalink
Auto merge of #3290 - devnexen:android_unlocked_io_api, r=JohnTitor
Browse files Browse the repository at this point in the history
android add handful lock free stdio calls
  • Loading branch information
bors committed Oct 16, 2023
2 parents b806bf2 + ad47c94 commit 508e174
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
2 changes: 2 additions & 0 deletions libc-test/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1908,6 +1908,8 @@ fn test_android(target: &str) {

// Added in API level 28, but some tests use level 24.
"pthread_attr_getinheritsched" | "pthread_attr_setinheritsched" => true,
// Added in API level 28, but some tests use level 24.
"fread_unlocked" | "fwrite_unlocked" | "fgets_unlocked" | "fflush_unlocked" => true,

_ => false,
}
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3101,6 +3101,7 @@ ff_trigger
fgetc
fgetpos
fgets
fgets_unlocked
fgetxattr
fileno
flistxattr
Expand All @@ -3116,6 +3117,7 @@ fprintf
fputc
fputs
fread
fread_unlocked
free
freeaddrinfo
freeifaddrs
Expand Down Expand Up @@ -3144,6 +3146,7 @@ ftruncate
ftruncate64
futimens
fwrite
fwrite_unlocked
gai_strerror
genlmsghdr
getaddrinfo
Expand Down
14 changes: 14 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3708,6 +3708,20 @@ extern "C" {
needle: *const ::c_void,
needlelen: ::size_t,
) -> *mut ::c_void;
pub fn fread_unlocked(
buf: *mut ::c_void,
size: ::size_t,
nobj: ::size_t,
stream: *mut ::FILE,
) -> ::size_t;
pub fn fwrite_unlocked(
buf: *const ::c_void,
size: ::size_t,
nobj: ::size_t,
stream: *mut ::FILE,
) -> ::size_t;
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
}

cfg_if! {
Expand Down
2 changes: 1 addition & 1 deletion src/unix/linux_like/linux/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4773,7 +4773,7 @@ extern "C" {
newfd: ::c_int,
) -> ::c_int;
pub fn fread_unlocked(
ptr: *mut ::c_void,
buf: *mut ::c_void,
size: ::size_t,
nobj: ::size_t,
stream: *mut ::FILE,
Expand Down

0 comments on commit 508e174

Please sign in to comment.