Skip to content

Commit 2e05555

Browse files
committed
Auto merge of #3125 - workingjubilee:joy/unified-auxvec.rs, r=JohnTitor
Unify **/uapi/linux/auxvec.h in linux_like/mod.rs The NDK automatically generates this from Linux kernel headers. It seems best to simply unify these, since where the kernel goes, Android will undoubtedly follow. Also, note relevant versions. New in this patch: `AT_MINSIGSTKSZ` This const is needed to handle new extensions to platform arches that add state to save to signal stacks, replacing `MINSIGSTKSZ` with an ELF-loaded equivalent.
2 parents b8e2476 + 426c088 commit 2e05555

File tree

4 files changed

+48
-63
lines changed

4 files changed

+48
-63
lines changed

libc-test/semver/linux.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,7 @@ AT_GID
167167
AT_HWCAP
168168
AT_HWCAP2
169169
AT_IGNORE
170+
AT_MINSIGSTKSZ
170171
AT_NOTELF
171172
AT_NO_AUTOMOUNT
172173
AT_NULL

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

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -264,31 +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-
292267
pub const PTHREAD_MUTEX_INITIALIZER: pthread_mutex_t = pthread_mutex_t {
293268
value: 0,
294269
__reserved: [0; 36],

src/unix/linux_like/linux/mod.rs

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,37 +1638,6 @@ pub const PF_R: u32 = 1 << 2;
16381638
pub const PF_MASKOS: u32 = 0x0ff00000;
16391639
pub const PF_MASKPROC: u32 = 0xf0000000;
16401640

1641-
// elf.h - Legal values for a_type (entry type).
1642-
pub const AT_NULL: ::c_ulong = 0;
1643-
pub const AT_IGNORE: ::c_ulong = 1;
1644-
pub const AT_EXECFD: ::c_ulong = 2;
1645-
pub const AT_PHDR: ::c_ulong = 3;
1646-
pub const AT_PHENT: ::c_ulong = 4;
1647-
pub const AT_PHNUM: ::c_ulong = 5;
1648-
pub const AT_PAGESZ: ::c_ulong = 6;
1649-
pub const AT_BASE: ::c_ulong = 7;
1650-
pub const AT_FLAGS: ::c_ulong = 8;
1651-
pub const AT_ENTRY: ::c_ulong = 9;
1652-
pub const AT_NOTELF: ::c_ulong = 10;
1653-
pub const AT_UID: ::c_ulong = 11;
1654-
pub const AT_EUID: ::c_ulong = 12;
1655-
pub const AT_GID: ::c_ulong = 13;
1656-
pub const AT_EGID: ::c_ulong = 14;
1657-
pub const AT_PLATFORM: ::c_ulong = 15;
1658-
pub const AT_HWCAP: ::c_ulong = 16;
1659-
pub const AT_CLKTCK: ::c_ulong = 17;
1660-
1661-
pub const AT_SECURE: ::c_ulong = 23;
1662-
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
1663-
pub const AT_RANDOM: ::c_ulong = 25;
1664-
pub const AT_HWCAP2: ::c_ulong = 26;
1665-
1666-
pub const AT_EXECFN: ::c_ulong = 31;
1667-
1668-
// defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value
1669-
// wherever it is defined.
1670-
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
1671-
16721641
pub const GLOB_ERR: ::c_int = 1 << 0;
16731642
pub const GLOB_MARK: ::c_int = 1 << 1;
16741643
pub const GLOB_NOSORT: ::c_int = 1 << 2;

src/unix/linux_like/mod.rs

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,13 +1196,53 @@ pub const POSIX_FADV_RANDOM: ::c_int = 1;
11961196
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
11971197
pub const POSIX_FADV_WILLNEED: ::c_int = 3;
11981198

1199-
pub const AT_FDCWD: ::c_int = -100;
1200-
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
1201-
pub const AT_REMOVEDIR: ::c_int = 0x200;
1202-
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
1203-
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
1204-
pub const AT_EMPTY_PATH: ::c_int = 0x1000;
1205-
pub const AT_RECURSIVE: ::c_int = 0x8000;
1199+
// flags for "at"-suffixed file operations, e.g. execveat, openat
1200+
pub const AT_FDCWD: ::c_int = -100; // used instead of dirfd
1201+
pub const AT_REMOVEDIR: ::c_int = 0x200; // unlinkat
1202+
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; // fstatat
1203+
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; // fstatat
1204+
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; // linkat
1205+
pub const AT_EMPTY_PATH: ::c_int = 0x1000; // linkat
1206+
pub const AT_RECURSIVE: ::c_int = 0x8000; // mount_setattr
1207+
1208+
// not to be confused with this completely unrelated list:
1209+
// keys to the values in the ELF auxiliary vector, usable with getauxval
1210+
// found at uapi/linux/auxvec.h in the kernel and elf/elf.h in musl and glibc
1211+
pub const AT_NULL: ::c_ulong = 0;
1212+
pub const AT_IGNORE: ::c_ulong = 1;
1213+
pub const AT_EXECFD: ::c_ulong = 2;
1214+
pub const AT_PHDR: ::c_ulong = 3;
1215+
pub const AT_PHENT: ::c_ulong = 4;
1216+
pub const AT_PHNUM: ::c_ulong = 5;
1217+
pub const AT_PAGESZ: ::c_ulong = 6;
1218+
pub const AT_BASE: ::c_ulong = 7;
1219+
pub const AT_FLAGS: ::c_ulong = 8;
1220+
pub const AT_ENTRY: ::c_ulong = 9;
1221+
pub const AT_NOTELF: ::c_ulong = 10;
1222+
pub const AT_UID: ::c_ulong = 11;
1223+
pub const AT_EUID: ::c_ulong = 12;
1224+
pub const AT_GID: ::c_ulong = 13;
1225+
pub const AT_EGID: ::c_ulong = 14;
1226+
pub const AT_PLATFORM: ::c_ulong = 15;
1227+
pub const AT_HWCAP: ::c_ulong = 16;
1228+
pub const AT_CLKTCK: ::c_ulong = 17;
1229+
1230+
pub const AT_SECURE: ::c_ulong = 23;
1231+
pub const AT_BASE_PLATFORM: ::c_ulong = 24;
1232+
pub const AT_RANDOM: ::c_ulong = 25;
1233+
pub const AT_HWCAP2: ::c_ulong = 26;
1234+
1235+
pub const AT_EXECFN: ::c_ulong = 31;
1236+
1237+
// defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value
1238+
// wherever it is defined, so glibc and musl also define it universally
1239+
// unsupported values return ENOENT so it's relatively "safe" to define
1240+
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;
1241+
1242+
pub const AT_MINSIGSTKSZ: ::c_ulong = 51;
1243+
// getauxval AT_* values should be current for all "architecture-neutral" ones as of
1244+
// Linux headers: include/uapi/linux/auxvec.h kernel 6.1
1245+
// Android NDK: libc/kernel/uapi/linux/auxvec.h NDK 25 (updated ~5.14)
12061246

12071247
pub const LOG_CRON: ::c_int = 9 << 3;
12081248
pub const LOG_AUTHPRIV: ::c_int = 10 << 3;

0 commit comments

Comments
 (0)