summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-02-27 14:18:02 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2012-02-27 14:18:02 +0100
commit72879c6a35cd5afa7f58ee7bc32e4dcd8e65bd9a (patch)
treedac4cb5f2ed67842aca65af1fef03b8094c98bd6
parentb237b1b20da4ff40efb919f9d4a6458a05f375ca (diff)
downloadstrace-72879c6a35cd5afa7f58ee7bc32e4dcd8e65bd9a.tar.gz
strace-72879c6a35cd5afa7f58ee7bc32e4dcd8e65bd9a.tar.bz2
strace-72879c6a35cd5afa7f58ee7bc32e4dcd8e65bd9a.tar.xz
Alias a few more syscall printing functions
text data bss dec hex filename 237384 672 19044 257100 3ec4c strace.before 236448 672 19044 256164 3e8a4 strace * defs.h: Declare new functions printargs_lu(), printargs_ld() which simply print syscall all args as unsigned or signed longs. * desc.c (sys_epoll_create): Call printargs_ld() instead of open-coding it. * linux/syscall.h: Remove declarations of the following functions: sys_alarm, sys_getresgid, sys_getsid, sys_nice, sys_setgid, sys_setpgid, sys_setpgrp, sys_setregid, sys_setresgid. * process.c (sys_setgid): Delete this function: now aliased to sys_setuid(). (sys_getresgid): Delete this function: now aliased to sys_getresuid(). (sys_setregid): Delete this function: now aliased to sys_setreuid(). (sys_setresgid): Delete this function: now aliased to sys_setresuid(). (sys_setpgrp): Delete this function: now aliased to printargs_lu(). (sys_getsid): Likewise. (sys_setpgid): Likewise. (sys_alarm): Likewise. (sys_getpgrp): Delete this function: was unused - was already shadowed by a define in linux/dummy.h. (sys_setsid): Likewise. (sys_getpgid): Likewise. * resource.c (sys_nice): Delete this function: now aliased to printargs_ld(). * linux/dummy.h: Define new aliases (see above for the list). * syscall.c (printargs_lu): New function. (printargs_ld): New function. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--defs.h2
-rw-r--r--desc.c5
-rw-r--r--linux/dummy.h19
-rw-r--r--linux/syscall.h9
-rw-r--r--process.c116
-rw-r--r--resource.c8
-rw-r--r--syscall.c24
7 files changed, 43 insertions, 140 deletions
diff --git a/defs.h b/defs.h
index f8e5b1a..9c3b234 100644
--- a/defs.h
+++ b/defs.h
@@ -472,6 +472,8 @@ extern int trace_syscall(struct tcb *);
extern void count_syscall(struct tcb *, struct timeval *);
extern void printxval(const struct xlat *, int, const char *);
extern int printargs(struct tcb *);
+extern int printargs_lu(struct tcb *);
+extern int printargs_ld(struct tcb *);
extern void addflags(const struct xlat *, int);
extern int printflags(const struct xlat *, int, const char *);
extern const char *sprintflags(const char *, const struct xlat *, int);
diff --git a/desc.c b/desc.c
index a207d2f..932c66f 100644
--- a/desc.c
+++ b/desc.c
@@ -668,12 +668,11 @@ static const struct xlat epollevents[] = {
{ 0, NULL }
};
+/* Not aliased to printargs_ld: we want it to have a distinct address */
int
sys_epoll_create(struct tcb *tcp)
{
- if (entering(tcp))
- tprintf("%ld", tcp->u_arg[0]);
- return 0;
+ return printargs_ld(tcp);
}
static const struct xlat epollflags[] = {
diff --git a/linux/dummy.h b/linux/dummy.h
index 0def94c..26afbbc 100644
--- a/linux/dummy.h
+++ b/linux/dummy.h
@@ -75,9 +75,14 @@
#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_getegid sys_getuid
#define sys_getgid sys_getuid
+#define sys_getresgid sys_getresuid
+#define sys_setgid sys_setuid
+#define sys_setregid sys_setreuid
+#define sys_setresgid sys_setresuid
+#define sys_setfsgid sys_setfsuid
#define sys_mlock sys_munmap
#define sys_mq_unlink sys_chdir
#define sys_munlock sys_munmap
@@ -85,7 +90,6 @@
#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
@@ -96,17 +100,16 @@
/* printargs does the right thing */
#define sys_getpgid printargs
-#define sys_getpgrp printargs
#define sys_getpid printargs
#define sys_getppid printargs
#define sys_gettid printargs
+#define sys_setsid printargs
#define sys_idle printargs
#define sys_inotify_init printargs
#define sys_munlockall printargs
#define sys_pause printargs
#define sys_rt_sigreturn printargs
#define sys_sched_yield printargs
-#define sys_setsid printargs
#define sys_setup printargs
#define sys_set_tid_address printargs
#define sys_sync printargs
@@ -114,6 +117,14 @@
#define sys_timer_getoverrun printargs
#define sys_vhangup printargs
+/* printargs_lu/ld does the right thing */
+#define sys_getsid printargs_lu
+#define sys_getpgrp printargs_lu
+#define sys_setpgid printargs_lu
+#define sys_setpgrp printargs_lu
+#define sys_alarm printargs_lu
+#define sys_nice printargs_ld
+
/* unimplemented */
#define sys_afs_syscall printargs
#define sys_break printargs
diff --git a/linux/syscall.h b/linux/syscall.h
index 23c67c7..4eb7368 100644
--- a/linux/syscall.h
+++ b/linux/syscall.h
@@ -36,7 +36,6 @@ int sys_accept();
int sys_accept4();
int sys_access();
int sys_adjtimex();
-int sys_alarm();
int sys_arch_prctl();
int sys_bind();
int sys_brk();
@@ -102,11 +101,9 @@ int sys_getitimer();
int sys_getpeername();
int sys_getpmsg();
int sys_getpriority();
-int sys_getresgid();
int sys_getresuid();
int sys_getrlimit();
int sys_getrusage();
-int sys_getsid();
int sys_getsockname();
int sys_getsockopt();
int sys_gettimeofday();
@@ -159,7 +156,6 @@ int sys_msync();
int sys_munmap();
int sys_nanosleep();
int sys_newfstatat();
-int sys_nice();
int sys_old_mmap();
int sys_oldfstat();
int sys_oldlstat();
@@ -226,16 +222,11 @@ int sys_set_mempolicy();
int sys_set_thread_area();
int sys_setdomainname();
int sys_setfsuid();
-int sys_setgid();
int sys_setgroups();
int sys_setgroups32();
int sys_sethostname();
int sys_setitimer();
-int sys_setpgid();
-int sys_setpgrp();
int sys_setpriority();
-int sys_setregid();
-int sys_setresgid();
int sys_setresuid();
int sys_setreuid();
int sys_setrlimit();
diff --git a/process.c b/process.c
index de30514..621cad8 100644
--- a/process.c
+++ b/process.c
@@ -721,15 +721,6 @@ sys_setuid(struct tcb *tcp)
}
int
-sys_setgid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%u", (gid_t) tcp->u_arg[0]);
- }
- return 0;
-}
-
-int
sys_getresuid(struct tcb *tcp)
{
if (exiting(tcp)) {
@@ -756,32 +747,6 @@ sys_getresuid(struct tcb *tcp)
}
int
-sys_getresgid(struct tcb *tcp)
-{
- if (exiting(tcp)) {
- __kernel_gid_t gid;
- if (syserror(tcp))
- tprintf("%#lx, %#lx, %#lx", tcp->u_arg[0],
- tcp->u_arg[1], tcp->u_arg[2]);
- else {
- if (umove(tcp, tcp->u_arg[0], &gid) < 0)
- tprintf("%#lx, ", tcp->u_arg[0]);
- else
- tprintf("[%lu], ", (unsigned long) gid);
- if (umove(tcp, tcp->u_arg[1], &gid) < 0)
- tprintf("%#lx, ", tcp->u_arg[1]);
- else
- tprintf("[%lu], ", (unsigned long) gid);
- if (umove(tcp, tcp->u_arg[2], &gid) < 0)
- tprintf("%#lx", tcp->u_arg[2]);
- else
- tprintf("[%lu]", (unsigned long) gid);
- }
- }
- return 0;
-}
-
-int
sys_setreuid(struct tcb *tcp)
{
if (entering(tcp)) {
@@ -792,16 +757,6 @@ sys_setreuid(struct tcb *tcp)
}
int
-sys_setregid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- printuid("", tcp->u_arg[0]);
- printuid(", ", tcp->u_arg[1]);
- }
- return 0;
-}
-
-int
sys_setresuid(struct tcb *tcp)
{
if (entering(tcp)) {
@@ -811,16 +766,6 @@ sys_setresuid(struct tcb *tcp)
}
return 0;
}
-int
-sys_setresgid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- printuid("", tcp->u_arg[0]);
- printuid(", ", tcp->u_arg[1]);
- printuid(", ", tcp->u_arg[2]);
- }
- return 0;
-}
int
sys_setgroups(struct tcb *tcp)
@@ -1052,59 +997,6 @@ sys_getgroups32(struct tcb *tcp)
return 0;
}
-#if defined(ALPHA)
-int
-sys_setpgrp(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%lu, %lu", tcp->u_arg[0], tcp->u_arg[1]);
- }
- return 0;
-}
-#endif
-
-int
-sys_getpgrp(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%lu", tcp->u_arg[0]);
- }
- return 0;
-}
-
-int
-sys_getsid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%lu", tcp->u_arg[0]);
- }
- return 0;
-}
-
-int
-sys_setsid(struct tcb *tcp)
-{
- return 0;
-}
-
-int
-sys_getpgid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%lu", tcp->u_arg[0]);
- }
- return 0;
-}
-
-int
-sys_setpgid(struct tcb *tcp)
-{
- if (entering(tcp)) {
- tprintf("%lu, %lu", tcp->u_arg[0], tcp->u_arg[1]);
- }
- return 0;
-}
-
static void
printargv(struct tcb *tcp, long addr)
{
@@ -1433,14 +1325,6 @@ sys_waitid(struct tcb *tcp)
}
int
-sys_alarm(struct tcb *tcp)
-{
- if (entering(tcp))
- tprintf("%lu", tcp->u_arg[0]);
- return 0;
-}
-
-int
sys_uname(struct tcb *tcp)
{
struct utsname uname;
diff --git a/resource.c b/resource.c
index 1aaf7d7..09744d7 100644
--- a/resource.c
+++ b/resource.c
@@ -431,14 +431,6 @@ sys_setpriority(struct tcb *tcp)
}
int
-sys_nice(struct tcb *tcp)
-{
- if (entering(tcp))
- tprintf("%ld", tcp->u_arg[0]);
- return 0;
-}
-
-int
sys_times(struct tcb *tcp)
{
struct tms tbuf;
diff --git a/syscall.c b/syscall.c
index 7360f4f..dce7056 100644
--- a/syscall.c
+++ b/syscall.c
@@ -599,6 +599,30 @@ printargs(struct tcb *tcp)
return 0;
}
+int
+printargs_lu(struct tcb *tcp)
+{
+ if (entering(tcp)) {
+ int i;
+
+ for (i = 0; i < tcp->u_nargs; i++)
+ tprintf("%s%lu", i ? ", " : "", tcp->u_arg[i]);
+ }
+ return 0;
+}
+
+int
+printargs_ld(struct tcb *tcp)
+{
+ if (entering(tcp)) {
+ int i;
+
+ for (i = 0; i < tcp->u_nargs; i++)
+ tprintf("%s%ld", i ? ", " : "", tcp->u_arg[i]);
+ }
+ return 0;
+}
+
long
getrval2(struct tcb *tcp)
{