Skip to content

Commit

Permalink
Move auxvec constants into linux_like/mod.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Feb 22, 2023
1 parent 14ab478 commit ea657a9
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 43 deletions.
36 changes: 0 additions & 36 deletions src/unix/linux_like/auxvec.rs

This file was deleted.

54 changes: 47 additions & 7 deletions src/unix/linux_like/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1196,13 +1196,53 @@ pub const POSIX_FADV_RANDOM: ::c_int = 1;
pub const POSIX_FADV_SEQUENTIAL: ::c_int = 2;
pub const POSIX_FADV_WILLNEED: ::c_int = 3;

pub const AT_FDCWD: ::c_int = -100;
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100;
pub const AT_REMOVEDIR: ::c_int = 0x200;
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400;
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800;
pub const AT_EMPTY_PATH: ::c_int = 0x1000;
pub const AT_RECURSIVE: ::c_int = 0x8000;
// flags for "at"-suffixed file operations, e.g. execveat, openat
pub const AT_FDCWD: ::c_int = -100; // used instead of dirfd
pub const AT_REMOVEDIR: ::c_int = 0x200; // unlinkat
pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x100; // fstatat
pub const AT_NO_AUTOMOUNT: ::c_int = 0x800; // fstatat
pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; // linkat
pub const AT_EMPTY_PATH: ::c_int = 0x1000; // linkat
pub const AT_RECURSIVE: ::c_int = 0x8000; // mount_setattr

// not to be confused with this completely unrelated list:
// keys to the values in the ELF auxiliary vector, usable with getauxval
// found at uapi/linux/auxvec.h in the kernel and elf/elf.h in musl and glibc
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;

// defined in arch/<arch>/include/uapi/asm/auxvec.h but has the same value
// wherever it is defined, so glibc and musl also define it universally
// unsupported values return ENOENT so it's relatively "safe" to define
pub const AT_SYSINFO_EHDR: ::c_ulong = 33;

pub const AT_MINSIGSTKSZ: ::c_ulong = 51;
// getauxval AT_* values should be current for all "architecture-neutral" ones as of
// Linux headers: include/uapi/linux/auxvec.h kernel 6.1
// Android NDK: libc/kernel/uapi/linux/auxvec.h NDK 25 (updated ~5.14)

pub const LOG_CRON: ::c_int = 9 << 3;
pub const LOG_AUTHPRIV: ::c_int = 10 << 3;
Expand Down

0 comments on commit ea657a9

Please sign in to comment.