Skip to content

Commit 508e174

Browse files
committed
Auto merge of rust-lang#3290 - devnexen:android_unlocked_io_api, r=JohnTitor
android add handful lock free stdio calls
2 parents b806bf2 + ad47c94 commit 508e174

File tree

4 files changed

+20
-1
lines changed

4 files changed

+20
-1
lines changed

libc-test/build.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1908,6 +1908,8 @@ fn test_android(target: &str) {
19081908

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

19121914
_ => false,
19131915
}

libc-test/semver/android.txt

+3
Original file line numberDiff line numberDiff line change
@@ -3101,6 +3101,7 @@ ff_trigger
31013101
fgetc
31023102
fgetpos
31033103
fgets
3104+
fgets_unlocked
31043105
fgetxattr
31053106
fileno
31063107
flistxattr
@@ -3116,6 +3117,7 @@ fprintf
31163117
fputc
31173118
fputs
31183119
fread
3120+
fread_unlocked
31193121
free
31203122
freeaddrinfo
31213123
freeifaddrs
@@ -3144,6 +3146,7 @@ ftruncate
31443146
ftruncate64
31453147
futimens
31463148
fwrite
3149+
fwrite_unlocked
31473150
gai_strerror
31483151
genlmsghdr
31493152
getaddrinfo

src/unix/linux_like/android/mod.rs

+14
Original file line numberDiff line numberDiff line change
@@ -3708,6 +3708,20 @@ extern "C" {
37083708
needle: *const ::c_void,
37093709
needlelen: ::size_t,
37103710
) -> *mut ::c_void;
3711+
pub fn fread_unlocked(
3712+
buf: *mut ::c_void,
3713+
size: ::size_t,
3714+
nobj: ::size_t,
3715+
stream: *mut ::FILE,
3716+
) -> ::size_t;
3717+
pub fn fwrite_unlocked(
3718+
buf: *const ::c_void,
3719+
size: ::size_t,
3720+
nobj: ::size_t,
3721+
stream: *mut ::FILE,
3722+
) -> ::size_t;
3723+
pub fn fflush_unlocked(stream: *mut ::FILE) -> ::c_int;
3724+
pub fn fgets_unlocked(buf: *mut ::c_char, size: ::c_int, stream: *mut ::FILE) -> *mut ::c_char;
37113725
}
37123726

37133727
cfg_if! {

src/unix/linux_like/linux/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -4773,7 +4773,7 @@ extern "C" {
47734773
newfd: ::c_int,
47744774
) -> ::c_int;
47754775
pub fn fread_unlocked(
4776-
ptr: *mut ::c_void,
4776+
buf: *mut ::c_void,
47774777
size: ::size_t,
47784778
nobj: ::size_t,
47794779
stream: *mut ::FILE,

0 commit comments

Comments
 (0)