From a51916b58b2d211bcf8ffdbe9cf7faa58e57382f Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 3 Apr 2013 10:08:09 -0700 Subject: [PATCH] Fix the SYSCALLS.TXT documentation and remove a dead script. We use the system call constants from the kernel header files now, so there's no need to check that they've been correctly transcribed into SYSCALLS.TXT. This is a work in progress. I've added TODOs to SYSCALLS.TXT explaining what's left to do. Change-Id: I3b86acfe7f84b4da1c802ee5a4ef13a2e83e7939 --- libc/SYSCALLS.TXT | 514 ++++++++++++++++++------------------ libc/tools/checksyscalls.py | 188 ------------- 2 files changed, 258 insertions(+), 444 deletions(-) delete mode 100755 libc/tools/checksyscalls.py diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT index bf56ffe48..96cc9e6a9 100644 --- a/libc/SYSCALLS.TXT +++ b/libc/SYSCALLS.TXT @@ -1,13 +1,11 @@ -# this file is used to list all the syscalls that will be supported by -# the Bionic C library. It is used to automatically generate the syscall -# stubs, the list of syscall constants (__NR_xxxx) and the content of +# This file is used to automatically generate bionic's the system calls stubs. # -# each non comment line has the following format: +# Each non comment line has the following format: # -# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (syscall_number|"stub") +# return_type func_name[:syscall_name[:call_id]]([parameter_list]) (1|-1|"stub") # -# note that: -# - syscall_name correspond to the name of the syscall, which may differ from +# Note that: +# - syscall_name corresponds to the name of the syscall, which may differ from # the exported function name (example: the exit syscall is implemented by the _exit() # function, which is not the same as the standard C exit() function which calls it) # The call_id parameter, given that func_name and syscall_name have @@ -18,302 +16,306 @@ # - each parameter type is assumed to be stored on 32 bits, there is no plan to support # 64-bit architectures at the moment # -# - it there is "stub" instead of a syscall number, the tool will not generate any -# assembler template for the syscall; it's up to the bionic implementation to provide -# a relevant C stub +# - the final field can be "1", meaning: generate a stub for each architecture, +# taking the constants from the kernel header files. # -# - additionally, if the syscall number is different amoung ARM, and x86, MIPS use: -# return_type funcname[:syscall_name](parameters) arm_number,x86_number,mips_number +# - the final field can be "stub" meaning: do not generate any stubs --- +# in this case, a hand-written custom stub must be provided. +# TODO: replace this with something like "custom" or "none", or remove +# it entirely. +# +# - the final field can be a three-element list of 1s and -1 meaning: +# this system call is only available on some of the architectures (1), +# and no stub should be generated for those architectures marked with -1. +# the order is arm,x86,mips. +# TODO: replace this with something more readable like "-arm,-mips" (meaning x86 only). # # This file is processed by a python script named gensyscalls.py. # -# The checksyscalls.py script can check that the syscall numbers here are -# correct by comparing them to the numbers in the Linux kernel headers. -# # process management -void _exit:exit_group (int) 248,252,246 +void _exit:exit_group (int) 1 void _exit_thread:exit (int) 1 -pid_t __fork:fork (void) 2 -pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,7,7 -int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 280,284,278 -pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) 114 +pid_t __fork:fork (void) 1 +pid_t _waitpid:waitpid (pid_t, int*, int, struct rusage*) -1,1,1 +int __waitid:waitid(int, pid_t, struct siginfo_t*, int,void*) 1 +pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) 1 # NOTE: this system call is never called directly, but we list it there # to have __NR_clone properly defined. # -pid_t __sys_clone:clone (int, void*, int*, void*, int*) 120 +pid_t __sys_clone:clone (int, void*, int*, void*, int*) 1 -int execve (const char*, char* const*, char* const*) 11 +int execve (const char*, char* const*, char* const*) 1 -int __setuid:setuid32 (uid_t) 213,213,-1 -int __setuid:setuid (uid_t) -1,-1,23 -uid_t getuid:getuid32 () 199,199,-1 -uid_t getuid:getuid () -1,-1,24 -gid_t getgid:getgid32 () 200,200,-1 -gid_t getgid:getgid () -1,-1,47 -uid_t geteuid:geteuid32 () 201,201,-1 -uid_t geteuid:geteuid () -1,-1,49 -gid_t getegid:getegid32 () 202,202,-1 -gid_t getegid:getegid () -1,-1,50 -uid_t getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid) 209,209,-1 -uid_t getresuid:getresuid (uid_t *ruid, uid_t *euid, uid_t *suid) -1,-1,186 -gid_t getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid) 211,211,-1 -gid_t getresgid:getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid) -1,-1,191 -pid_t gettid() 224,224,222 -ssize_t readahead(int, off64_t, size_t) 225,225,223 -int getgroups:getgroups32(int, gid_t *) 205,205,-1 -int getgroups:getgroups(int, gid_t *) -1,-1,80 -pid_t getpgid(pid_t) 132 -pid_t getppid() 64 -pid_t getsid(pid_t) 147,147,151 -pid_t setsid() 66 -int setgid:setgid32(gid_t) 214,214,-1 -int setgid:setgid(gid_t) -1,-1,46 +int __setuid:setuid32 (uid_t) 1,1,-1 +int __setuid:setuid (uid_t) -1,-1,1 +uid_t getuid:getuid32 () 1,1,-1 +uid_t getuid:getuid () -1,-1,1 +gid_t getgid:getgid32 () 1,1,-1 +gid_t getgid:getgid () -1,-1,1 +uid_t geteuid:geteuid32 () 1,1,-1 +uid_t geteuid:geteuid () -1,-1,1 +gid_t getegid:getegid32 () 1,1,-1 +gid_t getegid:getegid () -1,-1,1 +uid_t getresuid:getresuid32 (uid_t *ruid, uid_t *euid, uid_t *suid) 1,1,-1 +uid_t getresuid:getresuid (uid_t *ruid, uid_t *euid, uid_t *suid) -1,-1,1 +gid_t getresgid:getresgid32 (gid_t *rgid, gid_t *egid, gid_t *sgid) 1,1,-1 +gid_t getresgid:getresgid (gid_t *rgid, gid_t *egid, gid_t *sgid) -1,-1,1 +pid_t gettid() 1 +ssize_t readahead(int, off64_t, size_t) 1 +int getgroups:getgroups32(int, gid_t *) 1,1,-1 +int getgroups:getgroups(int, gid_t *) -1,-1,1 +pid_t getpgid(pid_t) 1 +pid_t getppid() 1 +pid_t getsid(pid_t) 1 +pid_t setsid() 1 +int setgid:setgid32(gid_t) 1,1,-1 +int setgid:setgid(gid_t) -1,-1,1 int seteuid:seteuid32(uid_t) stub -int __setreuid:setreuid32(uid_t, uid_t) 203,203,-1 -int __setreuid:setreuid(uid_t, uid_t) -1,-1,70 -int __setresuid:setresuid32(uid_t, uid_t, uid_t) 208,208,-1 -int __setresuid:setresuid(uid_t, uid_t, uid_t) -1,-1,185 -int setresgid:setresgid32(gid_t, gid_t, gid_t) 210,210,-1 -int setresgid:setresgid(gid_t, gid_t, gid_t) -1,-1,190 -void* __brk:brk(void*) 45 +int __setreuid:setreuid32(uid_t, uid_t) 1,1,-1 +int __setreuid:setreuid(uid_t, uid_t) -1,-1,1 +int __setresuid:setresuid32(uid_t, uid_t, uid_t) 1,1,-1 +int __setresuid:setresuid(uid_t, uid_t, uid_t) -1,-1,1 +int setresgid:setresgid32(gid_t, gid_t, gid_t) 1,1,-1 +int setresgid:setresgid(gid_t, gid_t, gid_t) -1,-1,1 +void* __brk:brk(void*) 1 # see comments in arch-arm/bionic/kill.S to understand why we don't generate an ARM stub for kill/tkill -int kill(pid_t, int) -1,37,37 -int tkill(pid_t tid, int sig) -1,238,236 -int tgkill(pid_t tgid, pid_t tid, int sig) -1,270,266 -int __ptrace:ptrace(int request, int pid, void* addr, void* data) 26 -int __set_thread_area:set_thread_area(void* user_desc) -1,243,283 -int __getpriority:getpriority(int, int) 96 -int setpriority(int, int, int) 97 -int setrlimit(int resource, const struct rlimit *rlp) 75 -int getrlimit:ugetrlimit(int resource, struct rlimit *rlp) 191,191,-1 -int getrlimit:getrlimit(int resource, struct rlimit *rlp) -1,-1,76 -int getrusage(int who, struct rusage* r_usage) 77 -int setgroups:setgroups32(int, const gid_t *) 206,206,-1 -int setgroups:setgroups(int, const gid_t *) -1,-1,81 +int kill(pid_t, int) -1,1,1 +int tkill(pid_t tid, int sig) -1,1,1 +int tgkill(pid_t tgid, pid_t tid, int sig) -1,1,1 +int __ptrace:ptrace(int request, int pid, void* addr, void* data) 1 +int __set_thread_area:set_thread_area(void* user_desc) -1,1,1 +int __getpriority:getpriority(int, int) 1 +int setpriority(int, int, int) 1 +int setrlimit(int resource, const struct rlimit *rlp) 1 +int getrlimit:ugetrlimit(int resource, struct rlimit *rlp) 1,1,-1 +int getrlimit:getrlimit(int resource, struct rlimit *rlp) -1,-1,1 +int getrusage(int who, struct rusage* r_usage) 1 +int setgroups:setgroups32(int, const gid_t *) 1,1,-1 +int setgroups:setgroups(int, const gid_t *) -1,-1,1 pid_t getpgrp(void) stub -int setpgid(pid_t, pid_t) 57 -pid_t vfork(void) 190,-1,-1 -int setregid:setregid32(gid_t, gid_t) 204,204,-1 -int setregid:setregid(gid_t, gid_t) -1,-1,71 -int chroot(const char *) 61 +int setpgid(pid_t, pid_t) 1 +pid_t vfork(void) 1,-1,-1 +int setregid:setregid32(gid_t, gid_t) 1,1,-1 +int setregid:setregid(gid_t, gid_t) -1,-1,1 +int chroot(const char *) 1 # IMPORTANT: Even though declares prctl(int,...), the syscall stub must take 6 arguments # to match the kernel implementation. -int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 172,172,192 -int capget(cap_user_header_t header, cap_user_data_t data) 184,184,204 -int capset(cap_user_header_t header, const cap_user_data_t data) 185,185,205 -int sigaltstack(const stack_t*, stack_t*) 186,186,206 -int acct(const char* filepath) 51 +int prctl(int option, unsigned int arg2, unsigned int arg3, unsigned int arg4, unsigned int arg5) 1 +int capget(cap_user_header_t header, cap_user_data_t data) 1 +int capset(cap_user_header_t header, const cap_user_data_t data) 1 +int sigaltstack(const stack_t*, stack_t*) 1 +int acct(const char* filepath) 1 # file descriptors -ssize_t read (int, void*, size_t) 3 -ssize_t write (int, const void*, size_t) 4 -ssize_t pread64 (int, void *, size_t, off64_t) 180,180,200 -ssize_t pwrite64 (int, void *, size_t, off64_t) 181,181,201 -int __open:open (const char*, int, mode_t) 5 -int __openat:openat (int, const char*, int, mode_t) 322,295,288 -int close (int) 6 +ssize_t read (int, void*, size_t) 1 +ssize_t write (int, const void*, size_t) 1 +ssize_t pread64 (int, void *, size_t, off64_t) 1 +ssize_t pwrite64 (int, void *, size_t, off64_t) 1 +int __open:open (const char*, int, mode_t) 1 +int __openat:openat (int, const char*, int, mode_t) 1 +int close (int) 1 int creat(const char*, mode_t) stub -off_t lseek(int, off_t, int) 19 -int __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int) 140 -pid_t getpid () 20 +off_t lseek(int, off_t, int) 1 +int __llseek:_llseek (int, unsigned long, unsigned long, loff_t*, int) 1 +pid_t getpid () 1 void * mmap(void *, size_t, int, int, int, long) stub -void * __mmap2:mmap2(void*, size_t, int, int, int, long) 192,192,210 -int munmap(void *, size_t) 91 -void * mremap(void *, size_t, size_t, unsigned long) 163,163,167 -int msync(const void *, size_t, int) 144 -int mprotect(const void *, size_t, int) 125 -int madvise(const void *, size_t, int) 220,219,218 -int mlock(const void *addr, size_t len) 150,150,154 -int munlock(const void *addr, size_t len) 151,151,155 -int mlockall(int flags) 152,152,156 -int munlockall() 153,153,157 -int mincore(void* start, size_t length, unsigned char* vec) 219,218,217 -int __ioctl:ioctl(int, int, void *) 54 -int readv(int, const struct iovec *, int) 145 -int writev(int, const struct iovec *, int) 146 -int __fcntl:fcntl(int, int, void*) 55 -int flock(int, int) 143 -int fchmod(int, mode_t) 94 -int dup(int) 41 -int pipe(int *) 42,42,-1 -int pipe2(int *, int) 359,331,328 -int dup2(int, int) 63 -int select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *) 142 -int ftruncate(int, off_t) 93 -int ftruncate64(int, off64_t) 194,194,212 -int getdents:getdents64(unsigned int, struct dirent *, unsigned int) 217,220,219 -int fsync(int) 118 -int fdatasync(int) 148,148,152 -int fchown:fchown32(int, uid_t, gid_t) 207,207,-1 -int fchown:fchown(int, uid_t, gid_t) -1,-1,95 -void sync(void) 36 -int __fcntl64:fcntl64(int, int, void *) 221,221,220 -int __fstatfs64:fstatfs64(int, size_t, struct statfs *) 267,269,256 -ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) 187,187,207 -int fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags) 327,300,293 -int mkdirat(int dirfd, const char *pathname, mode_t mode) 323,296,289 -int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 325,298,291 -int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 333,306,299 -int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 329,302,295 -int fsetxattr(int, const char *, const void *, size_t, int) 228,228,226 -ssize_t fgetxattr(int, const char *, void *, size_t) 231,231,229 -ssize_t flistxattr(int, char *, size_t) 234,234,232 -int fremovexattr(int, const char *) 237,237,235 +void * __mmap2:mmap2(void*, size_t, int, int, int, long) 1 +int munmap(void *, size_t) 1 +void * mremap(void *, size_t, size_t, unsigned long) 1 +int msync(const void *, size_t, int) 1 +int mprotect(const void *, size_t, int) 1 +int madvise(const void *, size_t, int) 1 +int mlock(const void *addr, size_t len) 1 +int munlock(const void *addr, size_t len) 1 +int mlockall(int flags) 1 +int munlockall() 1 +int mincore(void* start, size_t length, unsigned char* vec) 1 +int __ioctl:ioctl(int, int, void *) 1 +int readv(int, const struct iovec *, int) 1 +int writev(int, const struct iovec *, int) 1 +int __fcntl:fcntl(int, int, void*) 1 +int flock(int, int) 1 +int fchmod(int, mode_t) 1 +int dup(int) 1 +int pipe(int *) 1,1,-1 +int pipe2(int *, int) 1 +int dup2(int, int) 1 +int select:_newselect(int, struct fd_set *, struct fd_set *, struct fd_set *, struct timeval *) 1 +int ftruncate(int, off_t) 1 +int ftruncate64(int, off64_t) 1 +int getdents:getdents64(unsigned int, struct dirent *, unsigned int) 1 +int fsync(int) 1 +int fdatasync(int) 1 +int fchown:fchown32(int, uid_t, gid_t) 1,1,-1 +int fchown:fchown(int, uid_t, gid_t) -1,-1,1 +void sync(void) 1 +int __fcntl64:fcntl64(int, int, void *) 1 +int __fstatfs64:fstatfs64(int, size_t, struct statfs *) 1 +ssize_t sendfile(int out_fd, int in_fd, off_t *offset, size_t count) 1 +int fstatat:fstatat64(int dirfd, const char *path, struct stat *buf, int flags) 1 +int mkdirat(int dirfd, const char *pathname, mode_t mode) 1 +int fchownat(int dirfd, const char *path, uid_t owner, gid_t group, int flags) 1 +int fchmodat(int dirfd, const char *path, mode_t mode, int flags) 1 +int renameat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath) 1 +int fsetxattr(int, const char *, const void *, size_t, int) 1 +ssize_t fgetxattr(int, const char *, void *, size_t) 1 +ssize_t flistxattr(int, char *, size_t) 1 +int fremovexattr(int, const char *) 1 # file system -int link (const char*, const char*) 9 -int unlink (const char*) 10 -int unlinkat (int, const char *, int) 328,301,294 -int chdir (const char*) 12 -int mknod (const char*, mode_t, dev_t) 14 -int chmod (const char*,mode_t) 15 -int chown:chown32(const char *, uid_t, gid_t) 212,212,-1 -int chown:chown(const char *, uid_t, gid_t) -1,-1,202 -int lchown:lchown32 (const char*, uid_t, gid_t) 198,198,-1 -int lchown:lchown (const char*, uid_t, gid_t) -1,-1,16 -int mount (const char*, const char*, const char*, unsigned long, const void*) 21 +int link (const char*, const char*) 1 +int unlink (const char*) 1 +int unlinkat (int, const char *, int) 1 +int chdir (const char*) 1 +int mknod (const char*, mode_t, dev_t) 1 +int chmod (const char*,mode_t) 1 +int chown:chown32(const char *, uid_t, gid_t) 1,1,-1 +int chown:chown(const char *, uid_t, gid_t) -1,-1,1 +int lchown:lchown32 (const char*, uid_t, gid_t) 1,1,-1 +int lchown:lchown (const char*, uid_t, gid_t) -1,-1,1 +int mount (const char*, const char*, const char*, unsigned long, const void*) 1 int umount(const char*) stub -int umount2 (const char*, int) 52 -int fstat:fstat64(int, struct stat*) 197,197,215 -int stat:stat64(const char *, struct stat *) 195,195,213 -int lstat:lstat64(const char *, struct stat *) 196,196,214 -int mkdir(const char *, mode_t) 39 -int readlink(const char *, char *, size_t) 85 -int rmdir(const char *) 40 -int rename(const char *, const char *) 38 -int __getcwd:getcwd(char * buf, size_t size) 183,183,203 -int access(const char *, int) 33 -int faccessat(int, const char *, int, int) 334,307,300 -int symlink(const char *, const char *) 83 -int fchdir(int) 133 -int truncate(const char*, off_t) 92 -int setxattr(const char *, const char *, const void *, size_t, int) 226,226,224 -int lsetxattr(const char *, const char *, const void *, size_t, int) 227,227,225 -ssize_t getxattr(const char *, const char *, void *, size_t) 229,229,227 -ssize_t lgetxattr(const char *, const char *, void *, size_t) 230,230,228 -ssize_t listxattr(const char *, char *, size_t) 232,232,230 -ssize_t llistxattr(const char *, char *, size_t) 233,233,231 -int removexattr(const char *, const char *) 235,235,233 -int lremovexattr(const char *, const char *) 236,236,234 -int __statfs64:statfs64(const char *, size_t, struct statfs *) 266,268,255 -long unshare(unsigned long) 337,310,303 +int umount2 (const char*, int) 1 +int fstat:fstat64(int, struct stat*) 1 +int stat:stat64(const char *, struct stat *) 1 +int lstat:lstat64(const char *, struct stat *) 1 +int mkdir(const char *, mode_t) 1 +int readlink(const char *, char *, size_t) 1 +int rmdir(const char *) 1 +int rename(const char *, const char *) 1 +int __getcwd:getcwd(char * buf, size_t size) 1 +int access(const char *, int) 1 +int faccessat(int, const char *, int, int) 1 +int symlink(const char *, const char *) 1 +int fchdir(int) 1 +int truncate(const char*, off_t) 1 +int setxattr(const char *, const char *, const void *, size_t, int) 1 +int lsetxattr(const char *, const char *, const void *, size_t, int) 1 +ssize_t getxattr(const char *, const char *, void *, size_t) 1 +ssize_t lgetxattr(const char *, const char *, void *, size_t) 1 +ssize_t listxattr(const char *, char *, size_t) 1 +ssize_t llistxattr(const char *, char *, size_t) 1 +int removexattr(const char *, const char *) 1 +int lremovexattr(const char *, const char *) 1 +int __statfs64:statfs64(const char *, size_t, struct statfs *) 1 +long unshare(unsigned long) 1 # time -int pause () 29 -int gettimeofday(struct timeval*, struct timezone*) 78 -int settimeofday(const struct timeval*, const struct timezone*) 79 -clock_t times(struct tms *) 43 -int nanosleep(const struct timespec *, struct timespec *) 162,162,166 -int clock_gettime(clockid_t clk_id, struct timespec *tp) 263,265,263 -int clock_settime(clockid_t clk_id, const struct timespec *tp) 262,264,262 -int clock_getres(clockid_t clk_id, struct timespec *res) 264,266,264 -int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem) 265,267,265 -int getitimer(int, const struct itimerval *) 105 -int setitimer(int, const struct itimerval *, struct itimerval *) 104 -int __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) 257,259,257 -int __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 258,260,258 -int __timer_gettime:timer_gettime(timer_t, struct itimerspec*) 259,261,259 -int __timer_getoverrun:timer_getoverrun(timer_t) 260,262,260 -int __timer_delete:timer_delete(timer_t) 261,263,261 -int utimes(const char*, const struct timeval tvp[2]) 269,271,267 -int utimensat(int, const char *, const struct timespec times[2], int) 348,320,316 +int pause () 1 +int gettimeofday(struct timeval*, struct timezone*) 1 +int settimeofday(const struct timeval*, const struct timezone*) 1 +clock_t times(struct tms *) 1 +int nanosleep(const struct timespec *, struct timespec *) 1 +int clock_gettime(clockid_t clk_id, struct timespec *tp) 1 +int clock_settime(clockid_t clk_id, const struct timespec *tp) 1 +int clock_getres(clockid_t clk_id, struct timespec *res) 1 +int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *req, struct timespec *rem) 1 +int getitimer(int, const struct itimerval *) 1 +int setitimer(int, const struct itimerval *, struct itimerval *) 1 +int __timer_create:timer_create(clockid_t clockid, struct sigevent *evp, timer_t *timerid) 1 +int __timer_settime:timer_settime(timer_t, int, const struct itimerspec*, struct itimerspec*) 1 +int __timer_gettime:timer_gettime(timer_t, struct itimerspec*) 1 +int __timer_getoverrun:timer_getoverrun(timer_t) 1 +int __timer_delete:timer_delete(timer_t) 1 +int utimes(const char*, const struct timeval tvp[2]) 1 +int utimensat(int, const char *, const struct timespec times[2], int) 1 # signals -int sigaction(int, const struct sigaction *, struct sigaction *) 67 -int sigprocmask(int, const sigset_t *, sigset_t *) 126 -int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 72,72,-1 -int __sigsuspend:sigsuspend(const sigset_t *mask) -1,-1,72 -int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 174,174,194 -int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 175,175,195 -int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 177,177,197 -int sigpending(sigset_t *) 73 -int signalfd4(int fd, const sigset_t *mask, size_t sizemask, int flags) 355,327,324 +int sigaction(int, const struct sigaction *, struct sigaction *) 1 +int sigprocmask(int, const sigset_t *, sigset_t *) 1 +int __sigsuspend:sigsuspend(int unused1, int unused2, unsigned mask) 1,1,-1 +int __sigsuspend:sigsuspend(const sigset_t *mask) -1,-1,1 +int __rt_sigaction:rt_sigaction (int sig, const struct sigaction *act, struct sigaction *oact, size_t sigsetsize) 1 +int __rt_sigprocmask:rt_sigprocmask (int how, const sigset_t *set, sigset_t *oset, size_t sigsetsize) 1 +int __rt_sigtimedwait:rt_sigtimedwait(const sigset_t *set, struct siginfo_t *info, struct timespec_t *timeout, size_t sigset_size) 1 +int sigpending(sigset_t *) 1 +int signalfd4(int fd, const sigset_t *mask, size_t sizemask, int flags) 1 # sockets -int socket(int, int, int) 281,-1,183 -int socketpair(int, int, int, int*) 288,-1,184 -int bind(int, struct sockaddr *, int) 282,-1,169 -int connect(int, struct sockaddr *, socklen_t) 283,-1,170 -int listen(int, int) 284,-1,174 -int accept(int, struct sockaddr *, socklen_t *) 285,-1,168 -int getsockname(int, struct sockaddr *, socklen_t *) 286,-1,172 -int getpeername(int, struct sockaddr *, socklen_t *) 287,-1,171 -int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) 290,-1,180 -int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) 292,-1,176 -int shutdown(int, int) 293,-1,182 -int setsockopt(int, int, int, const void *, socklen_t) 294,-1,181 -int getsockopt(int, int, int, void *, socklen_t *) 295,-1,173 -int sendmsg(int, const struct msghdr *, unsigned int) 296,-1,179 -int recvmsg(int, struct msghdr *, unsigned int) 297,-1,177 +int socket(int, int, int) 1,-1,1 +int socketpair(int, int, int, int*) 1,-1,1 +int bind(int, struct sockaddr *, int) 1,-1,1 +int connect(int, struct sockaddr *, socklen_t) 1,-1,1 +int listen(int, int) 1,-1,1 +int accept(int, struct sockaddr *, socklen_t *) 1,-1,1 +int getsockname(int, struct sockaddr *, socklen_t *) 1,-1,1 +int getpeername(int, struct sockaddr *, socklen_t *) 1,-1,1 +int sendto(int, const void *, size_t, int, const struct sockaddr *, socklen_t) 1,-1,1 +int recvfrom(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) 1,-1,1 +int shutdown(int, int) 1,-1,1 +int setsockopt(int, int, int, const void *, socklen_t) 1,-1,1 +int getsockopt(int, int, int, void *, socklen_t *) 1,-1,1 +int sendmsg(int, const struct msghdr *, unsigned int) 1,-1,1 +int recvmsg(int, struct msghdr *, unsigned int) 1,-1,1 # sockets for x86. These are done as an "indexed" call to socketcall syscall. -int socket:socketcall:1 (int, int, int) -1,102,-1 -int bind:socketcall:2 (int, struct sockaddr *, int) -1,102,-1 -int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,102,-1 -int listen:socketcall:4(int, int) -1,102,-1 -int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,102,-1 -int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,102,-1 -int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,102,-1 -int socketpair:socketcall:8(int, int, int, int*) -1,102,-1 -int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,102,-1 -int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,102,-1 -int shutdown:socketcall:13(int, int) -1,102,-1 -int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,102,-1 -int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,102,-1 -int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,102,-1 -int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,102,-1 +int socket:socketcall:1 (int, int, int) -1,1,-1 +int bind:socketcall:2 (int, struct sockaddr *, int) -1,1,-1 +int connect:socketcall:3(int, struct sockaddr *, socklen_t) -1,1,-1 +int listen:socketcall:4(int, int) -1,1,-1 +int accept:socketcall:5(int, struct sockaddr *, socklen_t *) -1,1,-1 +int getsockname:socketcall:6(int, struct sockaddr *, socklen_t *) -1,1,-1 +int getpeername:socketcall:7(int, struct sockaddr *, socklen_t *) -1,1,-1 +int socketpair:socketcall:8(int, int, int, int*) -1,1,-1 +int sendto:socketcall:11(int, const void *, size_t, int, const struct sockaddr *, socklen_t) -1,1,-1 +int recvfrom:socketcall:12(int, void *, size_t, unsigned int, struct sockaddr *, socklen_t *) -1,1,-1 +int shutdown:socketcall:13(int, int) -1,1,-1 +int setsockopt:socketcall:14(int, int, int, const void *, socklen_t) -1,1,-1 +int getsockopt:socketcall:15(int, int, int, void *, socklen_t *) -1,1,-1 +int sendmsg:socketcall:16(int, const struct msghdr *, unsigned int) -1,1,-1 +int recvmsg:socketcall:17(int, struct msghdr *, unsigned int) -1,1,-1 # scheduler & real-time -int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) 156,156,160 -int sched_getscheduler(pid_t pid) 157,157,161 -int sched_yield(void) 158,158,162 -int sched_setparam(pid_t pid, const struct sched_param *param) 154,154,158 -int sched_getparam(pid_t pid, struct sched_param *param) 155,155,159 -int sched_get_priority_max(int policy) 159,159,163 -int sched_get_priority_min(int policy) 160,160,164 -int sched_rr_get_interval(pid_t pid, struct timespec *interval) 161,161,165 -int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 241,241,239 -int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) 242,242,240 -int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 345,318,312 +int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param) 1 +int sched_getscheduler(pid_t pid) 1 +int sched_yield(void) 1 +int sched_setparam(pid_t pid, const struct sched_param *param) 1 +int sched_getparam(pid_t pid, struct sched_param *param) 1 +int sched_get_priority_max(int policy) 1 +int sched_get_priority_min(int policy) 1 +int sched_rr_get_interval(pid_t pid, struct timespec *interval) 1 +int sched_setaffinity(pid_t pid, size_t setsize, const cpu_set_t* set) 1 +int __sched_getaffinity:sched_getaffinity(pid_t pid, size_t setsize, cpu_set_t* set) 1 +int __getcpu:getcpu(unsigned *cpu, unsigned *node, void *unused) 1 # io priorities -int ioprio_set(int which, int who, int ioprio) 314,289,314 -int ioprio_get(int which, int who) 315,290,315 +int ioprio_set(int which, int who, int ioprio) 1 +int ioprio_get(int which, int who) 1 # other -int uname(struct utsname *) 122 -mode_t umask(mode_t) 60 -int __reboot:reboot(int, int, int, void *) 88 -int __syslog:syslog(int, char *, int) 103 -int init_module(void *, unsigned long, const char *) 128 -int delete_module(const char*, unsigned int) 129 -int klogctl:syslog(int, char *, int) 103 -int sysinfo(struct sysinfo *) 116 -int personality(unsigned long) 136 -long perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 364,336,333 +int uname(struct utsname *) 1 +mode_t umask(mode_t) 1 +int __reboot:reboot(int, int, int, void *) 1 +int __syslog:syslog(int, char *, int) 1 +int init_module(void *, unsigned long, const char *) 1 +int delete_module(const char*, unsigned int) 1 +int klogctl:syslog(int, char *, int) 1 +int sysinfo(struct sysinfo *) 1 +int personality(unsigned long) 1 +long perf_event_open(struct perf_event_attr *attr_uptr, pid_t pid, int cpu, int group_fd, unsigned long flags) 1 # futex -int futex(void *, int, int, void *, void *, int) 240,240,238 +int futex(void *, int, int, void *, void *, int) 1 # epoll -int epoll_create(int size) 250,254,248 -int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 251,255,249 -int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout) 252,256,250 +int epoll_create(int size) 1 +int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event) 1 +int epoll_wait(int epfd, struct epoll_event *events, int max, int timeout) 1 -int inotify_init(void) 316,291,284 -int inotify_add_watch(int, const char *, unsigned int) 317,292,285 -int inotify_rm_watch(int, unsigned int) 318,293,286 +int inotify_init(void) 1 +int inotify_add_watch(int, const char *, unsigned int) 1 +int inotify_rm_watch(int, unsigned int) 1 -int poll(struct pollfd *, unsigned int, long) 168,168,188 +int poll(struct pollfd *, unsigned int, long) 1 -int eventfd:eventfd2(unsigned int, int) 356,328,325 +int eventfd:eventfd2(unsigned int, int) 1 # ARM-specific ARM_NR_BASE == 0x0f0000 == 983040 -int __set_tls:__ARM_NR_set_tls(void*) 983045,-1,-1 -int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) 983042,-1,-1 +int __set_tls:__ARM_NR_set_tls(void*) 1,-1,-1 +int cacheflush:__ARM_NR_cacheflush(long start, long end, long flags) 1,-1,-1 # MIPS-specific -int _flush_cache:cacheflush(char *addr, const int nbytes, const int op) -1,-1,147 -int syscall(int number,...) -1,-1,0 +int _flush_cache:cacheflush(char *addr, const int nbytes, const int op) -1,-1,1 +int syscall(int number,...) -1,-1,1 diff --git a/libc/tools/checksyscalls.py b/libc/tools/checksyscalls.py deleted file mode 100755 index b32567684..000000000 --- a/libc/tools/checksyscalls.py +++ /dev/null @@ -1,188 +0,0 @@ -#!/usr/bin/python -# -# this tool is used to check that the syscall numbers that are in -# SYSCALLS.TXT correspond to those found in the Linux kernel sources -# for the arm, i386 and mips architectures -# - -import sys, re, string, os, commands -from bionic_utils import * - -# change this if necessary -syscalls_txt = "SYSCALLS.TXT" - -def usage(): - print "usage: checksyscalls [options] [kernel_headers_rootdir]" - print " options: -v enable verbose mode" - sys.exit(1) - - -linux_root = None -syscalls_file = None - -def parse_command_line(args): - global linux_root, syscalls_file, verbose - - program = args[0] - args = args[1:] - while len(args) > 0 and args[0][0] == "-": - option = args[0][1:] - args = args[1:] - - if option == "v": - D_setlevel(1) - else: - usage() - - if len(args) > 2: - usage() - - if len(args) == 0: - linux_root = find_kernel_headers() - if linux_root == None: - print "Could not locate original or system kernel headers root directory." - print "Please specify one when calling this program, i.e. 'checksyscalls '" - sys.exit(1) - print "using the following kernel headers root: '%s'" % linux_root - else: - linux_root = args[0] - if not os.path.isdir(linux_root): - print "the directory '%s' does not exist. aborting\n" % headers_root - sys.exit(1) - -parse_command_line(sys.argv) - -syscalls_file = find_file_from_upwards(None, syscalls_txt) -if not syscalls_file: - print "could not locate the %s file. Aborting" % syscalls_txt - sys.exit(1) - -print "parsing %s" % syscalls_file - -# read the syscalls description file -# - -parser = SysCallsTxtParser() -parser.parse_file(syscalls_file) -syscalls = parser.syscalls - -re_nr_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_SYSCALL_BASE\+\s*(\w*)\)" ) -re_nr_clock_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_timer_create\+(\w*)\)" ) -re_arm_nr_line = re.compile( r"#define __ARM_NR_(\w*)\s*\(__ARM_NR_BASE\+\s*(\w*)\)" ) -re_x86_line = re.compile( r"#define __NR_(\w*)\s*([0-9]*)" ) -re_mips_line = re.compile( r"#define __NR_(\w*)\s*\(__NR_Linux\s*\+\s*([0-9]*)\)" ) - -# now read the Linux arm header -def process_nr_line(line,dict): - - m = re_mips_line.match(line) - if m: - if dict["Linux"]==4000: - dict[m.group(1)] = int(m.group(2)) - return - - m = re_nr_line.match(line) - if m: - dict[m.group(1)] = int(m.group(2)) - return - - m = re_nr_clock_line.match(line) - if m: - dict[m.group(1)] = int(m.group(2)) + 259 - return - - m = re_arm_nr_line.match(line) - if m: - offset_str = m.group(2) - #print "%s = %s" % (m.group(1), offset_str) - base = 10 - if offset_str.lower().startswith("0x"): - # Processing something similar to - # #define __ARM_NR_cmpxchg (__ARM_NR_BASE+0x00fff0) - base = 16 - dict["ARM_"+m.group(1)] = int(offset_str, base) + 0x0f0000 - return - - m = re_x86_line.match(line) - if m: - # try block because the ARM header has some #define _NR_XXXXX /* nothing */ - try: - #print "%s = %s" % (m.group(1), m.group(2)) - dict[m.group(1)] = int(m.group(2)) - except: - pass - return - - -def process_header(header_file,dict): - fp = open(header_file) - D("reading "+header_file) - for line in fp.xreadlines(): - line = line.strip() - if not line: continue - process_nr_line(line,dict) - fp.close() - -arm_dict = {} -x86_dict = {} -mips_dict = {} - -# remove trailing slash from the linux_root, if any -if linux_root[-1] == '/': - linux_root = linux_root[:-1] - -arm_unistd = find_arch_header(linux_root, "arm", "unistd.h") -if not arm_unistd: - print "WEIRD: Could not locate the ARM unistd.h kernel header file," - print "maybe using a different set of kernel headers might help." - sys.exit(1) - -# on recent kernels, asm-i386 and asm-x64_64 have been merged into asm-x86 -# with two distinct unistd_32.h and unistd_64.h definition files. -# take care of this here -# -x86_unistd = find_arch_header(linux_root, "i386", "unistd.h") -if not x86_unistd: - x86_unistd = find_arch_header(linux_root, "x86", "unistd_32.h") - if not x86_unistd: - print "WEIRD: Could not locate the i386/x86 unistd.h header file," - print "maybe using a different set of kernel headers might help." - sys.exit(1) - -mips_unistd = find_arch_header(linux_root, "mips", "unistd.h") -if not mips_unistd: - print "WEIRD: Could not locate the Mips unistd.h kernel header file," - print "maybe using a different set of kernel headers might help." - sys.exit(1) - -process_header( arm_unistd, arm_dict ) -process_header( x86_unistd, x86_dict ) -process_header( mips_unistd, mips_dict ) - -# now perform the comparison -errors = 0 - -def check_syscalls(archname, idname, arch_dict): - errors = 0 - for sc in syscalls: - sc_name = sc["name"] - sc_id = sc[idname] - if sc_id == -1: - sc_id = sc["common"] - if sc_id >= 0: - if not arch_dict.has_key(sc_name): - print "error: %s syscall %s not defined, should be %d" % (archname, sc_name, sc_id) - errors += 1 - elif arch_dict[sc_name] != sc_id: - print "error: %s syscall %s should be %d instead of %d" % (archname, sc_name, arch_dict[sc_name], sc_id) - errors += 1 - return errors - -errors += check_syscalls("arm", "armid", arm_dict) -errors += check_syscalls("x86", "x86id", x86_dict) -errors += check_syscalls("mips", "mipsid", mips_dict) - -if errors == 0: - print "congratulations, everything's fine !!" -else: - print "correct %d errors !!" % errors