Home | History | Annotate | Download | only in libc
      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 
     27 int     execve(const char*, char* const*, char* const*)  all
     28 
     29 uid_t   getuid:getuid32()         arm,x86
     30 uid_t   getuid:getuid()           arm64,mips,mips64,x86_64
     31 gid_t   getgid:getgid32()         arm,x86
     32 gid_t   getgid:getgid()           arm64,mips,mips64,x86_64
     33 uid_t   geteuid:geteuid32()       arm,x86
     34 uid_t   geteuid:geteuid()         arm64,mips,mips64,x86_64
     35 gid_t   getegid:getegid32()       arm,x86
     36 gid_t   getegid:getegid()         arm64,mips,mips64,x86_64
     37 uid_t   getresuid:getresuid32(uid_t* ruid, uid_t* euid, uid_t* suid)   arm,x86
     38 uid_t   getresuid:getresuid(uid_t* ruid, uid_t* euid, uid_t* suid)     arm64,mips,mips64,x86_64
     39 gid_t   getresgid:getresgid32(gid_t* rgid, gid_t* egid, gid_t* sgid)   arm,x86
     40 gid_t   getresgid:getresgid(gid_t* rgid, gid_t* egid, gid_t* sgid)     arm64,mips,mips64,x86_64
     41 ssize_t readahead(int, off64_t, size_t)     all
     42 int     getgroups:getgroups32(int, gid_t*)    arm,x86
     43 int     getgroups:getgroups(int, gid_t*)      arm64,mips,mips64,x86_64
     44 pid_t   getpgid(pid_t)             all
     45 pid_t   getppid()                  all
     46 pid_t   getsid(pid_t)              all
     47 pid_t   setsid()                   all
     48 int     setgid:setgid32(gid_t)     arm,x86
     49 int     setgid:setgid(gid_t)       arm64,mips,mips64,x86_64
     50 int     setuid:setuid32(uid_t)    arm,x86
     51 int     setuid:setuid(uid_t)      arm64,mips,mips64,x86_64
     52 int     setreuid:setreuid32(uid_t, uid_t)   arm,x86
     53 int     setreuid:setreuid(uid_t, uid_t)     arm64,mips,mips64,x86_64
     54 int     setresuid:setresuid32(uid_t, uid_t, uid_t)   arm,x86
     55 int     setresuid:setresuid(uid_t, uid_t, uid_t)     arm64,mips,mips64,x86_64
     56 int     setresgid:setresgid32(gid_t, gid_t, gid_t)   arm,x86
     57 int     setresgid:setresgid(gid_t, gid_t, gid_t)     arm64,mips,mips64,x86_64
     58 void*   __brk:brk(void*)           all
     59 int     kill(pid_t, int)           all
     60 int     tgkill(pid_t tgid, pid_t tid, int sig)  all
     61 int     __ptrace:ptrace(int request, int pid, void* addr, void* data)  all
     62 
     63 # <sys/resource.h>
     64 int getrusage(int, struct rusage*)  all
     65 int __getpriority:getpriority(int, int)  all
     66 int setpriority(int, int, int)   all
     67 # On LP64, rlimit and rlimit64 are the same.
     68 # On 32-bit systems we use prlimit64 to implement the rlimit64 functions.
     69 int getrlimit:ugetrlimit(int, struct rlimit*)  arm,x86
     70 int getrlimit(int, struct rlimit*)  mips
     71 int getrlimit|getrlimit64(int, struct rlimit*)  arm64,mips64,x86_64
     72 int setrlimit(int, const struct rlimit*)  arm,mips,x86
     73 int setrlimit|setrlimit64(int, const struct rlimit*)  arm64,mips64,x86_64
     74 int prlimit64|prlimit(pid_t, int, struct rlimit64*, const struct rlimit64*)  arm64,mips64,x86_64
     75 int prlimit64(pid_t, int, struct rlimit64*, const struct rlimit64*)  arm,mips,x86
     76 
     77 int     setgroups:setgroups32(int, const gid_t*)   arm,x86
     78 int     setgroups:setgroups(int, const gid_t*)     arm64,mips,mips64,x86_64
     79 int     setpgid(pid_t, pid_t)  all
     80 pid_t   vfork(void)  arm
     81 int     setregid:setregid32(gid_t, gid_t)  arm,x86
     82 int     setregid:setregid(gid_t, gid_t)    arm64,mips,mips64,x86_64
     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
     90 
     91 # file descriptors
     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) arm,mips,x86
     95 ssize_t     pread64|pread(int, void*, size_t, off_t) arm64,mips64,x86_64
     96 ssize_t     pwrite64(int, void*, size_t, off64_t) arm,mips,x86
     97 ssize_t     pwrite64|pwrite(int, void*, size_t, off_t) arm64,mips64,x86_64
     98 int         close(int)                      all
     99 pid_t       __getpid:getpid()  all
    100 int         munmap(void*, size_t)  all
    101 void*       mremap(void*, size_t, size_t, unsigned long)  all
    102 int         msync(const void*, size_t, int)    all
    103 int         mprotect(const void*, size_t, int)  all
    104 int         madvise(const void*, size_t, int)  all
    105 int         mlock(const void* addr, size_t len)    all
    106 int         munlock(const void* addr, size_t len)   all
    107 int         mlockall(int flags)   all
    108 int         munlockall()   all
    109 int         mincore(void*  start, size_t  length, unsigned char*  vec)   all
    110 int         __ioctl:ioctl(int, int, void*)  all
    111 int         readv(int, const struct iovec*, int)   all
    112 int         writev(int, const struct iovec*, int)  all
    113 int         __fcntl64:fcntl64(int, int, void*)  arm,mips,x86
    114 int         fcntl(int, int, void*)  arm64,mips64,x86_64
    115 int         flock(int, int)   all
    116 int         fchmod(int, mode_t)  all
    117 int         dup(int)  all
    118 int         pipe2(int*, int) all
    119 int         dup3(int, int, int)   all
    120 int         fsync(int)  all
    121 int         fdatasync(int) all
    122 int         fchown:fchown32(int, uid_t, gid_t)  arm,x86
    123 int         fchown:fchown(int, uid_t, gid_t)    arm64,mips,mips64,x86_64
    124 void        sync(void)  all
    125 int         fsetxattr(int, const char*, const void*, size_t, int) all
    126 ssize_t     fgetxattr(int, const char*, void*, size_t) all
    127 ssize_t     flistxattr(int, char*, size_t) all
    128 int         fremovexattr(int, const char*) all
    129 
    130 int __getdents64:getdents64(unsigned int, struct dirent*, unsigned int)   arm,arm64,mips,mips64,x86,x86_64
    131 
    132 int __openat:openat(int, const char*, int, mode_t) all
    133 int faccessat(int, const char*, int, int)  all
    134 int fchmodat(int, const char*, mode_t, int)  all
    135 int fchownat(int, const char*, uid_t, gid_t, int)  all
    136 int fstatat64|fstatat:fstatat64(int, const char*, struct stat*, int)   arm,mips,x86
    137 int fstatat64|fstatat:newfstatat(int, const char*, struct stat*, int)  arm64,mips64,x86_64
    138 int linkat(int, const char*, int, const char*, int)  all
    139 int mkdirat(int, const char*, mode_t)  all
    140 int mknodat(int, const char*, mode_t, dev_t)  all
    141 int readlinkat(int, const char*, char*, size_t)  all
    142 int renameat(int, const char*, int, const char*)  all
    143 int symlinkat(const char*, int, const char*)  all
    144 int unlinkat(int, const char*, int)   all
    145 int utimensat(int, const char*, const struct timespec times[2], int)  all
    146 
    147 # Paired off_t/off64_t system calls. On 64-bit systems,
    148 # sizeof(off_t) == sizeof(off64_t), so there we emit two symbols that are
    149 # aliases. On 32-bit systems, we have two different system calls.
    150 # That means that every system call in this section should take three lines.
    151 off_t lseek(int, off_t, int) arm,mips,x86
    152 int __llseek:_llseek(int, unsigned long, unsigned long, off64_t*, int) arm,mips,x86
    153 off_t lseek|lseek64(int, off_t, int) arm64,mips64,x86_64
    154 int ftruncate(int, off_t) arm,mips,x86
    155 int ftruncate64(int, off64_t) arm,mips,x86
    156 int ftruncate|ftruncate64(int, off_t) arm64,mips64,x86_64
    157 ssize_t sendfile(int out_fd, int in_fd, off_t* offset, size_t count) arm,mips,x86
    158 ssize_t sendfile64(int out_fd, int in_fd, off64_t* offset, size_t count) arm,mips,x86
    159 ssize_t sendfile|sendfile64(int out_fd, int in_fd, off_t* offset, size_t count) arm64,mips64,x86_64
    160 int truncate(const char*, off_t) arm,mips,x86
    161 int truncate64(const char*, off64_t) arm,mips,x86
    162 int truncate|truncate64(const char*, off_t) arm64,mips64,x86_64
    163 # (mmap only gets two lines because we only used the 64-bit variant on 32-bit systems.)
    164 void* __mmap2:mmap2(void*, size_t, int, int, int, long)   arm,mips,x86
    165 void* mmap|mmap64(void*, size_t, int, int, int, off_t)  arm64,mips64,x86_64
    166 # (fallocate only gets two lines because there is no 32-bit variant.)
    167 int fallocate64:fallocate(int, int, off64_t, off64_t) arm,mips,x86
    168 int fallocate|fallocate64(int, int, off_t, off_t) arm64,mips64,x86_64
    169 
    170 # posix_fadvise64 is awkward: arm has shuffled arguments,
    171 # the POSIX functions don't set errno, and no architecture has posix_fadvise.
    172 int __arm_fadvise64_64:arm_fadvise64_64(int, int, off64_t, off64_t) arm
    173 int __fadvise64:fadvise64_64(int, off64_t, off64_t, int) x86
    174 int __fadvise64:fadvise64(int, off64_t, off64_t, int) arm64,mips,mips64,x86_64
    175 
    176 int __fstatfs64:fstatfs64(int, size_t, struct statfs*)  arm,mips,x86
    177 int fstatfs64|fstatfs:fstatfs(int, struct statfs*)  arm64,mips64,x86_64
    178 int __statfs64:statfs64(const char*, size_t, struct statfs*)  arm,mips,x86
    179 int statfs64|statfs:statfs(const char*, struct statfs*)  arm64,mips64,x86_64
    180 
    181 int     fstat64|fstat:fstat64(int, struct stat*)    arm,mips,x86
    182 int     fstat64|fstat:fstat(int, struct stat*)    arm64,mips64,x86_64
    183 
    184 # file system
    185 int     chdir(const char*)              all
    186 int     mount(const char*, const char*, const char*, unsigned long, const void*)  all
    187 int     umount2(const char*, int)  all
    188 int     __getcwd:getcwd(char* buf, size_t size)  all
    189 int     fchdir(int)    all
    190 int     setxattr(const char*, const char*, const void*, size_t, int) all
    191 int     lsetxattr(const char*, const char*, const void*, size_t, int) all
    192 ssize_t getxattr(const char*, const char*, void*, size_t) all
    193 ssize_t lgetxattr(const char*, const char*, void*, size_t) all
    194 ssize_t listxattr(const char*, char*, size_t) all
    195 ssize_t llistxattr(const char*, char*, size_t) all
    196 int     removexattr(const char*, const char*) all
    197 int     lremovexattr(const char*, const char*) all
    198 int     swapon(const char*, int) all
    199 int     swapoff(const char*) all
    200 
    201 # time
    202 int           settimeofday(const struct timeval*, const struct timezone*)   all
    203 clock_t       times(struct tms*)       all
    204 int           nanosleep(const struct timespec*, struct timespec*)   all
    205 int           clock_settime(clockid_t clk_id, const struct timespec* tp)  all
    206 int           clock_getres(clockid_t clk_id, struct timespec* res)   all
    207 int           clock_nanosleep(clockid_t clock_id, int flags, const struct timespec* req, struct timespec* rem)  all
    208 int           getitimer(int, const struct itimerval*)   all
    209 int           setitimer(int, const struct itimerval*, struct itimerval*)  all
    210 int           __timer_create:timer_create(clockid_t clockid, struct sigevent* evp, __kernel_timer_t* timerid)    all
    211 int           __timer_settime:timer_settime(__kernel_timer_t, int, const struct itimerspec*, struct itimerspec*) all
    212 int           __timer_gettime:timer_gettime(__kernel_timer_t, struct itimerspec*)                                all
    213 int           __timer_getoverrun:timer_getoverrun(__kernel_timer_t)                                              all
    214 int           __timer_delete:timer_delete(__kernel_timer_t)                                                      all
    215 int           timerfd_create(clockid_t, int)   all
    216 int           timerfd_settime(int, int, const struct itimerspec*, struct itimerspec*)   all
    217 int           timerfd_gettime(int, struct itimerspec*)   all
    218 
    219 # signals
    220 int     __sigaction:sigaction(int, const struct sigaction*, struct sigaction*)  arm,mips,x86
    221 int     __rt_sigaction:rt_sigaction(int, const struct sigaction*, struct sigaction*, size_t)  all
    222 int     __rt_sigpending:rt_sigpending(sigset_t*, size_t)  all
    223 int     __rt_sigprocmask:rt_sigprocmask(int, const sigset_t*, sigset_t*, size_t)  all
    224 int     __rt_sigsuspend:rt_sigsuspend(const sigset_t*, size_t)  all
    225 int     __rt_sigtimedwait:rt_sigtimedwait(const sigset_t*, struct siginfo_t*, struct timespec_t*, size_t)  all
    226 int     __signalfd4:signalfd4(int, const sigset_t*, size_t, int)  all
    227 
    228 # sockets
    229 int           __socket:socket(int, int, int)              arm,arm64,mips,mips64,x86_64
    230 int           socketpair(int, int, int, int*)    arm,arm64,mips,mips64,x86_64
    231 int           bind(int, struct sockaddr*, int)  arm,arm64,mips,mips64,x86_64
    232 int           __connect:connect(int, struct sockaddr*, socklen_t)   arm,arm64,mips,mips64,x86_64
    233 int           listen(int, int)                   arm,arm64,mips,mips64,x86_64
    234 int           __accept4:accept4(int, struct sockaddr*, socklen_t*, int)  arm,arm64,mips,mips64,x86_64
    235 int           getsockname(int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
    236 int           getpeername(int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
    237 int           sendto(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  arm,arm64,mips,mips64,x86_64
    238 int           recvfrom(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*)  arm,arm64,mips,mips64,x86_64
    239 int           shutdown(int, int)  arm,arm64,mips,mips64,x86_64
    240 int           setsockopt(int, int, int, const void*, socklen_t)  arm,arm64,mips,mips64,x86_64
    241 int           getsockopt(int, int, int, void*, socklen_t*)    arm,arm64,mips,mips64,x86_64
    242 int           sendmsg(int, const struct msghdr*, unsigned int)  arm,arm64,mips,mips64,x86_64
    243 int           recvmsg(int, struct msghdr*, unsigned int)   arm,arm64,mips,mips64,x86_64
    244 int           recvmmsg(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   arm,arm64,mips,mips64,x86_64
    245 int           sendmmsg(int, struct mmsghdr*, unsigned int, int)   arm,arm64,mips,mips64,x86_64
    246 
    247 # sockets for x86. These are done as an "indexed" call to socketcall syscall.
    248 int           __socket:socketcall:1(int, int, int) x86
    249 int           bind:socketcall:2(int, struct sockaddr*, int)  x86
    250 int           __connect:socketcall:3(int, struct sockaddr*, socklen_t)   x86
    251 int           listen:socketcall:4(int, int)                   x86
    252 int           getsockname:socketcall:6(int, struct sockaddr*, socklen_t*)  x86
    253 int           getpeername:socketcall:7(int, struct sockaddr*, socklen_t*)  x86
    254 int           socketpair:socketcall:8(int, int, int, int*)    x86
    255 int           sendto:socketcall:11(int, const void*, size_t, int, const struct sockaddr*, socklen_t)  x86
    256 int           recvfrom:socketcall:12(int, void*, size_t, unsigned int, struct sockaddr*, socklen_t*)  x86
    257 int           shutdown:socketcall:13(int, int)  x86
    258 int           setsockopt:socketcall:14(int, int, int, const void*, socklen_t)  x86
    259 int           getsockopt:socketcall:15(int, int, int, void*, socklen_t*)    x86
    260 int           sendmsg:socketcall:16(int, const struct msghdr*, unsigned int)  x86
    261 int           recvmsg:socketcall:17(int, struct msghdr*, unsigned int)   x86
    262 int           __accept4:socketcall:18(int, struct sockaddr*, socklen_t*, int)  x86
    263 int           recvmmsg:socketcall:19(int, struct mmsghdr*, unsigned int, int, const struct timespec*)   x86
    264 int           sendmmsg:socketcall:20(int, struct mmsghdr*, unsigned int, int)   x86
    265 
    266 # scheduler & real-time
    267 int sched_setscheduler(pid_t pid, int policy, const struct sched_param* param)  all
    268 int sched_getscheduler(pid_t pid)  all
    269 int sched_yield(void)  all
    270 int sched_setparam(pid_t pid, const struct sched_param* param)  all
    271 int sched_getparam(pid_t pid, struct sched_param* param)  all
    272 int sched_get_priority_max(int policy)  all
    273 int sched_get_priority_min(int policy)  all
    274 int sched_rr_get_interval(pid_t pid, struct timespec* interval)  all
    275 int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) all
    276 int setns(int, int) all
    277 int unshare(int) all
    278 int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set)  all
    279 int __getcpu:getcpu(unsigned*, unsigned*, void*) all
    280 
    281 # other
    282 int     uname(struct utsname*)  all
    283 mode_t  umask(mode_t)  all
    284 int     __reboot:reboot(int, int, int, void*)  all
    285 int     init_module(void*, unsigned long, const char*)  all
    286 int     delete_module(const char*, unsigned int)   all
    287 int     klogctl:syslog(int, char*, int)   all
    288 int     sysinfo(struct sysinfo*)  all
    289 int     personality(unsigned long)  all
    290 
    291 ssize_t tee(int, int, size_t, unsigned int)  all
    292 ssize_t splice(int, off64_t*, int, off64_t*, size_t, unsigned int)  all
    293 ssize_t vmsplice(int, const struct iovec*, size_t, unsigned int)  all
    294 
    295 int epoll_create1(int)  all
    296 int epoll_ctl(int, int op, int, struct epoll_event*)  all
    297 int __epoll_pwait:epoll_pwait(int, struct epoll_event*, int, int, const sigset_t*, size_t)  all
    298 
    299 int eventfd:eventfd2(unsigned int, int)  all
    300 
    301 void _exit|_Exit:exit_group(int)  all
    302 void __exit:exit(int)  all
    303 
    304 int inotify_init1(int)  all
    305 int inotify_add_watch(int, const char*, unsigned int)  all
    306 int inotify_rm_watch(int, unsigned int)  all
    307 
    308 int __pselect6:pselect6(int, fd_set*, fd_set*, fd_set*, timespec*, void*)  all
    309 int __ppoll:ppoll(pollfd*, unsigned int, timespec*, const sigset_t*, size_t)  all
    310 
    311 int __set_tid_address:set_tid_address(int*)  all
    312 
    313 int setfsgid(gid_t)  all
    314 int setfsuid(uid_t)  all
    315 
    316 pid_t wait4(pid_t, int*, int, struct rusage*)  all
    317 int __waitid:waitid(int, pid_t, struct siginfo_t*, int, void*)  all
    318 
    319 # ARM-specific
    320 int     __set_tls:__ARM_NR_set_tls(void*)                                 arm
    321 int     cacheflush:__ARM_NR_cacheflush(long start, long end, long flags)  arm
    322 
    323 # MIPS-specific
    324 int     _flush_cache:cacheflush(char* addr, const int nbytes, const int op) mips,mips64
    325 int     __set_tls:set_thread_area(void*) mips,mips64
    326 
    327 # x86-specific
    328 int     __set_thread_area:set_thread_area(void*) x86
    329 
    330 # vdso stuff.
    331 int clock_gettime(clockid_t, timespec*)                 arm,mips,mips64,x86
    332 int __clock_gettime:clock_gettime(clockid_t, timespec*) arm64,x86_64
    333 int gettimeofday(timeval*, timezone*)                   arm,mips,mips64,x86
    334 int __gettimeofday:gettimeofday(timeval*, timezone*)    arm64,x86_64
    335