Skip to content

Commit

Permalink
android: add missing syscall constants
Browse files Browse the repository at this point in the history
This adds all syscall constants that are available in NDK `r26` but were so far missing in this library.
See `semver/android.txt` changes for the complete list.

Refs:
 * https://android.googlesource.com/platform/bionic/+/refs/tags/ndk-r26/libc/kernel/uapi/asm-generic/unistd.h
 * https://android.googlesource.com/platform/bionic/+/refs/tags/ndk-r26/libc/include/bits/glibc-syscalls.h

(backport <rust-lang#3558>)
(cherry picked from commit e89781f)
  • Loading branch information
yujincheng08 authored and tgross35 committed Nov 17, 2024
1 parent bd40454 commit 1716138
Show file tree
Hide file tree
Showing 8 changed files with 103 additions and 2 deletions.
1 change: 1 addition & 0 deletions libc-test/semver/android-aarch64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ PROT_MTE
SYS_arch_specific_syscall
SYS_fcntl
SYS_lseek
SYS_memfd_secret
SYS_mmap
SYS_syscalls
__system_property_wait
Expand Down
1 change: 1 addition & 0 deletions libc-test/semver/android-x86_64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ SYS_arch_prctl
SYS_epoll_ctl_old
SYS_epoll_wait_old
SYS_kexec_file_load
SYS_memfd_secret
SYS_msgctl
SYS_msgget
SYS_msgrcv
Expand Down
16 changes: 16 additions & 0 deletions libc-test/semver/android.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2488,7 +2488,9 @@ SYS_clock_gettime
SYS_clock_nanosleep
SYS_clock_settime
SYS_clone
SYS_clone3
SYS_close
SYS_close_range
SYS_connect
SYS_copy_file_range
SYS_delete_module
Expand All @@ -2497,12 +2499,14 @@ SYS_dup3
SYS_epoll_create1
SYS_epoll_ctl
SYS_epoll_pwait
SYS_epoll_pwait2
SYS_eventfd2
SYS_execve
SYS_execveat
SYS_exit
SYS_exit_group
SYS_faccessat
SYS_faccessat2
SYS_fallocate
SYS_fanotify_init
SYS_fanotify_mark
Expand All @@ -2524,6 +2528,7 @@ SYS_fsopen
SYS_fspick
SYS_fsync
SYS_futex
SYS_futex_waitv
SYS_get_mempolicy
SYS_get_robust_list
SYS_getcpu
Expand Down Expand Up @@ -2569,6 +2574,9 @@ SYS_kcmp
SYS_kexec_load
SYS_keyctl
SYS_kill
SYS_landlock_add_rule
SYS_landlock_create_ruleset
SYS_landlock_restrict_self
SYS_lgetxattr
SYS_linkat
SYS_listen
Expand All @@ -2588,6 +2596,7 @@ SYS_mlock
SYS_mlock2
SYS_mlockall
SYS_mount
SYS_mount_setattr
SYS_move_mount
SYS_move_pages
SYS_mprotect
Expand All @@ -2608,8 +2617,11 @@ SYS_nfsservctl
SYS_open_by_handle_at
SYS_open_tree
SYS_openat
SYS_openat2
SYS_perf_event_open
SYS_personality
SYS_pidfd_getfd
SYS_pidfd_open
SYS_pidfd_send_signal
SYS_pipe2
SYS_pivot_root
Expand All @@ -2622,6 +2634,8 @@ SYS_pread64
SYS_preadv
SYS_preadv2
SYS_prlimit64
SYS_process_madvise
SYS_process_mrelease
SYS_process_vm_readv
SYS_process_vm_writev
SYS_pselect6
Expand All @@ -2630,6 +2644,7 @@ SYS_pwrite64
SYS_pwritev
SYS_pwritev2
SYS_quotactl
SYS_quotactl_fd
SYS_read
SYS_readahead
SYS_readlinkat
Expand Down Expand Up @@ -2669,6 +2684,7 @@ SYS_sendmmsg
SYS_sendmsg
SYS_sendto
SYS_set_mempolicy
SYS_set_mempolicy_home_node
SYS_set_robust_list
SYS_set_tid_address
SYS_setdomainname
Expand Down
16 changes: 16 additions & 0 deletions src/unix/linux_like/android/b32/arm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,22 @@ pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
pub const SYS_close_range: ::c_long = 436;
pub const SYS_openat2: ::c_long = 437;
pub const SYS_pidfd_getfd: ::c_long = 438;
pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
pub const SYS_quotactl_fd: ::c_long = 443;
pub const SYS_landlock_create_ruleset: ::c_long = 444;
pub const SYS_landlock_add_rule: ::c_long = 445;
pub const SYS_landlock_restrict_self: ::c_long = 446;
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;

// offsets in mcontext_t.gregs from sys/ucontext.h
pub const REG_R0: ::c_int = 0;
Expand Down
17 changes: 17 additions & 0 deletions src/unix/linux_like/android/b32/x86/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -546,6 +546,23 @@ pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
pub const SYS_close_range: ::c_long = 436;
pub const SYS_openat2: ::c_long = 437;
pub const SYS_pidfd_getfd: ::c_long = 438;
pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
pub const SYS_quotactl_fd: ::c_long = 443;
pub const SYS_landlock_create_ruleset: ::c_long = 444;
pub const SYS_landlock_add_rule: ::c_long = 445;
pub const SYS_landlock_restrict_self: ::c_long = 446;
pub const SYS_memfd_secret: ::c_long = 447;
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;

// offsets in user_regs_structs, from sys/reg.h
pub const EBX: ::c_int = 0;
Expand Down
19 changes: 18 additions & 1 deletion src/unix/linux_like/android/b64/aarch64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,24 @@ pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_syscalls: ::c_long = 436;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
pub const SYS_close_range: ::c_long = 436;
pub const SYS_openat2: ::c_long = 437;
pub const SYS_pidfd_getfd: ::c_long = 438;
pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
pub const SYS_quotactl_fd: ::c_long = 443;
pub const SYS_landlock_create_ruleset: ::c_long = 444;
pub const SYS_landlock_add_rule: ::c_long = 445;
pub const SYS_landlock_restrict_self: ::c_long = 446;
pub const SYS_memfd_secret: ::c_long = 447;
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;
pub const SYS_syscalls: ::c_long = 451;

pub const PROT_BTI: ::c_int = 0x10;
pub const PROT_MTE: ::c_int = 0x20;
Expand Down
18 changes: 17 additions & 1 deletion src/unix/linux_like/android/b64/riscv64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,23 @@ pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_syscalls: ::c_long = 436;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
pub const SYS_close_range: ::c_long = 436;
pub const SYS_openat2: ::c_long = 437;
pub const SYS_pidfd_getfd: ::c_long = 438;
pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
pub const SYS_quotactl_fd: ::c_long = 443;
pub const SYS_landlock_create_ruleset: ::c_long = 444;
pub const SYS_landlock_add_rule: ::c_long = 445;
pub const SYS_landlock_restrict_self: ::c_long = 446;
pub const SYS_memfd_secret: ::c_long = 447;
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;
Expand Down
17 changes: 17 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 @@ -741,6 +741,23 @@ pub const SYS_fsopen: ::c_long = 430;
pub const SYS_fsconfig: ::c_long = 431;
pub const SYS_fsmount: ::c_long = 432;
pub const SYS_fspick: ::c_long = 433;
pub const SYS_pidfd_open: ::c_long = 434;
pub const SYS_clone3: ::c_long = 435;
pub const SYS_close_range: ::c_long = 436;
pub const SYS_openat2: ::c_long = 437;
pub const SYS_pidfd_getfd: ::c_long = 438;
pub const SYS_faccessat2: ::c_long = 439;
pub const SYS_process_madvise: ::c_long = 440;
pub const SYS_epoll_pwait2: ::c_long = 441;
pub const SYS_mount_setattr: ::c_long = 442;
pub const SYS_quotactl_fd: ::c_long = 443;
pub const SYS_landlock_create_ruleset: ::c_long = 444;
pub const SYS_landlock_add_rule: ::c_long = 445;
pub const SYS_landlock_restrict_self: ::c_long = 446;
pub const SYS_memfd_secret: ::c_long = 447;
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;

// offsets in user_regs_structs, from sys/reg.h
pub const R15: ::c_int = 0;
Expand Down

0 comments on commit 1716138

Please sign in to comment.