Skip to content

Commit ea657a9

Browse files
Move auxvec constants into linux_like/mod.rs
1 parent 14ab478 commit ea657a9

File tree

2 files changed

+47
-43
lines changed

2 files changed

+47
-43
lines changed

src/unix/linux_like/auxvec.rs

-36
This file was deleted.

src/unix/linux_like/mod.rs

+47-7
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)