diff options
38 files changed, 961 insertions, 962 deletions
@@ -49,7 +49,7 @@ #define MOD_RUNNING 1 #define MOD_DELETED 2 #define MOD_AUTOCLEAN 4 -#define MOD_VISITED 8 +#define MOD_VISITED 8 #define MOD_USED_ONCE 16 #define MOD_JUST_FREED 32 #define MOD_INITIALIZING 64 @@ -140,7 +140,7 @@ sys_query_module(struct tcb *tcp) tcp->u_arg[3], data) < 0) { tprintf(" /* %Zu entries */ ", ret); } else { - for (idx=0; idx<ret; idx++) { + for (idx = 0; idx < ret; idx++) { tprintf("%s%s", (idx ? ", " : ""), mod); @@ -167,7 +167,7 @@ sys_query_module(struct tcb *tcp) tcp->u_arg[3], data) < 0) { tprintf(" /* %Zu entries */ ", ret); } else { - for (idx=0; idx<ret; idx++) { + for (idx = 0; idx < ret; idx++) { tprintf("%s{name=%s, value=%lu}", (idx ? " " : ""), data+(long)sym->name, @@ -255,13 +255,13 @@ extern int ptrace(int, int, char *, int, ...); #ifdef SVR4 #ifdef HAVE_MP_PROCFS -extern int mp_ioctl (int f, int c, void *a, int s); -#define IOCTL(f,c,a) mp_ioctl (f, c, a, sizeof *a) +extern int mp_ioctl(int f, int c, void *a, int s); +#define IOCTL(f,c,a) mp_ioctl(f, c, a, sizeof *a) #define IOCTL_STATUS(t) \ - pread (t->pfd_stat, &t->status, sizeof t->status, 0) + pread(t->pfd_stat, &t->status, sizeof t->status, 0) #define IOCTL_WSTOP(t) \ - (IOCTL (t->pfd, PCWSTOP, (char *)NULL) < 0 ? -1 : \ - IOCTL_STATUS (t)) + (IOCTL(t->pfd, PCWSTOP, (char *)NULL) < 0 ? -1 : \ + IOCTL_STATUS(t)) #define PR_WHY pr_lwp.pr_why #define PR_WHAT pr_lwp.pr_what #define PR_REG pr_lwp.pr_context.uc_mcontext.gregs @@ -280,8 +280,8 @@ extern int mp_ioctl (int f, int c, void *a, int s); #define PIOCRUN PCRUN #else #define IOCTL ioctl -#define IOCTL_STATUS(t) ioctl (t->pfd, PIOCSTATUS, &t->status) -#define IOCTL_WSTOP(t) ioctl (t->pfd, PIOCWSTOP, &t->status) +#define IOCTL_STATUS(t) ioctl(t->pfd, PIOCSTATUS, &t->status) +#define IOCTL_WSTOP(t) ioctl(t->pfd, PIOCWSTOP, &t->status) #define PR_WHY pr_why #define PR_WHAT pr_what #define PR_REG pr_reg @@ -292,8 +292,8 @@ extern int mp_ioctl (int f, int c, void *a, int s); #endif #ifdef FREEBSD #define IOCTL ioctl -#define IOCTL_STATUS(t) ioctl (t->pfd, PIOCSTATUS, &t->status) -#define IOCTL_WSTOP(t) ioctl (t->pfd, PIOCWAIT, &t->status) +#define IOCTL_STATUS(t) ioctl(t->pfd, PIOCSTATUS, &t->status) +#define IOCTL_WSTOP(t) ioctl(t->pfd, PIOCWAIT, &t->status) #define PIOCRUN PIOCCONT #define PIOCWSTOP PIOCWAIT #define PR_WHY why @@ -395,7 +395,7 @@ sys_fcntl(struct tcb *tcp) printflock(tcp, tcp->u_arg[2], 1); break; #if _LFS64_LARGEFILE -#if defined(F_GETLK64) && F_GETLK64+0!=F_GETLK +#if defined(F_GETLK64) && F_GETLK64+0 != F_GETLK case F_GETLK64: #endif tprintf(", "); @@ -257,17 +257,17 @@ const struct xlat open_mode_flags[] = { # endif # endif # ifdef O_LARGEFILE - { O_LARGEFILE, "O_LARGEFILE" }, + { O_LARGEFILE, "O_LARGEFILE" }, # endif #endif #ifdef O_DIRECTORY - { O_DIRECTORY, "O_DIRECTORY" }, + { O_DIRECTORY, "O_DIRECTORY" }, #endif #ifdef O_NOFOLLOW - { O_NOFOLLOW, "O_NOFOLLOW" }, + { O_NOFOLLOW, "O_NOFOLLOW" }, #endif #ifdef O_NOATIME - { O_NOATIME, "O_NOATIME" }, + { O_NOATIME, "O_NOATIME" }, #endif #ifdef O_CLOEXEC { O_CLOEXEC, "O_CLOEXEC" }, @@ -946,11 +946,11 @@ static const struct xlat fileflags[] = { { SF_APPEND, "SF_APPEND" }, { SF_NOUNLINK, "SF_NOUNLINK" }, #elif UNIXWARE >= 2 -#ifdef _S_ISMLD - { _S_ISMLD, "_S_ISMLD" }, +#ifdef _S_ISMLD + { _S_ISMLD, "_S_ISMLD" }, #endif -#ifdef _S_ISMOUNTED - { _S_ISMOUNTED, "_S_ISMOUNTED" }, +#ifdef _S_ISMOUNTED + { _S_ISMOUNTED, "_S_ISMOUNTED" }, #endif #endif { 0, NULL }, @@ -1723,7 +1723,7 @@ printstatfs(struct tcb *tcp, long addr) sprintfstype(statbuf.f_type), statbuf.f_bsize, statbuf.f_blocks, statbuf.f_bfree); tprintf("f_bavail=%u, f_files=%u, f_ffree=%u, f_fsid={%d, %d}, f_namelen=%u", - statbuf.f_bavail,statbuf.f_files, statbuf.f_ffree, + statbuf.f_bavail, statbuf.f_files, statbuf.f_ffree, statbuf.f_fsid.__val[0], statbuf.f_fsid.__val[1], statbuf.f_namelen); #else /* !ALPHA */ @@ -1809,7 +1809,7 @@ sys_statfs64(struct tcb *tcp) printpath(tcp, tcp->u_arg[0]); tprintf(", %lu, ", tcp->u_arg[1]); } else { - if (tcp->u_arg[1] == sizeof (struct statfs64)) + if (tcp->u_arg[1] == sizeof(struct statfs64)) printstatfs64(tcp, tcp->u_arg[2]); else tprintf("{???}"); @@ -1824,7 +1824,7 @@ sys_fstatfs64(struct tcb *tcp) printfd(tcp, tcp->u_arg[0]); tprintf(", %lu, ", tcp->u_arg[1]); } else { - if (tcp->u_arg[1] == sizeof (struct statfs64)) + if (tcp->u_arg[1] == sizeof(struct statfs64)) printstatfs64(tcp, tcp->u_arg[2]); else tprintf("{???}"); @@ -2223,7 +2223,7 @@ decode_utimes(struct tcb *tcp, int offset, int special) BITNESS_CURRENT, special); tprintf(", "); printtv_bitness(tcp, tcp->u_arg[offset + 1] - + sizeof (struct timeval), + + sizeof(struct timeval), BITNESS_CURRENT, special); tprintf("}"); } @@ -2402,15 +2402,15 @@ sys_readdir(struct tcb *tcp) #if defined FREEBSD || defined LINUX static const struct xlat direnttypes[] = { - { DT_UNKNOWN, "DT_UNKNOWN" }, - { DT_FIFO, "DT_FIFO" }, - { DT_CHR, "DT_CHR" }, - { DT_DIR, "DT_DIR" }, - { DT_BLK, "DT_BLK" }, - { DT_REG, "DT_REG" }, - { DT_LNK, "DT_LNK" }, - { DT_SOCK, "DT_SOCK" }, - { DT_WHT, "DT_WHT" }, + { DT_UNKNOWN, "DT_UNKNOWN" }, + { DT_FIFO, "DT_FIFO" }, + { DT_CHR, "DT_CHR" }, + { DT_DIR, "DT_DIR" }, + { DT_BLK, "DT_BLK" }, + { DT_REG, "DT_REG" }, + { DT_LNK, "DT_LNK" }, + { DT_SOCK, "DT_SOCK" }, + { DT_WHT, "DT_WHT" }, { 0, NULL }, }; @@ -2969,8 +2969,8 @@ static const struct xlat inotify_modes[] = { static const struct xlat inotify_init_flags[] = { { 0x00000800, "IN_NONBLOCK" }, - { 0x00080000, "IN_CLOEXEC" }, - { 0, NULL } + { 0x00080000, "IN_CLOEXEC" }, + { 0, NULL } }; int @@ -298,7 +298,7 @@ tprint_sembuf(struct tcb *tcp, long addr, unsigned long count) return; } - for(i = 0; i < max_count; ++i) { + for (i = 0; i < max_count; ++i) { struct sembuf sb; if (i) tprintf(", "); diff --git a/linux/arm/syscallent.h b/linux/arm/syscallent.h index 5969900..e0ea811 100644 --- a/linux/arm/syscallent.h +++ b/linux/arm/syscallent.h @@ -202,7 +202,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ @@ -247,7 +247,7 @@ { 1, 0, sys_setgid, "setgid32" }, /* 214 */ { 1, NF, sys_setfsuid, "setfsuid32" }, /* 215 */ { 1, NF, sys_setfsgid, "setfsgid32" }, /* 216 */ - { 3, 0, sys_getdents64, "getdents64" }, /* 217 */ + { 3, 0, sys_getdents64, "getdents64" }, /* 217 */ { 2, TF, sys_pivotroot, "pivot_root" }, /* 218 */ { 3, 0, printargs, "mincore" }, /* 219 */ { 3, 0, sys_madvise, "madvise" }, /* 220 */ diff --git a/linux/avr32/syscallent.h b/linux/avr32/syscallent.h index cae6162..11742c1 100644 --- a/linux/avr32/syscallent.h +++ b/linux/avr32/syscallent.h @@ -94,7 +94,7 @@ { 0, 0, sys_getppid, "getppid" }, /* 64 */ { 0, 0, sys_getpgrp, "getpgrp" }, /* 65 */ { 0, 0, sys_setsid, "setsid" }, /* 66 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 67 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 67 */ { 1, TS, printargs, "rt_sigreturn" }, /* 68 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 69 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 70 */ @@ -292,7 +292,7 @@ { 4, TD, printargs, "sync_file_range" }, /* 262 */ { 4, TD, printargs, "tee" }, /* 263 */ { 4, TD, printargs, "vmsplice" }, /* 264 */ - { 5, TD, sys_epoll_pwait, "epoll_pwait" }, /* 265 */ + { 5, TD, sys_epoll_pwait, "epoll_pwait" }, /* 265 */ { 4, TI, sys_msgget, "msgget" }, /* 266 */ { 4, TI, sys_msgsnd, "msgsnd" }, /* 267 */ { 5, TI, sys_msgrcv, "msgrcv" }, /* 268 */ diff --git a/linux/hppa/syscallent.h b/linux/hppa/syscallent.h index 119c26e..8dbbbeb 100644 --- a/linux/hppa/syscallent.h +++ b/linux/hppa/syscallent.h @@ -233,7 +233,7 @@ { 4, TD, sys_epoll_ctl, "epoll_ctl" }, /* 225 */ { 4, TD, sys_epoll_wait, "epoll_wait" }, /* 226 */ { 5, 0, printargs, "remap_file_pages" }, /* 227 */ - { 5, TI, sys_semtimedop, "semtimedop" }, /* 228 */ + { 5, TI, sys_semtimedop, "semtimedop" }, /* 228 */ { 5, 0, printargs, "mq_open" }, /* 229 */ { 5, 0, printargs, "mq_unlink" }, /* 230 */ { 5, 0, printargs, "mq_timedsend" }, /* 231 */ diff --git a/linux/i386/syscallent.h b/linux/i386/syscallent.h index 54de0ad..16ef36b 100644 --- a/linux/i386/syscallent.h +++ b/linux/i386/syscallent.h @@ -202,7 +202,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ diff --git a/linux/ioctlsort.c b/linux/ioctlsort.c index 6ee6c07..9b18d29 100644 --- a/linux/ioctlsort.c +++ b/linux/ioctlsort.c @@ -28,7 +28,7 @@ int compare(const void* a, const void* b) { unsigned long code2 = ((struct ioctlent *) b)->code; const char *name1 = ((struct ioctlent *) a)->name; const char *name2 = ((struct ioctlent *) b)->name; - return (code1 > code2) ? 1 : (code1 < code2) ? -1 : strcmp (name1, name2); + return (code1 > code2) ? 1 : (code1 < code2) ? -1 : strcmp(name1, name2); } @@ -41,10 +41,10 @@ int main(int argc, char** argv) { (_IOC_TYPEMASK << _IOC_TYPESHIFT); qsort(ioctls, nioctls, sizeof(ioctls[0]), compare); - puts ("\t/* Generated by ioctlsort */"); + puts("\t/* Generated by ioctlsort */"); for (i = 0; i < nioctls; i++) if (i == 0 || ioctls[i].code != ioctls[i-1].code || - strcmp (ioctls[i].name, ioctls[i-1].name)) + strcmp(ioctls[i].name, ioctls[i-1].name)) printf("\t{\"%s\",\t\"%s\",\t%#06lx},\n", ioctls[i].header, ioctls[i].name, ioctls[i].code); diff --git a/linux/m68k/syscallent.h b/linux/m68k/syscallent.h index 48b5378..febb341 100644 --- a/linux/m68k/syscallent.h +++ b/linux/m68k/syscallent.h @@ -202,7 +202,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ diff --git a/linux/microblaze/syscallent.h b/linux/microblaze/syscallent.h index ed6e525..3e1790c 100644 --- a/linux/microblaze/syscallent.h +++ b/linux/microblaze/syscallent.h @@ -149,7 +149,7 @@ { 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 */ + { 3, 0, sys_modify_ldt, "modify_ldt" }, /* 123 */ { 1, 0, sys_adjtimex, "adjtimex" }, /* 124 */ { 3, 0, sys_mprotect, "mprotect" }, /* 125 */ { 3, TS, sys_sigprocmask, "sigprocmask" }, /* 126 */ @@ -200,7 +200,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ diff --git a/linux/powerpc/syscallent.h b/linux/powerpc/syscallent.h index aeae7ed..2ec9247 100644 --- a/linux/powerpc/syscallent.h +++ b/linux/powerpc/syscallent.h @@ -338,7 +338,7 @@ { 1, TD, sys_eventfd, "eventfd" }, /* 307 */ { 4, TD, printargs, "sync_file_range" }, /* 308 */ { 6, TD, sys_fallocate, "fallocate" }, /* 309 */ - { 3, 0, sys_subpage_prot, "subpage_prot" }, /* 310 */ + { 3, 0, sys_subpage_prot, "subpage_prot" }, /* 310 */ { 4, TD, sys_timerfd_settime, "timerfd_settime" }, /* 311 */ { 2, TD, sys_timerfd_gettime, "timerfd_gettime" }, /* 312 */ { 4, TD|TS, sys_signalfd4, "signalfd4" }, /* 313 */ diff --git a/linux/s390/syscallent.h b/linux/s390/syscallent.h index c077731..a4ff152 100644 --- a/linux/s390/syscallent.h +++ b/linux/s390/syscallent.h @@ -246,7 +246,7 @@ { 1, NF, sys_setfsuid, "setfsuid" }, /* 215 */ { 1, NF, sys_setfsgid, "setfsgid" }, /* 216 */ { 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */ - { 3, 0, sys_mincore, "mincore" }, /* 218 */ + { 3, 0, sys_mincore, "mincore" }, /* 218 */ { 3, 0, sys_madvise, "madvise" }, /* 219 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { 3, TD, sys_fcntl, "fcntl64" }, /* 221 */ diff --git a/linux/s390x/syscallent.h b/linux/s390x/syscallent.h index 9ae284e..1ea682a 100644 --- a/linux/s390x/syscallent.h +++ b/linux/s390x/syscallent.h @@ -245,7 +245,7 @@ { 1, NF, sys_setfsuid, "setfsuid" }, /* 215 */ { 1, NF, sys_setfsgid, "setfsgid" }, /* 216 */ { 2, TF, sys_pivotroot, "pivot_root" }, /* 217 */ - { 3, 0, sys_mincore, "mincore" }, /* 218 */ + { 3, 0, sys_mincore, "mincore" }, /* 218 */ { 3, 0, sys_madvise, "madvise" }, /* 219 */ { 3, TD, sys_getdents64, "getdents64" }, /* 220 */ { -1, 0, printargs, "SYS_221" }, /* 221 */ diff --git a/linux/sh/syscallent.h b/linux/sh/syscallent.h index 6ad858e..6ffbe0c 100644 --- a/linux/sh/syscallent.h +++ b/linux/sh/syscallent.h @@ -120,7 +120,7 @@ { 1, TF, sys_swapon, "swapon" }, /* 87 */ { 3, 0, sys_reboot, "reboot" }, /* 88 */ { 3, TD, sys_readdir, "readdir" }, /* 89 */ - { 6, TD, sys_old_mmap, "old_mmap" }, /* 90 */ + { 6, TD, sys_old_mmap, "old_mmap" }, /* 90 */ { 2, 0, sys_munmap, "munmap" }, /* 91 */ { 2, TF, sys_truncate, "truncate" }, /* 92 */ { 2, TD, sys_ftruncate, "ftruncate" }, /* 93 */ @@ -204,7 +204,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ diff --git a/linux/sh64/syscallent.h b/linux/sh64/syscallent.h index 6f147a9..3103207 100644 --- a/linux/sh64/syscallent.h +++ b/linux/sh64/syscallent.h @@ -202,7 +202,7 @@ { 3, 0, sys_getresgid, "getresgid" }, /* 171 */ { 5, 0, sys_prctl, "prctl" }, /* 172 */ { 1, TS, printargs, "rt_sigreturn" }, /* 173 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 174 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 175 */ { 2, TS, sys_rt_sigpending, "rt_sigpending" }, /* 176 */ { 4, TS, sys_rt_sigtimedwait, "rt_sigtimedwait"}, /* 177 */ diff --git a/linux/tile/syscallent.h b/linux/tile/syscallent.h index bf5fa55..b548157 100644 --- a/linux/tile/syscallent.h +++ b/linux/tile/syscallent.h @@ -55,7 +55,7 @@ { 0, 0, sys_getppid, "getppid" }, /* 54 */ { 0, 0, sys_getpgrp, "getpgrp" }, /* 55 */ { 0, 0, sys_setsid, "setsid" }, /* 56 */ - { 0, TS, printargs, "sgetmask" }, /* 57 */ + { 0, TS, printargs, "sgetmask" }, /* 57 */ { 1, TS, printargs, "ssetmask" }, /* 58 */ { 2, 0, sys_setreuid, "setreuid" }, /* 59 */ { 2, 0, sys_setregid, "setregid" }, /* 60 */ @@ -287,7 +287,7 @@ { 4, TD, printargs, "sync_file_range" }, /* 286 */ { 4, TD, printargs, "tee" }, /* 287 */ { 4, TD, printargs, "vmsplice" }, /* 288 */ - { 6, TP, sys_move_pages, "move_pages" }, /* 289 */ + { 6, TP, sys_move_pages, "move_pages" }, /* 289 */ { 1, TP, printargs, "unused" }, /* 290 */ { 1, 0, printargs, "cmpxchg_badaddr" }, /* 291 */ { 3, 0, sys_getcpu, "getcpu" }, /* 292 */ diff --git a/linux/x86_64/syscallent.h b/linux/x86_64/syscallent.h index c58cc82..065b8ff 100644 --- a/linux/x86_64/syscallent.h +++ b/linux/x86_64/syscallent.h @@ -11,7 +11,7 @@ { 3, 0, sys_mprotect, "mprotect" }, /* 10 */ { 2, 0, sys_munmap, "munmap" }, /* 11 */ { 1, 0, sys_brk, "brk" }, /* 12 */ - { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 13 */ + { 4, TS, sys_rt_sigaction, "rt_sigaction" }, /* 13 */ { 4, TS, sys_rt_sigprocmask, "rt_sigprocmask"}, /* 14 */ { 1, TS, printargs, "rt_sigreturn" }, /* 15 */ { 3, TD, sys_ioctl, "ioctl" }, /* 16 */ @@ -289,7 +289,7 @@ int sys_old_mmap(struct tcb *tcp) #elif defined(SH) || defined(SH64) /* SH has always passed the args in registers */ int i; - for (i=0; i<6; i++) + for (i = 0; i < 6; i++) u_arg[i] = tcp->u_arg[i]; #else # if defined(X86_64) @@ -627,7 +627,7 @@ sys_modify_ldt(struct tcb *tcp) struct modify_ldt_ldt_s copy; tprintf("%ld", tcp->u_arg[0]); if (tcp->u_arg[1] == 0 - || tcp->u_arg[2] != sizeof (struct modify_ldt_ldt_s) + || tcp->u_arg[2] != sizeof(struct modify_ldt_ldt_s) || umove(tcp, tcp->u_arg[1], ©) == -1) tprintf(", %lx", tcp->u_arg[1]); else { @@ -875,7 +875,7 @@ sys_move_pages(struct tcb *tcp) break; } tprintf("%p", p); - puser += sizeof (void *); + puser += sizeof(void *); } tprintf("}, "); } @@ -894,7 +894,7 @@ sys_move_pages(struct tcb *tcp) break; } tprintf("%#x", node); - nodeuser += sizeof (int); + nodeuser += sizeof(int); } tprintf("}, "); } @@ -916,7 +916,7 @@ sys_move_pages(struct tcb *tcp) break; } tprintf("%#x", status); - statususer += sizeof (int); + statususer += sizeof(int); } tprintf("}, "); } @@ -893,8 +893,8 @@ static const struct xlat sockipv6options[] = { #ifdef SOL_IPX static const struct xlat sockipxoptions[] = { - { IPX_TYPE, "IPX_TYPE" }, - { 0, NULL }, + { IPX_TYPE, "IPX_TYPE" }, + { 0, NULL }, }; #endif /* SOL_IPX */ @@ -1267,24 +1267,24 @@ printsock(struct tcb *tcp, long addr, int addrlen) #ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_SCOPE_ID { #if defined(HAVE_IF_INDEXTONAME) && defined(IN6_IS_ADDR_LINKLOCAL) && defined(IN6_IS_ADDR_MC_LINKLOCAL) - int numericscope = 0; - if (IN6_IS_ADDR_LINKLOCAL (&addrbuf.sa6.sin6_addr) - || IN6_IS_ADDR_MC_LINKLOCAL (&addrbuf.sa6.sin6_addr)) { - char scopebuf[IFNAMSIZ + 1]; + int numericscope = 0; + if (IN6_IS_ADDR_LINKLOCAL(&addrbuf.sa6.sin6_addr) + || IN6_IS_ADDR_MC_LINKLOCAL(&addrbuf.sa6.sin6_addr)) { + char scopebuf[IFNAMSIZ + 1]; - if (if_indextoname (addrbuf.sa6.sin6_scope_id, scopebuf) == NULL) - numericscope++; - else - tprintf(", sin6_scope_id=if_nametoindex(\"%s\")", scopebuf); - } else - numericscope++; + if (if_indextoname(addrbuf.sa6.sin6_scope_id, scopebuf) == NULL) + numericscope++; + else + tprintf(", sin6_scope_id=if_nametoindex(\"%s\")", scopebuf); + } else + numericscope++; - if (numericscope) + if (numericscope) #endif - tprintf(", sin6_scope_id=%u", addrbuf.sa6.sin6_scope_id); + tprintf(", sin6_scope_id=%u", addrbuf.sa6.sin6_scope_id); } #endif - break; + break; #endif #if defined(AF_IPX) && defined(linux) case AF_IPX: @@ -1299,7 +1299,7 @@ printsock(struct tcb *tcp, long addr, int addrlen) * this way.. :) */ tprintf("%08lx:", (unsigned long)ntohl(addrbuf.sipx.sipx_network)); - for (i = 0; i<IPX_NODE_LEN; i++) + for (i = 0; i < IPX_NODE_LEN; i++) tprintf("%02x", addrbuf.sipx.sipx_node[i]); tprintf("/[%02x]", addrbuf.sipx.sipx_type); } @@ -1316,7 +1316,7 @@ printsock(struct tcb *tcp, long addr, int addrlen) tprintf(", addr(%d)={%d, ", addrbuf.ll.sll_halen, addrbuf.ll.sll_hatype); - for (i=0; i<addrbuf.ll.sll_halen; i++) + for (i = 0; i < addrbuf.ll.sll_halen; i++) tprintf("%02x", addrbuf.ll.sll_addr[i]); } break; @@ -1373,7 +1373,7 @@ printcmsghdr(struct tcb *tcp, unsigned long addr, unsigned long len) if (cmsg->cmsg_type == SCM_RIGHTS && CMSG_LEN(sizeof(int)) <= cmsg_len) { - int *fds = (int *) CMSG_DATA (cmsg); + int *fds = (int *) CMSG_DATA(cmsg); int first = 1; tprintf(", {"); @@ -1389,7 +1389,7 @@ printcmsghdr(struct tcb *tcp, unsigned long addr, unsigned long len) } if (cmsg->cmsg_type == SCM_CREDENTIALS && CMSG_LEN(sizeof(struct ucred)) <= cmsg_len) { - struct ucred *uc = (struct ucred *) CMSG_DATA (cmsg); + struct ucred *uc = (struct ucred *) CMSG_DATA(cmsg); tprintf("{pid=%ld, uid=%ld, gid=%ld}}", (long)uc->pid, (long)uc->uid, (long)uc->gid); @@ -1574,7 +1574,7 @@ do_accept(struct tcb *tcp, int flags_arg) else { int len; if (tcp->u_arg[1] == 0 || syserror(tcp) - || umove (tcp, tcp->u_arg[2], &len) < 0) { + || umove(tcp, tcp->u_arg[2], &len) < 0) { tprintf("%#lx", tcp->u_arg[1]); } else { printsock(tcp, tcp->u_arg[1], len); @@ -1784,10 +1784,10 @@ sys_recvmmsg(struct tcb *tcp) #endif /* HAVE_SENDMSG */ static const struct xlat shutdown_modes[] = { - { 0, "SHUT_RD" }, - { 1, "SHUT_WR" }, - { 2, "SHUT_RDWR" }, - { 0, NULL } + { 0, "SHUT_RD" }, + { 1, "SHUT_WR" }, + { 2, "SHUT_RDWR" }, + { 0, NULL } }; int @@ -1906,7 +1906,7 @@ sys_getsockopt(struct tcb *tcp) if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); printxval(socketlayers, tcp->u_arg[1], "SOL_???"); - tprintf (", "); + tprintf(", "); switch (tcp->u_arg[1]) { case SOL_SOCKET: printxval(sockoptions, tcp->u_arg[2], "SO_???"); @@ -1948,10 +1948,10 @@ sys_getsockopt(struct tcb *tcp) tprintf("%lu", tcp->u_arg[2]); break; } - tprintf (", "); + tprintf(", "); } else { int len; - if (syserror(tcp) || umove (tcp, tcp->u_arg[4], &len) < 0) { + if (syserror(tcp) || umove(tcp, tcp->u_arg[4], &len) < 0) { tprintf("%#lx, %#lx", tcp->u_arg[3], tcp->u_arg[4]); return 0; @@ -1962,9 +1962,9 @@ sys_getsockopt(struct tcb *tcp) switch (tcp->u_arg[2]) { #ifdef SO_LINGER case SO_LINGER: - if (len == sizeof (struct linger)) { + if (len == sizeof(struct linger)) { struct linger linger; - if (umove (tcp, + if (umove(tcp, tcp->u_arg[3], &linger) < 0) break; @@ -1979,9 +1979,9 @@ sys_getsockopt(struct tcb *tcp) #endif #ifdef SO_PEERCRED case SO_PEERCRED: - if (len == sizeof (struct ucred)) { + if (len == sizeof(struct ucred)) { struct ucred uc; - if (umove (tcp, + if (umove(tcp, tcp->u_arg[3], &uc) < 0) break; @@ -2003,7 +2003,7 @@ sys_getsockopt(struct tcb *tcp) case PACKET_STATISTICS: if (len == sizeof(struct tpacket_stats)) { struct tpacket_stats stats; - if (umove (tcp, + if (umove(tcp, tcp->u_arg[3], &stats) < 0) break; @@ -2020,11 +2020,11 @@ sys_getsockopt(struct tcb *tcp) break; } - if (len == sizeof (int)) { + if (len == sizeof(int)) { printnum_int(tcp, tcp->u_arg[3], "%d"); } else { - printstr (tcp, tcp->u_arg[3], len); + printstr(tcp, tcp->u_arg[3], len); } tprintf(", [%d]", len); } @@ -2059,16 +2059,16 @@ static int printsockopt(struct tcb *tcp, int level, int name, long addr, int len) { printxval(socketlayers, level, "SOL_??"); - tprintf (", "); + tprintf(", "); switch (level) { case SOL_SOCKET: printxval(sockoptions, name, "SO_???"); switch (name) { #if defined(SO_LINGER) case SO_LINGER: - if (len == sizeof (struct linger)) { + if (len == sizeof(struct linger)) { struct linger linger; - if (umove (tcp, addr, &linger) < 0) + if (umove(tcp, addr, &linger) < 0) break; tprintf(", {onoff=%d, linger=%d}", linger.l_onoff, @@ -2155,13 +2155,13 @@ printsockopt(struct tcb *tcp, int level, int name, long addr, int len) /* default arg printing */ - tprintf (", "); + tprintf(", "); - if (len == sizeof (int)) { - printnum_int (tcp, addr, "%d"); + if (len == sizeof(int)) { + printnum_int(tcp, addr, "%d"); } else { - printstr (tcp, addr, len); + printstr(tcp, addr, len); } return 0; } @@ -2178,26 +2178,26 @@ print_sock_optmgmt(struct tcb *tcp, long addr, int len) while (len >= (int) sizeof hdr) { if (umove(tcp, addr, &hdr) < 0) break; if (c++) { - tprintf (", "); + tprintf(", "); } else if (len > hdr.len + sizeof hdr) { - tprintf ("["); + tprintf("["); } - tprintf ("{"); + tprintf("{"); addr += sizeof hdr; len -= sizeof hdr; - printsockopt (tcp, hdr.level, hdr.name, addr, hdr.len); + printsockopt(tcp, hdr.level, hdr.name, addr, hdr.len); if (hdr.len > 0) { addr += hdr.len; len -= hdr.len; } - tprintf ("}"); + tprintf("}"); } if (len > 0) { - if (c++) tprintf (", "); - printstr (tcp, addr, len); + if (c++) tprintf(", "); + printstr(tcp, addr, len); } - if (c > 1) tprintf ("]"); + if (c > 1) tprintf("]"); } #endif @@ -2207,7 +2207,7 @@ sys_setsockopt(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); - printsockopt (tcp, tcp->u_arg[1], tcp->u_arg[2], + printsockopt(tcp, tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]); tprintf(", %lu", tcp->u_arg[4]); } @@ -2223,7 +2223,7 @@ static const struct xlat sock_version[] = { { __NETLIB_GEMINI_XPG4, "GEMINI_XPG4" }, { __NETLIB_FP1_SVR4, "FP1_SVR4" }, { __NETLIB_FP1_XPG4, "FP1_XPG4" }, - { 0, NULL }, + { 0, NULL }, }; @@ -2232,82 +2232,81 @@ netlib_call(struct tcb *tcp, int (*func)()) { if (entering(tcp)) { int i; - printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); + printxval(sock_version, tcp->u_arg[0], "__NETLIB_???"); tprintf(", "); --tcp->u_nargs; for (i = 0; i < tcp->u_nargs; i++) tcp->u_arg[i] = tcp->u_arg[i + 1]; - return func (tcp); - + return func(tcp); } - return func (tcp); + return func(tcp); } int sys_xsocket(struct tcb *tcp) { - return netlib_call (tcp, sys_socket); + return netlib_call(tcp, sys_socket); } int sys_xsocketpair(struct tcb *tcp) { - return netlib_call (tcp, sys_socketpair); + return netlib_call(tcp, sys_socketpair); } int sys_xbind(struct tcb *tcp) { - return netlib_call (tcp, sys_bind); + return netlib_call(tcp, sys_bind); } int sys_xconnect(struct tcb *tcp) { - return netlib_call (tcp, sys_connect); + return netlib_call(tcp, sys_connect); } int sys_xlisten(struct tcb *tcp) { - return netlib_call (tcp, sys_listen); + return netlib_call(tcp, sys_listen); } int sys_xaccept(struct tcb *tcp) { - return netlib_call (tcp, sys_accept); + return netlib_call(tcp, sys_accept); } int sys_xsendmsg(struct tcb *tcp) { - return netlib_call (tcp, sys_sendmsg); + return netlib_call(tcp, sys_sendmsg); } int sys_xrecvmsg(struct tcb *tcp) { - return netlib_call (tcp, sys_recvmsg); + return netlib_call(tcp, sys_recvmsg); } int sys_xgetsockaddr(struct tcb *tcp) { if (entering(tcp)) { - printxval (sock_version, tcp->u_arg[0], "__NETLIB_???"); + printxval(sock_version, tcp->u_arg[0], "__NETLIB_???"); tprintf(", "); if (tcp->u_arg[1] == 0) { - tprintf ("LOCALNAME, "); + tprintf("LOCALNAME, "); } else if (tcp->u_arg[1] == 1) { - tprintf ("REMOTENAME, "); + tprintf("REMOTENAME, "); } else { - tprintf ("%ld, ", tcp->u_arg [1]); + tprintf("%ld, ", tcp->u_arg[1]); } - tprintf ("%ld, ", tcp->u_arg [2]); + tprintf("%ld, ", tcp->u_arg[2]); } else { if (tcp->u_arg[3] == 0 || syserror(tcp)) { @@ -2326,19 +2325,19 @@ sys_xgetsockaddr(struct tcb *tcp) int sys_xgetsockopt(struct tcb *tcp) { - return netlib_call (tcp, sys_getsockopt); + return netlib_call(tcp, sys_getsockopt); } int sys_xsetsockopt(struct tcb *tcp) { - return netlib_call (tcp, sys_setsockopt); + return netlib_call(tcp, sys_setsockopt); } int sys_xshutdown(struct tcb *tcp) { - return netlib_call (tcp, sys_shutdown); + return netlib_call(tcp, sys_shutdown); } #endif /* UNIXWARE */ diff --git a/pathtrace.c b/pathtrace.c index bcab4bb..397f235 100644 --- a/pathtrace.c +++ b/pathtrace.c @@ -40,7 +40,7 @@ #include "syscall.h" -#define NumElem(a) ((int)((sizeof (a))/((sizeof (a)[0])))) +#define NumElem(a) (int)(sizeof(a) / sizeof((a)[0])) #define MAXSELECTED 256 /* max number of "selected" paths */ static const char *selected[MAXSELECTED]; /* paths selected for tracing */ @@ -202,7 +202,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")) + !strcmp(s->sys_name, "tee")) { /* fd, fd */ return fdmatch(tcp, tcp->u_arg[0]) || @@ -221,7 +221,7 @@ pathtrace_match(struct tcb *tcp) s->sys_func == sys_readlinkat || s->sys_func == sys_utimensat || s->sys_func == sys_fchownat || - s->sys_func == sys_pipe2) + s->sys_func == sys_pipe2) { /* fd, path */ return fdmatch(tcp, tcp->u_arg[0]) || @@ -232,7 +232,7 @@ pathtrace_match(struct tcb *tcp) s->sys_func == sys_pivotroot || s->sys_func == sys_rename || s->sys_func == sys_symlink || - s->sys_func == sys_mount) + s->sys_func == sys_mount) { /* path, path */ return upathmatch(tcp, tcp->u_arg[0]) || @@ -240,7 +240,7 @@ pathtrace_match(struct tcb *tcp) } if (s->sys_func == sys_renameat || - s->sys_func == sys_linkat) + s->sys_func == sys_linkat) { /* fd, path, fd, path */ return fdmatch(tcp, tcp->u_arg[0]) || @@ -260,7 +260,7 @@ pathtrace_match(struct tcb *tcp) /* path, fd, path */ return fdmatch(tcp, tcp->u_arg[1]) || upathmatch(tcp, tcp->u_arg[0]) || - upathmatch(tcp, tcp->u_arg[2]); + upathmatch(tcp, tcp->u_arg[2]); } if (!strcmp(s->sys_name, "splice")) @@ -278,7 +278,7 @@ pathtrace_match(struct tcb *tcp) if (s->sys_func == sys_select || s->sys_func == sys_oldselect || - s->sys_func == sys_pselect6) + s->sys_func == sys_pselect6) { int i, j, nfds; long *args, oldargs[5]; @@ -331,7 +331,7 @@ pathtrace_match(struct tcb *tcp) } if (s->sys_func == sys_poll || - s->sys_func == sys_ppoll) + s->sys_func == sys_ppoll) { struct pollfd fds; unsigned nfds; @@ -480,7 +480,7 @@ int sys_rfork(struct tcb *tcp) { if (entering(tcp)) { - tprintf ("%ld", tcp->u_arg[0]); + tprintf("%ld", tcp->u_arg[0]); } else if (!syserror(tcp)) { if (getrval2(tcp)) { @@ -692,27 +692,27 @@ change_syscall(struct tcb *tcp, int new) return 0; #elif defined(S390) || defined(S390X) /* s390 linux after 2.4.7 has a hook in entry.S to allow this */ - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR2), new) < 0) return -1; return 0; #elif defined(M68K) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_ORIG_D0), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*PT_ORIG_D0), new) < 0) return -1; return 0; #elif defined(SPARC) || defined(SPARC64) struct pt_regs regs; - if (ptrace(PTRACE_GETREGS, tcp->pid, (char*)®s, 0)<0) + if (ptrace(PTRACE_GETREGS, tcp->pid, (char*)®s, 0) < 0) return -1; regs.u_regs[U_REG_G1] = new; - if (ptrace(PTRACE_SETREGS, tcp->pid, (char*)®s, 0)<0) + if (ptrace(PTRACE_SETREGS, tcp->pid, (char*)®s, 0) < 0) return -1; return 0; #elif defined(MIPS) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_V0), new) < 0) return -1; return 0; #elif defined(ALPHA) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_A3), new) < 0) return -1; return 0; #elif defined(AVR32) @@ -720,7 +720,7 @@ change_syscall(struct tcb *tcp, int new) return -1; return 0; #elif defined(BFIN) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_P0), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(REG_P0), new) < 0) return -1; return 0; #elif defined(IA64) @@ -736,17 +736,17 @@ change_syscall(struct tcb *tcp, int new) __FUNCTION__, new); return -1; } - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R1), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R1), new) < 0) return -1; - } else if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R15), new)<0) + } else if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_R15), new) < 0) return -1; return 0; #elif defined(HPPA) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GR20), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GR20), new) < 0) return -1; return 0; #elif defined(SH) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(4*(REG_REG0+3)), new) < 0) return -1; return 0; #elif defined(SH64) @@ -766,7 +766,7 @@ change_syscall(struct tcb *tcp, int new) # define PTRACE_SET_SYSCALL 23 # endif - if (ptrace (PTRACE_SET_SYSCALL, tcp->pid, 0, new & 0xffff) != 0) + if (ptrace(PTRACE_SET_SYSCALL, tcp->pid, 0, new & 0xffff) != 0) return -1; return 0; @@ -777,7 +777,7 @@ change_syscall(struct tcb *tcp, int new) return -1; return 0; #elif defined(MICROBLAZE) - if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR(0)), new)<0) + if (ptrace(PTRACE_POKEUSER, tcp->pid, (char*)(PT_GPR(0)), new) < 0) return -1; return 0; #else @@ -1513,7 +1513,7 @@ sys_setpgid(struct tcb *tcp) #include <sys/privilege.h> -static const struct xlat procpriv_cmds [] = { +static const struct xlat procpriv_cmds[] = { { SETPRV, "SETPRV" }, { CLRPRV, "CLRPRV" }, { PUTPRV, "PUTPRV" }, @@ -1523,7 +1523,7 @@ static const struct xlat procpriv_cmds [] = { }; -static const struct xlat procpriv_priv [] = { +static const struct xlat procpriv_priv[] = { { P_OWNER, "P_OWNER" }, { P_AUDIT, "P_AUDIT" }, { P_COMPAT, "P_COMPAT" }, @@ -1556,7 +1556,7 @@ static const struct xlat procpriv_priv [] = { }; -static const struct xlat procpriv_type [] = { +static const struct xlat procpriv_type[] = { { PS_FIX, "PS_FIX" }, { PS_INH, "PS_INH" }, { PS_MAX, "PS_MAX" }, @@ -1568,40 +1568,40 @@ static const struct xlat procpriv_type [] = { static void printpriv(struct tcb *tcp, long addr, int len, const struct xlat *opt) { - priv_t buf [128]; - int max = verbose (tcp) ? sizeof buf / sizeof buf [0] : 10; + priv_t buf[128]; + int max = verbose(tcp) ? sizeof buf / sizeof buf[0] : 10; int dots = len > max; int i; if (len > max) len = max; if (len <= 0 || - umoven (tcp, addr, len * sizeof buf[0], (char *) buf) < 0) + umoven(tcp, addr, len * sizeof buf[0], (char *) buf) < 0) { - tprintf ("%#lx", addr); + tprintf("%#lx", addr); return; } - tprintf ("["); + tprintf("["); for (i = 0; i < len; ++i) { const char *t, *p; - if (i) tprintf (", "); + if (i) tprintf(", "); - if ((t = xlookup (procpriv_type, buf [i] & PS_TYPE)) && - (p = xlookup (procpriv_priv, buf [i] & ~PS_TYPE))) + if ((t = xlookup(procpriv_type, buf[i] & PS_TYPE)) && + (p = xlookup(procpriv_priv, buf[i] & ~PS_TYPE))) { - tprintf ("%s|%s", t, p); + tprintf("%s|%s", t, p); } else { - tprintf ("%#lx", buf [i]); + tprintf("%#lx", buf[i]); } } - if (dots) tprintf (" ..."); + if (dots) tprintf(" ..."); - tprintf ("]"); + tprintf("]"); } @@ -1619,19 +1619,19 @@ sys_procpriv(struct tcb *tcp) break; default: - tprintf (", "); - printpriv (tcp, tcp->u_arg[1], tcp->u_arg[2]); - tprintf (", %ld", tcp->u_arg[2]); + tprintf(", "); + printpriv(tcp, tcp->u_arg[1], tcp->u_arg[2]); + tprintf(", %ld", tcp->u_arg[2]); } } else if (tcp->u_arg[0] == GETPRV) { - if (syserror (tcp)) { + if (syserror(tcp)) { tprintf(", %#lx, %ld", tcp->u_arg[1], tcp->u_arg[2]); } else { - tprintf (", "); - printpriv (tcp, tcp->u_arg[1], tcp->u_rval); - tprintf (", %ld", tcp->u_arg[2]); + tprintf(", "); + printpriv(tcp, tcp->u_arg[1], tcp->u_rval); + tprintf(", %ld", tcp->u_arg[2]); } } @@ -1730,9 +1730,9 @@ sys_execve(struct tcb *tcp) int sys_rexecve(struct tcb *tcp) { - if (entering (tcp)) { - sys_execve (tcp); - tprintf (", %ld", tcp->u_arg[3]); + if (entering(tcp)) { + sys_execve(tcp); + tprintf(", %ld", tcp->u_arg[3]); } return 0; } @@ -2412,7 +2412,7 @@ const struct xlat struct_user_offsets[] = { { PT_CR_9, "cr9" }, { PT_CR_10, "cr10" }, { PT_CR_11, "cr11" }, - { PT_IEEE_IP, "ieee_exception_ip" }, + { PT_IEEE_IP, "ieee_exception_ip" }, # elif defined(SPARC) /* XXX No support for these offsets yet. */ # elif defined(HPPA) @@ -2620,10 +2620,10 @@ const struct xlat struct_user_offsets[] = { { 4*UESP, "4*UESP" }, { 4*SS, "4*SS" }, # elif defined(X86_64) - { 8*R15, "8*R15" }, - { 8*R14, "8*R14" }, - { 8*R13, "8*R13" }, - { 8*R12, "8*R12" }, + { 8*R15, "8*R15" }, + { 8*R14, "8*R14" }, + { 8*R13, "8*R13" }, + { 8*R12, "8*R12" }, { 8*RBP, "8*RBP" }, { 8*RBX, "8*RBX" }, { 8*R11, "8*R11" }, @@ -2662,210 +2662,210 @@ const struct xlat struct_user_offsets[] = { { 4*PT_SR, "4*PT_SR" }, { 4*PT_PC, "4*PT_PC" }, # elif defined(SH) - { 4*REG_REG0, "4*REG_REG0" }, - { 4*(REG_REG0+1), "4*REG_REG1" }, - { 4*(REG_REG0+2), "4*REG_REG2" }, - { 4*(REG_REG0+3), "4*REG_REG3" }, - { 4*(REG_REG0+4), "4*REG_REG4" }, - { 4*(REG_REG0+5), "4*REG_REG5" }, - { 4*(REG_REG0+6), "4*REG_REG6" }, - { 4*(REG_REG0+7), "4*REG_REG7" }, - { 4*(REG_REG0+8), "4*REG_REG8" }, - { 4*(REG_REG0+9), "4*REG_REG9" }, - { 4*(REG_REG0+10), "4*REG_REG10" }, - { 4*(REG_REG0+11), "4*REG_REG11" }, - { 4*(REG_REG0+12), "4*REG_REG12" }, - { 4*(REG_REG0+13), "4*REG_REG13" }, - { 4*(REG_REG0+14), "4*REG_REG14" }, - { 4*REG_REG15, "4*REG_REG15" }, - { 4*REG_PC, "4*REG_PC" }, - { 4*REG_PR, "4*REG_PR" }, - { 4*REG_SR, "4*REG_SR" }, - { 4*REG_GBR, "4*REG_GBR" }, - { 4*REG_MACH, "4*REG_MACH" }, - { 4*REG_MACL, "4*REG_MACL" }, - { 4*REG_SYSCALL, "4*REG_SYSCALL" }, - { 4*REG_FPUL, "4*REG_FPUL" }, - { 4*REG_FPREG0, "4*REG_FPREG0" }, - { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, - { 4*(REG_FPREG0+2), "4*REG_FPREG2" }, - { 4*(REG_FPREG0+3), "4*REG_FPREG3" }, - { 4*(REG_FPREG0+4), "4*REG_FPREG4" }, - { 4*(REG_FPREG0+5), "4*REG_FPREG5" }, - { 4*(REG_FPREG0+6), "4*REG_FPREG6" }, - { 4*(REG_FPREG0+7), "4*REG_FPREG7" }, - { 4*(REG_FPREG0+8), "4*REG_FPREG8" }, - { 4*(REG_FPREG0+9), "4*REG_FPREG9" }, - { 4*(REG_FPREG0+10), "4*REG_FPREG10" }, - { 4*(REG_FPREG0+11), "4*REG_FPREG11" }, - { 4*(REG_FPREG0+12), "4*REG_FPREG12" }, - { 4*(REG_FPREG0+13), "4*REG_FPREG13" }, - { 4*(REG_FPREG0+14), "4*REG_FPREG14" }, - { 4*REG_FPREG15, "4*REG_FPREG15" }, + { 4*REG_REG0, "4*REG_REG0" }, + { 4*(REG_REG0+1), "4*REG_REG1" }, + { 4*(REG_REG0+2), "4*REG_REG2" }, + { 4*(REG_REG0+3), "4*REG_REG3" }, + { 4*(REG_REG0+4), "4*REG_REG4" }, + { 4*(REG_REG0+5), "4*REG_REG5" }, + { 4*(REG_REG0+6), "4*REG_REG6" }, + { 4*(REG_REG0+7), "4*REG_REG7" }, + { 4*(REG_REG0+8), "4*REG_REG8" }, + { 4*(REG_REG0+9), "4*REG_REG9" }, + { 4*(REG_REG0+10), "4*REG_REG10" }, + { 4*(REG_REG0+11), "4*REG_REG11" }, + { 4*(REG_REG0+12), "4*REG_REG12" }, + { 4*(REG_REG0+13), "4*REG_REG13" }, + { 4*(REG_REG0+14), "4*REG_REG14" }, + { 4*REG_REG15, "4*REG_REG15" }, + { 4*REG_PC, "4*REG_PC" }, + { 4*REG_PR, "4*REG_PR" }, + { 4*REG_SR, "4*REG_SR" }, + { 4*REG_GBR, "4*REG_GBR" }, + { 4*REG_MACH, "4*REG_MACH" }, + { 4*REG_MACL, "4*REG_MACL" }, + { 4*REG_SYSCALL, "4*REG_SYSCALL" }, + { 4*REG_FPUL, "4*REG_FPUL" }, + { 4*REG_FPREG0, "4*REG_FPREG0" }, + { 4*(REG_FPREG0+1), "4*REG_FPREG1" }, + { 4*(REG_FPREG0+2), "4*REG_FPREG2" }, + { 4*(REG_FPREG0+3), "4*REG_FPREG3" }, + { 4*(REG_FPREG0+4), "4*REG_FPREG4" }, + { 4*(REG_FPREG0+5), "4*REG_FPREG5" }, + { 4*(REG_FPREG0+6), "4*REG_FPREG6" }, + { 4*(REG_FPREG0+7), "4*REG_FPREG7" }, + { 4*(REG_FPREG0+8), "4*REG_FPREG8" }, + { 4*(REG_FPREG0+9), "4*REG_FPREG9" }, + { 4*(REG_FPREG0+10), "4*REG_FPREG10" }, + { 4*(REG_FPREG0+11), "4*REG_FPREG11" }, + { 4*(REG_FPREG0+12), "4*REG_FPREG12" }, + { 4*(REG_FPREG0+13), "4*REG_FPREG13" }, + { 4*(REG_FPREG0+14), "4*REG_FPREG14" }, + { 4*REG_FPREG15, "4*REG_FPREG15" }, # ifdef REG_XDREG0 - { 4*REG_XDREG0, "4*REG_XDREG0" }, - { 4*(REG_XDREG0+2), "4*REG_XDREG2" }, - { 4*(REG_XDREG0+4), "4*REG_XDREG4" }, - { 4*(REG_XDREG0+6), "4*REG_XDREG6" }, - { 4*(REG_XDREG0+8), "4*REG_XDREG8" }, - { 4*(REG_XDREG0+10), "4*REG_XDREG10" }, - { 4*(REG_XDREG0+12), "4*REG_XDREG12" }, - { 4*REG_XDREG14, "4*REG_XDREG14" }, + { 4*REG_XDREG0, "4*REG_XDREG0" }, + { 4*(REG_XDREG0+2), "4*REG_XDREG2" }, + { 4*(REG_XDREG0+4), "4*REG_XDREG4" }, + { 4*(REG_XDREG0+6), "4*REG_XDREG6" }, + { 4*(REG_XDREG0+8), "4*REG_XDREG8" }, + { 4*(REG_XDREG0+10), "4*REG_XDREG10" }, + { 4*(REG_XDREG0+12), "4*REG_XDREG12" }, + { 4*REG_XDREG14, "4*REG_XDREG14" }, # endif - { 4*REG_FPSCR, "4*REG_FPSCR" }, + { 4*REG_FPSCR, "4*REG_FPSCR" }, # elif defined(SH64) - { 0, "PC(L)" }, - { 4, "PC(U)" }, - { 8, "SR(L)" }, - { 12, "SR(U)" }, - { 16, "syscall no.(L)" }, - { 20, "syscall_no.(U)" }, - { 24, "R0(L)" }, - { 28, "R0(U)" }, - { 32, "R1(L)" }, - { 36, "R1(U)" }, - { 40, "R2(L)" }, - { 44, "R2(U)" }, - { 48, "R3(L)" }, - { 52, "R3(U)" }, - { 56, "R4(L)" }, - { 60, "R4(U)" }, - { 64, "R5(L)" }, - { 68, "R5(U)" }, - { 72, "R6(L)" }, - { 76, "R6(U)" }, - { 80, "R7(L)" }, - { 84, "R7(U)" }, - { 88, "R8(L)" }, - { 92, "R8(U)" }, - { 96, "R9(L)" }, - { 100, "R9(U)" }, - { 104, "R10(L)" }, - { 108, "R10(U)" }, - { 112, "R11(L)" }, - { 116, "R11(U)" }, - { 120, "R12(L)" }, - { 124, "R12(U)" }, - { 128, "R13(L)" }, - { 132, "R13(U)" }, - { 136, "R14(L)" }, - { 140, "R14(U)" }, - { 144, "R15(L)" }, - { 148, "R15(U)" }, - { 152, "R16(L)" }, - { 156, "R16(U)" }, - { 160, "R17(L)" }, - { 164, "R17(U)" }, - { 168, "R18(L)" }, - { 172, "R18(U)" }, - { 176, "R19(L)" }, - { 180, "R19(U)" }, - { 184, "R20(L)" }, - { 188, "R20(U)" }, - { 192, "R21(L)" }, - { 196, "R21(U)" }, - { 200, "R22(L)" }, - { 204, "R22(U)" }, - { 208, "R23(L)" }, - { 212, "R23(U)" }, - { 216, "R24(L)" }, - { 220, "R24(U)" }, - { 224, "R25(L)" }, - { 228, "R25(U)" }, - { 232, "R26(L)" }, - { 236, "R26(U)" }, - { 240, "R27(L)" }, - { 244, "R27(U)" }, - { 248, "R28(L)" }, - { 252, "R28(U)" }, - { 256, "R29(L)" }, - { 260, "R29(U)" }, - { 264, "R30(L)" }, - { 268, "R30(U)" }, - { 272, "R31(L)" }, - { 276, "R31(U)" }, - { 280, "R32(L)" }, - { 284, "R32(U)" }, - { 288, "R33(L)" }, - { 292, "R33(U)" }, - { 296, "R34(L)" }, - { 300, "R34(U)" }, - { 304, "R35(L)" }, - { 308, "R35(U)" }, - { 312, "R36(L)" }, - { 316, "R36(U)" }, - { 320, "R37(L)" }, - { 324, "R37(U)" }, - { 328, "R38(L)" }, - { 332, "R38(U)" }, - { 336, "R39(L)" }, - { 340, "R39(U)" }, - { 344, "R40(L)" }, - { 348, "R40(U)" }, - { 352, "R41(L)" }, - { 356, "R41(U)" }, - { 360, "R42(L)" }, - { 364, "R42(U)" }, - { 368, "R43(L)" }, - { 372, "R43(U)" }, - { 376, "R44(L)" }, - { 380, "R44(U)" }, - { 384, "R45(L)" }, - { 388, "R45(U)" }, - { 392, "R46(L)" }, - { 396, "R46(U)" }, - { 400, "R47(L)" }, - { 404, "R47(U)" }, - { 408, "R48(L)" }, - { 412, "R48(U)" }, - { 416, "R49(L)" }, - { 420, "R49(U)" }, - { 424, "R50(L)" }, - { 428, "R50(U)" }, - { 432, "R51(L)" }, - { 436, "R51(U)" }, - { 440, "R52(L)" }, - { 444, "R52(U)" }, - { 448, "R53(L)" }, - { 452, "R53(U)" }, - { 456, "R54(L)" }, - { 460, "R54(U)" }, - { 464, "R55(L)" }, - { 468, "R55(U)" }, - { 472, "R56(L)" }, - { 476, "R56(U)" }, - { 480, "R57(L)" }, - { 484, "R57(U)" }, - { 488, "R58(L)" }, - { 492, "R58(U)" }, - { 496, "R59(L)" }, - { 500, "R59(U)" }, - { 504, "R60(L)" }, - { 508, "R60(U)" }, - { 512, "R61(L)" }, - { 516, "R61(U)" }, - { 520, "R62(L)" }, - { 524, "R62(U)" }, - { 528, "TR0(L)" }, - { 532, "TR0(U)" }, - { 536, "TR1(L)" }, - { 540, "TR1(U)" }, - { 544, "TR2(L)" }, - { 548, "TR2(U)" }, - { 552, "TR3(L)" }, - { 556, "TR3(U)" }, - { 560, "TR4(L)" }, - { 564, "TR4(U)" }, - { 568, "TR5(L)" }, - { 572, "TR5(U)" }, - { 576, "TR6(L)" }, - { 580, "TR6(U)" }, - { 584, "TR7(L)" }, - { 588, "TR7(U)" }, + { 0, "PC(L)" }, + { 4, "PC(U)" }, + { 8, "SR(L)" }, + { 12, "SR(U)" }, + { 16, "syscall no.(L)" }, + { 20, "syscall_no.(U)" }, + { 24, "R0(L)" }, + { 28, "R0(U)" }, + { 32, "R1(L)" }, + { 36, "R1(U)" }, + { 40, "R2(L)" }, + { 44, "R2(U)" }, + { 48, "R3(L)" }, + { 52, "R3(U)" }, + { 56, "R4(L)" }, + { 60, "R4(U)" }, + { 64, "R5(L)" }, + { 68, "R5(U)" }, + { 72, "R6(L)" }, + { 76, "R6(U)" }, + { 80, "R7(L)" }, + { 84, "R7(U)" }, + { 88, "R8(L)" }, + { 92, "R8(U)" }, + { 96, "R9(L)" }, + { 100, "R9(U)" }, + { 104, "R10(L)" }, + { 108, "R10(U)" }, + { 112, "R11(L)" }, + { 116, "R11(U)" }, + { 120, "R12(L)" }, + { 124, "R12(U)" }, + { 128, "R13(L)" }, + { 132, "R13(U)" }, + { 136, "R14(L)" }, + { 140, "R14(U)" }, + { 144, "R15(L)" }, + { 148, "R15(U)" }, + { 152, "R16(L)" }, + { 156, "R16(U)" }, + { 160, "R17(L)" }, + { 164, "R17(U)" }, + { 168, "R18(L)" }, + { 172, "R18(U)" }, + { 176, "R19(L)" }, + { 180, "R19(U)" }, + { 184, "R20(L)" }, + { 188, "R20(U)" }, + { 192, "R21(L)" }, + { 196, "R21(U)" }, + { 200, "R22(L)" }, + { 204, "R22(U)" }, + { 208, "R23(L)" }, + { 212, "R23(U)" }, + { 216, "R24(L)" }, + { 220, "R24(U)" }, + { 224, "R25(L)" }, + { 228, "R25(U)" }, + { 232, "R26(L)" }, + { 236, "R26(U)" }, + { 240, "R27(L)" }, + { 244, "R27(U)" }, + { 248, "R28(L)" }, + { 252, "R28(U)" }, + { 256, "R29(L)" }, + { 260, "R29(U)" }, + { 264, "R30(L)" }, + { 268, "R30(U)" }, + { 272, "R31(L)" }, + { 276, "R31(U)" }, + { 280, "R32(L)" }, + { 284, "R32(U)" }, + { 288, "R33(L)" }, + { 292, "R33(U)" }, + { 296, "R34(L)" }, + { 300, "R34(U)" }, + { 304, "R35(L)" }, + { 308, "R35(U)" }, + { 312, "R36(L)" }, + { 316, "R36(U)" }, + { 320, "R37(L)" }, + { 324, "R37(U)" }, + { 328, "R38(L)" }, + { 332, "R38(U)" }, + { 336, "R39(L)" }, + { 340, "R39(U)" }, + { 344, "R40(L)" }, + { 348, "R40(U)" }, + { 352, "R41(L)" }, + { 356, "R41(U)" }, + { 360, "R42(L)" }, + { 364, "R42(U)" }, + { 368, "R43(L)" }, + { 372, "R43(U)" }, + { 376, "R44(L)" }, + { 380, "R44(U)" }, + { 384, "R45(L)" }, + { 388, "R45(U)" }, + { 392, "R46(L)" }, + { 396, "R46(U)" }, + { 400, "R47(L)" }, + { 404, "R47(U)" }, + { 408, "R48(L)" }, + { 412, "R48(U)" }, + { 416, "R49(L)" }, + { 420, "R49(U)" }, + { 424, "R50(L)" }, + { 428, "R50(U)" }, + { 432, "R51(L)" }, + { 436, "R51(U)" }, + { 440, "R52(L)" }, + { 444, "R52(U)" }, + { 448, "R53(L)" }, + { 452, "R53(U)" }, + { 456, "R54(L)" }, + { 460, "R54(U)" }, + { 464, "R55(L)" }, + { 468, "R55(U)" }, + { 472, "R56(L)" }, + { 476, "R56(U)" }, + { 480, "R57(L)" }, + { 484, "R57(U)" }, + { 488, "R58(L)" }, + { 492, "R58(U)" }, + { 496, "R59(L)" }, + { 500, "R59(U)" }, + { 504, "R60(L)" }, + { 508, "R60(U)" }, + { 512, "R61(L)" }, + { 516, "R61(U)" }, + { 520, "R62(L)" }, + { 524, "R62(U)" }, + { 528, "TR0(L)" }, + { 532, "TR0(U)" }, + { 536, "TR1(L)" }, + { 540, "TR1(U)" }, + { 544, "TR2(L)" }, + { 548, "TR2(U)" }, + { 552, "TR3(L)" }, + { 556, "TR3(U)" }, + { 560, "TR4(L)" }, + { 564, "TR4(U)" }, + { 568, "TR5(L)" }, + { 572, "TR5(U)" }, + { 576, "TR6(L)" }, + { 580, "TR6(U)" }, + { 584, "TR7(L)" }, + { 588, "TR7(U)" }, /* This entry is in case pt_regs contains dregs (depends on the kernel build options). */ - { uoff(regs), "offsetof(struct user, regs)" }, - { uoff(fpu), "offsetof(struct user, fpu)" }, + { uoff(regs), "offsetof(struct user, regs)" }, + { uoff(fpu), "offsetof(struct user, fpu)" }, # elif defined(ARM) { uoff(regs.ARM_r0), "r0" }, { uoff(regs.ARM_r1), "r1" }, @@ -3140,12 +3140,12 @@ const struct xlat struct_user_offsets[] = { { PT_GPR(29), "r29" }, { PT_GPR(30), "r30" }, { PT_GPR(31), "r31" }, - { PT_PC, "rpc", }, - { PT_MSR, "rmsr", }, + { PT_PC, "rpc", }, + { PT_MSR, "rmsr", }, { PT_EAR, "rear", }, { PT_ESR, "resr", }, { PT_FSR, "rfsr", }, - { PT_KERNEL_MODE, "kernel_mode", }, + { PT_KERNEL_MODE, "kernel_mode", }, # endif # if !defined(SPARC) && !defined(HPPA) && !defined(POWERPC) \ @@ -3579,7 +3579,7 @@ sys_sched_getscheduler(struct tcb *tcp) if (entering(tcp)) { tprintf("%d", (int) tcp->u_arg[0]); } else if (! syserror(tcp)) { - tcp->auxstr = xlookup (schedulers, tcp->u_rval); + tcp->auxstr = xlookup(schedulers, tcp->u_rval); if (tcp->auxstr != NULL) return RVAL_STR; } @@ -460,7 +460,7 @@ typedef union sigval } sigval_t; # define __SI_MAX_SIZE 128 -# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof (int)) - 3) +# define __SI_PAD_SIZE ((__SI_MAX_SIZE / sizeof(int)) - 3) typedef struct siginfo { @@ -659,7 +659,7 @@ printsiginfo(siginfo_t *sip, int verbose) const char *code; if (sip->si_signo == 0) { - tprintf ("{}"); + tprintf("{}"); return; } tprintf("{si_signo="); @@ -1148,7 +1148,7 @@ sys_sigaction(struct tcb *tcp) #endif /* !USE_PROCFS */ tprintf("{%#lx, ", (long) sa.SA_HANDLER); #ifndef LINUX - printsigmask (&sa.sa_mask, 0); + printsigmask(&sa.sa_mask, 0); #else long_to_sigset(sa.sa_mask, &sigset); printsigmask(&sigset, 0); @@ -1269,17 +1269,17 @@ sys_sigreturn(struct tcb *tcp) if (entering(tcp)) { tcp->u_arg[0] = 0; - if (upeek(tcp,PT_GPR15,&usp)<0) + if (upeek(tcp, PT_GPR15, &usp) < 0) return 0; if (umove(tcp, usp+__SIGNAL_FRAMESIZE, &sc) < 0) return 0; tcp->u_arg[0] = 1; - memcpy(&tcp->u_arg[1],&sc.oldmask[0],sizeof(sigset_t)); + memcpy(&tcp->u_arg[1], &sc.oldmask[0], sizeof(sigset_t)); } else { tcp->u_rval = tcp->u_error = 0; if (tcp->u_arg[0] == 0) return 0; - tcp->auxstr = sprintsigmask("mask now ",(sigset_t *)&tcp->u_arg[1],0); + tcp->auxstr = sprintsigmask("mask now ", (sigset_t *)&tcp->u_arg[1], 0); return RVAL_NONE | RVAL_STR; } return 0; @@ -1324,7 +1324,7 @@ sys_sigreturn(struct tcb *tcp) else { sigset_t sigm; - memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm)); + memcpy(&sigm, tcp->u_arg + 1, sizeof(sigm)); tcp->u_rval = tcp->u_error = 0; if (tcp->u_arg[0] == 0) return 0; @@ -1415,14 +1415,14 @@ sys_sigreturn(struct tcb *tcp) struct pt_regs regs; m_siginfo_t si; - if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { + if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { perror("sigreturn: PTRACE_GETREGS "); return 0; } - if(entering(tcp)) { + if (entering(tcp)) { tcp->u_arg[0] = 0; i1 = regs.u_regs[U_REG_O1]; - if(umove(tcp, i1, &si) < 0) { + if (umove(tcp, i1, &si) < 0) { perror("sigreturn: umove "); return 0; } @@ -1432,7 +1432,7 @@ sys_sigreturn(struct tcb *tcp) sigset_t sigm; long_to_sigset(tcp->u_arg[1], &sigm); tcp->u_rval = tcp->u_error = 0; - if(tcp->u_arg[0] == 0) + if (tcp->u_arg[0] == 0) return 0; tcp->auxstr = sprintsigmask("mask now ", &sigm, 0); return RVAL_NONE | RVAL_STR; @@ -1444,7 +1444,7 @@ sys_sigreturn(struct tcb *tcp) long sp; struct ucontext uc; - if(entering(tcp)) { + if (entering(tcp)) { tcp->u_arg[0] = 0; if (upeek(tcp, REG_SP, &sp) < 0) return 0; @@ -1458,7 +1458,7 @@ sys_sigreturn(struct tcb *tcp) sigset_t sigm; long_to_sigset(tcp->u_arg[1], &sigm); tcp->u_rval = tcp->u_error = 0; - if(tcp->u_arg[0] == 0) + if (tcp->u_arg[0] == 0) return 0; tcp->auxstr = sprintsigmask("mask now ", &sigm, 0); return RVAL_NONE | RVAL_STR; @@ -1469,11 +1469,11 @@ sys_sigreturn(struct tcb *tcp) struct pt_regs regs; m_siginfo_t si; - if(ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { + if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { perror("sigreturn: PTRACE_GETREGS "); return 0; } - if(entering(tcp)) { + if (entering(tcp)) { tcp->u_arg[0] = 0; sp = regs.regs[29]; if (umove(tcp, sp, &si) < 0) @@ -1483,7 +1483,7 @@ sys_sigreturn(struct tcb *tcp) sigset_t sigm; long_to_sigset(tcp->u_arg[1], &sigm); tcp->u_rval = tcp->u_error = 0; - if(tcp->u_arg[0] == 0) + if (tcp->u_arg[0] == 0) return 0; tcp->auxstr = sprintsigmask("mask now ", &sigm, 0); return RVAL_NONE | RVAL_STR; @@ -1535,7 +1535,7 @@ sys_sigreturn(struct tcb *tcp) else { sigset_t sigm; - memcpy(&sigm, tcp->u_arg + 1, sizeof (sigm)); + memcpy(&sigm, tcp->u_arg + 1, sizeof(sigm)); tcp->u_rval = tcp->u_error = 0; if (tcp->u_arg[0] == 0) return 0; @@ -190,7 +190,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg) "AF_???"); tprintf(", "); print_addr(tcp, ((long) tcp->u_arg[2] - + offsetof (struct ifreq, + + offsetof(struct ifreq, ifr_addr.sa_data)), &ifr); tprintf("}"); @@ -273,7 +273,7 @@ sock_ioctl(struct tcb *tcp, long code, long arg) "AF_???"); tprintf(", "); print_addr(tcp, ((long) tcp->u_arg[2] - + offsetof (struct ifreq, + + offsetof(struct ifreq, ifr_addr.sa_data) + ((char *) &ifra[i] - (char *) &ifra[0])), @@ -50,15 +50,15 @@ #ifdef LINUX # include <asm/unistd.h> # if defined __NR_tgkill -# define my_tgkill(pid, tid, sig) syscall (__NR_tgkill, (pid), (tid), (sig)) +# define my_tgkill(pid, tid, sig) syscall(__NR_tgkill, (pid), (tid), (sig)) # elif defined __NR_tkill -# define my_tgkill(pid, tid, sig) syscall (__NR_tkill, (tid), (sig)) +# define my_tgkill(pid, tid, sig) syscall(__NR_tkill, (tid), (sig)) # else /* kill() may choose arbitrarily the target task of the process group while we later wait on a that specific TID. PID process waits become TID task specific waits for a process under ptrace(2). */ # warning "Neither tkill(2) nor tgkill(2) available, risk of strace hangs!" -# define my_tgkill(pid, tid, sig) kill ((tid), (sig)) +# define my_tgkill(pid, tid, sig) kill((tid), (sig)) # endif #endif @@ -451,7 +451,7 @@ startup_attach(void) * Block user interruptions as we would leave the traced * process stopped (process state T) if we would terminate in * between PTRACE_ATTACH and wait4 () on SIGSTOP. - * We rely on cleanup () from this point on. + * We rely on cleanup() from this point on. */ if (interactive) sigprocmask(SIG_BLOCK, &blocked_set, NULL); @@ -655,7 +655,7 @@ startup_child(char **argv) ) { pid = getpid(); #ifdef USE_PROCFS - if (outf != stderr) close (fileno (outf)); + if (outf != stderr) close(fileno(outf)); #ifdef MIPS /* Kludge for SGI, see proc_open for details. */ sa.sa_handler = foobar; @@ -669,8 +669,8 @@ startup_child(char **argv) kill(pid, SIGSTOP); /* stop HERE */ #endif /* FREEBSD */ #else /* !USE_PROCFS */ - if (outf!=stderr) - close(fileno (outf)); + if (outf != stderr) + close(fileno(outf)); if (!daemonized_tracer) { if (ptrace(PTRACE_TRACEME, 0, (char *) 1, 0) < 0) { @@ -1059,7 +1059,7 @@ main(int argc, char *argv[]) case 'P': tracing_paths = 1; if (pathtrace_select(optarg)) { - fprintf(stderr,"%s : failed to select path '%s'\n", progname, optarg); + fprintf(stderr, "%s : failed to select path '%s'\n", progname, optarg); exit(1); } break; @@ -1393,7 +1393,7 @@ proc_open(struct tcb *tcp, int attaching) * condition we have to poll for the event. */ for (;;) { - if (IOCTL_STATUS (tcp) < 0) { + if (IOCTL_STATUS(tcp) < 0) { perror("strace: PIOCSTATUS"); return -1; } @@ -1449,22 +1449,22 @@ proc_open(struct tcb *tcp, int attaching) premptyset(&syscalls); for (i = 1; i < MAX_QUALS; ++i) { if (i > (sizeof syscalls) * CHAR_BIT) break; - if (qual_flags [i] & QUAL_TRACE) praddset (&syscalls, i); + if (qual_flags[i] & QUAL_TRACE) praddset(&syscalls, i); } - praddset (&syscalls, SYS_execve); + praddset(&syscalls, SYS_execve); if (followfork) { - praddset (&syscalls, SYS_fork); + praddset(&syscalls, SYS_fork); #ifdef SYS_forkall - praddset (&syscalls, SYS_forkall); + praddset(&syscalls, SYS_forkall); #endif #ifdef SYS_fork1 - praddset (&syscalls, SYS_fork1); + praddset(&syscalls, SYS_fork1); #endif #ifdef SYS_rfork1 - praddset (&syscalls, SYS_rfork1); + praddset(&syscalls, SYS_rfork1); #endif #ifdef SYS_rforkall - praddset (&syscalls, SYS_rforkall); + praddset(&syscalls, SYS_rforkall); #endif } if (IOCTL(tcp->pfd, PIOCSENTRY, &syscalls) < 0) { @@ -1480,7 +1480,7 @@ proc_open(struct tcb *tcp, int attaching) premptyset(&signals); for (i = 1; i < MAX_QUALS; ++i) { if (i > (sizeof signals) * CHAR_BIT) break; - if (qual_flags [i] & QUAL_SIGNAL) praddset (&signals, i); + if (qual_flags[i] & QUAL_SIGNAL) praddset(&signals, i); } if (IOCTL(tcp->pfd, PIOCSTRACE, &signals) < 0) { perror("PIOCSTRACE"); @@ -1490,7 +1490,7 @@ proc_open(struct tcb *tcp, int attaching) premptyset(&faults); for (i = 1; i < MAX_QUALS; ++i) { if (i > (sizeof faults) * CHAR_BIT) break; - if (qual_flags [i] & QUAL_FAULT) praddset (&faults, i); + if (qual_flags[i] & QUAL_FAULT) praddset(&faults, i); } if (IOCTL(tcp->pfd, PIOCSFAULT, &faults) < 0) { perror("PIOCSFAULT"); @@ -1498,8 +1498,8 @@ proc_open(struct tcb *tcp, int attaching) } #else /* FREEBSD */ /* set events flags. */ - arg = S_SIG | S_SCE | S_SCX ; - if(ioctl(tcp->pfd, PIOCBIS, arg) < 0) { + arg = S_SIG | S_SCE | S_SCX; + if (ioctl(tcp->pfd, PIOCBIS, arg) < 0) { perror("PIOCBIS"); return -1; } @@ -1515,7 +1515,7 @@ proc_open(struct tcb *tcp, int attaching) #ifdef PRSABORT /* The child is in a pause(), abort it. */ arg = PRSABORT; - if (IOCTL (tcp->pfd, PIOCRUN, &arg) < 0) { + if (IOCTL(tcp->pfd, PIOCRUN, &arg) < 0) { perror("PIOCRUN"); return -1; } @@ -1527,7 +1527,7 @@ proc_open(struct tcb *tcp, int attaching) #endif for (;;) { /* Wait for the child to do something. */ - if (IOCTL_WSTOP (tcp) < 0) { + if (IOCTL_WSTOP(tcp) < 0) { perror("PIOCWSTOP"); return -1; } @@ -1779,7 +1779,7 @@ resume_from_tcp(struct tcb *tcp) && ((t->flags & (TCB_CLONE_THREAD|TCB_SUSPENDED)) == (TCB_CLONE_THREAD|TCB_SUSPENDED)) && t->waitpid == tcp->pid) { - error |= resume (t); + error |= resume(t); ++resumed; } } @@ -1794,7 +1794,7 @@ resume_from_tcp(struct tcb *tcp) == (TCB_CLONE_THREAD|TCB_SUSPENDED)) && t->waitpid <= 0 ) { - error |= resume (t); + error |= resume(t); break; } } @@ -1923,7 +1923,7 @@ detach(struct tcb *tcp, int sig) #endif /* SUNOS4 */ #ifndef USE_PROCFS - error |= resume_from_tcp (tcp); + error |= resume_from_tcp(tcp); #endif if (!qflag) @@ -1933,7 +1933,7 @@ detach(struct tcb *tcp, int sig) #ifdef LINUX if (zombie != NULL) { - /* TCP no longer exists therefore you must not detach () it. */ + /* TCP no longer exists therefore you must not detach() it. */ droptcb(zombie); } #endif @@ -2045,7 +2045,7 @@ rebuild_pollv(void) int i, j; if (pollv != NULL) - free (pollv); + free(pollv); pollv = (struct pollfd *) malloc(nprocs * sizeof pollv[0]); if (pollv == NULL) { fprintf(stderr, "%s: out of memory\n", progname); @@ -2281,7 +2281,7 @@ trace(void) in_syscall = NULL; pv.fd = tcp->pfd; pv.events = POLLWANT; - if ((what = poll (&pv, 1, 1)) < 0) { + if ((what = poll(&pv, 1, 1)) < 0) { if (interrupted) return 0; continue; @@ -2321,15 +2321,15 @@ trace(void) /* Get the status of the process. */ if (!interrupted) { #ifndef FREEBSD - ioctl_result = IOCTL_WSTOP (tcp); + ioctl_result = IOCTL_WSTOP(tcp); #else /* FREEBSD */ /* Thanks to some scheduling mystery, the first poller sometimes waits for the already processed end of fork event. Doing a non blocking poll here solves the problem. */ if (proc_poll_pipe[0] != -1) - ioctl_result = IOCTL_STATUS (tcp); + ioctl_result = IOCTL_STATUS(tcp); else - ioctl_result = IOCTL_WSTOP (tcp); + ioctl_result = IOCTL_WSTOP(tcp); #endif /* FREEBSD */ ioctl_errno = errno; #ifndef HAVE_POLLABLE_PROCFS @@ -2368,7 +2368,7 @@ trace(void) #ifdef FREEBSD if ((tcp->flags & TCB_STARTUP) && (tcp->status.PR_WHY == PR_SYSEXIT)) { /* discard first event for a syscall we never entered */ - IOCTL (tcp->pfd, PIOCRUN, 0); + IOCTL(tcp->pfd, PIOCRUN, 0); continue; } #endif @@ -2461,9 +2461,9 @@ trace(void) tcp->curcol = curcol; arg = 0; #ifndef FREEBSD - if (IOCTL (tcp->pfd, PIOCRUN, &arg) < 0) + if (IOCTL(tcp->pfd, PIOCRUN, &arg) < 0) #else - if (IOCTL (tcp->pfd, PIOCRUN, 0) < 0) + if (IOCTL(tcp->pfd, PIOCRUN, 0) < 0) #endif { perror("PIOCRUN"); @@ -394,7 +394,7 @@ decode_poll(struct tcb *tcp, long pts) break; } sprintf(str, "{fd=%d, revents=", fds.fd); - flagstr=sprintflags("", pollflags, fds.revents); + flagstr = sprintflags("", pollflags, fds.revents); cumlen += strlen(str) + strlen(flagstr) + 1; if (cumlen < sizeof(outstr)) { strcat(outstr, str); @@ -560,7 +560,7 @@ static const struct xlat transport_user_options[] = { { 0, NULL }, }; -static const struct xlat transport_user_flags [] = { +static const struct xlat transport_user_flags[] = { { 0, "0" }, { T_MORE, "T_MORE" }, { T_EXPEDITED, "T_EXPEDITED" }, @@ -579,12 +579,12 @@ static const struct xlat transport_user_flags [] = { #ifdef HAVE_STRUCT_T_OPTHDR -static const struct xlat xti_level [] = { +static const struct xlat xti_level[] = { { XTI_GENERIC, "XTI_GENERIC" }, { 0, NULL }, }; -static const struct xlat xti_generic [] = { +static const struct xlat xti_generic[] = { { XTI_DEBUG, "XTI_DEBUG" }, { XTI_LINGER, "XTI_LINGER" }, { XTI_RCVBUF, "XTI_RCVBUF" }, @@ -605,43 +605,43 @@ print_xti_optmgmt(struct tcb *tcp, long addr, int len) while (len >= (int) sizeof hdr) { if (umove(tcp, addr, &hdr) < 0) break; if (c++) { - tprintf (", "); + tprintf(", "); } else if (len > hdr.len + sizeof hdr) { - tprintf ("["); + tprintf("["); } - tprintf ("{level="); - printxval (xti_level, hdr.level, "???"); - tprintf (", name="); + tprintf("{level="); + printxval(xti_level, hdr.level, "???"); + tprintf(", name="); switch (hdr.level) { case XTI_GENERIC: - printxval (xti_generic, hdr.name, "XTI_???"); + printxval(xti_generic, hdr.name, "XTI_???"); break; default: - tprintf ("%ld", hdr.name); + tprintf("%ld", hdr.name); break; } - tprintf (", status="); - printxval (transport_user_flags, hdr.status, "T_???"); + tprintf(", status="); + printxval(transport_user_flags, hdr.status, "T_???"); addr += sizeof hdr; len -= sizeof hdr; if ((hdr.len -= sizeof hdr) > 0) { if (hdr.len > len) break; - tprintf (", val="); - if (len == sizeof (int)) - printnum (tcp, addr, "%d"); + tprintf(", val="); + if (len == sizeof(int)) + printnum(tcp, addr, "%d"); else - printstr (tcp, addr, hdr.len); + printstr(tcp, addr, hdr.len); addr += hdr.len; len -= hdr.len; } - tprintf ("}"); + tprintf("}"); } if (len > 0) { - if (c++) tprintf (", "); - printstr (tcp, addr, len); + if (c++) tprintf(", "); + printstr(tcp, addr, len); } - if (c > 1) tprintf ("]"); + if (c > 1) tprintf("]"); } #endif @@ -653,25 +653,25 @@ print_optmgmt(struct tcb *tcp, long addr, int len) /* We don't know how to tell if TLI (socket) or XTI optmgmt is being used yet, assume TLI. */ #if defined (HAVE_STRUCT_OPTHDR) - print_sock_optmgmt (tcp, addr, len); + print_sock_optmgmt(tcp, addr, len); #elif defined (HAVE_STRUCT_T_OPTHDR) - print_xti_optmgmt (tcp, addr, len); + print_xti_optmgmt(tcp, addr, len); #else - printstr (tcp, addr, len); + printstr(tcp, addr, len); #endif } -static const struct xlat service_type [] = { +static const struct xlat service_type[] = { { T_COTS, "T_COTS" }, { T_COTS_ORD, "T_COTS_ORD" }, { T_CLTS, "T_CLTS" }, { 0, NULL }, }; -static const struct xlat ts_state [] = { +static const struct xlat ts_state[] = { { TS_UNBND, "TS_UNBND" }, { TS_WACK_BREQ, "TS_WACK_BREQ" }, { TS_WACK_UREQ, "TS_WACK_UREQ" }, @@ -692,7 +692,7 @@ static const struct xlat ts_state [] = { { 0, NULL }, }; -static const struct xlat provider_flags [] = { +static const struct xlat provider_flags[] = { { 0, "0" }, { SENDZERO, "SENDZERO" }, { EXPINLINE, "EXPINLINE" }, @@ -701,7 +701,7 @@ static const struct xlat provider_flags [] = { }; -static const struct xlat tli_errors [] = { +static const struct xlat tli_errors[] = { { TBADADDR, "TBADADDR" }, { TBADOPT, "TBADOPT" }, { TACCES, "TACCES" }, @@ -743,93 +743,93 @@ print_transport_message(struct tcb *tcp, int expect, long addr, int len) if (len < sizeof m.type) goto dump; - if (umove (tcp, addr, &m.type) < 0) goto dump; + if (umove(tcp, addr, &m.type) < 0) goto dump; #define GET(type, struct) \ do { \ if (len < sizeof m.struct) goto dump; \ - if (umove (tcp, addr, &m.struct) < 0) goto dump;\ - tprintf ("{"); \ + if (umove(tcp, addr, &m.struct) < 0) goto dump;\ + tprintf("{"); \ if (expect != type) { \ ++c; \ - tprintf (#type); \ + tprintf(#type); \ } \ } \ while (0) #define COMMA() \ - do { if (c++) tprintf (", "); } while (0) + do { if (c++) tprintf(", "); } while (0) #define STRUCT(struct, elem, print) \ do { \ - COMMA (); \ + COMMA(); \ if (m.struct.elem##_length < 0 || \ m.struct.elem##_offset < sizeof m.struct || \ m.struct.elem##_offset + m.struct.elem##_length > len) \ { \ - tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\ + tprintf(#elem "_length=%ld, " #elem "_offset=%ld",\ m.struct.elem##_length, \ m.struct.elem##_offset); \ } \ else { \ - tprintf (#elem "="); \ - print (tcp, \ + tprintf(#elem "="); \ + print(tcp, \ addr + m.struct.elem##_offset, \ m.struct.elem##_length); \ } \ } \ while (0) -#define ADDR(struct, elem) STRUCT (struct, elem, printstr) +#define ADDR(struct, elem) STRUCT(struct, elem, printstr) switch (m.type) { #ifdef T_CONN_REQ case T_CONN_REQ: /* connect request */ - GET (T_CONN_REQ, conn_req); - ADDR (conn_req, DEST); - ADDR (conn_req, OPT); + GET(T_CONN_REQ, conn_req); + ADDR(conn_req, DEST); + ADDR(conn_req, OPT); break; #endif #ifdef T_CONN_RES case T_CONN_RES: /* connect response */ - GET (T_CONN_RES, conn_res); + GET(T_CONN_RES, conn_res); #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR - COMMA (); - tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr); + COMMA(); + tprintf("QUEUE=%p", m.conn_res.QUEUE_ptr); #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID - COMMA (); - tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id); + COMMA(); + tprintf("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id); #endif - ADDR (conn_res, OPT); - COMMA (); - tprintf ("SEQ=%ld", m.conn_res.SEQ_number); + ADDR(conn_res, OPT); + COMMA(); + tprintf("SEQ=%ld", m.conn_res.SEQ_number); break; #endif #ifdef T_DISCON_REQ case T_DISCON_REQ: /* disconnect request */ - GET (T_DISCON_REQ, discon_req); - COMMA (); - tprintf ("SEQ=%ld", m.discon_req.SEQ_number); + GET(T_DISCON_REQ, discon_req); + COMMA(); + tprintf("SEQ=%ld", m.discon_req.SEQ_number); break; #endif #ifdef T_DATA_REQ case T_DATA_REQ: /* data request */ - GET (T_DATA_REQ, data_req); - COMMA (); - tprintf ("MORE=%ld", m.data_req.MORE_flag); + GET(T_DATA_REQ, data_req); + COMMA(); + tprintf("MORE=%ld", m.data_req.MORE_flag); break; #endif #ifdef T_EXDATA_REQ case T_EXDATA_REQ: /* expedited data req */ - GET (T_EXDATA_REQ, exdata_req); - COMMA (); - tprintf ("MORE=%ld", m.exdata_req.MORE_flag); + GET(T_EXDATA_REQ, exdata_req); + COMMA(); + tprintf("MORE=%ld", m.exdata_req.MORE_flag); break; #endif #ifdef T_INFO_REQ case T_INFO_REQ: /* information req */ - GET (T_INFO_REQ, info_req); + GET(T_INFO_REQ, info_req); break; #endif #ifdef T_BIND_REQ @@ -837,161 +837,161 @@ print_transport_message(struct tcb *tcp, int expect, long addr, int len) #ifdef O_T_BIND_REQ case O_T_BIND_REQ: /* Ugly xti/tli hack */ #endif - GET (T_BIND_REQ, bind_req); - ADDR (bind_req, ADDR); - COMMA (); - tprintf ("CONIND=%ld", m.bind_req.CONIND_number); + GET(T_BIND_REQ, bind_req); + ADDR(bind_req, ADDR); + COMMA(); + tprintf("CONIND=%ld", m.bind_req.CONIND_number); break; #endif #ifdef T_UNBIND_REQ case T_UNBIND_REQ: /* unbind request */ - GET (T_UNBIND_REQ, unbind_req); + GET(T_UNBIND_REQ, unbind_req); break; #endif #ifdef T_UNITDATA_REQ case T_UNITDATA_REQ: /* unitdata requset */ - GET (T_UNITDATA_REQ, unitdata_req); - ADDR (unitdata_req, DEST); - ADDR (unitdata_req, OPT); + GET(T_UNITDATA_REQ, unitdata_req); + ADDR(unitdata_req, DEST); + ADDR(unitdata_req, OPT); break; #endif #ifdef T_OPTMGMT_REQ case T_OPTMGMT_REQ: /* manage opt req */ - GET (T_OPTMGMT_REQ, optmgmt_req); - COMMA (); - tprintf ("MGMT="); - printflags (transport_user_flags, m.optmgmt_req.MGMT_flags, + GET(T_OPTMGMT_REQ, optmgmt_req); + COMMA(); + tprintf("MGMT="); + printflags(transport_user_flags, m.optmgmt_req.MGMT_flags, "T_???"); - STRUCT (optmgmt_req, OPT, print_optmgmt); + STRUCT(optmgmt_req, OPT, print_optmgmt); break; #endif #ifdef T_ORDREL_REQ case T_ORDREL_REQ: /* orderly rel req */ - GET (T_ORDREL_REQ, ordrel_req); + GET(T_ORDREL_REQ, ordrel_req); break; #endif #ifdef T_CONN_IND case T_CONN_IND: /* connect indication */ - GET (T_CONN_IND, conn_ind); - ADDR (conn_ind, SRC); - ADDR (conn_ind, OPT); - tprintf (", SEQ=%ld", m.conn_ind.SEQ_number); + GET(T_CONN_IND, conn_ind); + ADDR(conn_ind, SRC); + ADDR(conn_ind, OPT); + tprintf(", SEQ=%ld", m.conn_ind.SEQ_number); break; #endif #ifdef T_CONN_CON case T_CONN_CON: /* connect corfirm */ - GET (T_CONN_CON, conn_con); - ADDR (conn_con, RES); - ADDR (conn_con, OPT); + GET(T_CONN_CON, conn_con); + ADDR(conn_con, RES); + ADDR(conn_con, OPT); break; #endif #ifdef T_DISCON_IND case T_DISCON_IND: /* discon indication */ - GET (T_DISCON_IND, discon_ind); - COMMA (); - tprintf ("DISCON=%ld, SEQ=%ld", + GET(T_DISCON_IND, discon_ind); + COMMA(); + tprintf("DISCON=%ld, SEQ=%ld", m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number); break; #endif #ifdef T_DATA_IND case T_DATA_IND: /* data indication */ - GET (T_DATA_IND, data_ind); - COMMA (); - tprintf ("MORE=%ld", m.data_ind.MORE_flag); + GET(T_DATA_IND, data_ind); + COMMA(); + tprintf("MORE=%ld", m.data_ind.MORE_flag); break; #endif #ifdef T_EXDATA_IND case T_EXDATA_IND: /* expedited data ind */ - GET (T_EXDATA_IND, exdata_ind); - COMMA (); - tprintf ("MORE=%ld", m.exdata_ind.MORE_flag); + GET(T_EXDATA_IND, exdata_ind); + COMMA(); + tprintf("MORE=%ld", m.exdata_ind.MORE_flag); break; #endif #ifdef T_INFO_ACK case T_INFO_ACK: /* info ack */ - GET (T_INFO_ACK, info_ack); - COMMA (); - tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, " + GET(T_INFO_ACK, info_ack); + COMMA(); + tprintf("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, " "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=", m.info_ack.TSDU_size, m.info_ack.ETSDU_size, m.info_ack.CDATA_size, m.info_ack.DDATA_size, m.info_ack.ADDR_size, m.info_ack.OPT_size, m.info_ack.TIDU_size); - printxval (service_type, m.info_ack.SERV_type, "T_???"); - tprintf (", CURRENT="); - printxval (ts_state, m.info_ack.CURRENT_state, "TS_???"); - tprintf (", PROVIDER="); - printflags (provider_flags, m.info_ack.PROVIDER_flag, "???"); + printxval(service_type, m.info_ack.SERV_type, "T_???"); + tprintf(", CURRENT="); + printxval(ts_state, m.info_ack.CURRENT_state, "TS_???"); + tprintf(", PROVIDER="); + printflags(provider_flags, m.info_ack.PROVIDER_flag, "???"); break; #endif #ifdef T_BIND_ACK case T_BIND_ACK: /* bind ack */ - GET (T_BIND_ACK, bind_ack); - ADDR (bind_ack, ADDR); - tprintf (", CONIND=%ld", m.bind_ack.CONIND_number); + GET(T_BIND_ACK, bind_ack); + ADDR(bind_ack, ADDR); + tprintf(", CONIND=%ld", m.bind_ack.CONIND_number); break; #endif #ifdef T_ERROR_ACK case T_ERROR_ACK: /* error ack */ - GET (T_ERROR_ACK, error_ack); - COMMA (); - tprintf ("ERROR="); - printxval (transport_user_options, + GET(T_ERROR_ACK, error_ack); + COMMA(); + tprintf("ERROR="); + printxval(transport_user_options, m.error_ack.ERROR_prim, "TI_???"); - tprintf (", TLI="); - printxval (tli_errors, m.error_ack.TLI_error, "T???"); - tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error)); + tprintf(", TLI="); + printxval(tli_errors, m.error_ack.TLI_error, "T???"); + tprintf("UNIX=%s", strerror(m.error_ack.UNIX_error)); break; #endif #ifdef T_OK_ACK case T_OK_ACK: /* ok ack */ - GET (T_OK_ACK, ok_ack); - COMMA (); - tprintf ("CORRECT="); - printxval (transport_user_options, + GET(T_OK_ACK, ok_ack); + COMMA(); + tprintf("CORRECT="); + printxval(transport_user_options, m.ok_ack.CORRECT_prim, "TI_???"); break; #endif #ifdef T_UNITDATA_IND case T_UNITDATA_IND: /* unitdata ind */ - GET (T_UNITDATA_IND, unitdata_ind); - ADDR (unitdata_ind, SRC); - ADDR (unitdata_ind, OPT); + GET(T_UNITDATA_IND, unitdata_ind); + ADDR(unitdata_ind, SRC); + ADDR(unitdata_ind, OPT); break; #endif #ifdef T_UDERROR_IND case T_UDERROR_IND: /* unitdata error ind */ - GET (T_UDERROR_IND, uderror_ind); - ADDR (uderror_ind, DEST); - ADDR (uderror_ind, OPT); - tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type); + GET(T_UDERROR_IND, uderror_ind); + ADDR(uderror_ind, DEST); + ADDR(uderror_ind, OPT); + tprintf(", ERROR=%ld", m.uderror_ind.ERROR_type); break; #endif #ifdef T_OPTMGMT_ACK case T_OPTMGMT_ACK: /* manage opt ack */ - GET (T_OPTMGMT_ACK, optmgmt_ack); - COMMA (); - tprintf ("MGMT="); - printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags, + GET(T_OPTMGMT_ACK, optmgmt_ack); + COMMA(); + tprintf("MGMT="); + printflags(transport_user_flags, m.optmgmt_ack.MGMT_flags, "T_???"); - STRUCT (optmgmt_ack, OPT, print_optmgmt); + STRUCT(optmgmt_ack, OPT, print_optmgmt); break; #endif #ifdef T_ORDREL_IND case T_ORDREL_IND: /* orderly rel ind */ - GET (T_ORDREL_IND, ordrel_ind); + GET(T_ORDREL_IND, ordrel_ind); break; #endif #ifdef T_ADDR_REQ case T_ADDR_REQ: /* address req */ - GET (T_ADDR_REQ, addr_req); + GET(T_ADDR_REQ, addr_req); break; #endif #ifdef T_ADDR_ACK case T_ADDR_ACK: /* address response */ - GET (T_ADDR_ACK, addr_ack); - ADDR (addr_ack, LOCADDR); - ADDR (addr_ack, REMADDR); + GET(T_ADDR_ACK, addr_ack); + ADDR(addr_ack, LOCADDR); + ADDR(addr_ack, REMADDR); break; #endif default: @@ -1001,7 +1001,7 @@ print_transport_message(struct tcb *tcp, int expect, long addr, int len) break; } - if (c >= 0) tprintf ("}"); + if (c >= 0) tprintf("}"); #undef ADDR #undef COMMA @@ -1066,12 +1066,12 @@ static int internal_stream_ioctl(struct tcb *tcp, int arg) /* in T_BIND_REQ, out T_BIND_ACK */ ++timod; if (entering(tcp)) { - print_transport_message (tcp, + print_transport_message(tcp, T_BIND_REQ, si.ic_dp, si.ic_len); } else { - print_transport_message (tcp, + print_transport_message(tcp, T_BIND_ACK, si.ic_dp, si.ic_len); } @@ -1082,12 +1082,12 @@ static int internal_stream_ioctl(struct tcb *tcp, int arg) /* in T_UNBIND_REQ, out T_OK_ACK */ ++timod; if (entering(tcp)) { - print_transport_message (tcp, + print_transport_message(tcp, T_UNBIND_REQ, si.ic_dp, si.ic_len); } else { - print_transport_message (tcp, + print_transport_message(tcp, T_OK_ACK, si.ic_dp, si.ic_len); } @@ -1098,12 +1098,12 @@ static int internal_stream_ioctl(struct tcb *tcp, int arg) /* in T_INFO_REQ, out T_INFO_ACK */ ++timod; if (entering(tcp)) { - print_transport_message (tcp, + print_transport_message(tcp, T_INFO_REQ, si.ic_dp, si.ic_len); } else { - print_transport_message (tcp, + print_transport_message(tcp, T_INFO_ACK, si.ic_dp, si.ic_len); } @@ -1114,12 +1114,12 @@ static int internal_stream_ioctl(struct tcb *tcp, int arg) /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */ ++timod; if (entering(tcp)) { - print_transport_message (tcp, + print_transport_message(tcp, T_OPTMGMT_REQ, si.ic_dp, si.ic_len); } else { - print_transport_message (tcp, + print_transport_message(tcp, T_OPTMGMT_ACK, si.ic_dp, si.ic_len); } @@ -1150,7 +1150,7 @@ static int internal_stream_ioctl(struct tcb *tcp, int arg) if (exiting(tcp)) { tprintf("}"); if (timod && tcp->u_rval && !syserror(tcp)) { - tcp->auxstr = xlookup (tli_errors, tcp->u_rval); + tcp->auxstr = xlookup(tli_errors, tcp->u_rval); return RVAL_STR + 1; } } diff --git a/sunos4/syscall.h b/sunos4/syscall.h index 98b7e51..9bbd264 100644 --- a/sunos4/syscall.h +++ b/sunos4/syscall.h @@ -165,7 +165,7 @@ int sys_nfs_svc(); /* run nfs server */ int sys_nfs_getfh(); /* get file handle */ int sys_exportfs(); /* export file systems */ -int sys_rfssys(); /* RFS-related calls */ +int sys_rfssys(); /* RFS-related calls */ int sys_getmsg(); int sys_putmsg(); diff --git a/sunos4/syscallent.h b/sunos4/syscallent.h index 66c2048..5165ed1 100644 --- a/sunos4/syscallent.h +++ b/sunos4/syscallent.h @@ -230,12 +230,12 @@ { 0, 0, sys_nosys, "nosys" }, /* 199 */ { 4, TI, sys_semctl, "semctl" }, /* 200 */ { 4, TI, sys_semget, "semget" }, /* 201 */ - { 4, TI, sys_semop, "semop" }, /* 202 */ + { 4, TI, sys_semop, "semop" }, /* 202 */ { 5, TI, sys_msgget, "msgget" }, /* 203 */ { 5, TI, sys_msgctl, "msgctl" }, /* 204 */ { 5, TI, sys_msgrcv, "msgrcv" }, /* 205 */ { 5, TI, sys_msgsnd, "msgsnd" }, /* 206 */ - { 3, TI, sys_shmat, "shmat" }, /* 207 */ + { 3, TI, sys_shmat, "shmat" }, /* 207 */ { 3, TI, sys_shmctl, "shmctl" }, /* 208 */ - { 3, TI, sys_shmdt, "shmdt" }, /* 209 */ + { 3, TI, sys_shmdt, "shmdt" }, /* 209 */ { 3, TI, sys_shmget, "shmget" }, /* 210 */ diff --git a/svr4/syscall.h b/svr4/syscall.h index e0fba08..45211c4 100644 --- a/svr4/syscall.h +++ b/svr4/syscall.h @@ -308,29 +308,29 @@ extern int sys_door(); extern int sys_sigwait(); extern int sys_truncate(); extern int sys_ftruncate(); -extern int sys_getksym (); +extern int sys_getksym(); extern int sys_procpriv(); #endif #if UNIXWARE >= 7 -extern int sys_lseek64 (); -extern int sys_truncate64 (); -extern int sys_ftruncate64 (); -extern int sys_xsocket (); -extern int sys_xsocketpair (); -extern int sys_xbind (); -extern int sys_xconnect (); -extern int sys_xlisten (); -extern int sys_xaccept (); -extern int sys_xrecvmsg (); -extern int sys_xsendmsg (); -extern int sys_xgetsockaddr (); -extern int sys_xsetsockaddr (); -extern int sys_xgetsockopt (); -extern int sys_xsetsockopt (); -extern int sys_xshutdown (); -extern int sys_rfork (); -extern int sys_ssisys (); -extern int sys_rexecve (); +extern int sys_lseek64(); +extern int sys_truncate64(); +extern int sys_ftruncate64(); +extern int sys_xsocket(); +extern int sys_xsocketpair(); +extern int sys_xbind(); +extern int sys_xconnect(); +extern int sys_xlisten(); +extern int sys_xaccept(); +extern int sys_xrecvmsg(); +extern int sys_xsendmsg(); +extern int sys_xgetsockaddr(); +extern int sys_xsetsockaddr(); +extern int sys_xgetsockopt(); +extern int sys_xsetsockopt(); +extern int sys_xshutdown(); +extern int sys_rfork(); +extern int sys_ssisys(); +extern int sys_rexecve(); #endif #endif /* !MIPS */ diff --git a/svr4/syscallent.h b/svr4/syscallent.h index d8e5a12..54263c3 100644 --- a/svr4/syscallent.h +++ b/svr4/syscallent.h @@ -367,7 +367,7 @@ { -1, 0, printargs, "SYS_140" }, /* 140 */ #if UNIXWARE >= 2 { -1, 0, sys_seteuid, "seteuid" }, /* 141 */ - { -1, 0, printargs, "SYS_142" }, /* 142 */ + { -1, 0, printargs, "SYS_142" }, /* 142 */ { -1, 0, sys_keyctl, "keyctl" }, /* 143 */ { -1, 0, sys_secsys, "secsys" }, /* 144 */ { -1, 0, sys_filepriv, "filepriv" }, /* 145 */ @@ -377,10 +377,10 @@ { -1, 0, sys_fdevstat, "fdevstat" }, /* 149 */ { -1, 0, sys_flvlfile, "flvlfile" }, /* 150 */ { -1, 0, sys_lvlfile, "lvlfile" }, /* 151 */ - { -1, 0, printargs, "SYS_152" }, /* 152 */ + { -1, 0, printargs, "SYS_152" }, /* 152 */ { -1, 0, sys_lvlequal, "lvlequal" }, /* 153 */ { -1, 0, sys_lvlproc, "lvlproc" }, /* 154 */ - { -1, 0, printargs, "SYS_155" }, /* 155 */ + { -1, 0, printargs, "SYS_155" }, /* 155 */ { -1, 0, sys_lvlipc, "lvlipc" }, /* 156 */ { -1, 0, sys_acl, "acl" }, /* 157 */ { -1, 0, sys_auditevt, "auditevt" }, /* 158 */ @@ -406,14 +406,14 @@ { -1, 0, sys_lwpprivate, "lwpprivate" }, /* 178 */ { -1, 0, sys_processor_bind, "processor_bind"}, /* 179 */ { -1, 0, sys_processor_exbind, "processor_exbind"}, /* 180 */ - { -1, 0, printargs, "SYS_181" }, /* 181 */ - { -1, 0, printargs, "SYS_182" }, /* 182 */ + { -1, 0, printargs, "SYS_181" }, /* 181 */ + { -1, 0, printargs, "SYS_182" }, /* 182 */ { -1, 0, sys_prepblock, "prepblock" }, /* 183 */ { -1, 0, sys_block, "block" }, /* 184 */ { -1, 0, sys_rdblock, "rdblock" }, /* 185 */ { -1, 0, sys_unblock, "unblock" }, /* 186 */ { -1, 0, sys_cancelblock, "cancelblock" }, /* 187 */ - { -1, 0, printargs, "SYS_188" }, /* 188 */ + { -1, 0, printargs, "SYS_188" }, /* 188 */ { -1, TD, sys_pread, "pread" }, /* 189 */ { -1, TD, sys_pwrite, "pwrite" }, /* 190 */ { -1, TF, sys_truncate, "truncate" }, /* 191 */ @@ -674,53 +674,53 @@ internal_syscall(struct tcb *tcp) #ifdef LINUX -#if defined (I386) - static long eax; -#elif defined (IA64) - long r8, r10, psr; - long ia32 = 0; -#elif defined (POWERPC) - static long result,flags; -#elif defined (M68K) - static long d0; -#elif defined(BFIN) - static long r0; -#elif defined (ARM) - static struct pt_regs regs; -#elif defined (ALPHA) - static long r0; - static long a3; -#elif defined(AVR32) - static struct pt_regs regs; -#elif defined (SPARC) || defined (SPARC64) - static struct pt_regs regs; - static unsigned long trap; -#elif defined(LINUX_MIPSN32) - static long long a3; - static long long r2; -#elif defined(MIPS) - static long a3; - static long r2; -#elif defined(S390) || defined(S390X) - static long gpr2; - static long pc; - static long syscall_mode; -#elif defined(HPPA) - static long r28; -#elif defined(SH) - static long r0; -#elif defined(SH64) - static long r9; -#elif defined(X86_64) - static long rax; -#elif defined(CRISV10) || defined(CRISV32) - static long r10; -#elif defined(MICROBLAZE) - static long r3; -#endif +# if defined (I386) +static long eax; +# elif defined (IA64) +long r8, r10, psr; /* TODO: make static? */ +long ia32 = 0; /* not static */ +# elif defined (POWERPC) +static long result, flags; +# elif defined (M68K) +static long d0; +# elif defined(BFIN) +static long r0; +# elif defined (ARM) +static struct pt_regs regs; +# elif defined (ALPHA) +static long r0; +static long a3; +# elif defined(AVR32) +static struct pt_regs regs; +# elif defined (SPARC) || defined (SPARC64) +static struct pt_regs regs; +static unsigned long trap; +# elif defined(LINUX_MIPSN32) +static long long a3; +static long long r2; +# elif defined(MIPS) +static long a3; +static long r2; +# elif defined(S390) || defined(S390X) +static long gpr2; +static long pc; +static long syscall_mode; +# elif defined(HPPA) +static long r28; +# elif defined(SH) +static long r0; +# elif defined(SH64) +static long r9; +# elif defined(X86_64) +static long rax; +# elif defined(CRISV10) || defined(CRISV32) +static long r10; +# elif defined(MICROBLAZE) +static long r3; +# endif #endif /* LINUX */ #ifdef FREEBSD - struct reg regs; +struct reg regs; /* TODO: make static? */ #endif /* FREEBSD */ int @@ -751,7 +751,7 @@ get_scno(struct tcb *tcp) } if (upeek(tcp, PT_GPR2, &syscall_mode) < 0) - return -1; + return -1; if (syscall_mode != -ENOSYS) { /* @@ -848,7 +848,7 @@ get_scno(struct tcb *tcp) int pid = tcp->pid; /* Check for 64/32 bit mode. */ - if (upeek(tcp, sizeof (unsigned long)*PT_MSR, &val) < 0) + if (upeek(tcp, sizeof(unsigned long)*PT_MSR, &val) < 0) return -1; /* SF is bit 0 of MSR */ if (val < 0) @@ -898,8 +898,8 @@ get_scno(struct tcb *tcp) int pid = tcp->pid; /* Check CS register value. On x86-64 linux it is: - * 0x33 for long mode (64 bit) - * 0x23 for compatibility mode (32 bit) + * 0x33 for long mode (64 bit) + * 0x23 for compatibility mode (32 bit) * It takes only one ptrace and thus doesn't need * to be cached. */ @@ -956,14 +956,14 @@ get_scno(struct tcb *tcp) } # elif defined(IA64) # define IA64_PSR_IS ((long)1 << 34) - if (upeek (tcp, PT_CR_IPSR, &psr) >= 0) + if (upeek(tcp, PT_CR_IPSR, &psr) >= 0) ia32 = (psr & IA64_PSR_IS) != 0; if (!(tcp->flags & TCB_INSYSCALL)) { if (ia32) { if (upeek(tcp, PT_R1, &scno) < 0) /* orig eax */ return -1; } else { - if (upeek (tcp, PT_R15, &scno) < 0) + if (upeek(tcp, PT_R15, &scno) < 0) return -1; } /* Check if we return from execve. */ @@ -973,9 +973,9 @@ get_scno(struct tcb *tcp) } } else { /* syscall in progress */ - if (upeek (tcp, PT_R8, &r8) < 0) + if (upeek(tcp, PT_R8, &r8) < 0) return -1; - if (upeek (tcp, PT_R10, &r10) < 0) + if (upeek(tcp, PT_R10, &r10) < 0) return -1; } # elif defined (ARM) @@ -1064,12 +1064,12 @@ get_scno(struct tcb *tcp) # elif defined (LINUX_MIPSN32) unsigned long long regs[38]; - if (ptrace (PTRACE_GETREGS, tcp->pid, NULL, (long) ®s) < 0) + if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long) ®s) < 0) return -1; a3 = regs[REG_A3]; r2 = regs[REG_V0]; - if(!(tcp->flags & TCB_INSYSCALL)) { + if (!(tcp->flags & TCB_INSYSCALL)) { scno = r2; /* Check if we return from execve. */ @@ -1079,9 +1079,9 @@ get_scno(struct tcb *tcp) } if (scno < 0 || scno > nsyscalls) { - if(a3 == 0 || a3 == -1) { - if(debug) - fprintf (stderr, "stray syscall exit: v0 = %ld\n", scno); + if (a3 == 0 || a3 == -1) { + if (debug) + fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno); return 0; } } @@ -1089,7 +1089,7 @@ get_scno(struct tcb *tcp) # elif defined (MIPS) if (upeek(tcp, REG_A3, &a3) < 0) return -1; - if(!(tcp->flags & TCB_INSYSCALL)) { + if (!(tcp->flags & TCB_INSYSCALL)) { if (upeek(tcp, REG_V0, &scno) < 0) return -1; @@ -1100,9 +1100,9 @@ get_scno(struct tcb *tcp) } if (scno < 0 || scno > nsyscalls) { - if(a3 == 0 || a3 == -1) { - if(debug) - fprintf (stderr, "stray syscall exit: v0 = %ld\n", scno); + if (a3 == 0 || a3 == -1) { + if (debug) + fprintf(stderr, "stray syscall exit: v0 = %ld\n", scno); return 0; } } @@ -1131,7 +1131,7 @@ get_scno(struct tcb *tcp) if (scno < 0 || scno > nsyscalls) { if (a3 == 0 || a3 == -1) { if (debug) - fprintf (stderr, "stray syscall exit: r0 = %ld\n", scno); + fprintf(stderr, "stray syscall exit: r0 = %ld\n", scno); return 0; } } @@ -1170,7 +1170,7 @@ get_scno(struct tcb *tcp) break; case 0x91d02000: /* SunOS syscall trap. (pers 1) */ - fprintf(stderr,"syscall: SunOS no support\n"); + fprintf(stderr, "syscall: SunOS no support\n"); return -1; case 0x91d02008: /* Solaris 2.x syscall trap. (per 2) */ @@ -1178,7 +1178,7 @@ get_scno(struct tcb *tcp) break; case 0x91d02009: /* NetBSD/FreeBSD syscall trap. */ - fprintf(stderr,"syscall: NetBSD/FreeBSD not supported\n"); + fprintf(stderr, "syscall: NetBSD/FreeBSD not supported\n"); return -1; case 0x91d02027: /* Solaris 2.x gettimeofday */ @@ -1186,14 +1186,14 @@ get_scno(struct tcb *tcp) break; default: /* Unknown syscall trap. */ - if(tcp->flags & TCB_WAITEXECVE) { + if (tcp->flags & TCB_WAITEXECVE) { tcp->flags &= ~TCB_WAITEXECVE; return 0; } # if defined (SPARC64) - fprintf(stderr,"syscall: unknown syscall trap %08lx %016lx\n", trap, regs.tpc); + fprintf(stderr, "syscall: unknown syscall trap %08lx %016lx\n", trap, regs.tpc); # else - fprintf(stderr,"syscall: unknown syscall trap %08lx %08lx\n", trap, regs.pc); + fprintf(stderr, "syscall: unknown syscall trap %08lx %08lx\n", trap, regs.pc); # endif return -1; } @@ -1205,7 +1205,7 @@ get_scno(struct tcb *tcp) scno = regs.u_regs[U_REG_G1]; if (scno == 0) { scno = regs.u_regs[U_REG_O0]; - memmove (®s.u_regs[U_REG_O0], ®s.u_regs[U_REG_O1], 7*sizeof(regs.u_regs[0])); + memmove(®s.u_regs[U_REG_O0], ®s.u_regs[U_REG_O1], 7*sizeof(regs.u_regs[0])); } } # elif defined(HPPA) @@ -1578,217 +1578,217 @@ get_error(struct tcb *tcp) } } # elif defined(MIPS) - if (check_errno && a3) { - tcp->u_rval = -1; - u_error = r2; - } else { - tcp->u_rval = r2; - u_error = 0; - } + if (check_errno && a3) { + tcp->u_rval = -1; + u_error = r2; + } else { + tcp->u_rval = r2; + u_error = 0; + } # elif defined(POWERPC) - if (check_errno && is_negated_errno(result)) { - tcp->u_rval = -1; - u_error = -result; - } - else { - tcp->u_rval = result; - u_error = 0; - } + if (check_errno && is_negated_errno(result)) { + tcp->u_rval = -1; + u_error = -result; + } + else { + tcp->u_rval = result; + u_error = 0; + } # elif defined(M68K) - if (check_errno && is_negated_errno(d0)) { - tcp->u_rval = -1; - u_error = -d0; - } - else { - tcp->u_rval = d0; - u_error = 0; - } + if (check_errno && is_negated_errno(d0)) { + tcp->u_rval = -1; + u_error = -d0; + } + else { + tcp->u_rval = d0; + u_error = 0; + } # elif defined(ARM) - if (check_errno && is_negated_errno(regs.ARM_r0)) { - tcp->u_rval = -1; - u_error = -regs.ARM_r0; - } - else { - tcp->u_rval = regs.ARM_r0; - u_error = 0; - } + if (check_errno && is_negated_errno(regs.ARM_r0)) { + tcp->u_rval = -1; + u_error = -regs.ARM_r0; + } + else { + tcp->u_rval = regs.ARM_r0; + u_error = 0; + } # elif defined(AVR32) - if (check_errno && regs.r12 && (unsigned) -regs.r12 < nerrnos) { - tcp->u_rval = -1; - u_error = -regs.r12; - } - else { - tcp->u_rval = regs.r12; - u_error = 0; - } + if (check_errno && regs.r12 && (unsigned) -regs.r12 < nerrnos) { + tcp->u_rval = -1; + u_error = -regs.r12; + } + else { + tcp->u_rval = regs.r12; + u_error = 0; + } # elif defined(BFIN) - if (check_errno && is_negated_errno(r0)) { - tcp->u_rval = -1; - u_error = -r0; - } else { - tcp->u_rval = r0; - u_error = 0; - } + if (check_errno && is_negated_errno(r0)) { + tcp->u_rval = -1; + u_error = -r0; + } else { + tcp->u_rval = r0; + u_error = 0; + } # elif defined(ALPHA) - if (check_errno && a3) { - tcp->u_rval = -1; - u_error = r0; - } - else { - tcp->u_rval = r0; - u_error = 0; - } + if (check_errno && a3) { + tcp->u_rval = -1; + u_error = r0; + } + else { + tcp->u_rval = r0; + u_error = 0; + } # elif defined(SPARC) - if (check_errno && regs.psr & PSR_C) { - tcp->u_rval = -1; - u_error = regs.u_regs[U_REG_O0]; - } - else { - tcp->u_rval = regs.u_regs[U_REG_O0]; - u_error = 0; - } + if (check_errno && regs.psr & PSR_C) { + tcp->u_rval = -1; + u_error = regs.u_regs[U_REG_O0]; + } + else { + tcp->u_rval = regs.u_regs[U_REG_O0]; + u_error = 0; + } # elif defined(SPARC64) - if (check_errno && regs.tstate & 0x1100000000UL) { - tcp->u_rval = -1; - u_error = regs.u_regs[U_REG_O0]; - } - else { - tcp->u_rval = regs.u_regs[U_REG_O0]; - u_error = 0; - } + if (check_errno && regs.tstate & 0x1100000000UL) { + tcp->u_rval = -1; + u_error = regs.u_regs[U_REG_O0]; + } + else { + tcp->u_rval = regs.u_regs[U_REG_O0]; + u_error = 0; + } # elif defined(HPPA) - if (check_errno && is_negated_errno(r28)) { - tcp->u_rval = -1; - u_error = -r28; - } - else { - tcp->u_rval = r28; - u_error = 0; - } + if (check_errno && is_negated_errno(r28)) { + tcp->u_rval = -1; + u_error = -r28; + } + else { + tcp->u_rval = r28; + u_error = 0; + } # elif defined(SH) - /* interpret R0 as return value or error number */ - if (check_errno && is_negated_errno(r0)) { - tcp->u_rval = -1; - u_error = -r0; - } - else { - tcp->u_rval = r0; - u_error = 0; - } + /* interpret R0 as return value or error number */ + if (check_errno && is_negated_errno(r0)) { + tcp->u_rval = -1; + u_error = -r0; + } + else { + tcp->u_rval = r0; + u_error = 0; + } # elif defined(SH64) - /* interpret result as return value or error number */ - if (check_errno && is_negated_errno(r9)) { - tcp->u_rval = -1; - u_error = -r9; - } - else { - tcp->u_rval = r9; - u_error = 0; - } + /* interpret result as return value or error number */ + if (check_errno && is_negated_errno(r9)) { + tcp->u_rval = -1; + u_error = -r9; + } + else { + tcp->u_rval = r9; + u_error = 0; + } # elif defined(CRISV10) || defined(CRISV32) - if (check_errno && r10 && (unsigned) -r10 < nerrnos) { - tcp->u_rval = -1; - u_error = -r10; - } - else { - tcp->u_rval = r10; - u_error = 0; - } + if (check_errno && r10 && (unsigned) -r10 < nerrnos) { + tcp->u_rval = -1; + u_error = -r10; + } + else { + tcp->u_rval = r10; + u_error = 0; + } # elif defined(TILE) - long rval; - /* interpret result as return value or error number */ - if (upeek(tcp, PTREGS_OFFSET_REG(0), &rval) < 0) - return -1; - if (check_errno && rval < 0 && rval > -nerrnos) { - tcp->u_rval = -1; - u_error = -rval; - } - else { - tcp->u_rval = rval; - u_error = 0; - } + long rval; + /* interpret result as return value or error number */ + if (upeek(tcp, PTREGS_OFFSET_REG(0), &rval) < 0) + return -1; + if (check_errno && rval < 0 && rval > -nerrnos) { + tcp->u_rval = -1; + u_error = -rval; + } + else { + tcp->u_rval = rval; + u_error = 0; + } # elif defined(MICROBLAZE) - /* interpret result as return value or error number */ - if (check_errno && is_negated_errno(r3)) { - tcp->u_rval = -1; - u_error = -r3; - } - else { - tcp->u_rval = r3; - u_error = 0; - } + /* interpret result as return value or error number */ + if (check_errno && is_negated_errno(r3)) { + tcp->u_rval = -1; + u_error = -r3; + } + else { + tcp->u_rval = r3; + u_error = 0; + } # endif #endif /* LINUX */ #ifdef SUNOS4 - /* get error code from user struct */ - if (upeek(tcp, uoff(u_error), &u_error) < 0) - return -1; - u_error >>= 24; /* u_error is a char */ + /* get error code from user struct */ + if (upeek(tcp, uoff(u_error), &u_error) < 0) + return -1; + u_error >>= 24; /* u_error is a char */ - /* get system call return value */ - if (upeek(tcp, uoff(u_rval1), &tcp->u_rval) < 0) - return -1; + /* get system call return value */ + if (upeek(tcp, uoff(u_rval1), &tcp->u_rval) < 0) + return -1; #endif /* SUNOS4 */ #ifdef SVR4 -#ifdef SPARC - /* Judicious guessing goes a long way. */ - if (tcp->status.pr_reg[R_PSR] & 0x100000) { - tcp->u_rval = -1; - u_error = tcp->status.pr_reg[R_O0]; - } - else { - tcp->u_rval = tcp->status.pr_reg[R_O0]; - u_error = 0; - } -#endif /* SPARC */ -#ifdef I386 - /* Wanna know how to kill an hour single-stepping? */ - if (tcp->status.PR_REG[EFL] & 0x1) { - tcp->u_rval = -1; - u_error = tcp->status.PR_REG[EAX]; - } - else { - tcp->u_rval = tcp->status.PR_REG[EAX]; -#ifdef HAVE_LONG_LONG - tcp->u_lrval = - ((unsigned long long) tcp->status.PR_REG[EDX] << 32) + - tcp->status.PR_REG[EAX]; -#endif - u_error = 0; - } -#endif /* I386 */ -#ifdef X86_64 - /* Wanna know how to kill an hour single-stepping? */ - if (tcp->status.PR_REG[EFLAGS] & 0x1) { - tcp->u_rval = -1; - u_error = tcp->status.PR_REG[RAX]; - } - else { - tcp->u_rval = tcp->status.PR_REG[RAX]; - u_error = 0; - } -#endif /* X86_64 */ -#ifdef MIPS - if (tcp->status.pr_reg[CTX_A3]) { - tcp->u_rval = -1; - u_error = tcp->status.pr_reg[CTX_V0]; - } - else { - tcp->u_rval = tcp->status.pr_reg[CTX_V0]; - u_error = 0; - } -#endif /* MIPS */ +# ifdef SPARC + /* Judicious guessing goes a long way. */ + if (tcp->status.pr_reg[R_PSR] & 0x100000) { + tcp->u_rval = -1; + u_error = tcp->status.pr_reg[R_O0]; + } + else { + tcp->u_rval = tcp->status.pr_reg[R_O0]; + u_error = 0; + } +# endif /* SPARC */ +# ifdef I386 + /* Wanna know how to kill an hour single-stepping? */ + if (tcp->status.PR_REG[EFL] & 0x1) { + tcp->u_rval = -1; + u_error = tcp->status.PR_REG[EAX]; + } + else { + tcp->u_rval = tcp->status.PR_REG[EAX]; +# ifdef HAVE_LONG_LONG + tcp->u_lrval = + ((unsigned long long) tcp->status.PR_REG[EDX] << 32) + + tcp->status.PR_REG[EAX]; +# endif + u_error = 0; + } +# endif /* I386 */ +# ifdef X86_64 + /* Wanna know how to kill an hour single-stepping? */ + if (tcp->status.PR_REG[EFLAGS] & 0x1) { + tcp->u_rval = -1; + u_error = tcp->status.PR_REG[RAX]; + } + else { + tcp->u_rval = tcp->status.PR_REG[RAX]; + u_error = 0; + } +# endif /* X86_64 */ +# ifdef MIPS + if (tcp->status.pr_reg[CTX_A3]) { + tcp->u_rval = -1; + u_error = tcp->status.pr_reg[CTX_V0]; + } + else { + tcp->u_rval = tcp->status.pr_reg[CTX_V0]; + u_error = 0; + } +# endif /* MIPS */ #endif /* SVR4 */ #ifdef FREEBSD - if (regs.r_eflags & PSL_C) { - tcp->u_rval = -1; - u_error = regs.r_eax; - } else { - tcp->u_rval = regs.r_eax; - tcp->u_lrval = - ((unsigned long long) regs.r_edx << 32) + regs.r_eax; - u_error = 0; - } + if (regs.r_eflags & PSL_C) { + tcp->u_rval = -1; + u_error = regs.r_eax; + } else { + tcp->u_rval = regs.r_eax; + tcp->u_lrval = + ((unsigned long long) regs.r_edx << 32) + regs.r_eax; + u_error = 0; + } #endif /* FREEBSD */ tcp->u_error = u_error; return 1; @@ -1974,7 +1974,7 @@ syscall_enter(struct tcb *tcp) else tcp->u_nargs = MAX_ARGS; for (i = 0; i < tcp->u_nargs; i++) { - if (upeek(tcp,i==0 ? PT_ORIGGPR2:PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0) + if (upeek(tcp, i==0 ? PT_ORIGGPR2 : PT_GPR2+i*sizeof(long), &tcp->u_arg[i]) < 0) return -1; } } @@ -2061,10 +2061,10 @@ syscall_enter(struct tcb *tcp) else nargs = tcp->u_nargs = MAX_ARGS; - if (ptrace (PTRACE_GETREGS, tcp->pid, NULL, (long) ®s) < 0) + if (ptrace(PTRACE_GETREGS, tcp->pid, NULL, (long) ®s) < 0) return -1; - for(i = 0; i < nargs; i++) { + for (i = 0; i < nargs; i++) { tcp->u_arg[i] = regs[REG_A0 + i]; # if defined (LINUX_MIPSN32) tcp->ext_arg[i] = regs[REG_A0 + i]; @@ -2080,17 +2080,17 @@ syscall_enter(struct tcb *tcp) nargs = tcp->u_nargs = sysent[tcp->scno].nargs; else nargs = tcp->u_nargs = MAX_ARGS; - if(nargs > 4) { - if(upeek(tcp, REG_SP, &sp) < 0) + if (nargs > 4) { + if (upeek(tcp, REG_SP, &sp) < 0) return -1; - for(i = 0; i < 4; i++) { - if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i])<0) + for (i = 0; i < 4; i++) { + if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0) return -1; } umoven(tcp, sp+16, (nargs-4) * sizeof(tcp->u_arg[0]), (char *)(tcp->u_arg + 4)); } else { - for(i = 0; i < nargs; i++) { + for (i = 0; i < nargs; i++) { if (upeek(tcp, REG_A0 + i, &tcp->u_arg[i]) < 0) return -1; } @@ -2368,7 +2368,7 @@ syscall_enter(struct tcb *tcp) tcp->u_nargs = 0; if (tcp->u_nargs > MAX_ARGS) tcp->u_nargs = MAX_ARGS; - switch(regs.r_eax) { + switch (regs.r_eax) { case SYS___syscall: pread(tcp->pfd, &tcp->u_arg, tcp->u_nargs * sizeof(unsigned long), regs.r_esp + sizeof(int) + sizeof(quad_t)); @@ -2745,7 +2745,7 @@ getrval2(struct tcb *tcp) #ifdef LINUX #if defined (SPARC) || defined (SPARC64) struct pt_regs regs; - if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)®s,0) < 0) + if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) return -1; val = regs.u_regs[U_REG_O1]; #elif defined(SH) @@ -615,18 +615,18 @@ sys_exportfs(struct tcb *tcp) printxval(ex_auth_flags, e.ex_auth, "AUTH_???"); tprintf(", roots:["); if (e.ex_auth == AUTH_UNIX) { - for (i=0; i<e.ex_u.exunix.rootaddrs.naddrs; i++) { + for (i = 0; i < e.ex_u.exunix.rootaddrs.naddrs; i++) { printsock(tcp, (int)&e.ex_u.exunix.rootaddrs.addrvec[i]); } tprintf("], writers:["); - for (i=0; i<e.ex_writeaddrs.naddrs; i++) { + for (i = 0; i < e.ex_writeaddrs.naddrs; i++) { printsock(tcp, (int)&e.ex_writeaddrs.addrvec[i]); } tprintf("]"); } else { - for (i=0; i<e.ex_u.exdes.nnames; i++) { + for (i = 0; i < e.ex_u.exdes.nnames; i++) { printsock(tcp, (int)&e.ex_u.exdes.rootnames[i]); tprintf(", "); @@ -849,7 +849,7 @@ static const struct xlat sysinfo_options[] = { #ifdef SI_SET_KERB_REALM { SI_SET_KERB_REALM, "SI_SET_KERB_REALM" }, #endif -#ifdef SI_KERB_REALM +#ifdef SI_KERB_REALM { SI_KERB_REALM, "SI_KERB_REALM" }, #endif { 0, NULL }, @@ -1425,7 +1425,7 @@ int sys_mount(struct tcb *tcp) { if (entering(tcp)) { - char fstyp [FSTYPSZ]; + char fstyp[FSTYPSZ]; printpath(tcp, tcp->u_arg[0]); tprintf(", "); printpath(tcp, tcp->u_arg[1]); @@ -1448,7 +1448,7 @@ sys_mount(struct tcb *tcp) #ifdef VX_MS_MASK /* On UW7 they don't give us the defines and structs we need to see what is going on. Bummer. */ - if (strcmp (fstyp, "vxfs") == 0) { + if (strcmp(fstyp, "vxfs") == 0) { struct vx_mountargs5 args; if (umove(tcp, tcp->u_arg[4], &args) < 0) tprintf("%#lx", tcp->u_arg[4]); @@ -1456,32 +1456,32 @@ sys_mount(struct tcb *tcp) tprintf("{ flags="); printflags(vxfs_flags, args.mflags, "VX_MS_???"); if (args.mflags & VX_MS_SNAPSHOT) { - tprintf (", snapof="); - printstr (tcp, + tprintf(", snapof="); + printstr(tcp, (long) args.primaryspec, -1); if (args.snapsize > 0) - tprintf (", snapsize=%ld", args.snapsize); + tprintf(", snapsize=%ld", args.snapsize); } tprintf(" }"); } } else #endif - if (strcmp (fstyp, "specfs") == 0) { - tprintf ("dev="); - printstr (tcp, tcp->u_arg[4], -1); + if (strcmp(fstyp, "specfs") == 0) { + tprintf("dev="); + printstr(tcp, tcp->u_arg[4], -1); } else - if (strcmp (fstyp, "nfs") == 0) { + if (strcmp(fstyp, "nfs") == 0) { struct nfs_args args; if (umove(tcp, tcp->u_arg[4], &args) < 0) tprintf("%#lx", tcp->u_arg[4]); else { struct netbuf addr; tprintf("{ addr="); - if (umove (tcp, (int) args.addr, &addr) < 0) { - tprintf ("%#lx", (long) args.addr); + if (umove(tcp, (int) args.addr, &addr) < 0) { + tprintf("%#lx", (long) args.addr); } else { printsock(tcp, (int) addr.buf, addr.len); @@ -1565,7 +1565,7 @@ static const struct xlat capabilities[] = { #ifdef CAP_SETFCAP { 1<<CAP_SETFCAP, "CAP_SETFCAP" }, #endif - { 0, NULL }, + { 0, NULL }, }; @@ -1575,7 +1575,7 @@ sys_capget(struct tcb *tcp) static cap_user_header_t arg0 = NULL; static cap_user_data_t arg1 = NULL; - if(!entering(tcp)) { + if (!entering(tcp)) { if (!arg0) { if ((arg0 = malloc(sizeof(*arg0))) == NULL) { fprintf(stderr, "out of memory\n"); @@ -1626,7 +1626,7 @@ sys_capset(struct tcb *tcp) static cap_user_header_t arg0 = NULL; static cap_user_data_t arg1 = NULL; - if(entering(tcp)) { + if (entering(tcp)) { if (!arg0) { if ((arg0 = malloc(sizeof(*arg0))) == NULL) { fprintf(stderr, "out of memory\n"); @@ -1938,11 +1938,11 @@ sys_sysctl(struct tcb *tcp) int *name; unsigned long size; - if (umove (tcp, tcp->u_arg[0], &info) < 0) + if (umove(tcp, tcp->u_arg[0], &info) < 0) return printargs(tcp); - size = sizeof (int) * (unsigned long) info.nlen; - name = (size / sizeof (int) != info.nlen) ? NULL : malloc (size); + size = sizeof(int) * (unsigned long) info.nlen; + name = (size / sizeof(int) != info.nlen) ? NULL : malloc(size); if (name == NULL || umoven(tcp, (unsigned long) info.name, size, (char *) name) < 0) { free(name); @@ -2156,7 +2156,7 @@ static const struct xlat ksym_flags[] = { int sys_getksym(struct tcb *tcp) { - if (entering (tcp)) { + if (entering(tcp)) { printstr(tcp, tcp->u_arg[0], -1); tprintf(", "); } @@ -2167,14 +2167,14 @@ sys_getksym(struct tcb *tcp) } else { int val; - printnum (tcp, tcp->u_arg[1], "%#lx"); + printnum(tcp, tcp->u_arg[1], "%#lx"); tprintf(", "); if (umove(tcp, tcp->u_arg[2], &val) < 0) { tprintf("%#lx", tcp->u_arg[2]); } else { tprintf("["); - printxval (ksym_flags, val, "STT_???"); + printxval(ksym_flags, val, "STT_???"); tprintf("]"); } } @@ -2188,7 +2188,7 @@ sys_getksym(struct tcb *tcp) struct cred; #include <sys/nscsys.h> -static const struct xlat ssi_cmd [] = { +static const struct xlat ssi_cmd[] = { { SSISYS_BADOP, "SSISYS_BADOP" }, { SSISYS_LDLVL_INIT,"SSISYS_LDLVL_INIT"}, { SSISYS_LDLVL_GETVEC,"SSISYS_LDLVL_GETVEC"}, @@ -2241,54 +2241,54 @@ int sys_ssisys(struct tcb *tcp) cls_nodeinfo_args_t cni; clusternode_info_t info; - if (entering (tcp)) { + if (entering(tcp)) { ts_reclaim_child_inargs_t trc; if (tcp->u_arg[1] != sizeof iov || - umove (tcp, tcp->u_arg[0], &iov) < 0) + umove(tcp, tcp->u_arg[0], &iov) < 0) { - tprintf ("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]); + tprintf("%#lx, %ld", tcp->u_arg[0], tcp->u_arg[1]); return 0; } - tprintf ("{id="); + tprintf("{id="); printxval(ssi_cmd, iov.tio_id.id_cmd, "SSISYS_???"); - tprintf (":%d", iov.tio_id.id_ver); + tprintf(":%d", iov.tio_id.id_ver); switch (iov.tio_id.id_cmd) { case SSISYS_RECLAIM_CHILD: if (iov.tio_udatainlen != sizeof trc || - umove (tcp, (long) iov.tio_udatain, &trc) < 0) + umove(tcp, (long) iov.tio_udatain, &trc) < 0) goto bad; - tprintf (", in={pid=%ld, start=%ld}", + tprintf(", in={pid=%ld, start=%ld}", trc.trc_pid, trc.trc_start); break; case SSISYS_CLUSTERNODE_INFO: if (iov.tio_udatainlen != sizeof cni || - umove (tcp, (long) iov.tio_udatain, &cni) < 0) + umove(tcp, (long) iov.tio_udatain, &cni) < 0) goto bad; - tprintf (", in={node=%ld, len=%d}", + tprintf(", in={node=%ld, len=%d}", cni.nodenum, cni.info_len); break; default: bad: if (iov.tio_udatainlen) { - tprintf (", in=[/* %d bytes */]", + tprintf(", in=[/* %d bytes */]", iov.tio_udatainlen); } } } else { if (tcp->u_arg[1] != sizeof iov || - umove (tcp, tcp->u_arg[0], &iov) < 0) + umove(tcp, tcp->u_arg[0], &iov) < 0) goto done; switch (iov.tio_id.id_cmd) { case SSISYS_CLUSTERNODE_INFO: if (iov.tio_udatainlen != sizeof cni || - umove (tcp, (long) iov.tio_udatain, &cni) < 0) + umove(tcp, (long) iov.tio_udatain, &cni) < 0) goto bad_out; if (cni.info_len != sizeof info || iov.tio_udataoutlen != sizeof &info || - umove (tcp, (long) iov.tio_udataout, &info) < 0) + umove(tcp, (long) iov.tio_udataout, &info) < 0) goto bad_out; - tprintf (", out={node=%ld, cpus=%d, online=%d}", + tprintf(", out={node=%ld, cpus=%d, online=%d}", info.node_num, info.node_totalcpus, info.node_onlinecpus); break; @@ -2296,12 +2296,12 @@ int sys_ssisys(struct tcb *tcp) default: bad_out: if (iov.tio_udataoutlen) { - tprintf (", out=[/* %d bytes */]", + tprintf(", out=[/* %d bytes */]", iov.tio_udataoutlen); } } done: - tprintf ("}, %ld", tcp->u_arg[1]); + tprintf("}, %ld", tcp->u_arg[1]); } return 0; } @@ -2331,7 +2331,7 @@ int sys_sysmips(struct tcb *tcp) printxval(sysmips_operations, tcp->u_arg[0], "???"); if (!verbose(tcp)) { tprintf("%ld, %ld, %ld", tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]); - } else if (tcp->u_arg[0]==SETNAME) { + } else if (tcp->u_arg[0] == SETNAME) { char nodename[__NEW_UTS_LEN + 1]; if (umovestr(tcp, tcp->u_arg[1], (__NEW_UTS_LEN + 1), nodename) < 0) tprintf(", %#lx", tcp->u_arg[1]); diff --git a/test/childthread.c b/test/childthread.c index e89fb14..c86b9cf 100644 --- a/test/childthread.c +++ b/test/childthread.c @@ -29,7 +29,7 @@ int main(int argc, char *argv[]) child = fork(); - switch(child) { + switch (child) { case -1: assert(0); case 0: diff --git a/test/leaderkill.c b/test/leaderkill.c index ebb6ad1..c24a9f0 100644 --- a/test/leaderkill.c +++ b/test/leaderkill.c @@ -1,5 +1,5 @@ -/* Test handle_group_exit () handling of a thread leader still alive with its - * thread child calling exit_group () and proper passing of the process exit +/* Test handle_group_exit() handling of a thread leader still alive with its + * thread child calling exit_group() and proper passing of the process exit * code to the process parent of this whole thread group. * * gcc -o test/leaderkill test/leaderkill.c -Wall -ggdb2 -pthread;./test/leaderkill & pid=$!;sleep 1;strace -o x -q ./strace -f -p $pid @@ -38,7 +38,7 @@ int main(int argc, char *argv[]) child = fork(); - switch(child) { + switch (child) { case -1: abort(); case 0: diff --git a/test/skodic.c b/test/skodic.c index 09967bd..cfb935e 100644 --- a/test/skodic.c +++ b/test/skodic.c @@ -24,7 +24,7 @@ int main(int argc, char *argv[]) *c = 0; if (fork()) { - while(1) { + while (1) { strcpy(c, "/etc/passwd"); strcpy(c, "/etc/shadow"); } @@ -790,7 +790,7 @@ printsigevent(struct tcb *tcp, long arg) return; } #endif - if (umove (tcp, arg, &sev) < 0) + if (umove(tcp, arg, &sev) < 0) tprintf("{...}"); else { tprintf("{%p, ", sev.sigev_value.sival_ptr); @@ -846,7 +846,7 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr) hardware page size). Assume all pages >= 1024 (a-historical I know) */ - int page = 1024; /* How to find this? */ + int page = 1024; /* How to find this? */ int move = page - (addr & (page - 1)); int left = len; @@ -856,7 +856,7 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr) if (move > left) move = left; if ((move = read(fd, laddr, move)) <= 0) return left != len ? 0 : -1; - if (memchr (laddr, 0, move)) break; + if (memchr(laddr, 0, move)) break; left -= move; laddr += move; addr += move; @@ -887,7 +887,7 @@ umovestr(struct tcb *tcp, long addr, int len, char *laddr) return -1; } started = 1; - memcpy(laddr, &u.x[n], m = MIN(sizeof(long)-n,len)); + memcpy(laddr, &u.x[n], m = MIN(sizeof(long)-n, len)); while (n & (sizeof(long) - 1)) if (u.x[n++] == '\0') return 0; @@ -1023,7 +1023,7 @@ upeek(struct tcb *tcp, long off, long *res) if (val == -1 && errno) { if (errno != ESRCH) { char buf[60]; - sprintf(buf,"upeek: ptrace(PTRACE_PEEKUSER,%d,%lu,0)", tcp->pid, off); + sprintf(buf, "upeek: ptrace(PTRACE_PEEKUSER,%d,%lu,0)", tcp->pid, off); perror(buf); } return -1; @@ -1053,7 +1053,7 @@ printcall(struct tcb *tcp) # elif defined(S390) || defined(S390X) long psw; - if(upeek(tcp,PT_PSWADDR,&psw) < 0) { + if (upeek(tcp, PT_PSWADDR, &psw) < 0) { PRINTBADPC; return; } @@ -1095,7 +1095,7 @@ printcall(struct tcb *tcp) long pc; if (upeek(tcp, 4*PT_PC, &pc) < 0) { - tprintf ("[????????] "); + tprintf("[????????] "); return; } tprintf("[%08lx] ", pc); @@ -1103,13 +1103,13 @@ printcall(struct tcb *tcp) long pc; if (upeek(tcp, REG_PC, &pc) < 0) { - tprintf ("[????????????????] "); + tprintf("[????????????????] "); return; } tprintf("[%08lx] ", pc); # elif defined(SPARC) || defined(SPARC64) struct pt_regs regs; - if (ptrace(PTRACE_GETREGS,tcp->pid,(char *)®s,0) < 0) { + if (ptrace(PTRACE_GETREGS, tcp->pid, (char *)®s, 0) < 0) { PRINTBADPC; return; } @@ -1121,8 +1121,8 @@ printcall(struct tcb *tcp) # elif defined(HPPA) long pc; - if(upeek(tcp,PT_IAOQ0,&pc) < 0) { - tprintf ("[????????] "); + if (upeek(tcp, PT_IAOQ0, &pc) < 0) { + tprintf("[????????] "); return; } tprintf("[%08lx] ", pc); @@ -1130,7 +1130,7 @@ printcall(struct tcb *tcp) long pc; if (upeek(tcp, REG_EPC, &pc) < 0) { - tprintf ("[????????] "); + tprintf("[????????] "); return; } tprintf("[%08lx] ", pc); @@ -1138,7 +1138,7 @@ printcall(struct tcb *tcp) long pc; if (upeek(tcp, 4*REG_PC, &pc) < 0) { - tprintf ("[????????] "); + tprintf("[????????] "); return; } tprintf("[%08lx] ", pc); @@ -1146,7 +1146,7 @@ printcall(struct tcb *tcp) long pc; if (upeek(tcp, REG_PC, &pc) < 0) { - tprintf ("[????????????????] "); + tprintf("[????????????????] "); return; } tprintf("[%08lx] ", pc); @@ -1284,9 +1284,9 @@ get_arg0(struct tcb *tcp, arg_setup_state *state, long *valp) int ret; if (ia32) - ret = upeek (tcp, PT_R11, valp); + ret = upeek(tcp, PT_R11, valp); else - ret = umoven (tcp, + ret = umoven(tcp, (unsigned long) ia64_rse_skip_regs(*state, 0), sizeof(long), (void *) valp); return ret; @@ -1298,9 +1298,9 @@ get_arg1(struct tcb *tcp, arg_setup_state *state, long *valp) int ret; if (ia32) - ret = upeek (tcp, PT_R9, valp); + ret = upeek(tcp, PT_R9, valp); else - ret = umoven (tcp, + ret = umoven(tcp, (unsigned long) ia64_rse_skip_regs(*state, 1), sizeof(long), (void *) valp); return ret; @@ -1350,9 +1350,9 @@ set_arg1(struct tcb *tcp, arg_setup_state *state, long val) typedef struct pt_regs arg_setup_state; # define arg_setup(tcp, state) \ - (ptrace (PTRACE_GETREGS, tcp->pid, (char *) (state), 0)) + (ptrace(PTRACE_GETREGS, tcp->pid, (char *) (state), 0)) # define arg_finish_change(tcp, state) \ - (ptrace (PTRACE_SETREGS, tcp->pid, (char *) (state), 0)) + (ptrace(PTRACE_SETREGS, tcp->pid, (char *) (state), 0)) # define get_arg0(tcp, state, valp) (*(valp) = (state)->u_regs[U_REG_O0], 0) # define get_arg1(tcp, state, valp) (*(valp) = (state)->u_regs[U_REG_O1], 0) @@ -1417,20 +1417,20 @@ typedef int arg_setup_state; # define arg_setup(tcp, state) (0) # define arg_finish_change(tcp, state) 0 # define get_arg0(tcp, cookie, valp) \ - (upeek ((tcp), arg0_offset, (valp))) + (upeek((tcp), arg0_offset, (valp))) # define get_arg1(tcp, cookie, valp) \ - (upeek ((tcp), arg1_offset, (valp))) + (upeek((tcp), arg1_offset, (valp))) static int set_arg0(struct tcb *tcp, void *cookie, long val) { - return ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg0_offset, val); + return ptrace(PTRACE_POKEUSER, tcp->pid, (char*)arg0_offset, val); } static int set_arg1(struct tcb *tcp, void *cookie, long val) { - return ptrace (PTRACE_POKEUSER, tcp->pid, (char*)arg1_offset, val); + return ptrace(PTRACE_POKEUSER, tcp->pid, (char*)arg1_offset, val); } # endif /* architectures */ @@ -1480,13 +1480,13 @@ setbpt(struct tcb *tcp) case SYS_fork: # endif # if defined SYS_fork || defined SYS_vfork - if (arg_setup (tcp, &state) < 0 - || get_arg0 (tcp, &state, &tcp->inst[0]) < 0 - || get_arg1 (tcp, &state, &tcp->inst[1]) < 0 + if (arg_setup(tcp, &state) < 0 + || get_arg0(tcp, &state, &tcp->inst[0]) < 0 + || get_arg1(tcp, &state, &tcp->inst[1]) < 0 || change_syscall(tcp, clone_scno[current_personality]) < 0 - || set_arg0 (tcp, &state, CLONE_PTRACE|SIGCHLD) < 0 - || set_arg1 (tcp, &state, 0) < 0 - || arg_finish_change (tcp, &state) < 0) + || set_arg0(tcp, &state, CLONE_PTRACE|SIGCHLD) < 0 + || set_arg1(tcp, &state, 0) < 0 + || arg_finish_change(tcp, &state) < 0) return -1; tcp->u_arg[arg0_index] = CLONE_PTRACE|SIGCHLD; tcp->u_arg[arg1_index] = 0; @@ -1506,12 +1506,12 @@ setbpt(struct tcb *tcp) clear also CLONE_VM but only in the CLONE_VFORK case as otherwise we would break pthread_create. */ - if ((arg_setup (tcp, &state) < 0 - || set_arg0 (tcp, &state, + if ((arg_setup(tcp, &state) < 0 + || set_arg0(tcp, &state, (tcp->u_arg[arg0_index] | CLONE_PTRACE) & ~(tcp->u_arg[arg0_index] & CLONE_VFORK ? CLONE_VFORK | CLONE_VM : 0)) < 0 - || arg_finish_change (tcp, &state) < 0)) + || arg_finish_change(tcp, &state) < 0)) return -1; tcp->flags |= TCB_BPTSET; tcp->inst[0] = tcp->u_arg[arg0_index]; @@ -1531,10 +1531,10 @@ int clearbpt(struct tcb *tcp) { arg_setup_state state; - if (arg_setup (tcp, &state) < 0 - || restore_arg0 (tcp, &state, tcp->inst[0]) < 0 - || restore_arg1 (tcp, &state, tcp->inst[1]) < 0 - || arg_finish_change (tcp, &state)) + if (arg_setup(tcp, &state) < 0 + || restore_arg0(tcp, &state, tcp->inst[0]) < 0 + || restore_arg1(tcp, &state, tcp->inst[1]) < 0 + || arg_finish_change(tcp, &state)) if (errno != ESRCH) return -1; tcp->flags &= ~TCB_BPTSET; return 0; |