RPM Package Manager, CVS Repository http://rpm5.org/cvs/ ____________________________________________________________________________
Server: rpm5.org Name: Jeff Johnson Root: /v/rpm/cvs Email: j...@rpm5.org Module: rpm Date: 17-Jun-2017 11:19:47 Branch: rpm-5_4 Handle: 2017061709194700 Modified files: (Branch: rpm-5_4) rpm/rpmio teio.c Log: - parse prototypes for system calls. Summary: Revision Changes Path 1.1.2.2 +860 -1 rpm/rpmio/teio.c ____________________________________________________________________________ patch -p0 <<'@@ .' Index: rpm/rpmio/teio.c ============================================================================ $ cvs diff -u -r1.1.2.1 -r1.1.2.2 teio.c --- rpm/rpmio/teio.c 15 Jun 2017 07:16:18 -0000 1.1.2.1 +++ rpm/rpmio/teio.c 17 Jun 2017 09:19:47 -0000 1.1.2.2 @@ -238,6 +238,864 @@ } /*==============================================================*/ +static const char *protos[] = { + /* __NR_read 0 */ + "ssize_t read(int fdno, void *buf, size_t count);", + /* __NR_write 1 */ + "ssize_t write(int fdno, const void *buf, size_t count);", + /* __NR_open 2 */ + "int open(const char *pathname, int flags, mode_t mode);", + /* __NR_close 3 */ + "int close(int fdno);", + /* __NR_stat 4 */ + "int stat(const char *pathname, struct stat *buf);", + /* __NR_fstat 5 */ + "int fstat(int fdno, struct stat *buf);", + /* __NR_lstat 6 */ + "int lstat(const char *pathname, struct stat *buf);", + /* __NR_poll 7 */ + /* __NR_lseek 8 */ + "off_t lseek(int fdno, off_t offset, int whence);", + /* __NR_mmap 9 */ + "void *mmap(void *addr, size_t length, int prot, int flags, int fdno, off_t offset);", + /* __NR_mprotect 10 */ + "int mprotect(void *addr, size_t len, int prot);", + /* __NR_munmap 11 */ + "int munmap(void *addr, size_t length);", + /* __NR_brk 12 */ + "int brk(void *addr);", + /* __NR_rt_sigaction 13 */ + /* __NR_rt_sigprocmask 14 */ + /* __NR_rt_sigreturn 15 */ + /* __NR_ioctl 16 */ + "int ioctl(int fd, unsigned long request, ...);", + /* __NR_pread64 17 */ + "ssize_t pread(int fdno, void *buf, size_t count, off_t offset);", + /* __NR_pwrite64 18 */ + "ssize_t pwrite(int fdno, const void *buf, size_t count, off_t offset);", + /* __NR_readv 19 */ + "ssize_t readv(int fdno, const struct iovec *iov, int iovcnt);", + /* __NR_writev 20 */ + "ssize_t writev(int fdno, const struct iovec *iov, int iovcnt);", + /* __NR_access 21 */ + "int access(const char *pathname, int mode);", + /* __NR_pipe 22 */ + "int pipe(int pipefdno[2]);", + /* __NR_select 23 */ + "int select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);", + /* __NR_sched_yield 24 */ + "int sched_yield(void);", + /* __NR_mremap 25 */ + "void *mremap(void *old_address, size_t old_size, size_t new_size, int flags, void *new_address);", + /* __NR_msync 26 */ + "int msync(void *addr, size_t length, int flags);", + /* __NR_mincore 27 */ + "int mincore(void *addr, size_t length, unsigned char *vec);", + /* __NR_madvise 28 */ + "int madvise(void *addr, size_t length, int advice);", + /* __NR_shmget 29 */ + "int shmget(key_t key, size_t size, int shmflg);", + /* __NR_shmat 30 */ + "void *shmat(int shmid, const void *shmaddr, int shmflg);", + /* __NR_shmctl 31 */ + "int shmctl(int shmid, int cmd, struct shmid_ds *buf);", + /* __NR_dup 32 */ + "int dup(int oldfd);", + /* __NR_dup2 33 */ + "int dup2(int oldfdno, int newfdno);", + /* __NR_pause 34 */ + "int pause(void);", + /* __NR_nanosleep 35 */ + "int nanosleep(const struct timespec *req, struct timespec *rem);", + /* __NR_getitimer 36 */ + "int getitimer(int which, struct itimerval *value);", + /* __NR_alarm 37 */ + "unsigned int alarm(unsigned int seconds);", + /* __NR_setitimer 38 */ + "int setitimer(int which, const struct itimerval *restrict value, struct itimerval *restrict ovalue);", + /* __NR_getpid 39 */ + "pid_t getpid(void);", + /* __NR_sendfile 40 */ + "ssize_t sendfile(int out_fdno, int in_fdno, off_t *offset, size_t count);", + /* __NR_socket 41 */ + "int socket(int domain, int type, int protocol);", + /* __NR_connect 42 */ + "int connect(int sockfd, const struct sockaddr *addr, socklen_t addrlen);", + /* __NR_accept 43 */ + "int accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen);", + /* __NR_sendto 44 */ + "ssize_t sendto(int sockfd, const void *buf, size_t len, int flags, const struct sockaddr *dest_addr, socklen_t addrlen);", + /* __NR_recvfrom 45 */ + "ssize_t recvfrom(int sockfd, void *buf, size_t len, int flags, struct sockaddr *src_addr, socklen_t *addrlen);", + /* __NR_sendmsg 46 */ + "ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags);", + /* __NR_recvmsg 47 */ + "ssize_t recvmsg(int sockfd, struct msghdr *msg, int flags);", + /* __NR_shutdown 48 */ + "int shutdown(int sockfd, int how);", + /* __NR_bind 49 */ + "int bind(int sockfd, const struct sockaddr *addr, socklen_t addrlen);", + /* __NR_listen 50 */ + "int listen(int sockfd, int backlog);", + /* __NR_getsockname 51 */ + "int getsockname(int sockfd, struct sockaddr *addr, socklen_t *addrlen);", + /* __NR_getpeername 52 */ + "int getpeername(int sockfd, struct sockaddr *addr, socklen_t *addrlen);", + /* __NR_socketpair 53 */ + "int socketpair(int domain, int type, int protocol, int sv[2]);", + /* __NR_setsockopt 54 */ + "int setsockopt(int sockfd, int level, int optname, const void *optval, socklen_t optlen);", + /* __NR_getsockopt 55 */ + "int getsockopt(int sockfd, int level, int optname, void *optval, socklen_t *optlen);", + /* __NR_clone 56 */ + "long clone(unsigned long flags, void *child_stack, void *ptid, void *ctid, struct pt_regs *regs);", + /* __NR_fork 57 */ + "pid_t fork(void);", + /* __NR_vfork 58 */ + "pid_t vfork(void);", + /* __NR_execve 59 */ + "int execve(const char *filename, char *const argv[], char *const envp[]);", + /* __NR_exit 60 */ + "void _exit(int status);", + /* __NR_wait4 61 */ + "pid_t wait4(pid_t pid, int *wstatus, int options, struct rusage *rusage);", + /* __NR_kill 62 */ + "int kill(pid_t pid, int sig);", + /* __NR_uname 63 */ + "int uname(struct utsname *buf);", + /* __NR_semget 64 */ + "int semget(key_t key, int nsems, int semflg);", + /* __NR_semop 65 */ + "int semop(int semid, struct sembuf *sops, size_t nsops);", + /* __NR_semctl 66 */ + "int semctl(int semid, int semnum, int cmd, ...);", + /* __NR_shmdt 67 */ + "void *shmat(int shmid, const void *shmaddr, int shmflg);", + /* __NR_msgget 68 */ + "int msgget(key_t key, int msgflg);", + /* __NR_msgsnd 69 */ + "int msgsnd(int msqid, const void *msgp, size_t msgsz, int msgflg);", + /* __NR_msgrcv 70 */ + "ssize_t msgrcv(int msqid, void *msgp, size_t msgsz, long msgtyp, int msgflg);", + /* __NR_msgctl 71 */ + "int msgctl(int msqid, int cmd, struct msqid_ds *buf);", + /* __NR_fcntl 72 */ + "int fcntl(int fdno, int cmd, ... );", + /* __NR_flock 73 */ + "int flock(int fdno, int operation);", + /* __NR_fsync 74 */ + "int fsync(int fdno);", + /* __NR_fdatasync 75 */ + "int fdatasync(int fdno);", + /* __NR_truncate 76 */ + "int truncate(const char *path, off_t length);", + /* __NR_ftruncate 77 */ + "int ftruncate(int fdno, off_t length);", + /* __NR_getdents 78 */ + "int getdents(unsigned int fdno, struct linux_dirent *dirp, unsigned int count);", + /* __NR_getcwd 79 */ + "char *getcwd(char *buf, size_t size);", + /* __NR_chdir 80 */ + "int chdir(const char *path);", + /* __NR_fchdir 81 */ + "int fchdir(int fd);", + /* __NR_rename 82 */ + "int rename(const char *oldpath, const char *newpath);", + /* __NR_mkdir 83 */ + "int mkdir(const char *pathname, mode_t mode);", + /* __NR_rmdir 84 */ + "int rmdir(const char *pathname);", + /* __NR_creat 85 */ + "int creat(const char *pathname, mode_t mode);", + /* __NR_link 86 */ + "int link(const char *oldpath, const char *newpath);", + /* __NR_unlink 87 */ + "int unlink(const char *pathname);", + /* __NR_symlink 88 */ + "int symlink(const char *target, const char *linkpath);", + /* __NR_readlink 89 */ + "ssize_t readlink(const char *pathname, char *buf, size_t bufsiz);", + /* __NR_chmod 90 */ + "int chmod(const char *pathname, mode_t mode);", + /* __NR_fchmod 91 */ + "int fchmod(int fdno, mode_t mode);", + /* __NR_chown 92 */ + "int chown(const char *pathname, uid_t owner, gid_t group);", + /* __NR_fchown 93 */ + "int fchown(int fdno, uid_t owner, gid_t group);", + /* __NR_lchown 94 */ + "int lchown(const char *pathname, uid_t owner, gid_t group);", + /* __NR_umask 95 */ + "mode_t umask(mode_t mask);", + /* __NR_gettimeofday 96 */ + "int gettimeofday(struct timeval *tv, struct timezone *tz);", + /* __NR_getrlimit 97 */ + "int getrlimit(int resource, struct rlimit *rlim);", + /* __NR_getrusage 98 */ + "int getrusage(int who, struct rusage *usage);", + /* __NR_sysinfo 99 */ + /* __NR_times 100 */ + "clock_t times(struct tms *buf);", + /* __NR_ptrace 101 */ + "long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data);", + /* __NR_getuid 102 */ + "uid_t getuid(void);", + /* __NR_syslog 103 */ + "int syslog(int type, char *bufp, int len);", + /* __NR_getgid 104 */ + "gid_t getgid(void);", + /* __NR_setuid 105 */ + "int setuid(uid_t uid);", + /* __NR_setgid 106 */ + "int setgid(gid_t gid);", + /* __NR_geteuid 107 */ + "uid_t geteuid(void);", + /* __NR_getegid 108 */ + "gid_t getegid(void);", + /* __NR_setpgid 109 */ + "int setpgid(pid_t pid, pid_t pgid);", + /* __NR_getppid 110 */ + "pid_t getppid(void);", + /* __NR_getpgrp 111 */ + "pid_t getpgrp(void);", + /* __NR_setsid 112 */ + "pid_t setsid(void);", + /* __NR_setreuid 113 */ + "int setreuid(uid_t ruid, uid_t euid);", + /* __NR_setregid 114 */ + "int setregid(gid_t rgid, gid_t egid);", + /* __NR_getgroups 115 */ + "int getgroups(int size, gid_t list[]);", + /* __NR_setgroups 116 */ + "int setgroups(size_t size, const gid_t *list);", + /* __NR_setresuid 117 */ + "int setresuid(uid_t ruid, uid_t euid, uid_t suid);", + /* __NR_getresuid 118 */ + "int getresuid(uid_t *ruid, uid_t *euid, uid_t *suid);", + /* __NR_setresgid 119 */ + "int setresgid(gid_t rgid, gid_t egid, gid_t sgid);", + /* __NR_getresgid 120 */ + "int getresgid(gid_t *rgid, gid_t *egid, gid_t *sgid);", + /* __NR_getpgid 121 */ + "pid_t getpgid(pid_t pid);", + /* __NR_setfsuid 122 */ + "int setfsuid(uid_t fsuid);", + /* __NR_setfsgid 123 */ + "int setfsgid(uid_t fsgid);", + /* __NR_getsid 124 */ + "pid_t getsid(pid_t pid);", + /* __NR_capget 125 */ + "int capget(cap_user_header_t hdrp, cap_user_data_t datap);", + /* __NR_capset 126 */ + "int capset(cap_user_header_t hdrp, const cap_user_data_t datap);", + /* __NR_rt_sigpending 127 */ + /* __NR_rt_sigtimedwait 128 */ + /* __NR_rt_sigqueueinfo 129 */ + /* __NR_rt_sigsuspend 130 */ + /* __NR_sigaltstack 131 */ + " int sigaltstack(const stack_t *ss, stack_t *oss);", + /* __NR_utime 132 */ + "int utime(const char *filename, const struct utimbuf *times);", + /* __NR_mknod 133 */ + "int mknod(const char *pathname, mode_t mode, dev_t dev);", + /* __NR_uselib 134 */ + "int uselib(const char *library);", + /* __NR_personality 135 */ + "int personality(unsigned long persona);", + /* __NR_ustat 136 */ + "int ustat(dev_t dev, struct ustat *ubuf);", + /* __NR_statfs 137 */ + "int statfs(const char *path, struct statfs *buf);", + /* __NR_fstatfs 138 */ + "int fstatfs(int fdno, struct statfs *buf);", + /* __NR_sysfs 139 */ + "int sysfs(int option, unsigned int fs_index, char *buf);", + /* __NR_getpriority 140 */ + "int getpriority(int which, id_t who);", + /* __NR_setpriority 141 */ + "int setpriority(int which, id_t who, int prio);", + /* __NR_sched_setparam 142 */ + "int sched_setparam(pid_t pid, const struct sched_param *param);", + /* __NR_sched_getparam 143 */ + "int sched_getparam(pid_t pid, struct sched_param *param);", + /* __NR_sched_setscheduler 144 */ + "int sched_setscheduler(pid_t pid, int policy, const struct sched_param *param);", + /* __NR_sched_getscheduler 145 */ + "int sched_getscheduler(pid_t pid);", + /* __NR_sched_get_priority_max 146 */ + "int sched_get_priority_max(int policy);", + /* __NR_sched_get_priority_min 147 */ + "int sched_get_priority_min(int policy);", + /* __NR_sched_rr_get_interval 148 */ + "int sched_rr_get_interval(pid_t pid, struct timespec * tp);", + /* __NR_mlock 149 */ + "int mlock(const void *addr, size_t len);", + /* __NR_munlock 150 */ + "int munlock(const void *addr, size_t len);", + /* __NR_mlockall 151 */ + "int mlockall(int flags);", + /* __NR_munlockall 152 */ + "int munlockall(void);", + /* __NR_vhangup 153 */ + "int vhangup(void);", + /* __NR_modify_ldt 154 */ + "int modify_ldt(int func, void *ptr, unsigned long bytecount);", + /* __NR_pivot_root 155 */ + "int pivot_root(const char *new_root, const char *put_old);", + /* __NR__sysctl 156 */ + "int _sysctl(struct __sysctl_args *args);", + /* __NR_prctl 157 */ + "int prctl(int option, unsigned long arg2, unsigned long arg3, unsigned long arg4, unsigned long arg5);", + /* __NR_arch_prctl 158 */ + "int arch_prctl(int code, unsigned long *addr);", + /* __NR_adjtimex 159 */ + "int adjtimex(struct timex *buf);", + /* __NR_setrlimit 160 */ + "int setrlimit(int resource, const struct rlimit *rlim);", + /* __NR_chroot 161 */ + "int chroot(const char *path);", + /* __NR_sync 162 */ + "void sync(void);", + /* __NR_acct 163 */ + "int acct(const char *filename);", + /* __NR_settimeofday 164 */ + "int settimeofday(const struct timeval *tv, const struct timezone *tz);", + /* __NR_mount 165 */ + "int mount(const char *source, const char *target, const char *filesystemtype, unsigned long mountflags, const void *data);", + /* __NR_umount2 166 */ + "int umount2(const char *target, int flags);", + /* __NR_swapon 167 */ + "int swapon(const char *path, int swapflags);", + /* __NR_swapoff 168 */ + "int swapoff(const char *path);", + /* __NR_reboot 169 */ + "int reboot(int magic, int magic2, int cmd, void *arg);", + /* __NR_sethostname 170 */ + "int sethostname(const char *name, size_t len);", + /* __NR_setdomainname 171 */ + "int setdomainname(const char *name, size_t len);", + /* __NR_iopl 172 */ + "int iopl(int level);", + /* __NR_ioperm 173 */ + "int ioperm(unsigned long from, unsigned long num, int turn_on);", + /* __NR_create_module 174 */ + "caddr_t create_module(const char *name, size_t size);", + /* __NR_init_module 175 */ + "int init_module(void *module_image, unsigned long len, const char *param_values);", + /* __NR_delete_module 176 */ + "int delete_module(const char *name, int flags);", + /* __NR_get_kernel_syms 177 */ + "int get_kernel_syms(struct kernel_sym *table);", + /* __NR_query_module 178 */ + "int query_module(const char *name, int which, void *buf, size_t bufsize, size_t *ret);", + /* __NR_quotactl 179 */ + "int quotactl(int cmd, const char *special, int id, caddr_t addr);", + /* __NR_nfsservctl 180 */ + "long nfsservctl(int cmd, struct nfsctl_arg *argp, union nfsctl_res *resp);", + /* __NR_getpmsg 181 */ + /* __NR_putpmsg 182 */ + /* __NR_afs_syscall 183 */ + /* __NR_tuxcall 184 */ + /* __NR_security 185 */ + /* __NR_gettid 186 */ + "pid_t gettid(void);", + /* __NR_readahead 187 */ + "ssize_t readahead(int fdno, off64_t offset, size_t count);", + /* __NR_setxattr 188 */ + "int setxattr(const char *path, const char *name, const void *value, size_t size, int flags);", + /* __NR_lsetxattr 189 */ + "int lsetxattr(const char *path, const char *name, const void *value, size_t size, int flags);", + /* __NR_fsetxattr 190 */ + "int fsetxattr(int fdno, const char *name, const void *value, size_t size, int flags);", + /* __NR_getxattr 191 */ + "ssize_t getxattr(const char *path, const char *name, void *value, size_t size);", + /* __NR_lgetxattr 192 */ + "ssize_t lgetxattr(const char *path, const char *name, void *value, size_t size);", + /* __NR_fgetxattr 193 */ + "ssize_t fgetxattr(int fdno, const char *name, void *value, size_t size);", + /* __NR_listxattr 194 */ + "ssize_t listxattr(const char *path, char *list, size_t size);", + /* __NR_llistxattr 195 */ + "ssize_t llistxattr(const char *path, char *list, size_t size);", + /* __NR_flistxattr 196 */ + "ssize_t flistxattr(int fdno, char *list, size_t size);", + /* __NR_removexattr 197 */ + "int removexattr(const char *path, const char *name);", + /* __NR_lremovexattr 198 */ + "int lremovexattr(const char *path, const char *name);", + /* __NR_fremovexattr 199 */ + "int fremovexattr(int fdno, const char *name);", + /* __NR_tkill 200 */ + "int tkill(int tid, int sig);", + /* __NR_time 201 */ + "time_t time(time_t *tloc);", + /* __NR_futex 202 */ + "int futex(int *uaddr, int futex_op, int val, const struct timespec *timeout, /* or: uint32_t val2 */ int *uaddr2, int val3);", + /* __NR_sched_setaffinity 203 */ + "int sched_setaffinity(pid_t pid, size_t cpusetsize, const cpu_set_t *mask);", + /* __NR_sched_getaffinity 204 */ + "int sched_getaffinity(pid_t pid, size_t cpusetsize, cpu_set_t *mask);", + /* __NR_set_thread_area 205 */ + "int set_thread_area(struct user_desc *u_info);", + /* __NR_io_setup 206 */ + "int io_setup(unsigned nr_events, aio_context_t *ctx_idp);", + /* __NR_io_destroy 207 */ + "int io_destroy(aio_context_t ctx_id);", + /* __NR_io_getevents 208 */ + "int io_getevents(aio_context_t ctx_id, long min_nr, long nr, struct io_event *events, struct timespec *timeout);", + /* __NR_io_submit 209 */ + "int io_submit(aio_context_t ctx_id, long nr, struct iocb **iocbpp);", + /* __NR_io_cancel 210 */ + "int io_cancel(aio_context_t ctx_id, struct iocb *iocb, struct io_event *result);", + /* __NR_get_thread_area 211 */ + "int get_thread_area(struct user_desc *u_info);", + /* __NR_lookup_dcookie 212 */ + "int lookup_dcookie(u64 cookie, char *buffer, size_t len);", + /* __NR_epoll_create 213 */ + "int epoll_create(int size);", + /* __NR_epoll_ctl_old 214 */ + /* __NR_epoll_wait_old 215 */ + /* __NR_remap_file_pages 216 */ + "int remap_file_pages(void *addr, size_t size, int prot, size_t pgoff, int flags);", + /* __NR_getdents64 217 */ + "int getdents64(unsigned int fdno, struct linux_dirent64 *dirp, unsigned int count);", + /* __NR_set_tid_address 218 */ + "long set_tid_address(int *tidptr);", + /* __NR_restart_syscall 219 */ + "int restart_syscall(void);", + /* __NR_semtimedop 220 */ + "int semtimedop(int semid, struct sembuf *sops, size_t nsops, const struct timespec *timeout);", + /* __NR_fadvise64 221 */ + /* __NR_timer_create 222 */ + "int timer_create(clockid_t clockid, struct sigevent *sevp, timer_t *timerid);", + /* __NR_timer_settime 223 */ + "int timer_settime(timer_t timerid, int flags, const struct itimerspec *new_value, struct itimerspec *old_value);", + /* __NR_timer_gettime 224 */ + "int timer_gettime(timer_t timerid, struct itimerspec *curr_value);", + /* __NR_timer_getoverrun 225 */ + "int timer_getoverrun(timer_t timerid);", + /* __NR_timer_delete 226 */ + "int timer_delete(timer_t timerid);", + /* __NR_clock_settime 227 */ + "int clock_settime(clockid_t clk_id, const struct timespec *tp);", + /* __NR_clock_gettime 228 */ + "int clock_gettime(clockid_t clk_id, struct timespec *tp);", + /* __NR_clock_getres 229 */ + "int clock_getres(clockid_t clk_id, struct timespec *res);", + /* __NR_clock_nanosleep 230 */ + "int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *request, struct timespec *remain);", + /* __NR_exit_group 231 */ + "void exit_group(int status);", + /* __NR_epoll_wait 232 */ + "int epoll_wait(int epfd, struct epoll_event *events, int maxevents, int timeout);", + /* __NR_epoll_ctl 233 */ + "int epoll_ctl(int epfd, int op, int fd, struct epoll_event *event);", + /* __NR_tgkill 234 */ + "int tgkill(int tgid, int tid, int sig);", + /* __NR_utimes 235 */ + "int utimes(const char *filename, const struct timeval times[2]);", + /* __NR_vserver 236 */ + /* __NR_mbind 237 */ + "long mbind(void *addr, unsigned long len, int mode, const unsigned long *nodemask, unsigned long maxnode, unsigned flags);", + /* __NR_set_mempolicy 238 */ + "long set_mempolicy(int mode, const unsigned long *nodemask, unsigned long maxnode);", + /* __NR_get_mempolicy 239 */ + "int get_mempolicy(int *mode, unsigned long *nodemask, unsigned long maxnode, unsigned long addr, unsigned long flags);", + /* __NR_mq_open 240 */ + "mqd_t mq_open(const char *name, int oflag, mode_t mode, struct mq_attr *attr);", + /* __NR_mq_unlink 241 */ + "int mq_unlink(const char *name);", + /* __NR_mq_timedsend 242 */ + "int mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned int msg_prio, const struct timespec *abs_timeout);", + /* __NR_mq_timedreceive 243 */ + "ssize_t mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned int *msg_prio, const struct timespec *abs_timeout);", + /* __NR_mq_notify 244 */ + "int mq_notify(mqd_t mqdes, const struct sigevent *sevp);", + /* __NR_mq_getsetattr 245 */ + "int mq_getsetattr(mqd_t mqdes, struct mq_attr *newattr, struct mq_attr *oldattr);", + /* __NR_kexec_load 246 */ + "long kexec_load(unsigned long entry, unsigned long nr_segments, struct kexec_segment *segments, unsigned long flags);", + /* __NR_waitid 247 */ + /* __NR_add_key 248 */ + "key_serial_t add_key(const char *type, const char *description, const void *payload, size_t plen, key_serial_t keyring);", + /* __NR_request_key 249 */ + "key_serial_t request_key(const char *type, const char *description, const char *callout_info, key_serial_t keyring);", + /* __NR_keyctl 250 */ + "long keyctl(int cmd, ...);", + /* __NR_ioprio_set 251 */ + "int ioprio_set(int which, int who, int ioprio);", + /* __NR_ioprio_get 252 */ + "int ioprio_get(int which, int who);", + /* __NR_inotify_init 253 */ + "int inotify_init(void);", + /* __NR_inotify_add_watch 254 */ + "int inotify_add_watch(int fdno, const char *pathname, uint32_t mask);", + /* __NR_inotify_rm_watch 255 */ + "int inotify_rm_watch(int fdno, int wd);", + /* __NR_migrate_pages 256 */ + "long migrate_pages(int pid, unsigned long maxnode, const unsigned long *old_nodes, const unsigned long *new_nodes);", + /* __NR_openat 257 */ + "int openat(int dirfdno, const char *pathname, int flags, mode_t mode);", + /* __NR_mkdirat 258 */ + "int mkdirat(int dirfdno, const char *pathname, mode_t mode);", + /* __NR_mknodat 259 */ + "int mknodat(int dirfdno, const char *pathname, mode_t mode, dev_t dev);", + /* __NR_fchownat 260 */ + "int fchownat(int dirfdno, const char *pathname, uid_t owner, gid_t group, int flags);", + /* __NR_futimesat 261 */ + "int futimesat(int dirfdno, const char *pathname, const struct timeval times[2]);", + /* __NR_newfstatat 262 */ + "int fstatat(int dirfdno, const char *pathname, struct stat *buf, int flags);", + /* __NR_unlinkat 263 */ + "int unlinkat(int dirfdno, const char *pathname, int flags);", + /* __NR_renameat 264 */ + "int renameat(int olddirfdno, const char *oldpath, int newdirfdno, const char *newpath);", + /* __NR_linkat 265 */ + "int linkat(int olddirfdno, const char *oldpath, int newdirfdno, const char *newpath, int flags);", + /* __NR_symlinkat 266 */ + "int symlinkat(const char *target, int newdirfdno, const char *linkpath);", + /* __NR_readlinkat 267 */ + "ssize_t readlinkat(int dirfdno, const char *pathname, char *buf, size_t bufsiz);", + /* __NR_fchmodat 268 */ + "int fchmodat(int dirfdno, const char *pathname, mode_t mode, int flags);", + /* __NR_faccessat 269 */ + "int faccessat(int dirfdno, const char *pathname, int mode, int flags);", + /* __NR_pselect6 270 */ + /* __NR_ppoll 271 */ + "int ppoll(struct pollfd *fds, nfds_t nfds, const struct timespec *tmo_p, const sigset_t *sigmask);", + /* __NR_unshare 272 */ + "int unshare(int flags);", + /* __NR_set_robust_list 273 */ + "long set_robust_list(struct robust_list_head *head, size_t len);", + /* __NR_get_robust_list 274 */ + "long get_robust_list(int pid, struct robust_list_head **head_ptr, size_t *len_ptr);", + /* __NR_splice 275 */ + "ssize_t splice(int in_fdno, loff_t *in_off, int out_fdno, loff_t *out_off, size_t len, unsigned int flags);", + /* __NR_tee 276 */ + "ssize_t tee(int in_fdno, int out_fdno, size_t len, unsigned int flags);", + /* __NR_sync_file_range 277 */ + "int sync_file_range(int fdno, off64_t offset, off64_t nbytes, unsigned int flags);", + /* __NR_vmsplice 278 */ + "ssize_t vmsplice(int fdno, const struct iovec *iov, unsigned long nr_segs, unsigned int flags);", + /* __NR_move_pages 279 */ + "long move_pages(int pid, unsigned long count, void **pages, const int *nodes, int *status, int flags);", + /* __NR_utimensat 280 */ + "int utimensat(int dirfdno, const char *pathname, const struct timespec times[2], int flags);", + /* __NR_epoll_pwait 281 */ + "int epoll_pwait(int epfd, struct epoll_event *events, int maxevents, int timeout, const sigset_t *sigmask);", + /* __NR_signalfd 282 */ + "int signalfd(int fd, const sigset_t *mask, int flags);", + /* __NR_timerfd_create 283 */ + "int timerfd_create(int clockid, int flags);", + /* __NR_eventfd 284 */ + "int eventfd(unsigned int initval, int flags);", + /* __NR_fallocate 285 */ + "int fallocate(int fdno, int mode, off_t offset, off_t len);", + /* __NR_timerfd_settime 286 */ + "int timerfd_create(int clockid, int flags);", + /* __NR_timerfd_gettime 287 */ + "int timerfd_gettime(int fd, struct itimerspec *curr_value);", + /* __NR_accept4 288 */ + "int accept4(int sockfd, struct sockaddr *addr, socklen_t *addrlen, int flags);", + /* __NR_signalfd4 289 */ + /* __NR_eventfd2 290 */ + "int eventfd(unsigned int initval, int flags);", + /* __NR_epoll_create1 291 */ + "int epoll_create1(int flags);", + /* __NR_dup3 292 */ + "int dup3(int oldfdno, int newfdno, int flags);", + /* __NR_pipe2 293 */ + "int pipe2(int pipefd[2], int flags);", + /* __NR_inotify_init1 294 */ + "int inotify_init1(int flags);", + /* __NR_preadv 295 */ + "ssize_t preadv(int fdno, const struct iovec *iov, int iovcnt, off_t offset);", + /* __NR_pwritev 296 */ + "ssize_t pwritev(int fdno, const struct iovec *iov, int iovcnt, off_t offset);", + /* __NR_rt_tgsigqueueinfo 297 */ + /* __NR_perf_event_open 298 */ + "int perf_event_open(struct perf_event_attr *attr, pid_t pid, int cpu, int group_fd, unsigned long flags);", + /* __NR_recvmmsg 299 */ + "int recvmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags, struct timespec *timeout);", + /* __NR_fanotify_init 300 */ + "int fanotify_init(unsigned int flags, unsigned int event_f_flags);", + /* __NR_fanotify_mark 301 */ + "int fanotify_mark(int fanotify_fdno, unsigned int flags, uint64_t mask, int dirfdno, const char *pathname);", + /* __NR_prlimit64 302 */ + "int prlimit(pid_t pid, int resource, const struct rlimit *new_limit, struct rlimit *old_limit);", + /* __NR_name_to_handle_at 303 */ + "int name_to_handle_at(int dirfd, const char *pathname, struct file_handle *handle, int *mount_id, int flags);", + /* __NR_open_by_handle_at 304 */ + "int open_by_handle_at(int mount_fd, struct file_handle *handle, int flags);", + /* __NR_clock_adjtime 305 */ + /* __NR_syncfs 306 */ + "int syncfs(int fdno);", + /* __NR_sendmmsg 307 */ + "int sendmmsg(int sockfd, struct mmsghdr *msgvec, unsigned int vlen, unsigned int flags);", + /* __NR_setns 308 */ + "int setns(int fd, int nstype);", + /* __NR_getcpu 309 */ + "int getcpu(unsigned *cpu, unsigned *node, struct getcpu_cache *tcache);", + /* __NR_process_vm_readv 310 */ + "ssize_t process_vm_readv(pid_t pid, const struct iovec *local_iov, unsigned long liovcnt, const struct iovec *remote_iov, unsigned long riovcnt, unsigned long flags);", + /* __NR_process_vm_writev 311 */ + "ssize_t process_vm_writev(pid_t pid, const struct iovec *local_iov, unsigned long liovcnt, const struct iovec *remote_iov, unsigned long riovcnt, unsigned long flags);", + /* __NR_kcmp 312 */ + "int kcmp(pid_t pid1, pid_t pid2, int type, unsigned long idx1, unsigned long idx2);", + /* __NR_finit_module 313 */ + "int finit_module(int fd, const char *param_values, int flags);", + /* __NR_sched_setattr 314 */ + "int sched_setattr(pid_t pid, struct sched_attr *attr, unsigned int flags);", + /* __NR_sched_getattr 315 */ + "int sched_getattr(pid_t pid, struct sched_attr *attr, unsigned int size, unsigned int flags);", + /* __NR_renameat2 316 */ + "int renameat2(int olddirfdno, const char *oldpath, int newdirfdno, const char *newpath, unsigned int flags);", + /* __NR_seccomp 317 */ + "int seccomp(unsigned int operation, unsigned int flags, void *args);", + /* __NR_getrandom 318 */ + "int getrandom(void *buf, size_t buflen, unsigned int flags);", + /* __NR_memfd_create 319 */ + "int memfd_create(const char *name, unsigned int flags);", + /* __NR_kexec_file_load 320 */ + "long kexec_file_load(int kernel_fd, int initrd_fd, unsigned long cmdline_len, const char *cmdline, unsigned long flags);", + /* __NR_bpf 321 */ + "int bpf(int cmd, union bpf_attr *attr, unsigned int size);", + /* __NR_execveat 322 */ + "int execveat(int dirfd, const char *pathname, char *const argv[], char *const envp[], int flags);", + /* __NR_userfaultfd 323 */ + "int userfaultfd(int flags);", + /* __NR_membarrier 324 */ + "int membarrier(int cmd, int flags);", + /* __NR_mlock2 325 */ + "int mlock2(const void *addr, size_t len, int flags);", + /* __NR_copy_file_range 326 */ + "ssize_t copy_file_range(int in_fdno, loff_t *in_off, int out_fdno, loff_t *out_off, size_t len, unsigned int flags);", + /* __NR_preadv2 327 */ + "ssize_t preadv2(int fdno, const struct iovec *iov, int iovcnt, off_t offset, int flags);", + /* __NR_pwritev2 328 */ + "ssize_t pwritev2(int fdno, const struct iovec *iov, int iovcnt, off_t offset, int flags);", + /* __NR_pkey_mprotect 329 */ + "int pkey_mprotect(void *start, size_t len, int prot, int pkey);", + /* __NR_pkey_alloc 330 */ + "int pkey_alloc(unsigned long flags, unsigned long initial_rights);", + /* __NR_pkey_free 331 */ + "int pkey_free(int key);", + /* __NR_statx 332 */ + + "void * eio_execute(void *feed);", + "eio_wd eio_wd_open(const char *path);", + "int eio_wd_close(eio_wd wd);", + "int eio_mtouch(void *addr, size_t length, int flags);", + "int eio_group(void);", + "int eio_nop(void);", + "int eio_busy(double delay);", + "char * eio_readdir(const char *path, int flags);", + + "char * realpath(const char *path, char *resolved_path);", + + "int futimes(int fdno, const struct timeval tv[2]);", + "int lutimes(const char *filename, const struct timeval tv[2]);", + + "int statvfs(const char *path, struct statvfs *buf);", + "int fstatvfs(int fdno, struct statvfs *buf);", + + NULL +}; + +typedef struct rpmwrap_s * rpmwrap; +struct rpmwrap_s { + char * proto; + char * arglist; + char * subtype; + char * subname; + ARGV_t items; + ARGV_t argtypes; + ARGV_t argnames; + unsigned nints; + unsigned nptrs; + unsigned noffs; + unsigned nsizes; + unsigned ndoubles; + unsigned nlongs; + unsigned nlonglongs; + unsigned nother; +}; +struct rpmwrap_s _wrap; + +static void wrapFree(rpmwrap wrap) +{ + if (wrap) { + wrap->proto = _free(wrap->proto); + wrap->arglist = _free(wrap->arglist); + wrap->subtype = _free(wrap->subtype); + wrap->subname = _free(wrap->subname); + wrap->items = argvFree(wrap->items); + wrap->argtypes = argvFree(wrap->argtypes); + wrap->argnames = argvFree(wrap->argnames); + memset(wrap, 0, sizeof(*wrap)); + } +} + +static void wrapDump(const char * msg, rpmwrap wrap, FILE * fp) +{ + if (fp == NULL) fp = stderr; + if (msg) fprintf(fp, "========================== %s(%p)\n", msg, wrap); + if (wrap) { +#define PRINT(_fmt, _foo) \ + { fprintf(fp, "%25s: |%"#_fmt"|\n", #_foo, wrap->_foo); } + PRINT(s, proto); + PRINT(s, subtype); + PRINT(s, subname); + PRINT(s, arglist); + if (wrap->items) argvPrint("items", wrap->items, NULL); + if (wrap->argtypes) argvPrint("argtypes", wrap->argtypes, NULL); + if (wrap->argnames) argvPrint("argnames", wrap->argnames, NULL); +fprintf(fp, "*** nints:%u nptrs:%u noffs:%u nsizes:%u ndoubles:%u nlongs:%u nlonglongs:%u nother:%u\n", wrap->nints, wrap->nptrs, wrap->noffs, wrap->nsizes, wrap->ndoubles, wrap->nlongs, wrap->nlonglongs, wrap->nother); +#undef PRINT + } +} + +static void wrapAnalyze(rpmwrap wrap) +{ + for (int i = 0; wrap->argtypes[i]; i++) { + const char * argtype = wrap->argtypes[i]; + const char * argname = wrap->argnames[i]; + + if (!strcmp(argtype, "void") + || !strcmp(argtype, "...")) + /* do nothing */; + else if (strchr(argtype, '*') + || strstr(argtype, "caddr_t") + || strstr(argtype, "timer_t") + || !strcmp(argtype, "eio_wd") + || strstr(argtype, "cap_user_data_t") + || strstr(argtype, "cap_user_header_t")) + wrap->nptrs++; + else if (!strcmp(argtype, "int") && strstr(argname, "[2]")) + wrap->nints += 2; + else if (!strcmp(argtype, "int") + || !strcmp(argtype, "unsigned") + || !strcmp(argtype, "unsigned int") + || !strcmp(argtype, "uint32_t") + || !strcmp(argtype, "uid_t") + || !strcmp(argtype, "gid_t") + || !strcmp(argtype, "pid_t") + || !strcmp(argtype, "id_t") + || !strcmp(argtype, "mode_t") + || !strcmp(argtype, "mqd_t") + || !strcmp(argtype, "key_serial_t") + || !strcmp(argtype, "key_t") + || !strcmp(argtype, "dev_t") + || !strcmp(argtype, "socklen_t") + || !strcmp(argtype, "clockid_t") + || strstr(argtype, "enum ")) + wrap->nints++; + else if (!strcmp(argtype, "off_t")) + wrap->noffs++; + else if (!strcmp(argtype, "size_t")) + wrap->nsizes++; + else if (!strcmp(argtype, "double")) + wrap->ndoubles++; + else if ((strstr(argtype, "struct timeval") && strstr(argname, "[2]")) + || (strstr(argtype, "struct timespec") && strstr(argname, "[2]"))) + wrap->ndoubles += 2; + else if (!strcmp(argtype, "struct timeval") + || !strcmp(argtype, "struct timespec")) + wrap->ndoubles += 1; + else if (!strcmp(argtype, "long") + || !strcmp(argtype, "long int") + || !strcmp(argtype, "unsigned long") + || !strcmp(argtype, "unsigned long int") + || !strcmp(argtype, "nfds_t") + || !strcmp(argtype, "aio_context_t")) + wrap->nlongs++; + else if (!strcmp(argtype, "long long") + || !strcmp(argtype, "unsigned long long") + || !strcmp(argtype, "off64_t") + || !strcmp(argtype, "uint64_t") + || !strcmp(argtype, "u64")) + wrap->nlonglongs++; + else + wrap->nother++; + } +} + +static int spewEIO(ARGV_t av, int ac) +{ +rpmwrap wrap = &_wrap; + int rc = 0; + + for (int i = 0; protos[i]; i++) { + char *t; + char *te; + int xx; + + char * proto = xstrdup(protos[i]); +wrap->proto = xstrdup(proto); + t = strchr(proto, '('); + *t++ = '\0'; + char *arglist = t; + t = strrchr(arglist, ')'); + *t++ = '\0'; +wrap->arglist = xstrdup(arglist); + + char * subtype = proto; + t = strrchr(subtype, ' '); + if (t) + *t++ = '\0'; + else + t = proto; + char * subname = t; +wrap->subname = xstrdup(subname); +wrap->subtype = xstrdup(subtype); + + ARGV_t items = NULL; + xx = argvSplit(&items, arglist, ","); + + int nitems = argvCount(items); + for (int i = 0; i < nitems; i++) { + char * item = (char *) items[i]; + + for (t = item; *t == ' ';) t++; +#ifdef DYING + if (!strncmp(t, "const ", sizeof("const ")-1)) + t += sizeof("const ")-1; +#endif + for (te = t + strlen(t); te > t && te[-1] == ' ';) te--; + item = strndup(t, (te-t)); + items[i] = _free(items[i]); + items[i] = item; +xx = argvAdd(&wrap->items, item); + char * argtype = item; + + /* XXX need to handle '**' */ + if ((t = strrchr(item, '*')) != NULL) { + if (t[-1] == ' ' && t[1] != ' ') { + t[-1] = '*'; + t[0] = ' '; + } + } + if ((t = strrchr(item, ' ')) != NULL) + *t++ = '\0'; + else + t = "WTF?!?"; + char * argname = t; +xx = argvAdd(&wrap->argtypes, argtype); +xx = argvAdd(&wrap->argnames, argname); + } + + items = argvFree(items); + proto = _free(proto); +wrapAnalyze(wrap); +wrapDump(__FUNCTION__, wrap, NULL); +wrapFree(wrap); + + } + + return rc; +} + +/*==============================================================*/ #if !defined(POPT_BIT_XOR) #define POPT_BIT_XOR (POPT_ARG_VAL|POPT_ARGFLAG_XOR) #endif @@ -294,9 +1152,10 @@ qname = xstrdup("rpm"); #endif - switch (6) { + switch (7) { case 5: ec = doEV(av, ac); break; case 6: ec = doEIO(av, ac); break; + case 7: ec = spewEIO(av, ac); break; } #ifdef DYING @@ . ______________________________________________________________________ RPM Package Manager http://rpm5.org CVS Sources Repository rpm-cvs@rpm5.org