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