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