]> granicus.if.org Git - strace/commitdiff
Remove initialization of native_scno field for most of syscalls
authorDmitry V. Levin <ldv@altlinux.org>
Fri, 10 Feb 2012 22:33:36 +0000 (22:33 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Mon, 20 Feb 2012 00:36:01 +0000 (00:36 +0000)
The native_scno field is not so much used in the code than before.
In many cases sys_func is checked instead, and for most of syscall
entries there is no need to initialize native_scno.

* linux/i386/syscallent.h: Remove native_scno initialization for
_exit, read, write, waitpid, execve, wait4, sysfs, readv, writev,
pread64, pwrite64, exit_group, waitid, send, recv, sendto and
recvfrom syscall entries.
* linux/syscall.h: Do not define no longer used SYS_waitid and
SYS_sub_* constants.
[IA64]: Do not define SYS_waitpid and SYS32_* constants.
* defs.h: Do not define no longer used  __NR_exit_group constant.
* strace.c [USE_PROCFS] (proc_open): Use sys_func to check for execve.

defs.h
linux/i386/syscallent.h
linux/syscall.h
strace.c

diff --git a/defs.h b/defs.h
index 2f085119abfb860ef80bd561a32d97ee724d35cc..5bf3d8d359c8787e087841508fb4cb2f32ee7c9f 100644 (file)
--- a/defs.h
+++ b/defs.h
@@ -511,26 +511,6 @@ struct tcb {
 #  define TCB_WAITEXECVE 04000
 # endif
 # include <sys/syscall.h>
-# ifndef __NR_exit_group
-# /* Hack: Most headers around are too old to have __NR_exit_group.  */
-#  ifdef ALPHA
-#   define __NR_exit_group 405
-#  elif defined I386
-#   define __NR_exit_group 252
-#  elif defined X86_64
-#   define __NR_exit_group 231
-#  elif defined IA64
-#   define __NR_exit_group 1236
-#  elif defined POWERPC
-#   define __NR_exit_group 234
-#  elif defined S390 || defined S390X
-#   define __NR_exit_group 248
-#  elif defined SPARC || defined SPARC64
-#   define __NR_exit_group 188
-#  elif defined M68K
-#   define __NR_exit_group 247
-#  endif /* ALPHA et al */
-# endif        /* !__NR_exit_group */
 #endif /* LINUX */
 
 /* qualifier flags */
index 62597913aa42c2bd5ea2ff390ac672bbb37a6203..77543fe4ff878027771a0a3fb4f30e949b03b994 100644 (file)
  */
 
        { 0,    0,      sys_restart_syscall,    "restart_syscall" }, /* 0 */
-       { 1,    TP,     sys_exit,               "_exit", SYS_exit }, /* 1 */
+       { 1,    TP,     sys_exit,               "_exit",        }, /* 1 */
        { 0,    TP,     sys_fork,               "fork", SYS_fork }, /* 2 */
-       { 3,    TD,     sys_read,               "read", SYS_read }, /* 3 */
-       { 3,    TD,     sys_write,              "write", SYS_write }, /* 4 */
+       { 3,    TD,     sys_read,               "read",         }, /* 3 */
+       { 3,    TD,     sys_write,              "write",        }, /* 4 */
        { 3,    TD|TF,  sys_open,               "open"          }, /* 5 */
        { 1,    TD,     sys_close,              "close"         }, /* 6 */
-       { 3,    TP,     sys_waitpid,            "waitpid", SYS_wait4 }, /* 7 */
+       { 3,    TP,     sys_waitpid,            "waitpid",      }, /* 7 */
        { 2,    TD|TF,  sys_creat,              "creat"         }, /* 8 */
        { 2,    TF,     sys_link,               "link"          }, /* 9 */
        { 1,    TF,     sys_unlink,             "unlink"        }, /* 10 */
-       { 3,    TF|TP,  sys_execve,             "execve", SYS_execve }, /* 11 */
+       { 3,    TF|TP,  sys_execve,             "execve"        }, /* 11 */
        { 1,    TF,     sys_chdir,              "chdir"         }, /* 12 */
        { 1,    0,      sys_time,               "time"          }, /* 13 */
        { 3,    TF,     sys_mknod,              "mknod"         }, /* 14 */
        { 0,    0,      sys_vhangup,            "vhangup"       }, /* 111 */
        { 0,    0,      sys_idle,               "idle"          }, /* 112 */
        { 1,    0,      sys_vm86old,            "vm86old"       }, /* 113 */
-       { 4,    TP,     sys_wait4,              "wait4", SYS_wait4 }, /* 114 */
+       { 4,    TP,     sys_wait4,              "wait4",        }, /* 114 */
        { 1,    TF,     sys_swapoff,            "swapoff"       }, /* 115 */
        { 1,    0,      sys_sysinfo,            "sysinfo"       }, /* 116 */
        { 6,    TI,     sys_ipc,                "ipc", SYS_ipc }, /* 117 */
        { 1,    0,      sys_getpgid,            "getpgid"       }, /* 132 */
        { 1,    TD,     sys_fchdir,             "fchdir"        }, /* 133 */
        { 0,    0,      sys_bdflush,            "bdflush"       }, /* 134 */
-       { 3,    0,      sys_sysfs,              "sysfs", SYS_sysfs }, /* 135 */
+       { 3,    0,      sys_sysfs,              "sysfs",        }, /* 135 */
        { 1,    0,      sys_personality,        "personality"   }, /* 136 */
        { 5,    0,      sys_afs_syscall,        "afs_syscall"   }, /* 137 */
        { 1,    NF,     sys_setfsuid,           "setfsuid"      }, /* 138 */
        { 5,    TD,     sys_select,             "select"        }, /* 142 */
        { 2,    TD,     sys_flock,              "flock"         }, /* 143 */
        { 3,    0,      sys_msync,              "msync"         }, /* 144 */
-       { 3,    TD,     sys_readv,              "readv", SYS_readv }, /* 145 */
-       { 3,    TD,     sys_writev,             "writev", SYS_writev }, /* 146 */
+       { 3,    TD,     sys_readv,              "readv",        }, /* 145 */
+       { 3,    TD,     sys_writev,             "writev",       }, /* 146 */
        { 1,    0,      sys_getsid,             "getsid"        }, /* 147 */
        { 1,    TD,     sys_fdatasync,          "fdatasync"     }, /* 148 */
        { 1,    0,      sys_sysctl,             "_sysctl"       }, /* 149 */
        { 3,    TS,     sys_rt_sigqueueinfo,    "rt_sigqueueinfo"}, /* 178 */
        { 2,    TS,     sys_rt_sigsuspend,      "rt_sigsuspend" }, /* 179 */
 
-       { 5,    TD,     sys_pread,              "pread64", SYS_read }, /* 180 */
-       { 5,    TD,     sys_pwrite,             "pwrite64", SYS_write }, /* 181 */
+       { 5,    TD,     sys_pread,              "pread64",      }, /* 180 */
+       { 5,    TD,     sys_pwrite,             "pwrite64",     }, /* 181 */
        { 3,    TF,     sys_chown,              "chown"         }, /* 182 */
        { 2,    TF,     sys_getcwd,             "getcwd"        }, /* 183 */
        { 2,    0,      sys_capget,             "capget"        }, /* 184 */
        { 3,    0,      sys_io_cancel,          "io_cancel"     }, /* 249 */
        { 5,    TD,     sys_fadvise64,          "fadvise64"     }, /* 250 */
        { 6,    0,      printargs,              "SYS_251"       }, /* 251 */
-       { 1,    TP,     sys_exit,               "exit_group", __NR_exit_group }, /* 252 */
+       { 1,    TP,     sys_exit,               "exit_group"    }, /* 252 */
        { 4,    0,      sys_lookup_dcookie,     "lookup_dcookie"}, /* 253 */
        { 1,    TD,     sys_epoll_create,       "epoll_create"  }, /* 254 */
        { 4,    TD,     sys_epoll_ctl,          "epoll_ctl"     }, /* 255 */
        { 2,    0,      sys_mq_notify,          "mq_notify"     }, /* 281 */
        { 3,    0,      sys_mq_getsetattr,      "mq_getsetattr" }, /* 282 */
        { 4,    0,      sys_kexec_load,         "kexec_load"    }, /* 283 */
-       { 5,    TP,     sys_waitid,             "waitid", SYS_waitid }, /* 284 */
+       { 5,    TP,     sys_waitid,             "waitid",       }, /* 284 */
        { 6,    0,      printargs,              "SYS_285"       }, /* 285 */
        { 5,    0,      sys_add_key,            "add_key"       }, /* 286 */
        { 4,    0,      sys_request_key,        "request_key"   }, /* 287 */
        { 3,    TN,     sys_getsockname,        "getsockname"   }, /* 406 */
        { 3,    TN,     sys_getpeername,        "getpeername"   }, /* 407 */
        { 4,    TN,     sys_socketpair,         "socketpair"    }, /* 408 */
-       { 4,    TN,     sys_send,               "send", SYS_sub_send }, /* 409 */
-       { 4,    TN,     sys_recv,               "recv", SYS_sub_recv }, /* 410 */
-       { 6,    TN,     sys_sendto,             "sendto", SYS_sub_sendto }, /* 411 */
-       { 6,    TN,     sys_recvfrom,           "recvfrom", SYS_sub_recvfrom }, /* 412 */
+       { 4,    TN,     sys_send,               "send",         }, /* 409 */
+       { 4,    TN,     sys_recv,               "recv",         }, /* 410 */
+       { 6,    TN,     sys_sendto,             "sendto",       }, /* 411 */
+       { 6,    TN,     sys_recvfrom,           "recvfrom",     }, /* 412 */
        { 2,    TN,     sys_shutdown,           "shutdown"      }, /* 413 */
        { 5,    TN,     sys_setsockopt,         "setsockopt"    }, /* 414 */
        { 5,    TN,     sys_getsockopt,         "getsockopt"    }, /* 415 */
index 504b26f86e4d7f0fb78f41413e0c854d440d1f0e..f1833b88d3b7b6b4d04f820a5e811bd21158d620 100644 (file)
@@ -313,34 +313,6 @@ int sys_osf_utimes();
 int sys_osf_wait4();
 #endif
 
-#ifndef SYS_waitid
-# ifdef I386
-#  define SYS_waitid 284
-# elif defined ALPHA
-#  define SYS_waitid 438
-# elif defined ARM
-#  define SYS_waitid (NR_SYSCALL_BASE + 280)
-# elif defined IA64
-#  define SYS_waitid 1270
-# elif defined M68K
-#  define SYS_waitid 277
-# elif defined POWERPC
-#  define SYS_waitid 272
-# elif defined S390 || defined S390X
-#  define SYS_waitid 281
-# elif defined SH64
-#  define SYS_waitid 312
-# elif defined SH64
-#  define SYS_waitid 312
-# elif defined SH
-#  define SYS_waitid 284
-# elif defined SPARC || defined SPARC64
-#  define SYS_waitid 279
-# elif defined X86_64
-#  define SYS_waitid 247
-# endif
-#endif
-
 #if !defined(ALPHA) && !defined(MIPS) && !defined(HPPA) && \
        !defined(__ARM_EABI__)
 # ifdef        IA64
@@ -374,25 +346,6 @@ int sys_osf_wait4();
 # else
 #  define SYS_socket_subcall   400
 # endif
-#define SYS_sub_socket         (SYS_socket_subcall + 1)
-#define SYS_sub_bind           (SYS_socket_subcall + 2)
-#define SYS_sub_connect                (SYS_socket_subcall + 3)
-#define SYS_sub_listen         (SYS_socket_subcall + 4)
-#define SYS_sub_accept         (SYS_socket_subcall + 5)
-#define SYS_sub_getsockname    (SYS_socket_subcall + 6)
-#define SYS_sub_getpeername    (SYS_socket_subcall + 7)
-#define SYS_sub_socketpair     (SYS_socket_subcall + 8)
-#define SYS_sub_send           (SYS_socket_subcall + 9)
-#define SYS_sub_recv           (SYS_socket_subcall + 10)
-#define SYS_sub_sendto         (SYS_socket_subcall + 11)
-#define SYS_sub_recvfrom       (SYS_socket_subcall + 12)
-#define SYS_sub_shutdown       (SYS_socket_subcall + 13)
-#define SYS_sub_setsockopt     (SYS_socket_subcall + 14)
-#define SYS_sub_getsockopt     (SYS_socket_subcall + 15)
-#define SYS_sub_sendmsg                (SYS_socket_subcall + 16)
-#define SYS_sub_recvmsg                (SYS_socket_subcall + 17)
-#define SYS_sub_accept4                (SYS_socket_subcall + 18)
-#define SYS_sub_recvmmsg       (SYS_socket_subcall + 19)
 
 #define SYS_socket_nsubcalls   20
 #endif /* !(ALPHA || MIPS || HPPA) */
@@ -423,18 +376,6 @@ int sys_osf_wait4();
 #  undef SYS_shmctl
 # endif /* IA64 */
 #define SYS_ipc_subcall                ((SYS_socket_subcall)+(SYS_socket_nsubcalls))
-#define SYS_sub_semop          (SYS_ipc_subcall + 1)
-#define SYS_sub_semget         (SYS_ipc_subcall + 2)
-#define SYS_sub_semctl         (SYS_ipc_subcall + 3)
-#define SYS_sub_semtimedop     (SYS_ipc_subcall + 4)
-#define SYS_sub_msgsnd         (SYS_ipc_subcall + 11)
-#define SYS_sub_msgrcv         (SYS_ipc_subcall + 12)
-#define SYS_sub_msgget         (SYS_ipc_subcall + 13)
-#define SYS_sub_msgctl         (SYS_ipc_subcall + 14)
-#define SYS_sub_shmat          (SYS_ipc_subcall + 21)
-#define SYS_sub_shmdt          (SYS_ipc_subcall + 22)
-#define SYS_sub_shmget         (SYS_ipc_subcall + 23)
-#define SYS_sub_shmctl         (SYS_ipc_subcall + 24)
 
 #define SYS_ipc_nsubcalls      25
 #endif /* !(ALPHA || MIPS || HPPA) */
@@ -454,10 +395,6 @@ int sys_osf_wait4();
    */
 # define SYS_fork      2
 # define SYS_vfork     190
-# define SYS32_exit    1
-# define SYS_waitpid   7
-# define SYS32_wait4   114
-# define SYS32_execve  11
 #endif /* IA64 */
 
 #if defined(ALPHA) || defined(IA64) || defined(SPARC) || defined(SPARC64)
index 493283135abd7ee70c1037a4bf4c2d3294ddde17..2bca0de87a3e99bfd0d65896755498038c53bfe1 100644 (file)
--- a/strace.c
+++ b/strace.c
@@ -1698,7 +1698,8 @@ proc_open(struct tcb *tcp, int attaching)
                        if (tcp->status.PR_WHY == PR_SYSENTRY) {
                                tcp->flags &= ~TCB_INSYSCALL;
                                get_scno(tcp);
-                               if (known_scno(tcp) == SYS_execve)
+                               if (SCNO_IN_RANGE(tcp->scno) &&
+                                   sysent[tcp->scno].sys_func == sys_execve)
                                        break;
                        }
                        /* Set it running: maybe execve will be next. */