1# This file is used to automatically generate bionic's system call stubs. 2# 3# Each non-blank, non-comment line has the following format: 4# 5# return_type func_name[|alias_list][:syscall_name[:socketcall_id]]([parameter_list]) arch_list 6# 7# where: 8# arch_list ::= "all" | arch+ 9# arch ::= "arm" | "arm64" | "mips" | "mips64" | "x86" | "x86_64" 10# 11# Note: 12# - syscall_name corresponds to the name of the syscall, which may differ from 13# the exported function name (example: the exit syscall is implemented by the _exit() 14# function, which is not the same as the standard C exit() function which calls it) 15# 16# - alias_list is optional comma separated list of function aliases. 17# 18# - The call_id parameter, given that func_name and syscall_name have 19# been provided, allows the user to specify dispatch style syscalls. 20# For example, socket() syscall on i386 actually becomes: 21# socketcall(__NR_socket, 1, *(rest of args on stack)). 22# 23# - Each parameter type is assumed to be stored in 32 bits. 24# 25# This file is processed by a python script named gensyscalls.py. 26 27int execve(const char*, char* const*, char* const*) all 28 29uid_t getuid:getuid32() arm,x86 30uid_t getuid:getuid() arm64,mips,mips64,x86_64 31gid_t getgid:getgid32() arm,x86 32gid_t getgid:getgid() arm64,mips,mips64,x86_64 33uid_t geteuid:geteuid32() arm,x86 34uid_t geteuid:geteuid() arm64,mips,mips64,x86_64 35gid_t getegid:getegid32() arm,x86 36gid_t getegid:getegid() arm64,mips,mips64,x86_64 37uid_t getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid) arm,x86 38uid_t getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid) arm64,mips,mips64,x86_64 39gid_t getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid) arm,x86 40gid_t getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid) arm64,mips,mips64,x86_64 41ssize_t readahead(int, off64_t, size_t) all 42int getgroups:getgroups32(int, gid_t*) arm,x86 43int getgroups:getgroups(int, gid_t*) arm64,mips,mips64,x86_64 44pid_t getpgid(pid_t) all 45pid_t getppid() all 46pid_t getsid(pid_t) all 47pid_t setsid() all 48int setgid:setgid32(gid_t) arm,x86 49int setgid:setgid(gid_t) arm64,mips,mips64,x86_64 50int setuid:setuid32(uid_t) arm,x86 51int setuid:setuid(uid_t) arm64,mips,mips64,x86_64 52int setreuid:setreuid32(uid_t, uid_t) arm,x86 53int setreuid:setreuid(uid_t, uid_t) arm64,mips,mips64,x86_64 54int setresuid:setresuid32(uid_t, uid_t, uid_t) arm,x86 55int setresuid:setresuid(uid_t, uid_t, uid_t) arm64,mips,mips64,x86_64 56int setresgid:setresgid32(gid_t, gid_t, gid_t) arm,x86 57int setresgid:setresgid(gid_t, gid_t, gid_t) arm64,mips,mips64,x86_64 58void* __brk:brk(void*) all 59int kill(pid_t, int) all 60int tgkill(pid_t tgid, pid_t tid, int sig) all 61int __ptrace:ptrace(int request, int pid, void* addr, void* data) all 62 63# <sys/resource.h> 64int getrusage(int, struct rusage*) all 65int __getpriority:getpriority(int, id_t) all 66int setpriority(int, id_t, int) all 67# On LP64, rlimit and rlimit64 are the same. 68# On 32-bit systems we use prlimit64 to implement the rlimit64 functions. 69int getrlimit:ugetrlimit(int, struct rlimit*) arm,x86 70int getrlimit(int, struct rlimit*) mips 71int getrlimit|getrlimit64(int, struct rlimit*) arm64,mips64,x86_64 72int setrlimit(int, const struct rlimit*) arm,mips,x86 73int setrlimit|setrlimit64(int, const struct rlimit*) arm64,mips64,x86_64 74int prlimit64|prlimit(pid_t, int, struct rlimit64*, const struct rlimit64*) arm64,mips64,x86_64 75int prlimit64(pid_t, int, struct rlimit64*, const struct rlimit64*) arm,mips,x86 76 77int setgroups:setgroups32(int, const gid_t*) arm,x86 78int setgroups:setgroups(int, const gid_t*) arm64,mips,mips64,x86_64 79int setpgid(pid_t, pid_t) all 80int setregid:setregid32(gid_t, gid_t) arm,x86 81int setregid:setregid(gid_t, gid_t) arm64,mips,mips64,x86_64 82int chroot(const char*) all 83int prctl(int, unsigned long, unsigned long, unsigned long, unsigned long) all 84long __arch_prctl:arch_prctl(int, unsigned long) x86_64 85int capget(cap_user_header_t header, cap_user_data_t data) all 86int capset(cap_user_header_t header, const cap_user_data_t data) all 87int sigaltstack(const stack_t*, stack_t*) all 88int acct(const char* filepath) all 89 90# file descriptors 91ssize_t read(int, void*, size_t) all 92ssize_t write(int, const void*, size_t) all 93ssize_t pread64(int, void*, size_t, off64_t) arm,mips,x86 94ssize_t pread64|pread(int, void*, size_t, off_t) arm64,mips64,x86_64 95ssize_t pwrite64(int, void*, size_t, off64_t) arm,mips,x86 96ssize_t pwrite64|pwrite(int, void*, size_t, off_t) arm64,mips64,x86_64 97 98# On LP32, preadv/pwritev don't use off64_t --- they use pairs of 32-bit 99# arguments to avoid problems on architectures like ARM where 64-bit arguments 100# must be in a register pair starting with an even-numbered register. 101# See linux/fs/read_write.c and https://lwn.net/Articles/311630/. 102ssize_t __preadv64:preadv(int, const struct iovec*, int, long, long) arm,mips,x86 103ssize_t preadv|preadv64(int, const struct iovec*, int, off_t) arm64,mips64,x86_64 104ssize_t __pwritev64:pwritev(int, const struct iovec*, int, long, long) arm,mips,x86 105ssize_t pwritev|pwritev64(int, const struct iovec*, int, off_t) arm64,mips64,x86_64 106 107int ___close:close(int) all 108pid_t __getpid:getpid() all 109int munmap(void*, size_t) all 110void* ___mremap:mremap(void*, size_t, size_t, int, void*) all 111int msync(const void*, size_t, int) all 112int mprotect(const void*, size_t, int) all 113int madvise(void*, size_t, int) all 114int mlock(const void* addr, size_t len) all 115int munlock(const void* addr, size_t len) all 116int mlockall(int flags) all 117int munlockall() all 118int mincore(void* start, size_t length, unsigned char* vec) all 119int __ioctl:ioctl(int, int, void*) all 120ssize_t readv(int, const struct iovec*, int) all 121ssize_t writev(int, const struct iovec*, int) all 122int __fcntl64:fcntl64(int, int, void*) arm,mips,x86 123int fcntl(int, int, void*) arm64,mips64,x86_64 124int flock(int, int) all 125int ___fchmod:fchmod(int, mode_t) all 126int dup(int) all 127int pipe2(int*, int) all 128int dup3(int, int, int) all 129int fsync(int) all 130int fdatasync(int) all 131int fchown:fchown32(int, uid_t, gid_t) arm,x86 132int fchown:fchown(int, uid_t, gid_t) arm64,mips,mips64,x86_64 133void sync(void) all 134int ___fsetxattr:fsetxattr(int, const char*, const void*, size_t, int) all 135ssize_t ___fgetxattr:fgetxattr(int, const char*, void*, size_t) all 136ssize_t ___flistxattr:flistxattr(int, char*, size_t) all 137int fremovexattr(int, const char*) all 138 139int __getdents64:getdents64(unsigned int, struct dirent*, unsigned int) arm,arm64,mips,mips64,x86,x86_64 140 141int __openat:openat(int, const char*, int, mode_t) all 142int ___faccessat:faccessat(int, const char*, int) all 143int ___fchmodat:fchmodat(int, const char*, mode_t) all 144int fchownat(int, const char*, uid_t, gid_t, int) all 145int fstatat64|fstatat:fstatat64(int, const char*, struct stat*, int) arm,mips,x86 146int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int) arm64,x86_64 147int linkat(int, const char*, int, const char*, int) all 148int mkdirat(int, const char*, mode_t) all 149int mknodat(int, const char*, mode_t, dev_t) all 150int readlinkat(int, const char*, char*, size_t) all 151int renameat(int, const char*, int, const char*) all 152int symlinkat(const char*, int, const char*) all 153int unlinkat(int, const char*, int) all 154int utimensat(int, const char*, const struct timespec times[2], int) all 155 156# Paired off_t/off64_t system calls. On 64-bit systems, 157# sizeof(off_t) == sizeof(off64_t), so there we emit two symbols that are 158# aliases. On 32-bit systems, we have two different system calls. 159# That means that every system call in this section should take three lines. 160off_t lseek(int, off_t, int) arm,mips,x86 161int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86 162off_t lseek|lseek64(int, off_t, int) arm64,mips64,x86_64 163int ftruncate64(int, off64_t) arm,mips,x86 164int ftruncate|ftruncate64(int, off_t) arm64,mips64,x86_64 165ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count) arm,mips,x86 166ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) arm,mips,x86 167ssize_t sendfile|sendfile64(int out_fd, int in_fd, off_t* offset, size_t count) arm64,mips64,x86_64 168int truncate(const char*, off_t) arm,mips,x86 169int truncate64(const char*, off64_t) arm,mips,x86 170int truncate|truncate64(const char*, off_t) arm64,mips64,x86_64 171# (mmap only gets two lines because we only used the 64-bit variant on 32-bit systems.) 172void* __mmap2:mmap2(void*, size_t, int, int, int, long) arm,mips,x86 173void* mmap|mmap64(void*, size_t, int, int, int, off_t) arm64,mips64,x86_64 174# (fallocate only gets two lines because there is no 32-bit variant.) 175int fallocate64:fallocate(int, int, off64_t, off64_t) arm,mips,x86 176int fallocate|fallocate64(int, int, off_t, off_t) arm64,mips64,x86_64 177 178# posix_fadvise64 is awkward: arm has shuffled arguments, 179# the POSIX functions don't set errno, and no architecture has posix_fadvise. 180int __arm_fadvise64_64:arm_fadvise64_64(int, int, off64_t, off64_t) arm 181int __fadvise64:fadvise64_64(int, off64_t, off64_t, int) x86 182int __fadvise64:fadvise64(int, off64_t, off64_t, int) arm64,mips,mips64,x86_64 183 184int __fstatfs64:fstatfs64(int, size_t, struct statfs*) arm,mips,x86 185int __fstatfs:fstatfs(int, struct statfs*) arm64,mips64,x86_64 186int __statfs64:statfs64(const char*, size_t, struct statfs*) arm,mips,x86 187int __statfs:statfs(const char*, struct statfs*) arm64,mips64,x86_64 188 189int fstat64|fstat:fstat64(int, struct stat*) arm,mips,x86 190int fstat64|fstat:fstat(int, struct stat*) arm64,x86_64 191 192# file system 193int chdir(const char*) all 194int mount(const char*, const char*, const char*, unsigned long, const void*) all 195int umount2(const char*, int) all 196int __getcwd:getcwd(char* buf, size_t size) all 197int fchdir(int) all 198int setxattr(const char*, const char*, const void*, size_t, int) all 199int lsetxattr(const char*, const char*, const void*, size_t, int) all 200ssize_t getxattr(const char*, const char*, void*, size_t) all 201ssize_t lgetxattr(const char*, const char*, void*, size_t) all 202ssize_t listxattr(const char*, char*, size_t) all 203ssize_t llistxattr(const char*, char*, size_t) all 204int removexattr(const char*, const char*) all 205int lremovexattr(const char*, const char*) all 206int swapon(const char*, int) all 207int swapoff(const char*) all 208 209# time 210int settimeofday(const struct timeval*, const struct timezone*) all 211clock_t times(struct tms*) all 212int nanosleep(const struct timespec*, struct timespec*) all 213int clock_settime(clockid_t, const struct timespec*) all 214int clock_getres(clockid_t, struct timespec*) all 215int ___clock_nanosleep:clock_nanosleep(clockid_t, int, const struct timespec*, struct timespec*) all 216int getitimer(int, const struct itimerval*) all 217int setitimer(int, const struct itimerval*, struct itimerval*) all 218int __timer_create:timer_create(clockid_t clockid, struct sigevent* evp, __kernel_timer_t* timerid) all 219int __timer_settime:timer_settime(__kernel_timer_t, int, const struct itimerspec*, struct itimerspec*) all 220int __timer_gettime:timer_gettime(__kernel_timer_t, struct itimerspec*) all 221int __timer_getoverrun:timer_getoverrun(__kernel_timer_t) all 222int __timer_delete:timer_delete(__kernel_timer_t) all 223int timerfd_create(clockid_t, int) all 224int timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*) all 225int timerfd_gettime(int, struct itimerspec*) all 226int adjtimex(struct timex*) all 227int clock_adjtime(clockid_t, struct timex*) all 228 229# signals 230int __sigaction:sigaction(int, const struct sigaction*, struct sigaction*) arm,mips,x86 231int __rt_sigaction:rt_sigaction(int, const struct sigaction*, struct sigaction*, size_t) all 232int __rt_sigpending:rt_sigpending(sigset_t*, size_t) all 233int __rt_sigprocmask:rt_sigprocmask(int, const sigset_t*, sigset_t*, size_t) all 234int __rt_sigsuspend:rt_sigsuspend(const sigset_t*, size_t) all 235int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t*, siginfo_t*, const timespec*, size_t) all 236int ___rt_sigqueueinfo:rt_sigqueueinfo(pid_t, int, siginfo_t*) all 237int __signalfd4:signalfd4(int, const sigset_t*, size_t, int) all 238 239# sockets 240int __socket:socket(int, int, int) arm,arm64,mips,mips64,x86_64 241int socketpair(int, int, int, int*) arm,arm64,mips,mips64,x86_64 242int bind(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64 243int __connect:connect(int, struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64 244int listen(int, int) arm,arm64,mips,mips64,x86_64 245int __accept4:accept4(int, struct sockaddr*, socklen_t*, int) arm,arm64,mips,mips64,x86_64 246int getsockname(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64 247int getpeername(int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64 248int sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t) arm,arm64,mips,mips64,x86_64 249int recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) arm,arm64,mips,mips64,x86_64 250int shutdown(int, int) arm,arm64,mips,mips64,x86_64 251int setsockopt(int, int, int, const void*, socklen_t) arm,arm64,mips,mips64,x86_64 252int getsockopt(int, int, int, void*, socklen_t*) arm,arm64,mips,mips64,x86_64 253ssize_t recvmsg(int, struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64 254ssize_t sendmsg(int, const struct msghdr*, unsigned int) arm,arm64,mips,mips64,x86_64 255int recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*) arm,arm64,mips,mips64,x86_64 256int sendmmsg(int, struct mmsghdr*, unsigned int, int) arm,arm64,mips,mips64,x86_64 257 258# sockets for x86. These are done as an "indexed" call to socketcall syscall. 259int __socket:socketcall:1(int, int, int) x86 260int bind:socketcall:2(int, struct sockaddr*, int) x86 261int __connect:socketcall:3(int, struct sockaddr*, socklen_t) x86 262int listen:socketcall:4(int, int) x86 263int getsockname:socketcall:6(int, struct sockaddr*, socklen_t*) x86 264int getpeername:socketcall:7(int, struct sockaddr*, socklen_t*) x86 265int socketpair:socketcall:8(int, int, int, int*) x86 266int sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t) x86 267int recvfrom:socketcall:12(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*) x86 268int shutdown:socketcall:13(int, int) x86 269int setsockopt:socketcall:14(int, int, int, const void*, socklen_t) x86 270int getsockopt:socketcall:15(int, int, int, void*, socklen_t*) x86 271int sendmsg:socketcall:16(int, const struct msghdr*, unsigned int) x86 272int recvmsg:socketcall:17(int, struct msghdr*, unsigned int) x86 273int __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int) x86 274int recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*) x86 275int sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int) x86 276 277# scheduler & real-time 278int sched_setscheduler(pid_t pid, int policy, const struct sched_param* param) all 279int sched_getscheduler(pid_t pid) all 280int sched_yield(void) all 281int sched_setparam(pid_t pid, const struct sched_param* param) all 282int sched_getparam(pid_t pid, struct sched_param* param) all 283int sched_get_priority_max(int policy) all 284int sched_get_priority_min(int policy) all 285int sched_rr_get_interval(pid_t pid, struct timespec* interval) all 286int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) all 287int setns(int, int) all 288int unshare(int) all 289int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) all 290int __getcpu:getcpu(unsigned*, unsigned*, void*) all 291 292# other 293int uname(struct utsname*) all 294mode_t umask(mode_t) all 295int __reboot:reboot(int, int, int, void*) all 296int init_module(void*, unsigned long, const char*) all 297int delete_module(const char*, unsigned int) all 298int klogctl:syslog(int, char*, int) all 299int sysinfo(struct sysinfo*) all 300int personality(unsigned long) all 301 302ssize_t tee(int, int, size_t, unsigned int) all 303ssize_t splice(int, off64_t*, int, off64_t*, size_t, unsigned int) all 304ssize_t vmsplice(int, const struct iovec*, size_t, unsigned int) all 305 306int epoll_create1(int) all 307int epoll_ctl(int, int op, int, struct epoll_event*) all 308int __epoll_pwait:epoll_pwait(int, struct epoll_event*, int, int, const sigset_t*, size_t) all 309 310int eventfd:eventfd2(unsigned int, int) all 311 312void _exit|_Exit:exit_group(int) all 313void __exit:exit(int) all 314 315int inotify_init1(int) all 316int inotify_add_watch(int, const char*, unsigned int) all 317int inotify_rm_watch(int, unsigned int) all 318 319int __pselect6:pselect6(int, fd_set*, fd_set*, fd_set*, timespec*, void*) all 320int __ppoll:ppoll(pollfd*, unsigned int, timespec*, const sigset_t*, size_t) all 321 322ssize_t process_vm_readv(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long) all 323ssize_t process_vm_writev(pid_t, const struct iovec*, unsigned long, const struct iovec*, unsigned long, unsigned long) all 324 325int quotactl(int, const char*, int, char*) all 326 327int __set_tid_address:set_tid_address(int*) all 328 329int setfsgid(gid_t) all 330int setfsuid(uid_t) all 331 332int setdomainname(const char*, size_t) all 333int sethostname(const char*, size_t) all 334 335int __sync_file_range:sync_file_range(int, off64_t, off64_t, unsigned int) arm64,mips,mips64,x86,x86_64 336int __sync_file_range2:sync_file_range2(int, unsigned int, off64_t, off64_t) arm 337 338pid_t wait4(pid_t, int*, int, struct rusage*) all 339int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*) all 340 341# ARM-specific 342int __set_tls:__ARM_NR_set_tls(void*) arm 343int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) arm 344 345# MIPS-specific 346int _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips 347int __set_tls:set_thread_area(void*) mips,mips64 348 349# x86-specific 350int __set_thread_area:set_thread_area(void*) x86 351 352# vdso stuff. 353int clock_gettime(clockid_t, timespec*) mips,mips64 354int __clock_gettime:clock_gettime(clockid_t, timespec*) arm,arm64,x86,x86_64 355int gettimeofday(timeval*, timezone*) mips,mips64 356int __gettimeofday:gettimeofday(timeval*, timezone*) arm,arm64,x86,x86_64 357