From: Dmitry V. Levin Date: Mon, 20 Feb 2012 21:17:58 +0000 (+0000) Subject: Remove initialization of native_scno field X-Git-Tag: v4.7~167 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0c661513e5a4594cfae98042018ed549b1e26b8d;p=strace Remove initialization of native_scno field * linux/i386/syscallent.h: Remove native_scno initialization for clone, fork and vfork. * linux/ia64/syscallent.h (sys_fork, sys_vfork): Remove redirections to printargs. * linux/syscall.h [IA64]: Do not define SYS_fork and SYS_vfork. * util.c (printcall) [IA64]: Likewise. (setbpt): Use sys_func to check for clone, fork and vfork syscalls. --- diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h index 46d61f9b..83a901c4 100644 --- a/linux/i386/syscallent.h +++ b/linux/i386/syscallent.h @@ -30,7 +30,7 @@ { 0, 0, sys_restart_syscall, "restart_syscall" }, /* 0 */ { 1, TP, sys_exit, "_exit", }, /* 1 */ - { 0, TP, sys_fork, "fork", SYS_fork }, /* 2 */ + { 0, TP, sys_fork, "fork", }, /* 2 */ { 3, TD, sys_read, "read", }, /* 3 */ { 3, TD, sys_write, "write", }, /* 4 */ { 3, TD|TF, sys_open, "open" }, /* 5 */ @@ -148,7 +148,7 @@ { 6, TI, sys_ipc, "ipc", }, /* 117 */ { 1, TD, sys_fsync, "fsync" }, /* 118 */ { 0, TS, sys_sigreturn, "sigreturn" }, /* 119 */ - { 5, TP, sys_clone, "clone", SYS_clone }, /* 120 */ + { 5, TP, sys_clone, "clone" }, /* 120 */ { 2, 0, sys_setdomainname, "setdomainname" }, /* 121 */ { 1, 0, sys_uname, "uname" }, /* 122 */ { 3, 0, sys_modify_ldt, "modify_ldt" }, /* 123 */ @@ -219,7 +219,7 @@ { 4, TD|TN, sys_sendfile, "sendfile" }, /* 187 */ { 5, 0, sys_getpmsg, "getpmsg" }, /* 188 */ { 5, 0, sys_putpmsg, "putpmsg" }, /* 189 */ - { 0, TP, sys_vfork, "vfork", SYS_vfork }, /* 190 */ + { 0, TP, sys_vfork, "vfork" }, /* 190 */ { 2, 0, sys_getrlimit, "getrlimit" }, /* 191 */ { 6, TD, sys_mmap, "mmap2" }, /* 192 */ { 3, TF, sys_truncate64, "truncate64" }, /* 193 */ diff --git a/linux/ia64/syscallent.h b/linux/ia64/syscallent.h index 25f74029..e3beb790 100644 --- a/linux/ia64/syscallent.h +++ b/linux/ia64/syscallent.h @@ -37,7 +37,6 @@ #define sys_getpmsg printargs #define sys_putpmsg printargs #define sys_ugetrlimit printargs -#define sys_fork printargs #define sys_waitpid printargs #define sys_time printargs #define sys_break printargs @@ -124,7 +123,6 @@ #define sys_pwrite printargs #define sys_sigaltstack printargs #define sys_sendfile printargs -#define sys_vfork printargs #define sys_truncate64 printargs #define sys_ftruncate64 printargs #define sys_stat64 printargs @@ -139,7 +137,6 @@ #undef sys_getpmsg #undef sys_putpmsg #undef sys_ugetrlimit -#undef sys_fork #undef sys_waitpid #undef sys_time #undef sys_break @@ -228,7 +225,6 @@ #undef sys_pwrite #undef sys_sigaltstack #undef sys_sendfile -#undef sys_vfork #undef sys_truncate64 #undef sys_ftruncate64 #undef sys_stat64 diff --git a/linux/syscall.h b/linux/syscall.h index de33c106..23c67c7e 100644 --- a/linux/syscall.h +++ b/linux/syscall.h @@ -332,16 +332,6 @@ int sys_osf_wait4(); #define SYS_ipc_nsubcalls 25 #endif /* !(ALPHA || MIPS || HPPA) */ -#ifdef IA64 - /* - * IA64 syscall numbers (the only ones available from standard header - * files) are disjoint from IA32 syscall numbers. We need to define - * some IA32 specific syscalls here. - */ -# define SYS_fork 2 -# define SYS_vfork 190 -#endif /* IA64 */ - #if defined(ALPHA) || defined(IA64) || defined(SPARC) || defined(SPARC64) int sys_getpagesize(); #endif diff --git a/util.c b/util.c index bd166d2d..3e6269fd 100644 --- a/util.c +++ b/util.c @@ -1415,11 +1415,6 @@ printcall(struct tcb *tcp) # ifdef IA64 -/* We don't have fork()/vfork() syscalls on ia64 itself, but the ia32 - subsystem has them for x86... */ -# define SYS_fork 2 -# define SYS_vfork 190 - typedef unsigned long *arg_setup_state; static int @@ -1449,7 +1444,6 @@ arg_setup(struct tcb *tcp, arg_setup_state *state) # define arg_finish_change(tcp, state) 0 -# ifdef SYS_fork static int get_arg0(struct tcb *tcp, arg_setup_state *state, long *valp) { @@ -1477,7 +1471,6 @@ get_arg1(struct tcb *tcp, arg_setup_state *state, long *valp) sizeof(long), (void *) valp); return ret; } -# endif static int set_arg0(struct tcb *tcp, arg_setup_state *state, long val) @@ -1644,14 +1637,8 @@ setbpt(struct tcb *tcp) } } - switch (known_scno(tcp)) { -# ifdef SYS_vfork - case SYS_vfork: -# endif -# ifdef SYS_fork - case SYS_fork: -# endif -# if defined SYS_fork || defined SYS_vfork + if (sysent[tcp->scno].sys_func == sys_fork || + sysent[tcp->scno].sys_func == sys_vfork) { if (arg_setup(tcp, &state) < 0 || get_arg0(tcp, &state, &tcp->inst[0]) < 0 || get_arg1(tcp, &state, &tcp->inst[1]) < 0 @@ -1664,14 +1651,11 @@ setbpt(struct tcb *tcp) tcp->u_arg[arg1_index] = 0; tcp->flags |= TCB_BPTSET; return 0; -# endif + } - case SYS_clone: ; -# ifdef SYS_clone2 - case SYS_clone2: ; -# endif + if (sysent[tcp->scno].sys_func == sys_clone) { /* ia64 calls directly `clone (CLONE_VFORK | CLONE_VM)' - contrary to x86 SYS_vfork above. Even on x86 we turn the + contrary to x86 vfork above. Even on x86 we turn the vfork semantics into plain fork - each application must not depend on the vfork specifics according to POSIX. We would hang waiting for the parent resume otherwise. We need to @@ -1689,13 +1673,10 @@ setbpt(struct tcb *tcp) tcp->inst[0] = tcp->u_arg[arg0_index]; tcp->inst[1] = tcp->u_arg[arg1_index]; return 0; - - default: - fprintf(stderr, "PANIC: setbpt for syscall %ld on %u???\n", - tcp->scno, tcp->pid); - break; } + fprintf(stderr, "PANIC: setbpt for syscall %ld on %u???\n", + tcp->scno, tcp->pid); return -1; }