Skip to content

Commit 45b431a

Browse files
committed
Auto merge of #2758 - fkm3:master, r=JohnTitor
Add misc constants and functions for android These are the main diffs present in the downstream android opensource project repo.
2 parents 318dccc + 572e11b commit 45b431a

File tree

6 files changed

+36
-0
lines changed

6 files changed

+36
-0
lines changed

libc-test/build.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1803,6 +1803,9 @@ fn test_android(target: &str) {
18031803
// Added in glibc 2.25.
18041804
"getentropy" => true,
18051805

1806+
// Added in API level 28, but some tests use level 24.
1807+
"getrandom" => true,
1808+
18061809
_ => false,
18071810
}
18081811
});

src/unix/linux_like/android/b32/arm.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,6 +501,9 @@ pub const SYS_pwritev2: ::c_long = 393;
501501
pub const SYS_pkey_mprotect: ::c_long = 394;
502502
pub const SYS_pkey_alloc: ::c_long = 395;
503503
pub const SYS_pkey_free: ::c_long = 396;
504+
pub const SYS_io_uring_setup: ::c_long = 425;
505+
pub const SYS_io_uring_enter: ::c_long = 426;
506+
pub const SYS_io_uring_register: ::c_long = 427;
504507

505508
// offsets in mcontext_t.gregs from sys/ucontext.h
506509
pub const REG_R0: ::c_int = 0;

src/unix/linux_like/android/b32/x86/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ pub const SYS_pwritev2: ::c_long = 379;
533533
pub const SYS_pkey_mprotect: ::c_long = 380;
534534
pub const SYS_pkey_alloc: ::c_long = 381;
535535
pub const SYS_pkey_free: ::c_long = 382;
536+
pub const SYS_io_uring_setup: ::c_long = 425;
537+
pub const SYS_io_uring_enter: ::c_long = 426;
538+
pub const SYS_io_uring_register: ::c_long = 427;
536539

537540
// offsets in user_regs_structs, from sys/reg.h
538541
pub const EBX: ::c_int = 0;

src/unix/linux_like/android/b64/aarch64/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -374,6 +374,9 @@ pub const SYS_pwritev2: ::c_long = 287;
374374
pub const SYS_pkey_mprotect: ::c_long = 288;
375375
pub const SYS_pkey_alloc: ::c_long = 289;
376376
pub const SYS_pkey_free: ::c_long = 290;
377+
pub const SYS_io_uring_setup: ::c_long = 425;
378+
pub const SYS_io_uring_enter: ::c_long = 426;
379+
pub const SYS_io_uring_register: ::c_long = 427;
377380
pub const SYS_syscalls: ::c_long = 436;
378381

379382
cfg_if! {

src/unix/linux_like/android/b64/x86_64/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -728,6 +728,9 @@ pub const SYS_pwritev2: ::c_long = 328;
728728
pub const SYS_pkey_mprotect: ::c_long = 329;
729729
pub const SYS_pkey_alloc: ::c_long = 330;
730730
pub const SYS_pkey_free: ::c_long = 331;
731+
pub const SYS_io_uring_setup: ::c_long = 425;
732+
pub const SYS_io_uring_enter: ::c_long = 426;
733+
pub const SYS_io_uring_register: ::c_long = 427;
731734

732735
// offsets in user_regs_structs, from sys/reg.h
733736
pub const R15: ::c_int = 0;

src/unix/linux_like/android/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2421,9 +2421,20 @@ pub const SND_CNT: usize = SND_MAX as usize + 1;
24212421
pub const UINPUT_VERSION: ::c_uint = 5;
24222422
pub const UINPUT_MAX_NAME_SIZE: usize = 80;
24232423

2424+
// bionic/libc/kernel/uapi/linux/if_tun.h
24242425
pub const IFF_TUN: ::c_int = 0x0001;
24252426
pub const IFF_TAP: ::c_int = 0x0002;
2427+
pub const IFF_NAPI: ::c_int = 0x0010;
2428+
pub const IFF_NAPI_FRAGS: ::c_int = 0x0020;
24262429
pub const IFF_NO_PI: ::c_int = 0x1000;
2430+
pub const IFF_ONE_QUEUE: ::c_int = 0x2000;
2431+
pub const IFF_VNET_HDR: ::c_int = 0x4000;
2432+
pub const IFF_TUN_EXCL: ::c_int = 0x8000;
2433+
pub const IFF_MULTI_QUEUE: ::c_int = 0x0100;
2434+
pub const IFF_ATTACH_QUEUE: ::c_int = 0x0200;
2435+
pub const IFF_DETACH_QUEUE: ::c_int = 0x0400;
2436+
pub const IFF_PERSIST: ::c_int = 0x0800;
2437+
pub const IFF_NOFILTER: ::c_int = 0x1000;
24272438

24282439
// start android/platform/bionic/libc/kernel/uapi/linux/if_ether.h
24292440
// from https://android.googlesource.com/
@@ -2739,6 +2750,12 @@ pub const PF_VSOCK: ::c_int = AF_VSOCK;
27392750

27402751
pub const SOMAXCONN: ::c_int = 128;
27412752

2753+
// sys/prctl.h
2754+
pub const PR_SET_PDEATHSIG: ::c_int = 1;
2755+
pub const PR_GET_PDEATHSIG: ::c_int = 2;
2756+
pub const PR_GET_SECUREBITS: ::c_int = 27;
2757+
pub const PR_SET_SECUREBITS: ::c_int = 28;
2758+
27422759
// sys/system_properties.h
27432760
pub const PROP_VALUE_MAX: ::c_int = 92;
27442761
pub const PROP_NAME_MAX: ::c_int = 32;
@@ -3446,6 +3463,10 @@ extern "C" {
34463463

34473464
pub fn gettid() -> ::pid_t;
34483465

3466+
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
3467+
3468+
pub fn pthread_setname_np(thread: ::pthread_t, name: *const ::c_char) -> ::c_int;
3469+
34493470
pub fn __system_property_set(__name: *const ::c_char, __value: *const ::c_char) -> ::c_int;
34503471
pub fn __system_property_get(__name: *const ::c_char, __value: *mut ::c_char) -> ::c_int;
34513472
pub fn __system_property_find(__name: *const ::c_char) -> *const prop_info;

0 commit comments

Comments
 (0)