Skip to content

Commit 73af7aa

Browse files
yujincheng08tgross35
authored andcommitted
Add missing constant for Android
(backport <rust-lang#3779>) (cherry picked from commit 93e531e)
1 parent 3f102f3 commit 73af7aa

File tree

12 files changed

+90
-26
lines changed

12 files changed

+90
-26
lines changed

libc-test/semver/android-aarch64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
AT_SYSINFO_EHDR
2+
AT_VECTOR_SIZE_ARCH
13
HWCAP2_DCPODP
24
HWCAP2_FLAGM2
35
HWCAP2_FRINT

libc-test/semver/android-arm.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
AT_SYSINFO_EHDR
12
NGREG
23
PTRACE_GETFPREGS
34
PTRACE_GETREGS

libc-test/semver/android-i686.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
AT_SYSINFO
2+
AT_SYSINFO_EHDR
3+
AT_VECTOR_SIZE_ARCH
4+
SYS_memfd_secret
15
__c_anonymous_uc_sigmask
26
__c_anonymous_uc_sigmask_with_padding
37
time64_t

libc-test/semver/android-x86_64.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
AT_SYSINFO_EHDR
2+
AT_VECTOR_SIZE_ARCH
13
EFLAGS
24
FS_BASE
35
GS_BASE

libc-test/semver/android.txt

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,39 @@ ATF_NETMASK
136136
ATF_PERM
137137
ATF_PUBL
138138
ATF_USETRAILERS
139+
AT_BASE
140+
AT_BASE_PLATFORM
141+
AT_CLKTCK
142+
AT_EGID
139143
AT_EMPTY_PATH
144+
AT_ENTRY
145+
AT_EUID
146+
AT_EXECFD
147+
AT_EXECFN
140148
AT_FDCWD
149+
AT_FLAGS
150+
AT_GID
151+
AT_HWCAP
152+
AT_HWCAP2
153+
AT_IGNORE
154+
AT_MINSIGSTKSZ
155+
AT_NOTELF
141156
AT_NO_AUTOMOUNT
157+
AT_NULL
158+
AT_PAGESZ
159+
AT_PHDR
160+
AT_PHENT
161+
AT_PHNUM
162+
AT_PLATFORM
163+
AT_RANDOM
142164
AT_RECURSIVE
143165
AT_REMOVEDIR
166+
AT_RSEQ_ALIGN
167+
AT_RSEQ_FEATURE_SIZE
168+
AT_SECURE
144169
AT_SYMLINK_FOLLOW
145170
AT_SYMLINK_NOFOLLOW
171+
AT_UID
146172
B0
147173
B1000000
148174
B110

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,9 @@ pub const REG_R15: ::c_int = 15;
533533

534534
pub const NGREG: ::c_int = 18;
535535

536+
// From NDK's asm/auxvec.h
537+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
538+
536539
f! {
537540
// Sadly, Android before 5.0 (API level 21), the accept4 syscall is not
538541
// exposed by the libc. As work-around, we implement it through `syscall`

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,6 +585,11 @@ pub const REG_EFL: ::c_int = 16;
585585
pub const REG_UESP: ::c_int = 17;
586586
pub const REG_SS: ::c_int = 18;
587587

588+
// From NDK's asm/auxvec.h
589+
pub const AT_SYSINFO: ::c_ulong = 32;
590+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
591+
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3;
592+
588593
// socketcall values from linux/net.h (only the needed ones, and not public)
589594
const SYS_ACCEPT4: ::c_int = 18;
590595

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,9 @@ cfg_if! {
423423
pub use self::align::*;
424424
}
425425
}
426+
// From NDK's asm/auxvec.h
427+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
428+
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 2;
426429

427430
cfg_if! {
428431
if #[cfg(libc_int128)] {

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

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -264,32 +264,6 @@ pub const RTLD_GLOBAL: ::c_int = 0x00100;
264264
pub const RTLD_NOW: ::c_int = 2;
265265
pub const RTLD_DEFAULT: *mut ::c_void = 0i64 as *mut ::c_void;
266266

267-
// From NDK's linux/auxvec.h
268-
pub const AT_NULL: ::c_ulong = 0;
269-
pub const AT_IGNORE: ::c_ulong = 1;
270-
pub const AT_EXECFD: ::c_ulong = 2;
271-
pub const AT_PHDR: ::c_ulong = 3;
272-
pub const AT_PHENT: ::c_ulong = 4;
273-
pub const AT_PHNUM: ::c_ulong = 5;
274-
pub const AT_PAGESZ: ::c_ulong = 6;
275-
pub const AT_BASE: ::c_ulong = 7;
276-
pub const AT_FLAGS: ::c_ulong = 8;
277-
pub const AT_ENTRY: ::c_ulong = 9;
278-
pub const AT_NOTELF: ::c_ulong = 10;
279-
pub const AT_UID: ::c_ulong = 11;
280-
pub const AT_EUID: ::c_ulong = 12;
281-
pub const AT_GID: ::c_ulong = 13;
282-
pub const AT_EGID: ::c_ulong = 14;
283-
pub const AT_PLATFORM: ::c_ulong = 15;
284-
pub const AT_HWCAP: ::c_ulong = 16;
285-
pub const AT_CLKTCK: ::c_ulong = 17;
286-
pub const AT_SECURE: ::c_ulong = 23;
287-
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
288-
pub const AT_RANDOM: ::c_ulong = 25;
289-
pub const AT_HWCAP2: ::c_ulong = 26;
290-
pub const AT_EXECFN: ::c_ulong = 31;
291-
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;
292-
293267
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
294268
value: 0,
295269
__reserved: [0; 36],

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,3 +351,15 @@ cfg_if! {
351351
pub use self::align::*;
352352
}
353353
}
354+
355+
// From NDK's asm/auxvec.h
356+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
357+
pub const AT_L1I_CACHESIZE: ::c_ulong = 40;
358+
pub const AT_L1I_CACHEGEOMETRY: ::c_ulong = 41;
359+
pub const AT_L1D_CACHESIZE: ::c_ulong = 42;
360+
pub const AT_L1D_CACHEGEOMETRY: ::c_ulong = 43;
361+
pub const AT_L2_CACHESIZE: ::c_ulong = 44;
362+
pub const AT_L2_CACHEGEOMETRY: ::c_ulong = 45;
363+
pub const AT_L3_CACHESIZE: ::c_ulong = 46;
364+
pub const AT_L3_CACHEGEOMETRY: ::c_ulong = 47;
365+
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 9;

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,3 +800,7 @@ cfg_if! {
800800
pub use self::align::*;
801801
}
802802
}
803+
804+
// From NDK's asm/auxvec.h
805+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
806+
pub const AT_VECTOR_SIZE_ARCH: ::c_ulong = 3;

src/unix/linux_like/android/mod.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,6 +3523,34 @@ pub const PF_MEMALLOC_PIN: ::c_int = 0x10000000;
35233523

35243524
pub const PF_SUSPEND_TASK: ::c_int = 0x80000000;
35253525

3526+
// From NDK's linux/auxvec.h
3527+
pub const AT_NULL: ::c_ulong = 0;
3528+
pub const AT_IGNORE: ::c_ulong = 1;
3529+
pub const AT_EXECFD: ::c_ulong = 2;
3530+
pub const AT_PHDR: ::c_ulong = 3;
3531+
pub const AT_PHENT: ::c_ulong = 4;
3532+
pub const AT_PHNUM: ::c_ulong = 5;
3533+
pub const AT_PAGESZ: ::c_ulong = 6;
3534+
pub const AT_BASE: ::c_ulong = 7;
3535+
pub const AT_FLAGS: ::c_ulong = 8;
3536+
pub const AT_ENTRY: ::c_ulong = 9;
3537+
pub const AT_NOTELF: ::c_ulong = 10;
3538+
pub const AT_UID: ::c_ulong = 11;
3539+
pub const AT_EUID: ::c_ulong = 12;
3540+
pub const AT_GID: ::c_ulong = 13;
3541+
pub const AT_EGID: ::c_ulong = 14;
3542+
pub const AT_PLATFORM: ::c_ulong = 15;
3543+
pub const AT_HWCAP: ::c_ulong = 16;
3544+
pub const AT_CLKTCK: ::c_ulong = 17;
3545+
pub const AT_SECURE: ::c_ulong = 23;
3546+
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
3547+
pub const AT_RANDOM: ::c_ulong = 25;
3548+
pub const AT_HWCAP2: ::c_ulong = 26;
3549+
pub const AT_RSEQ_FEATURE_SIZE: ::c_ulong = 27;
3550+
pub const AT_RSEQ_ALIGN: ::c_ulong = 28;
3551+
pub const AT_EXECFN: ::c_ulong = 31;
3552+
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;
3553+
35263554
// Most `*_SUPER_MAGIC` constants are defined at the `linux_like` level; the
35273555
// following are only available on newer Linux versions than the versions
35283556
// currently used in CI in some configurations, so we define them here.

0 commit comments

Comments
 (0)