From ad178c0dc050a0bd68179ca60f3aebe0ff6ddd89 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Mon, 28 Nov 2011 22:48:53 +0000 Subject: [PATCH] Remove redundant parsers * desc.c (sys_dup): Remove. * file.c (sys_pivotroot, sys_rmdir, sys_fchdir, sys_chroot, sys_fchroot, sys_unlink, sys_symlink, sys_rename): Remove. * linux/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_pivotroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove. * linux/dummy.h: Add aliases for sys_chroot, sys_dup, sys_pivotroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink. * pathtrace.c (pathtrace_match): Update. * sunos4/dummy.h: Add aliases for sys_chroot, sys_dup, sys_fchdir, sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink. * svr4/dummy.h: Likewise. * sunos4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove. * svr4/syscall.h (sys_chroot, sys_dup, sys_fchdir, sys_fchroot, sys_rename, sys_rmdir, sys_symlink, sys_unlink): Remove. --- desc.c | 9 ------ file.c | 81 ------------------------------------------------ linux/dummy.h | 9 +++++- linux/syscall.h | 15 +++++---- pathtrace.c | 7 ++--- sunos4/dummy.h | 10 ++++++ sunos4/syscall.h | 11 +++---- svr4/dummy.h | 8 +++++ svr4/syscall.h | 11 ------- 9 files changed, 40 insertions(+), 121 deletions(-) diff --git a/desc.c b/desc.c index ee9aacc6..a41514aa 100644 --- a/desc.c +++ b/desc.c @@ -440,15 +440,6 @@ sys_close(struct tcb *tcp) return 0; } -int -sys_dup(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - } - return 0; -} - static int do_dup2(struct tcb *tcp, int flags_arg) { diff --git a/file.c b/file.c index b1d97c73..4e62c2cb 100644 --- a/file.c +++ b/file.c @@ -1883,18 +1883,6 @@ sys_ustat(struct tcb *tcp) } #endif /* SUNOS4 */ -int -sys_pivotroot(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprints(", "); - printpath(tcp, tcp->u_arg[1]); - } - return 0; -} - - /* directory */ int sys_chdir(struct tcb *tcp) @@ -1931,44 +1919,6 @@ sys_mkdirat(struct tcb *tcp) } #endif -int -sys_rmdir(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - } - return 0; -} - -int -sys_fchdir(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - } - return 0; -} - -int -sys_chroot(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - } - return 0; -} - -#if defined(SUNOS4) || defined(SVR4) -int -sys_fchroot(struct tcb *tcp) -{ - if (entering(tcp)) { - printfd(tcp, tcp->u_arg[0]); - } - return 0; -} -#endif /* SUNOS4 || SVR4 */ - int sys_link(struct tcb *tcp) { @@ -1997,15 +1947,6 @@ sys_linkat(struct tcb *tcp) } #endif -int -sys_unlink(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - } - return 0; -} - #ifdef LINUX static const struct xlat unlinkatflags[] = { #ifndef AT_REMOVEDIR @@ -2028,17 +1969,6 @@ sys_unlinkat(struct tcb *tcp) } #endif -int -sys_symlink(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprints(", "); - printpath(tcp, tcp->u_arg[1]); - } - return 0; -} - #ifdef LINUX int sys_symlinkat(struct tcb *tcp) @@ -2085,17 +2015,6 @@ sys_readlinkat(struct tcb *tcp) } #endif -int -sys_rename(struct tcb *tcp) -{ - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprints(", "); - printpath(tcp, tcp->u_arg[1]); - } - return 0; -} - #ifdef LINUX int sys_renameat(struct tcb *tcp) diff --git a/linux/dummy.h b/linux/dummy.h index aa8b262a..e7ed992c 100644 --- a/linux/dummy.h +++ b/linux/dummy.h @@ -69,22 +69,29 @@ /* like another call */ #define sys_acct sys_chdir +#define sys_chroot sys_chdir #define sys_clock_getres sys_clock_gettime #define sys_delete_module sys_open +#define sys_dup sys_close #define sys_fchdir sys_close #define sys_fdatasync sys_close #define sys_getegid sys_getuid #define sys_geteuid sys_getuid #define sys_getgid sys_getuid #define sys_mlock sys_munmap -#define sys_mq_unlink sys_unlink +#define sys_mq_unlink sys_chdir #define sys_munlock sys_munmap +#define sys_pivotroot sys_link +#define sys_rename sys_link +#define sys_rmdir sys_chdir #define sys_sched_get_priority_max sys_sched_get_priority_min #define sys_setfsgid sys_setfsuid #define sys_swapoff sys_chdir #define sys_swapon sys_chdir +#define sys_symlink sys_link #define sys_syncfs sys_close #define sys_umount sys_chdir +#define sys_unlink sys_chdir #define sys_uselib sys_chdir /* printargs does the right thing */ diff --git a/linux/syscall.h b/linux/syscall.h index b7ad67cd..d7554166 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -35,18 +35,18 @@ int sys_restart_syscall(); int sys_setup(), sys_exit(), sys_fork(), sys_read(), sys_write(); int sys_open(), sys_close(), sys_waitpid(), sys_creat(), sys_link(); -int sys_unlink(), sys_execve(), sys_chdir(), sys_time(), sys_mknod(); +int sys_execve(), sys_chdir(), sys_time(), sys_mknod(); int sys_chmod(), sys_chown(), sys_break(), sys_oldstat(); int sys_lseek(), sys_getpid(), sys_mount(), sys_umount(), sys_umount2(); int sys_setuid(), sys_getuid(), sys_stime(), sys_ptrace(); int sys_alarm(), sys_oldfstat(), sys_pause(), sys_utime(); int sys_stty(), sys_gtty(), sys_access(), sys_nice(), sys_ftime(); -int sys_sync(), sys_kill(), sys_rename(), sys_mkdir(), sys_rmdir(); -int sys_dup(), sys_pipe(), sys_times(), sys_prof(), sys_brk(); +int sys_sync(), sys_kill(), sys_mkdir(); +int sys_pipe(), sys_times(), sys_prof(), sys_brk(); int sys_setgid(), sys_getgid(), sys_signal(), sys_geteuid(); int sys_getegid(), sys_acct(), sys_phys(), sys_lock(), sys_ioctl(); int sys_fcntl(), sys_mpx(), sys_setpgid(), sys_ulimit(); -int sys_olduname(), sys_umask(), sys_chroot(), sys_ustat(); +int sys_olduname(), sys_umask(), sys_ustat(); int sys_dup2(), sys_getppid(), sys_getpgrp(), sys_setsid(); int sys_sigaction(), sys_siggetmask(), sys_sigsetmask(); int sys_setreuid(), sys_setregid(), sys_sigsuspend(); @@ -54,7 +54,7 @@ int sys_sigpending(), sys_sethostname(), sys_setrlimit(); int sys_getrlimit(), sys_getrusage(), sys_gettimeofday(); int sys_settimeofday(), sys_getgroups(), sys_setgroups(); int sys_setgroups32(), sys_getgroups32(); -int sys_oldselect(), sys_symlink(), sys_oldlstat(), sys_readlink(); +int sys_oldselect(), sys_oldlstat(), sys_readlink(); int sys_uselib(), sys_swapon(), sys_reboot(), sys_readdir(); int sys_mmap(), sys_munmap(), sys_truncate(), sys_ftruncate(); int sys_fchmod(), sys_fchown(), sys_getpriority(); @@ -67,7 +67,7 @@ int sys_fsync(), sys_clone(), sys_setdomainname(), sys_sysinfo(); int sys_modify_ldt(), sys_adjtimex(), sys_mprotect(); int sys_sigprocmask(), sys_create_module(), sys_init_module(); int sys_delete_module(), sys_get_kernel_syms(), sys_quotactl(); -int sys_getpgid(), sys_fchdir(), sys_bdflush(); +int sys_getpgid(), sys_bdflush(); int sys_sysfs(), sys_personality(), sys_afs_syscall(); int sys_setfsuid(), sys_setfsgid(), sys_llseek(); int sys_getdents(), sys_flock(), sys_msync(); @@ -85,8 +85,7 @@ int sys_sigaltstack(), sys_rt_sigprocmask(), sys_rt_sigaction(); int sys_rt_sigpending(), sys_rt_sigsuspend(), sys_rt_sigqueueinfo(); int sys_rt_sigtimedwait(), sys_prctl(), sys_poll(), sys_vfork(); int sys_sendfile(), sys_old_mmap(), sys_stat64(), sys_lstat64(), sys_fstat64(); -int sys_truncate64(), sys_ftruncate64(), sys_pivotroot(); -int sys_getdents64(); +int sys_truncate64(), sys_ftruncate64(), sys_getdents64(); int sys_getpmsg(), sys_putpmsg(), sys_readahead(), sys_sendfile64(); int sys_setxattr(), sys_fsetxattr(), sys_getxattr(), sys_fgetxattr(); int sys_listxattr(), sys_flistxattr(), sys_removexattr(), sys_fremovexattr(); diff --git a/pathtrace.c b/pathtrace.c index 380363cd..697dfeb6 100644 --- a/pathtrace.c +++ b/pathtrace.c @@ -195,7 +195,7 @@ pathtrace_match(struct tcb *tcp) s->sys_func == sys_dup3 || s->sys_func == sys_sendfile || s->sys_func == sys_sendfile64 || - !strcmp(s->sys_name, "tee")) + s->sys_func == sys_tee) { /* fd, fd */ return fdmatch(tcp, tcp->u_arg[0]) || @@ -222,9 +222,6 @@ pathtrace_match(struct tcb *tcp) } if (s->sys_func == sys_link || - s->sys_func == sys_pivotroot || - s->sys_func == sys_rename || - s->sys_func == sys_symlink || s->sys_func == sys_mount) { /* path, path */ @@ -254,7 +251,7 @@ pathtrace_match(struct tcb *tcp) upathmatch(tcp, tcp->u_arg[2]); } - if (!strcmp(s->sys_name, "splice")) { + if (s->sys_func == sys_splice) { /* fd, x, fd, x, x */ return fdmatch(tcp, tcp->u_arg[0]) || fdmatch(tcp, tcp->u_arg[2]); diff --git a/sunos4/dummy.h b/sunos4/dummy.h index 136215d0..8a8f664b 100644 --- a/sunos4/dummy.h +++ b/sunos4/dummy.h @@ -52,6 +52,16 @@ #define sys_oldquota printargs #define sys_getdirentries printargs +/* like another call */ +#define sys_chroot sys_chdir +#define sys_rmdir sys_chdir +#define sys_unlink sys_chdir +#define sys_dup sys_close +#define sys_fchdir sys_close +#define sys_fchroot sys_close +#define sys_rename sys_link +#define sys_symlink sys_link + /* No interesting parameters or return values */ #define sys_vhangup printargs #define sys_sys_setsid printargs diff --git a/sunos4/syscall.h b/sunos4/syscall.h index 9bbd264d..bf71f05b 100644 --- a/sunos4/syscall.h +++ b/sunos4/syscall.h @@ -57,7 +57,7 @@ int sys_adjtime(); int sys_getitimer(),sys_setitimer(); /* 1.5 descriptors */ -int sys_getdtablesize(),sys_dup(),sys_dup2(),sys_close(); +int sys_getdtablesize(),sys_dup2(),sys_close(); int sys_select(),sys_getdopt(),sys_setdopt(),sys_fcntl(),sys_flock(); /* 1.6 resource controls */ @@ -78,12 +78,11 @@ int sys_read(),sys_write(),sys_readv(),sys_writev(),sys_ioctl(); int sys_aioread(), sys_aiowrite(), sys_aiowait(), sys_aiocancel(); /* 2.2 file system */ -int sys_chdir(),sys_chroot(); -int sys_fchdir(),sys_fchroot(); -int sys_mkdir(),sys_rmdir(),sys_getdirentries(), sys_getdents(); -int sys_creat(),sys_open(),sys_mknod(),sys_unlink(),sys_stat(),sys_fstat(),sys_lstat(); +int sys_chdir(); +int sys_mkdir(),sys_getdirentries(), sys_getdents(); +int sys_creat(),sys_open(),sys_mknod(),sys_stat(),sys_fstat(),sys_lstat(); int sys_chown(),sys_fchown(),sys_chmod(),sys_fchmod(),sys_utimes(); -int sys_link(),sys_symlink(),sys_readlink(),sys_rename(); +int sys_link(),sys_readlink(); int sys_lseek(),sys_truncate(),sys_ftruncate(),sys_access(),sys_fsync(); int sys_statfs(),sys_fstatfs(); diff --git a/svr4/dummy.h b/svr4/dummy.h index 9ee09272..8c14c514 100644 --- a/svr4/dummy.h +++ b/svr4/dummy.h @@ -206,6 +206,14 @@ #define sys_ntp_adjtime printargs /* like another call */ +#define sys_chroot sys_chdir +#define sys_rmdir sys_chdir +#define sys_unlink sys_chdir +#define sys_dup sys_close +#define sys_fchdir sys_close +#define sys_fchroot sys_close +#define sys_rename sys_link +#define sys_symlink sys_link #define sys_lchown sys_chown #define sys_setuid sys_close #define sys_seteuid sys_close diff --git a/svr4/syscall.h b/svr4/syscall.h index 45211c4c..f366968d 100644 --- a/svr4/syscall.h +++ b/svr4/syscall.h @@ -39,7 +39,6 @@ extern int sys_close(); extern int sys_wait(); extern int sys_creat(); extern int sys_link(); -extern int sys_unlink(); extern int sys_exec(); extern int sys_chdir(); extern int sys_time(); @@ -73,7 +72,6 @@ extern int sys_pgrpsys(); extern int sys_setpgrp(); extern int sys_xenix(); extern int sys_syssgi(); -extern int sys_dup(); extern int sys_pipe(); extern int sys_times(); extern int sys_profil(); @@ -95,10 +93,8 @@ extern int sys_utssys(); extern int sys_fdsync(); extern int sys_execve(); extern int sys_umask(); -extern int sys_chroot(); extern int sys_fcntl(); extern int sys_ulimit(); -extern int sys_rmdir(); extern int sys_mkdir(); extern int sys_getdents(); extern int sys_sysfs(); @@ -134,8 +130,6 @@ extern int sys_getdomainname(); extern int sys_setdomainname(); extern int sys_truncate(); extern int sys_ftruncate(); -extern int sys_rename(); -extern int sys_symlink(); extern int sys_readlink(); extern int sys_nfssvc(); extern int sys_getfh(); @@ -163,7 +157,6 @@ extern int sys_BSDgetpgrp(); extern int sys_BSDsetpgrp(); extern int sys_vhangup(); extern int sys_fsync(); -extern int sys_fchdir(); extern int sys_getrlimit(); extern int sys_setrlimit(); extern int sys_cacheflush(); @@ -198,7 +191,6 @@ extern int sys_priocntl(); extern int sys_ksigqueue(); #else /* !MIPS */ extern int sys_lstat(); -extern int sys_symlink(); extern int sys_readlink(); extern int sys_setgroups(); extern int sys_getgroups(); @@ -228,7 +220,6 @@ extern int sys_mprotect(); extern int sys_munmap(); extern int sys_fpathconf(); extern int sys_vfork(); -extern int sys_fchdir(); extern int sys_readv(); extern int sys_writev(); extern int sys_xstat(); @@ -242,7 +233,6 @@ extern int sys_lchown(); extern int sys_memcntl(); extern int sys_getpmsg(); extern int sys_putpmsg(); -extern int sys_rename(); extern int sys_uname(); extern int sys_setegid(); extern int sys_sysconfig(); @@ -257,7 +247,6 @@ extern int sys_yield(); extern int sys_lwp_sema_wait(); extern int sys_lwp_sema_post(); extern int sys_modctl(); -extern int sys_fchroot(); extern int sys_utimes(); extern int sys_vhangup(); extern int sys_gettimeofday();