blob: 14b990dc797f81df1ac309e23178052826102686 [file] [log] [blame]
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08001# this file is used to list all the syscalls that will be supported by
2# the Bionic C library. It is used to automatically generate the syscall
3# stubs, the list of syscall constants (__NR_xxxx) and the content of <linux/_unitsd.h>
4#
5# each non comment line has the following format:
6#
David 'Digit' Turner70b16682012-01-30 17:17:58 +01007# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (syscall_number|"stub")
The Android Open Source Project1dc9e472009-03-03 19:28:35 -08008#
9# note that:
10# - syscall_name correspond to the name of the syscall, which may differ from
11# the exported function name (example: the exit syscall is implemented by the _exit()
12# function, which is not the same as the standard C exit() function which calls it)
13# The call_id parameter, given that func_name and syscall_name have
14# been provided, allows the user to specify dispatch style syscalls.
15# For example, socket() syscall on i386 actually becomes:
16# socketcall(__NR_socket, 1, *(rest of args on stack)).
17#
18# - each parameter type is assumed to be stored on 32 bits, there is no plan to support
19# 64-bit architectures at the moment
20#
21# - it there is "stub" instead of a syscall number, the tool will not generate any
22# assembler template for the syscall; it's up to the bionic implementation to provide
23# a relevant C stub
24#
David 'Digit' Turner70b16682012-01-30 17:17:58 +010025# - additionally, if the syscall number is different amoung ARM, and x86, use:
26# return_type funcname[:syscall_name](parameters) arm_number,x86_number
Shin-ichiro KAWASAKIce0595d2009-09-01 19:03:06 +090027#
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080028# the file is processed by a python script named gensyscalls.py
29#
30
31# process management
32void _exit:exit_group (int) 248,252
David 'Digit' Turner70b16682012-01-30 17:17:58 +010033void _exit_thread:exit (int) 1
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080034pid_t __fork:fork (void) 2
35pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7
David 'Digit' Turner9973a562010-09-27 17:30:33 +020036int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284
David 'Digit' Turner97cf7f32010-01-22 18:59:05 -080037
38# NOTE: this system call is never called directly, but we list it there
39# to have __NR_clone properly defined.
40#
41pid_t __sys_clone:clone (int, void*, int*, void*, int*) 120
42
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080043int execve (const char*, char* const*, char* const*) 11
44
Mike Chan9f691562010-03-02 10:55:58 -080045int __setuid:setuid32 (uid_t) 213
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080046uid_t getuid:getuid32 () 199
47gid_t getgid:getgid32 () 200
48uid_t geteuid:geteuid32 () 201
49gid_t getegid:getegid32 () 202
50uid_t getresuid:getresuid32 () 209
51gid_t getresgid:getresgid32 () 211
52pid_t gettid() 224
Bruce Bearee30e9092011-07-13 10:23:50 -070053ssize_t readahead(int, off64_t, size_t) 225
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080054int getgroups:getgroups32(int, gid_t *) 205
55pid_t getpgid(pid_t) 132
David 'Digit' Turner70b16682012-01-30 17:17:58 +010056pid_t getppid() 64
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080057pid_t setsid() 66
58int setgid:setgid32(gid_t) 214
59int seteuid:seteuid32(uid_t) stub
Mike Chan9f691562010-03-02 10:55:58 -080060int __setreuid:setreuid32(uid_t, uid_t) 203
61int __setresuid:setresuid32(uid_t, uid_t, uid_t) 208
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080062int setresgid:setresgid32(gid_t, gid_t, gid_t) 210
63void* __brk:brk(void*) 45
64# see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill
65int kill(pid_t, int) -1,37
66int tkill(pid_t tid, int sig) -1,238
Jeff Brown10c8ce52011-11-18 15:17:07 -080067int tgkill(pid_t tgid, pid_t tid, int sig) -1,270
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080068int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26
69int __set_thread_area:set_thread_area(void* user_desc) -1,243
70int __getpriority:getpriority(int, int) 96
71int setpriority(int, int, int) 97
72int setrlimit(int resource, const struct rlimit *rlp) 75
73int getrlimit:ugetrlimit(int resource, struct rlimit *rlp) 191
74int getrusage(int who, struct rusage* r_usage) 77
75int setgroups:setgroups32(int, const gid_t *) 206
76pid_t getpgrp(void) stub
77int setpgid(pid_t, pid_t) 57
Shin-ichiro KAWASAKIce0595d2009-09-01 19:03:06 +090078pid_t vfork(void) 190,-1,190
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080079int setregid:setregid32(gid_t, gid_t) 204
80int chroot(const char *) 61
David 'Digit' Turnerb083bb52011-05-26 02:46:41 +020081# IMPORTANT: Even though <sys/prctl.h> declares prctl(int,...), the syscall stub must take 6 arguments
82# to match the kernel implementation.
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080083int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 172
84int capget(cap_user_header_t header, cap_user_data_t data) 184
85int capset(cap_user_header_t header, const cap_user_data_t data) 185
Andrei Popescueb9d5ed2010-02-25 13:27:46 +000086int sigaltstack(const stack_t*, stack_t*) 186
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080087int acct(const char* filepath) 51
88
89# file descriptors
90ssize_t read (int, void*, size_t) 3
91ssize_t write (int, const void*, size_t) 4
David 'Digit' Turner95d751f2010-12-16 16:47:14 +010092ssize_t pread64 (int, void *, size_t, off64_t) 180
93ssize_t pwrite64 (int, void *, size_t, off64_t) 181
The Android Open Source Project1dc9e472009-03-03 19:28:35 -080094int __open:open (const char*, int, mode_t) 5
95int __openat:openat (int, const char*, int, mode_t) 322,295
96int close (int) 6
97int creat(const char*, mode_t) stub
98off_t lseek(int, off_t, int) 19
99int __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int) 140
100pid_t getpid () 20
101void * mmap(void *, size_t, int, int, int, long) stub
102void * __mmap2:mmap2(void*, size_t, int, int, int, long) 192
103int munmap(void *, size_t) 91
104void * mremap(void *, size_t, size_t, unsigned long) 163
105int msync(const void *, size_t, int) 144
106int mprotect(const void *, size_t, int) 125
107int madvise(const void *, size_t, int) 220,219
108int mlock(const void *addr, size_t len) 150
109int munlock(const void *addr, size_t len) 151
110int mincore(void* start, size_t length, unsigned char* vec) 219,218
111int __ioctl:ioctl(int, int, void *) 54
112int readv(int, const struct iovec *, int) 145
113int writev(int, const struct iovec *, int) 146
114int __fcntl:fcntl(int, int, void*) 55
115int flock(int, int) 143
116int fchmod(int, mode_t) 94
117int dup(int) 41
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100118int pipe(int *) 42,42
David 'Digit' Turner275cd482010-09-27 17:33:08 +0200119int pipe2(int *, int) 359,331
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800120int dup2(int, int) 63
121int select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *) 142
122int ftruncate(int, off_t) 93
David 'Digit' Turner95d751f2010-12-16 16:47:14 +0100123int ftruncate64(int, off64_t) 194
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800124int getdents:getdents64(unsigned int, struct dirent *, unsigned int) 217,220
125int fsync(int) 118
David 'Digit' Turnera3ae60d2010-09-27 17:28:38 +0200126int fdatasync(int) 148
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800127int fchown:fchown32(int, uid_t, gid_t) 207
128void sync(void) 36
129int __fcntl64:fcntl64(int, int, void *) 221
David 'Digit' Turnerab8b5412010-07-08 16:52:27 -0700130int __fstatfs64:fstatfs64(int, size_t, struct statfs *) 267,269
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800131ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) 187
132int fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags) 327,300
133int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296
134int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 325,298
135int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 333,306
136int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 329,302
Stephen Smalley5eb686d2012-01-13 07:45:16 -0500137int fsetxattr(int, const char *, const void *, size_t, int) 228
138ssize_t fgetxattr(int, const char *, void *, size_t) 231
139ssize_t flistxattr(int, char *, size_t) 234
140int fremovexattr(int, const char *) 237
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800141
142# file system
143int link (const char*, const char*) 9
144int unlink (const char*) 10
145int unlinkat (int, const char *, int) 328,301
146int chdir (const char*) 12
147int mknod (const char*, mode_t, dev_t) 14
148int chmod (const char*,mode_t) 15
149int chown:chown32(const char *, uid_t, gid_t) 212
150int lchown:lchown32 (const char*, uid_t, gid_t) 198
151int mount (const char*, const char*, const char*, unsigned long, const void*) 21
152int umount(const char*) stub
153int umount2 (const char*, int) 52
154int fstat:fstat64(int, struct stat*) 197
155int stat:stat64(const char *, struct stat *) 195
156int lstat:lstat64(const char *, struct stat *) 196
157int mkdir(const char *, mode_t) 39
158int readlink(const char *, char *, size_t) 85
159int rmdir(const char *) 40
160int rename(const char *, const char *) 38
161int __getcwd:getcwd(char * buf, size_t size) 183
162int access(const char *, int) 33
163int symlink(const char *, const char *) 83
164int fchdir(int) 133
165int truncate(const char*, off_t) 92
Stephen Smalley5eb686d2012-01-13 07:45:16 -0500166int setxattr(const char *, const char *, const void *, size_t, int) 226
167int lsetxattr(const char *, const char *, const void *, size_t, int) 227
168ssize_t getxattr(const char *, const char *, void *, size_t) 229
169ssize_t lgetxattr(const char *, const char *, void *, size_t) 230
170ssize_t listxattr(const char *, char *, size_t) 232
171ssize_t llistxattr(const char *, char *, size_t) 233
172int removexattr(const char *, const char *) 235
173int lremovexattr(const char *, const char *) 236
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800174int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268
Stephen Smalley5eb686d2012-01-13 07:45:16 -0500175
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800176# time
177int pause () 29
178int gettimeofday(struct timeval*, struct timezone*) 78
179int settimeofday(const struct timeval*, const struct timezone*) 79
180clock_t times(struct tms *) 43
181int nanosleep(const struct timespec *, struct timespec *) 162
182int clock_gettime(clockid_t clk_id, struct timespec *tp) 263,265
183int clock_settime(clockid_t clk_id, const struct timespec *tp) 262,264
184int clock_getres(clockid_t clk_id, struct timespec *res) 264,266
185int clock_nanosleep(const struct timespec *req, struct timespec *rem) 265,267
186int getitimer(int, const struct itimerval *) 105
187int setitimer(int, const struct itimerval *, struct itimerval *) 104
188int __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) 257,259
189int __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260
190int __timer_gettime:timer_gettime(timer_t, struct itimerspec*) 259,261
191int __timer_getoverrun:timer_getoverrun(timer_t) 260,262
192int __timer_delete:timer_delete(timer_t) 261,263
193int utimes(const char*, const struct timeval tvp[2]) 269, 271
Ken Sumrallae2d5ba2011-03-18 11:55:12 -0700194int utimensat(int, const char *, const struct timespec times[2], int) 348, 320, 320
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800195
196# signals
Dima Zavin18c5bcc2010-07-29 19:12:04 -0700197int sigaction(int, const struct sigaction *, struct sigaction *) 67
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800198int sigprocmask(int, const sigset_t *, sigset_t *) 126
199int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72
200int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174
201int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175
202int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177
203int sigpending(sigset_t *) 73
204
205# sockets
206int socket(int, int, int) 281,-1
207int socketpair(int, int, int, int*) 288,-1
208int bind(int, struct sockaddr *, int) 282,-1
209int connect(int, struct sockaddr *, socklen_t) 283,-1
210int listen(int, int) 284,-1
211int accept(int, struct sockaddr *, socklen_t *) 285,-1
212int getsockname(int, struct sockaddr *, socklen_t *) 286,-1
213int getpeername(int, struct sockaddr *, socklen_t *) 287,-1
214int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) 290,-1
215int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) 292,-1
216int shutdown(int, int) 293,-1
217int setsockopt(int, int, int, const void *, socklen_t) 294,-1
218int getsockopt(int, int, int, void *, socklen_t *) 295,-1
219int sendmsg(int, const struct msghdr *, unsigned int) 296,-1
220int recvmsg(int, struct msghdr *, unsigned int) 297,-1
221
222# sockets for x86. These are done as an "indexed" call to socketcall syscall.
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100223int socket:socketcall:1 (int, int, int) -1,102
224int bind:socketcall:2 (int, struct sockaddr *, int) -1,102
225int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,102
226int listen:socketcall:4(int, int) -1,102
227int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,102
228int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,102
229int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,102
230int socketpair:socketcall:8(int, int, int, int*) -1,102
231int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,102
232int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,102
Shin-ichiro KAWASAKIce0595d2009-09-01 19:03:06 +0900233int shutdown:socketcall:13(int, int) -1,102,-1
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100234int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,102
235int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,102
236int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,102
237int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,102
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800238
239# scheduler & real-time
240int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) 156
241int sched_getscheduler(pid_t pid) 157
242int sched_yield(void) 158
243int sched_setparam(pid_t pid, const struct sched_param *param) 154
244int sched_getparam(pid_t pid, struct sched_param *param) 155
245int sched_get_priority_max(int policy) 159
246int sched_get_priority_min(int policy) 160
247int sched_rr_get_interval(pid_t pid, struct timespec *interval) 161
David 'Digit' Turner72e6fd42010-12-03 18:04:01 +0100248int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241
249int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) 242
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100250int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800251
San Mehat75c5e252010-02-23 15:55:29 -0800252# io priorities
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100253int ioprio_set(int which, int who, int ioprio) 314,289
254int ioprio_get(int which, int who) 315,290
San Mehat75c5e252010-02-23 15:55:29 -0800255
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800256# other
257int uname(struct utsname *) 122
258pid_t __wait4:wait4(pid_t pid, int *status, int options, struct rusage *rusage) 114
259mode_t umask(mode_t) 60
260int __reboot:reboot(int, int, int, void *) 88
261int __syslog:syslog(int, char *, int) 103
262int init_module(void *, unsigned long, const char *) 128
263int delete_module(const char*, unsigned int) 129
264int klogctl:syslog(int, char *, int) 103
David 'Digit' Turneraa4b1d02010-05-20 10:55:45 -0700265int sysinfo(struct sysinfo *) 116
Nick Kralevichf44de272012-01-13 14:03:01 -0800266int personality(unsigned long) 136
Ben Cheng1a823692012-03-13 12:28:40 -0700267long perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800268
269# futex
270int futex(void *, int, int, void *, void *, int) 240
271
272# epoll
273int epoll_create(int size) 250,254
274int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 251,255
275int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout) 252,256
276
Shin-ichiro KAWASAKIce0595d2009-09-01 19:03:06 +0900277int inotify_init(void) 316,291,290
David 'Digit' Turner70b16682012-01-30 17:17:58 +0100278int inotify_add_watch(int, const char *, unsigned int) 317,292
279int inotify_rm_watch(int, unsigned int) 318,293
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800280
281int poll(struct pollfd *, unsigned int, long) 168
282
David 'Digit' Turnerdefd1622010-09-26 22:29:14 +0200283int eventfd:eventfd2(unsigned int, int) 356,328
284
The Android Open Source Project1dc9e472009-03-03 19:28:35 -0800285# ARM-specific ARM_NR_BASE == 0x0f0000 == 983040
286int __set_tls:ARM_set_tls(void*) 983045,-1
287int cacheflush:ARM_cacheflush(long start, long end, long flags) 983042,-1