Skip to content

Commit

Permalink
Add missing constant for Android
Browse files Browse the repository at this point in the history
  • Loading branch information
yujincheng08 committed Jul 20, 2024
1 parent 0e28c86 commit 0ad3885
Show file tree
Hide file tree
Showing 13 changed files with 106 additions and 25 deletions.
3 changes: 3 additions & 0 deletions libc-test/semver/android-aarch64.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AT_MINSIGSTKSZ
AT_SYSINFO_EHD
AT_VECTOR_SIZE_ARCH
HWCAP2_DCPODP
HWCAP2_FLAGM2
HWCAP2_FRINT
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/android-arm.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
AT_SYSINFO_EHD
NGREG
PTRACE_GETFPREGS
PTRACE_GETREGS
Expand Down
3 changes: 3 additions & 0 deletions libc-test/semver/android-i686.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AT_SYSINFO
AT_SYSINFO_EHD
AT_VECTOR_SIZE_ARC
SYS_memfd_secret
__c_anonymous_uc_sigmask
__c_anonymous_uc_sigmask_with_padding
Expand Down
11 changes: 11 additions & 0 deletions libc-test/semver/android-riscv64.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
AT_L1D_CACHEGEOMETRY
AT_L1D_CACHESIZE
AT_L1I_CACHEGEOMETRY
AT_L1I_CACHESIZE
AT_L2_CACHEGEOMETRY
AT_L2_CACHESIZE
AT_L3_CACHEGEOMETRY
AT_L3_CACHESIZE
AT_MINSIGSTKSZ
AT_SYSINFO_EHDR
AT_VECTOR_SIZE_ARCH
3 changes: 3 additions & 0 deletions libc-test/semver/android-x86_64.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
AT_SYSINFO
AT_SYSINFO_EHD
AT_VECTOR_SIZE_ARC
EFLAGS
FS_BASE
GS_BASE
Expand Down
26 changes: 26 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,13 +136,39 @@ ATF_NETMASK
ATF_PERM
ATF_PUBL
ATF_USETRAILERS
AT_BASE
AT_BASE_PLATFORM
AT_CLKTCK
AT_EGID
AT_EMPTY_PATH
AT_ENTRY
AT_EUID
AT_EXECFD
AT_EXECFN
AT_FDCWD
AT_FLAGS
AT_GID
AT_HWCAP
AT_HWCAP2
AT_IGNORE
AT_MINSIGSTKSZ
AT_NOTELF
AT_NO_AUTOMOUNT
AT_NULL
AT_PAGESZ
AT_PHDR
AT_PHENT
AT_PHNUM
AT_PLATFORM
AT_RANDOM
AT_RECURSIVE
AT_REMOVEDIR
AT_RSEQ_ALIGN
AT_RSEQ_FEATURE_SIZE
AT_SECURE
AT_SYMLINK_FOLLOW
AT_SYMLINK_NOFOLLOW
AT_UID
B0
B1000000
B110
Expand Down
3 changes: 3 additions & 0 deletions src/unix/linux_like/android/b32/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,9 @@ pub const REG_R15: ::c_int = 15;

pub const NGREG: ::c_int = 18;

// From NDK's asm/auxvec.h
pub const AT_SYSINFO_EHD: ::c_ulong = 33;

f! {
// Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
// exposed by the libc. As work-around, we implement it through `syscall`
Expand Down
5 changes: 5 additions & 0 deletions src/unix/linux_like/android/b32/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -598,6 +598,11 @@ pub const REG_EFL: ::c_int = 16;
pub const REG_UESP: ::c_int = 17;
pub const REG_SS: ::c_int = 18;

// From NDK's asm/auxvec.h
pub const AT_SYSINFO: ::c_ulong = 32;
pub const AT_SYSINFO_EHD: ::c_ulong = 33;
pub const AT_VECTOR_SIZE_ARC: ::c_ulong = 3;

// socketcall values from linux/net.h (only the needed ones, and not public)
const SYS_ACCEPT4: ::c_int = 18;

Expand Down
5 changes: 5 additions & 0 deletions src/unix/linux_like/android/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,11 @@ pub const SYS_syscalls: ::c_long = 451;
pub const PROT_BTI: ::c_int = 0x10;
pub const PROT_MTE: ::c_int = 0x20;

// From NDK's asm/auxvec.h
pub const AT_SYSINFO_EHD: ::c_ulong = 33;
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 2;

mod align;
pub use self::align::*;

Expand Down
25 changes: 0 additions & 25 deletions src/unix/linux_like/android/b64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,31 +264,6 @@ pub const RTLD_GLOBAL: ::c_int = 0x00100;
pub const RTLD_NOW: ::c_int = 2;
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;

// From NDK's linux/auxvec.h
pub const AT_NULL: ::c_ulong = 0;
pub const AT_IGNORE: ::c_ulong = 1;
pub const AT_EXECFD: ::c_ulong = 2;
pub const AT_PHDR: ::c_ulong = 3;
pub const AT_PHENT: ::c_ulong = 4;
pub const AT_PHNUM: ::c_ulong = 5;
pub const AT_PAGESZ: ::c_ulong = 6;
pub const AT_BASE: ::c_ulong = 7;
pub const AT_FLAGS: ::c_ulong = 8;
pub const AT_ENTRY: ::c_ulong = 9;
pub const AT_NOTELF: ::c_ulong = 10;
pub const AT_UID: ::c_ulong = 11;
pub const AT_EUID: ::c_ulong = 12;
pub const AT_GID: ::c_ulong = 13;
pub const AT_EGID: ::c_ulong = 14;
pub const AT_PLATFORM: ::c_ulong = 15;
pub const AT_HWCAP: ::c_ulong = 16;
pub const AT_CLKTCK: ::c_ulong = 17;
pub const AT_SECURE: ::c_ulong = 23;
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
pub const AT_RANDOM: ::c_ulong = 25;
pub const AT_HWCAP2: ::c_ulong = 26;
pub const AT_EXECFN: ::c_ulong = 31;
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;

pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
value: 0,
Expand Down
13 changes: 13 additions & 0 deletions src/unix/linux_like/android/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,5 +362,18 @@ pub const SYS_process_mrelease: ::c_long = 448;
pub const SYS_futex_waitv: ::c_long = 449;
pub const SYS_set_mempolicy_home_node: ::c_long = 450;

// From NDK's asm/auxvec.h
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
pub const AT_L1I_CACHESIZE: ::c_ulong = 40;
pub const AT_L1I_CACHEGEOMETRY: ::c_ulong = 41;
pub const AT_L1D_CACHESIZE: ::c_ulong = 42;
pub const AT_L1D_CACHEGEOMETRY: ::c_ulong = 43;
pub const AT_L2_CACHESIZE: ::c_ulong = 44;
pub const AT_L2_CACHEGEOMETRY: ::c_ulong = 45;
pub const AT_L3_CACHESIZE: ::c_ulong = 46;
pub const AT_L3_CACHEGEOMETRY: ::c_ulong = 47;
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 9;
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;

mod align;
pub use self::align::*;
5 changes: 5 additions & 0 deletions src/unix/linux_like/android/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -808,5 +808,10 @@ pub const REG_TRAPNO: ::c_int = 20;
pub const REG_OLDMASK: ::c_int = 21;
pub const REG_CR2: ::c_int = 22;

// From NDK's asm/auxvec.h
pub const AT_SYSINFO: ::c_ulong = 32;
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3;

mod align;
pub use self::align::*;
28 changes: 28 additions & 0 deletions src/unix/linux_like/android/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3475,6 +3475,34 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;

pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;

// From NDK's linux/auxvec.h
pub const AT_NULL: ::c_ulong = 0;
pub const AT_IGNORE: ::c_ulong = 1;
pub const AT_EXECFD: ::c_ulong = 2;
pub const AT_PHDR: ::c_ulong = 3;
pub const AT_PHENT: ::c_ulong = 4;
pub const AT_PHNUM: ::c_ulong = 5;
pub const AT_PAGESZ: ::c_ulong = 6;
pub const AT_BASE: ::c_ulong = 7;
pub const AT_FLAGS: ::c_ulong = 8;
pub const AT_ENTRY: ::c_ulong = 9;
pub const AT_NOTELF: ::c_ulong = 10;
pub const AT_UID: ::c_ulong = 11;
pub const AT_EUID: ::c_ulong = 12;
pub const AT_GID: ::c_ulong = 13;
pub const AT_EGID: ::c_ulong = 14;
pub const AT_PLATFORM: ::c_ulong = 15;
pub const AT_HWCAP: ::c_ulong = 16;
pub const AT_CLKTCK: ::c_ulong = 17;
pub const AT_SECURE: ::c_ulong = 23;
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
pub const AT_RANDOM: ::c_ulong = 25;
pub const AT_HWCAP2: ::c_ulong = 26;
pub const AT_RSEQ_FEATURE_SIZE: ::c_ulong = 27;
pub const AT_RSEQ_ALIGN: ::c_ulong = 28;
pub const AT_EXECFN: ::c_ulong = 31;
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;

// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
// following are only available on newer Linux versions than the versions
// currently used in CI in some configurations, so we define them here.
Expand Down

0 comments on commit 0ad3885

Please sign in to comment.