diff --git a/ChangeLog b/ChangeLog index 4c5a30a2..2f04c629 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2009-04-14 Denys Vlasenko + + * signal.c: Whitespace, comment, and style fixes, no code changes. + * file.c: Ditto. + * time.c: Ditto. + * process.c: Ditto. + * resource.c: Ditto. + 2009-03-23 Denys Vlasenko * system.c (sram_alloc_flag): Add L2_SRAM constant. diff --git a/file.c b/file.c index f283a352..a8401cfa 100644 --- a/file.c +++ b/file.c @@ -1,5 +1,4 @@ /* -#ifdef LINUX * Copyright (c) 1991, 1992 Paul Kranenburg * Copyright (c) 1993 Branko Lankester * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey @@ -448,8 +447,7 @@ static const struct xlat openmodessol[] = { }; int -solaris_open(tcp) -struct tcb *tcp; +solaris_open(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -467,8 +465,7 @@ struct tcb *tcp; #endif int -sys_creat(tcp) -struct tcb *tcp; +sys_creat(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -519,8 +516,7 @@ sys_faccessat(struct tcb *tcp) #endif int -sys_umask(tcp) -struct tcb *tcp; +sys_umask(struct tcb *tcp) { if (entering(tcp)) { tprintf("%#lo", tcp->u_arg[0]); @@ -538,8 +534,7 @@ static const struct xlat whence[] = { #ifndef HAVE_LONG_LONG_OFF_T #if defined (LINUX_MIPSN32) int -sys_lseek(tcp) -struct tcb *tcp; +sys_lseek(struct tcb *tcp) { long long offset; int _whence; @@ -558,8 +553,7 @@ struct tcb *tcp; } #else /* !LINUX_MIPSN32 */ int -sys_lseek(tcp) -struct tcb *tcp; +sys_lseek(struct tcb *tcp) { off_t offset; int _whence; @@ -581,58 +575,55 @@ struct tcb *tcp; #ifdef LINUX int -sys_llseek (tcp) -struct tcb *tcp; +sys_llseek(struct tcb *tcp) { - if (entering(tcp)) { - /* - * This one call takes explicitly two 32-bit arguments hi, lo, - * rather than one 64-bit argument for which LONG_LONG works - * appropriate for the native byte order. - */ - if (tcp->u_arg[4] == SEEK_SET) - tprintf("%ld, %llu, ", tcp->u_arg[0], - (((long long int) tcp->u_arg[1]) << 32 - | (unsigned long long) (unsigned) tcp->u_arg[2])); - else - tprintf("%ld, %lld, ", tcp->u_arg[0], - (((long long int) tcp->u_arg[1]) << 32 - | (unsigned long long) (unsigned) tcp->u_arg[2])); - } - else { - long long int off; - if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0) - tprintf("%#lx, ", tcp->u_arg[3]); - else - tprintf("[%llu], ", off); - printxval(whence, tcp->u_arg[4], "SEEK_???"); - } - return 0; + if (entering(tcp)) { + /* + * This one call takes explicitly two 32-bit arguments hi, lo, + * rather than one 64-bit argument for which LONG_LONG works + * appropriate for the native byte order. + */ + if (tcp->u_arg[4] == SEEK_SET) + tprintf("%ld, %llu, ", tcp->u_arg[0], + (((long long int) tcp->u_arg[1]) << 32 + | (unsigned long long) (unsigned) tcp->u_arg[2])); + else + tprintf("%ld, %lld, ", tcp->u_arg[0], + (((long long int) tcp->u_arg[1]) << 32 + | (unsigned long long) (unsigned) tcp->u_arg[2])); + } + else { + long long int off; + if (syserror(tcp) || umove(tcp, tcp->u_arg[3], &off) < 0) + tprintf("%#lx, ", tcp->u_arg[3]); + else + tprintf("[%llu], ", off); + printxval(whence, tcp->u_arg[4], "SEEK_???"); + } + return 0; } int -sys_readahead (tcp) -struct tcb *tcp; +sys_readahead(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, %lld, %ld", tcp->u_arg[0], + if (entering(tcp)) { + tprintf("%ld, %lld, %ld", tcp->u_arg[0], # if defined LINUX_MIPSN32 - tcp->ext_arg[1], tcp->u_arg[2] + tcp->ext_arg[1], tcp->u_arg[2] # elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64 - (long long int) tcp->u_arg[1], tcp->u_arg[2] + (long long int) tcp->u_arg[1], tcp->u_arg[2] # else - LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3] + LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3] # endif ); - } - return 0; + } + return 0; } #endif #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int -sys_lseek64 (tcp) -struct tcb *tcp; +sys_lseek64(struct tcb *tcp) { if (entering(tcp)) { long long offset; @@ -650,8 +641,7 @@ struct tcb *tcp; #ifndef HAVE_LONG_LONG_OFF_T int -sys_truncate(tcp) -struct tcb *tcp; +sys_truncate(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -663,8 +653,7 @@ struct tcb *tcp; #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int -sys_truncate64(tcp) -struct tcb *tcp; +sys_truncate64(struct tcb *tcp) { if (entering(tcp)) { ALIGN64 (tcp, 1); @@ -677,8 +666,7 @@ struct tcb *tcp; #ifndef HAVE_LONG_LONG_OFF_T int -sys_ftruncate(tcp) -struct tcb *tcp; +sys_ftruncate(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, %lu", tcp->u_arg[0], tcp->u_arg[1]); @@ -689,8 +677,7 @@ struct tcb *tcp; #if _LFS64_LARGEFILE || HAVE_LONG_LONG_OFF_T int -sys_ftruncate64(tcp) -struct tcb *tcp; +sys_ftruncate64(struct tcb *tcp) { if (entering(tcp)) { ALIGN64 (tcp, 1); @@ -715,8 +702,7 @@ static const struct xlat modetypes[] = { }; static const char * -sprintmode(mode) -int mode; +sprintmode(int mode) { static char buf[64]; const char *s; @@ -838,9 +824,7 @@ printstatsol(struct tcb *tcp, long addr) #if defined (SPARC64) static void -printstat_sparc64(tcp, addr) -struct tcb *tcp; -long addr; +printstat_sparc64(struct tcb *tcp, long addr) { struct stat_sparc64 statbuf; @@ -920,8 +904,7 @@ static const struct xlat fileflags[] = { #ifdef FREEBSD int -sys_chflags(tcp) -struct tcb *tcp; +sys_chflags(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -932,8 +915,7 @@ struct tcb *tcp; } int -sys_fchflags(tcp) -struct tcb *tcp; +sys_fchflags(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); @@ -945,49 +927,47 @@ struct tcb *tcp; #ifndef HAVE_LONG_LONG_OFF_T static void -realprintstat(tcp, statbuf) -struct tcb *tcp; -struct stat *statbuf; +realprintstat(struct tcb *tcp, struct stat *statbuf) { - if (!abbrev(tcp)) { - tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ", - (unsigned long) major(statbuf->st_dev), - (unsigned long) minor(statbuf->st_dev), - (unsigned long) statbuf->st_ino, - sprintmode(statbuf->st_mode)); - tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ", - (unsigned long) statbuf->st_nlink, - (unsigned long) statbuf->st_uid, - (unsigned long) statbuf->st_gid); + if (!abbrev(tcp)) { + tprintf("{st_dev=makedev(%lu, %lu), st_ino=%lu, st_mode=%s, ", + (unsigned long) major(statbuf->st_dev), + (unsigned long) minor(statbuf->st_dev), + (unsigned long) statbuf->st_ino, + sprintmode(statbuf->st_mode)); + tprintf("st_nlink=%lu, st_uid=%lu, st_gid=%lu, ", + (unsigned long) statbuf->st_nlink, + (unsigned long) statbuf->st_uid, + (unsigned long) statbuf->st_gid); #ifdef HAVE_STRUCT_STAT_ST_BLKSIZE - tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize); -#endif /* HAVE_STRUCT_STAT_ST_BLKSIZE */ + tprintf("st_blksize=%lu, ", (unsigned long) statbuf->st_blksize); +#endif #ifdef HAVE_STRUCT_STAT_ST_BLOCKS - tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks); -#endif /* HAVE_STRUCT_STAT_ST_BLOCKS */ - } - else - tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode)); - switch (statbuf->st_mode & S_IFMT) { - case S_IFCHR: case S_IFBLK: + tprintf("st_blocks=%lu, ", (unsigned long) statbuf->st_blocks); +#endif + } + else + tprintf("{st_mode=%s, ", sprintmode(statbuf->st_mode)); + switch (statbuf->st_mode & S_IFMT) { + case S_IFCHR: case S_IFBLK: #ifdef HAVE_STRUCT_STAT_ST_RDEV - tprintf("st_rdev=makedev(%lu, %lu), ", - (unsigned long) major(statbuf->st_rdev), - (unsigned long) minor(statbuf->st_rdev)); + tprintf("st_rdev=makedev(%lu, %lu), ", + (unsigned long) major(statbuf->st_rdev), + (unsigned long) minor(statbuf->st_rdev)); #else /* !HAVE_STRUCT_STAT_ST_RDEV */ - tprintf("st_size=makedev(%lu, %lu), ", - (unsigned long) major(statbuf->st_size), - (unsigned long) minor(statbuf->st_size)); + tprintf("st_size=makedev(%lu, %lu), ", + (unsigned long) major(statbuf->st_size), + (unsigned long) minor(statbuf->st_size)); #endif /* !HAVE_STRUCT_STAT_ST_RDEV */ - break; - default: - tprintf("st_size=%lu, ", statbuf->st_size); - break; - } - if (!abbrev(tcp)) { - tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime)); - tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime)); - tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime)); + break; + default: + tprintf("st_size=%lu, ", statbuf->st_size); + break; + } + if (!abbrev(tcp)) { + tprintf("st_atime=%s, ", sprinttime(statbuf->st_atime)); + tprintf("st_mtime=%s, ", sprinttime(statbuf->st_mtime)); + tprintf("st_ctime=%s", sprinttime(statbuf->st_ctime)); #if HAVE_STRUCT_STAT_ST_FLAGS tprintf(", st_flags="); printflags(fileflags, statbuf->st_flags, "UF_???"); @@ -1006,16 +986,14 @@ struct stat *statbuf; tprintf(", st_gen=%u", statbuf->st_gen); #endif tprintf("}"); - } - else - tprintf("...}"); + } + else + tprintf("...}"); } static void -printstat(tcp, addr) -struct tcb *tcp; -long addr; +printstat(struct tcb *tcp, long addr) { struct stat statbuf; @@ -1083,9 +1061,7 @@ struct stat64 { #ifdef HAVE_STAT64 static void -printstat64(tcp, addr) -struct tcb *tcp; -long addr; +printstat64(struct tcb *tcp, long addr) { struct stat64 statbuf; @@ -1197,30 +1173,26 @@ long addr; #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) static void -convertoldstat(oldbuf, newbuf) -const struct __old_kernel_stat *oldbuf; -struct stat *newbuf; +convertoldstat(const struct __old_kernel_stat *oldbuf, struct stat *newbuf) { - newbuf->st_dev=oldbuf->st_dev; - newbuf->st_ino=oldbuf->st_ino; - newbuf->st_mode=oldbuf->st_mode; - newbuf->st_nlink=oldbuf->st_nlink; - newbuf->st_uid=oldbuf->st_uid; - newbuf->st_gid=oldbuf->st_gid; - newbuf->st_rdev=oldbuf->st_rdev; - newbuf->st_size=oldbuf->st_size; - newbuf->st_atime=oldbuf->st_atime; - newbuf->st_mtime=oldbuf->st_mtime; - newbuf->st_ctime=oldbuf->st_ctime; - newbuf->st_blksize=0; /* not supported in old_stat */ - newbuf->st_blocks=0; /* not supported in old_stat */ + newbuf->st_dev = oldbuf->st_dev; + newbuf->st_ino = oldbuf->st_ino; + newbuf->st_mode = oldbuf->st_mode; + newbuf->st_nlink = oldbuf->st_nlink; + newbuf->st_uid = oldbuf->st_uid; + newbuf->st_gid = oldbuf->st_gid; + newbuf->st_rdev = oldbuf->st_rdev; + newbuf->st_size = oldbuf->st_size; + newbuf->st_atime = oldbuf->st_atime; + newbuf->st_mtime = oldbuf->st_mtime; + newbuf->st_ctime = oldbuf->st_ctime; + newbuf->st_blksize = 0; /* not supported in old_stat */ + newbuf->st_blocks = 0; /* not supported in old_stat */ } static void -printoldstat(tcp, addr) -struct tcb *tcp; -long addr; +printoldstat(struct tcb *tcp, long addr) { struct __old_kernel_stat statbuf; struct stat newstatbuf; @@ -1252,8 +1224,7 @@ long addr; #ifndef HAVE_LONG_LONG_OFF_T int -sys_stat(tcp) -struct tcb *tcp; +sys_stat(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1266,8 +1237,7 @@ struct tcb *tcp; #endif int -sys_stat64(tcp) -struct tcb *tcp; +sys_stat64(struct tcb *tcp) { #ifdef HAVE_STAT64 if (entering(tcp)) { @@ -1314,8 +1284,7 @@ sys_newfstatat(struct tcb *tcp) #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) int -sys_oldstat(tcp) -struct tcb *tcp; +sys_oldstat(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1329,8 +1298,7 @@ struct tcb *tcp; #ifndef HAVE_LONG_LONG_OFF_T int -sys_fstat(tcp) -struct tcb *tcp; +sys_fstat(struct tcb *tcp) { if (entering(tcp)) tprintf("%ld, ", tcp->u_arg[0]); @@ -1342,8 +1310,7 @@ struct tcb *tcp; #endif int -sys_fstat64(tcp) -struct tcb *tcp; +sys_fstat64(struct tcb *tcp) { #ifdef HAVE_STAT64 if (entering(tcp)) @@ -1359,8 +1326,7 @@ struct tcb *tcp; #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) int -sys_oldfstat(tcp) -struct tcb *tcp; +sys_oldfstat(struct tcb *tcp) { if (entering(tcp)) tprintf("%ld, ", tcp->u_arg[0]); @@ -1373,8 +1339,7 @@ struct tcb *tcp; #ifndef HAVE_LONG_LONG_OFF_T int -sys_lstat(tcp) -struct tcb *tcp; +sys_lstat(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1387,8 +1352,7 @@ struct tcb *tcp; #endif int -sys_lstat64(tcp) -struct tcb *tcp; +sys_lstat64(struct tcb *tcp) { #ifdef HAVE_STAT64 if (entering(tcp)) { @@ -1405,8 +1369,7 @@ struct tcb *tcp; #if defined(LINUX) && defined(HAVE_STRUCT___OLD_KERNEL_STAT) int -sys_oldlstat(tcp) -struct tcb *tcp; +sys_oldlstat(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1422,8 +1385,7 @@ struct tcb *tcp; #if defined(SVR4) || defined(LINUXSPARC) int -sys_xstat(tcp) -struct tcb *tcp; +sys_xstat(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); @@ -1441,8 +1403,7 @@ struct tcb *tcp; } int -sys_fxstat(tcp) -struct tcb *tcp; +sys_fxstat(struct tcb *tcp) { if (entering(tcp)) tprintf("%ld, %ld, ", tcp->u_arg[0], tcp->u_arg[1]); @@ -1458,8 +1419,7 @@ struct tcb *tcp; } int -sys_lxstat(tcp) -struct tcb *tcp; +sys_lxstat(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); @@ -1477,8 +1437,7 @@ struct tcb *tcp; } int -sys_xmknod(tcp) -struct tcb *tcp; +sys_xmknod(struct tcb *tcp) { int mode = tcp->u_arg[2]; @@ -1532,8 +1491,7 @@ static const struct xlat aclcmds[] = { }; int -sys_acl(tcp) -struct tcb *tcp; +sys_acl(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1554,8 +1512,7 @@ struct tcb *tcp; int -sys_facl(tcp) -struct tcb *tcp; +sys_facl(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, ", tcp->u_arg[0]); @@ -1589,8 +1546,7 @@ static const struct xlat aclipc[] = { int -sys_aclipc(tcp) -struct tcb *tcp; +sys_aclipc(struct tcb *tcp) { if (entering(tcp)) { printxval(aclipc, tcp->u_arg[0], "???IPC???"); @@ -1609,8 +1565,6 @@ struct tcb *tcp; return 0; } - - #endif /* HAVE_SYS_ACL_H */ #endif /* SVR4 || LINUXSPARC */ @@ -1655,8 +1609,7 @@ static const struct xlat fsmagic[] = { #ifndef SVR4 static const char * -sprintfstype(magic) -int magic; +sprintfstype(int magic) { static char buf[32]; #ifdef LINUX @@ -1673,9 +1626,7 @@ int magic; } static void -printstatfs(tcp, addr) -struct tcb *tcp; -long addr; +printstatfs(struct tcb *tcp, long addr) { struct statfs statbuf; @@ -1718,8 +1669,7 @@ long addr; } int -sys_statfs(tcp) -struct tcb *tcp; +sys_statfs(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1731,8 +1681,7 @@ struct tcb *tcp; } int -sys_fstatfs(tcp) -struct tcb *tcp; +sys_fstatfs(struct tcb *tcp) { if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); @@ -1744,9 +1693,7 @@ struct tcb *tcp; #ifdef LINUX static void -printstatfs64(tcp, addr) -struct tcb *tcp; -long addr; +printstatfs64(struct tcb *tcp, long addr) { struct statfs64 statbuf; @@ -1776,8 +1723,7 @@ long addr; } int -sys_statfs64(tcp) -struct tcb *tcp; +sys_statfs64(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1792,8 +1738,7 @@ struct tcb *tcp; } int -sys_fstatfs64(tcp) -struct tcb *tcp; +sys_fstatfs64(struct tcb *tcp) { if (entering(tcp)) { tprintf("%lu, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); @@ -1810,8 +1755,7 @@ struct tcb *tcp; #if defined(LINUX) && defined(__alpha) int -osf_statfs(tcp) -struct tcb *tcp; +osf_statfs(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1824,8 +1768,7 @@ struct tcb *tcp; } int -osf_fstatfs(tcp) -struct tcb *tcp; +osf_fstatfs(struct tcb *tcp) { if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); @@ -1840,10 +1783,8 @@ struct tcb *tcp; #endif /* !SVR4 */ #ifdef SUNOS4 - int -sys_ustat(tcp) -struct tcb *tcp; +sys_ustat(struct tcb *tcp) { struct ustat statbuf; @@ -1870,12 +1811,10 @@ struct tcb *tcp; } return 0; } - #endif /* SUNOS4 */ int -sys_pivotroot(tcp) -struct tcb *tcp; +sys_pivotroot(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1888,8 +1827,7 @@ struct tcb *tcp; /* directory */ int -sys_chdir(tcp) -struct tcb *tcp; +sys_chdir(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1924,8 +1862,7 @@ sys_mkdirat(struct tcb *tcp) #endif int -sys_rmdir(tcp) -struct tcb *tcp; +sys_rmdir(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1934,8 +1871,7 @@ struct tcb *tcp; } int -sys_fchdir(tcp) -struct tcb *tcp; +sys_fchdir(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); @@ -1944,8 +1880,7 @@ struct tcb *tcp; } int -sys_chroot(tcp) -struct tcb *tcp; +sys_chroot(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1955,8 +1890,7 @@ struct tcb *tcp; #if defined(SUNOS4) || defined(SVR4) int -sys_fchroot(tcp) -struct tcb *tcp; +sys_fchroot(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); @@ -1966,8 +1900,7 @@ struct tcb *tcp; #endif /* SUNOS4 || SVR4 */ int -sys_link(tcp) -struct tcb *tcp; +sys_link(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -1994,8 +1927,7 @@ sys_linkat(struct tcb *tcp) #endif int -sys_unlink(tcp) -struct tcb *tcp; +sys_unlink(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -2026,8 +1958,7 @@ sys_unlinkat(struct tcb *tcp) #endif int -sys_symlink(tcp) -struct tcb *tcp; +sys_symlink(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -2084,8 +2015,7 @@ sys_readlinkat(struct tcb *tcp) #endif int -sys_rename(tcp) -struct tcb *tcp; +sys_rename(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -2111,8 +2041,7 @@ sys_renameat(struct tcb *tcp) #endif int -sys_chown(tcp) -struct tcb *tcp; +sys_chown(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -2139,8 +2068,7 @@ sys_fchownat(struct tcb *tcp) #endif int -sys_fchown(tcp) -struct tcb *tcp; +sys_fchown(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); @@ -2177,8 +2105,7 @@ sys_fchmodat(struct tcb *tcp) #endif int -sys_fchmod(tcp) -struct tcb *tcp; +sys_fchmod(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld, %#lo", tcp->u_arg[0], tcp->u_arg[1]); @@ -2188,15 +2115,14 @@ struct tcb *tcp; #ifdef ALPHA int -sys_osf_utimes(tcp) -struct tcb *tcp; +sys_osf_utimes(struct tcb *tcp) { - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); - } - return 0; + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + } + return 0; } #endif @@ -2251,8 +2177,7 @@ sys_utimensat(struct tcb *tcp) #endif int -sys_utime(tcp) -struct tcb *tcp; +sys_utime(struct tcb *tcp) { union { long utl[2]; @@ -2332,8 +2257,7 @@ sys_mknodat(struct tcb *tcp) #ifdef FREEBSD int -sys_mkfifo(tcp) -struct tcb *tcp; +sys_mkfifo(struct tcb *tcp) { if (entering(tcp)) { printpath(tcp, tcp->u_arg[0]); @@ -2344,8 +2268,7 @@ struct tcb *tcp; #endif /* FREEBSD */ int -sys_fsync(tcp) -struct tcb *tcp; +sys_fsync(struct tcb *tcp) { if (entering(tcp)) { tprintf("%ld", tcp->u_arg[0]); @@ -2356,9 +2279,7 @@ struct tcb *tcp; #ifdef LINUX static void -printdir(tcp, addr) -struct tcb *tcp; -long addr; +printdir(struct tcb *tcp, long addr) { struct dirent d; @@ -2377,8 +2298,7 @@ long addr; } int -sys_readdir(tcp) -struct tcb *tcp; +sys_readdir(struct tcb *tcp) { if (entering(tcp)) { tprintf("%lu, ", tcp->u_arg[0]); @@ -2626,41 +2546,38 @@ sys_getdirentries(struct tcb *tcp) #ifdef LINUX int -sys_getcwd(tcp) -struct tcb *tcp; +sys_getcwd(struct tcb *tcp) { - if (exiting(tcp)) { - if (syserror(tcp)) - tprintf("%#lx", tcp->u_arg[0]); - else - printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1); - tprintf(", %lu", tcp->u_arg[1]); - } - return 0; + if (exiting(tcp)) { + if (syserror(tcp)) + tprintf("%#lx", tcp->u_arg[0]); + else + printpathn(tcp, tcp->u_arg[0], tcp->u_rval - 1); + tprintf(", %lu", tcp->u_arg[1]); + } + return 0; } #endif /* LINUX */ #ifdef FREEBSD int -sys___getcwd(tcp) -struct tcb *tcp; +sys___getcwd(struct tcb *tcp) { - if (exiting(tcp)) { - if (syserror(tcp)) - tprintf("%#lx", tcp->u_arg[0]); - else - printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]); - tprintf(", %lu", tcp->u_arg[1]); - } - return 0; + if (exiting(tcp)) { + if (syserror(tcp)) + tprintf("%#lx", tcp->u_arg[0]); + else + printpathn(tcp, tcp->u_arg[0], tcp->u_arg[1]); + tprintf(", %lu", tcp->u_arg[1]); + } + return 0; } #endif #ifdef HAVE_SYS_ASYNCH_H int -sys_aioread(tcp) -struct tcb *tcp; +sys_aioread(struct tcb *tcp) { struct aio_result_t res; @@ -2684,8 +2601,7 @@ struct tcb *tcp; } int -sys_aiowrite(tcp) -struct tcb *tcp; +sys_aiowrite(struct tcb *tcp) { struct aio_result_t res; @@ -2709,8 +2625,7 @@ struct tcb *tcp; } int -sys_aiowait(tcp) -struct tcb *tcp; +sys_aiowait(struct tcb *tcp) { if (entering(tcp)) printtv(tcp, tcp->u_arg[0]); @@ -2718,8 +2633,7 @@ struct tcb *tcp; } int -sys_aiocancel(tcp) -struct tcb *tcp; +sys_aiocancel(struct tcb *tcp) { struct aio_result_t res; @@ -2747,150 +2661,142 @@ static const struct xlat xattrflags[] = { }; static void -print_xattr_val(tcp, failed, arg, insize, size) -struct tcb *tcp; -int failed; -unsigned long arg; -unsigned long insize, size; +print_xattr_val(struct tcb *tcp, int failed, + unsigned long arg, + unsigned long insize, + unsigned long size) { - if (!failed) { - unsigned long capacity = 4 * size + 1; - unsigned char *buf = (capacity < size) ? NULL : malloc(capacity); - if (buf == NULL || /* probably a bogus size argument */ - umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) { - failed = 1; - } - else { - unsigned char *out = buf; - unsigned char *in = &buf[3 * size]; - size_t i; - for (i = 0; i < size; ++i) - if (isprint(in[i])) - *out++ = in[i]; - else { -#define tohex(n) "0123456789abcdef"[n] - *out++ = '\\'; - *out++ = 'x'; - *out++ = tohex(in[i] / 16); - *out++ = tohex(in[i] % 16); + if (!failed) { + unsigned long capacity = 4 * size + 1; + unsigned char *buf = (capacity < size) ? NULL : malloc(capacity); + if (buf == NULL || /* probably a bogus size argument */ + umoven(tcp, arg, size, (char *) &buf[3 * size]) < 0) { + failed = 1; } - /* Don't print terminating NUL if there is one. */ - if (i > 0 && in[i - 1] == '\0') - out -= 4; - *out = '\0'; - tprintf(", \"%s\", %ld", buf, insize); + else { + unsigned char *out = buf; + unsigned char *in = &buf[3 * size]; + size_t i; + for (i = 0; i < size; ++i) { + if (isprint(in[i])) + *out++ = in[i]; + else { +#define tohex(n) "0123456789abcdef"[n] + *out++ = '\\'; + *out++ = 'x'; + *out++ = tohex(in[i] / 16); + *out++ = tohex(in[i] % 16); + } + } + /* Don't print terminating NUL if there is one. */ + if (i > 0 && in[i - 1] == '\0') + out -= 4; + *out = '\0'; + tprintf(", \"%s\", %ld", buf, insize); + } + free(buf); } - free(buf); - } - if (failed) - tprintf(", 0x%lx, %ld", arg, insize); + if (failed) + tprintf(", 0x%lx, %ld", arg, insize); } int -sys_setxattr(tcp) -struct tcb *tcp; +sys_setxattr(struct tcb *tcp) { - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprintf(", "); - printstr(tcp, tcp->u_arg[1], -1); - print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]); - tprintf(", "); - printflags(xattrflags, tcp->u_arg[4], "XATTR_???"); - } - return 0; + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]); + tprintf(", "); + printflags(xattrflags, tcp->u_arg[4], "XATTR_???"); + } + return 0; } int -sys_fsetxattr(tcp) -struct tcb *tcp; +sys_fsetxattr(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, ", tcp->u_arg[0]); - printstr(tcp, tcp->u_arg[1], -1); - print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]); - tprintf(", "); - printflags(xattrflags, tcp->u_arg[4], "XATTR_???"); - } - return 0; + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + print_xattr_val(tcp, 0, tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[3]); + tprintf(", "); + printflags(xattrflags, tcp->u_arg[4], "XATTR_???"); + } + return 0; } int -sys_getxattr(tcp) -struct tcb *tcp; +sys_getxattr(struct tcb *tcp) { - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprintf(", "); - printstr(tcp, tcp->u_arg[1], -1); - } else { - print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3], - tcp->u_rval); - } - return 0; + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + } else { + print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3], + tcp->u_rval); + } + return 0; } int -sys_fgetxattr(tcp) -struct tcb *tcp; +sys_fgetxattr(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, ", tcp->u_arg[0]); - printstr(tcp, tcp->u_arg[1], -1); - } else { - print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3], - tcp->u_rval); - } - return 0; + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + } else { + print_xattr_val(tcp, syserror(tcp), tcp->u_arg[2], tcp->u_arg[3], + tcp->u_rval); + } + return 0; } int -sys_listxattr(tcp) -struct tcb *tcp; +sys_listxattr(struct tcb *tcp) { - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - } else { - /* XXX Print value in format */ - tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); - } - return 0; + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + } else { + /* XXX Print value in format */ + tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); + } + return 0; } int -sys_flistxattr(tcp) -struct tcb *tcp; +sys_flistxattr(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld", tcp->u_arg[0]); - } else { - /* XXX Print value in format */ - tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); - } - return 0; + if (entering(tcp)) { + tprintf("%ld", tcp->u_arg[0]); + } else { + /* XXX Print value in format */ + tprintf(", %p, %lu", (void *) tcp->u_arg[1], tcp->u_arg[2]); + } + return 0; } int -sys_removexattr(tcp) -struct tcb *tcp; +sys_removexattr(struct tcb *tcp) { - if (entering(tcp)) { - printpath(tcp, tcp->u_arg[0]); - tprintf(", "); - printstr(tcp, tcp->u_arg[1], -1); - } - return 0; + if (entering(tcp)) { + printpath(tcp, tcp->u_arg[0]); + tprintf(", "); + printstr(tcp, tcp->u_arg[1], -1); + } + return 0; } int -sys_fremovexattr(tcp) -struct tcb *tcp; +sys_fremovexattr(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, ", tcp->u_arg[0]); - printstr(tcp, tcp->u_arg[1], -1); - } - return 0; + if (entering(tcp)) { + tprintf("%ld, ", tcp->u_arg[0]); + printstr(tcp, tcp->u_arg[1], -1); + } + return 0; } @@ -2907,45 +2813,43 @@ static const struct xlat advise[] = { #ifdef LINUX int -sys_fadvise64(tcp) -struct tcb *tcp; +sys_fadvise64(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, %lld, %ld, ", - tcp->u_arg[0], + if (entering(tcp)) { + tprintf("%ld, %lld, %ld, ", + tcp->u_arg[0], # if defined IA64 || defined X86_64 || defined ALPHA - (long long int) tcp->u_arg[1], tcp->u_arg[2]); - printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); + (long long int) tcp->u_arg[1], tcp->u_arg[2]); + printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); #else - LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]); - printxval(advise, tcp->u_arg[4], "POSIX_FADV_???"); + LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), tcp->u_arg[3]); + printxval(advise, tcp->u_arg[4], "POSIX_FADV_???"); #endif - } - return 0; + } + return 0; } #endif int -sys_fadvise64_64(tcp) -struct tcb *tcp; +sys_fadvise64_64(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, %lld, %lld, ", - tcp->u_arg[0], + if (entering(tcp)) { + tprintf("%ld, %lld, %lld, ", + tcp->u_arg[0], #if defined LINUX_MIPSN32 - tcp->ext_arg[1], tcp->ext_arg[2]); - printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); + tcp->ext_arg[1], tcp->ext_arg[2]); + printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); #elif defined IA64 || defined X86_64 || defined ALPHA || defined LINUX_MIPSN64 - (long long int) tcp->u_arg[1], (long long int) tcp->u_arg[2]); - printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); + (long long int) tcp->u_arg[1], (long long int) tcp->u_arg[2]); + printxval(advise, tcp->u_arg[3], "POSIX_FADV_???"); #else - LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), - LONG_LONG(tcp->u_arg[3], tcp->u_arg[4])); - printxval(advise, tcp->u_arg[5], "POSIX_FADV_???"); + LONG_LONG(tcp->u_arg[1], tcp->u_arg[2]), + LONG_LONG(tcp->u_arg[3], tcp->u_arg[4])); + printxval(advise, tcp->u_arg[5], "POSIX_FADV_???"); #endif - } - return 0; + } + return 0; } #ifdef LINUX diff --git a/process.c b/process.c index 695b9a5d..9ddae086 100644 --- a/process.c +++ b/process.c @@ -1226,8 +1226,7 @@ struct tcb *tcp; } int -sys_getresuid(tcp) - struct tcb *tcp; +sys_getresuid(struct tcb *tcp) { if (exiting(tcp)) { __kernel_uid_t uid; @@ -3489,85 +3488,79 @@ static const struct xlat futexwakecmps[] = { }; int -sys_futex(tcp) -struct tcb *tcp; +sys_futex(struct tcb *tcp) { - if (entering(tcp)) { - long int cmd = tcp->u_arg[1] & 127; - tprintf("%p, ", (void *) tcp->u_arg[0]); - printxval(futexops, tcp->u_arg[1], "FUTEX_???"); - tprintf(", %ld", tcp->u_arg[2]); - if (cmd == FUTEX_WAKE_BITSET) - tprintf(", %lx", tcp->u_arg[5]); - else if (cmd == FUTEX_WAIT) { - tprintf(", "); - printtv(tcp, tcp->u_arg[3]); - } else if (cmd == FUTEX_WAIT_BITSET) { - tprintf(", "); - printtv(tcp, tcp->u_arg[3]); - tprintf(", %lx", tcp->u_arg[5]); - } else if (cmd == FUTEX_REQUEUE) - tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]); - else if (cmd == FUTEX_CMP_REQUEUE) - tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]); - else if (cmd == FUTEX_WAKE_OP) { - tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]); - if ((tcp->u_arg[5] >> 28) & 8) - tprintf("FUTEX_OP_OPARG_SHIFT|"); - printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???"); - tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff); - if ((tcp->u_arg[5] >> 24) & 8) - tprintf("FUTEX_OP_OPARG_SHIFT|"); - printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???"); - tprintf(", %ld}", tcp->u_arg[5] & 0xfff); + if (entering(tcp)) { + long int cmd = tcp->u_arg[1] & 127; + tprintf("%p, ", (void *) tcp->u_arg[0]); + printxval(futexops, tcp->u_arg[1], "FUTEX_???"); + tprintf(", %ld", tcp->u_arg[2]); + if (cmd == FUTEX_WAKE_BITSET) + tprintf(", %lx", tcp->u_arg[5]); + else if (cmd == FUTEX_WAIT) { + tprintf(", "); + printtv(tcp, tcp->u_arg[3]); + } else if (cmd == FUTEX_WAIT_BITSET) { + tprintf(", "); + printtv(tcp, tcp->u_arg[3]); + tprintf(", %lx", tcp->u_arg[5]); + } else if (cmd == FUTEX_REQUEUE) + tprintf(", %ld, %p", tcp->u_arg[3], (void *) tcp->u_arg[4]); + else if (cmd == FUTEX_CMP_REQUEUE) + tprintf(", %ld, %p, %ld", tcp->u_arg[3], (void *) tcp->u_arg[4], tcp->u_arg[5]); + else if (cmd == FUTEX_WAKE_OP) { + tprintf(", %ld, %p, {", tcp->u_arg[3], (void *) tcp->u_arg[4]); + if ((tcp->u_arg[5] >> 28) & 8) + tprintf("FUTEX_OP_OPARG_SHIFT|"); + printxval(futexwakeops, (tcp->u_arg[5] >> 28) & 0x7, "FUTEX_OP_???"); + tprintf(", %ld, ", (tcp->u_arg[5] >> 12) & 0xfff); + if ((tcp->u_arg[5] >> 24) & 8) + tprintf("FUTEX_OP_OPARG_SHIFT|"); + printxval(futexwakecmps, (tcp->u_arg[5] >> 24) & 0x7, "FUTEX_OP_CMP_???"); + tprintf(", %ld}", tcp->u_arg[5] & 0xfff); + } } - } - return 0; + return 0; } static void -print_affinitylist(tcp, list, len) -struct tcb *tcp; -long list; -unsigned int len; +print_affinitylist(struct tcb *tcp, long list, unsigned int len) { - int first = 1; - tprintf(" {"); - while (len >= sizeof (unsigned long)) { - unsigned long w; - umove(tcp, list, &w); - tprintf("%s %lx", first ? "" : ",", w); - first = 0; - len -= sizeof (unsigned long); - list += sizeof(unsigned long); - } - tprintf(" }"); + int first = 1; + tprintf(" {"); + while (len >= sizeof (unsigned long)) { + unsigned long w; + umove(tcp, list, &w); + tprintf("%s %lx", first ? "" : ",", w); + first = 0; + len -= sizeof (unsigned long); + list += sizeof(unsigned long); + } + tprintf(" }"); } int -sys_sched_setaffinity(tcp) -struct tcb *tcp; +sys_sched_setaffinity(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); - print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]); - } - return 0; + if (entering(tcp)) { + tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); + print_affinitylist(tcp, tcp->u_arg[2], tcp->u_arg[1]); + } + return 0; } int -sys_sched_getaffinity(tcp) -struct tcb *tcp; +sys_sched_getaffinity(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); - } else { - if (tcp->u_rval == -1) - tprintf("%#lx", tcp->u_arg[2]); - else - print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval); - } - return 0; + if (entering(tcp)) { + tprintf("%ld, %lu, ", tcp->u_arg[0], tcp->u_arg[1]); + } else { + if (tcp->u_rval == -1) + tprintf("%#lx", tcp->u_arg[2]); + else + print_affinitylist(tcp, tcp->u_arg[2], tcp->u_rval); + } + return 0; } static const struct xlat schedulers[] = { @@ -3578,73 +3571,68 @@ static const struct xlat schedulers[] = { }; int -sys_sched_getscheduler(tcp) -struct tcb *tcp; +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); - if (tcp->auxstr != NULL) - return RVAL_STR; - } - return 0; + if (entering(tcp)) { + tprintf("%d", (int) tcp->u_arg[0]); + } else if (! syserror(tcp)) { + tcp->auxstr = xlookup (schedulers, tcp->u_rval); + if (tcp->auxstr != NULL) + return RVAL_STR; + } + return 0; } int -sys_sched_setscheduler(tcp) -struct tcb *tcp; +sys_sched_setscheduler(struct tcb *tcp) { - if (entering(tcp)) { - struct sched_param p; - tprintf("%d, ", (int) tcp->u_arg[0]); - printxval(schedulers, tcp->u_arg[1], "SCHED_???"); - if (umove(tcp, tcp->u_arg[2], &p) < 0) - tprintf(", %#lx", tcp->u_arg[2]); - else - tprintf(", { %d }", p.__sched_priority); - } - return 0; + if (entering(tcp)) { + struct sched_param p; + tprintf("%d, ", (int) tcp->u_arg[0]); + printxval(schedulers, tcp->u_arg[1], "SCHED_???"); + if (umove(tcp, tcp->u_arg[2], &p) < 0) + tprintf(", %#lx", tcp->u_arg[2]); + else + tprintf(", { %d }", p.__sched_priority); + } + return 0; } int -sys_sched_getparam(tcp) -struct tcb *tcp; +sys_sched_getparam(struct tcb *tcp) { - if (entering(tcp)) { - tprintf("%d, ", (int) tcp->u_arg[0]); - } else { - struct sched_param p; - if (umove(tcp, tcp->u_arg[1], &p) < 0) - tprintf("%#lx", tcp->u_arg[1]); - else - tprintf("{ %d }", p.__sched_priority); - } - return 0; + if (entering(tcp)) { + tprintf("%d, ", (int) tcp->u_arg[0]); + } else { + struct sched_param p; + if (umove(tcp, tcp->u_arg[1], &p) < 0) + tprintf("%#lx", tcp->u_arg[1]); + else + tprintf("{ %d }", p.__sched_priority); + } + return 0; } int -sys_sched_setparam(tcp) -struct tcb *tcp; +sys_sched_setparam(struct tcb *tcp) { - if (entering(tcp)) { - struct sched_param p; - if (umove(tcp, tcp->u_arg[1], &p) < 0) - tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]); - else - tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority); - } - return 0; + if (entering(tcp)) { + struct sched_param p; + if (umove(tcp, tcp->u_arg[1], &p) < 0) + tprintf("%d, %#lx", (int) tcp->u_arg[0], tcp->u_arg[1]); + else + tprintf("%d, { %d }", (int) tcp->u_arg[0], p.__sched_priority); + } + return 0; } int -sys_sched_get_priority_min(tcp) -struct tcb *tcp; +sys_sched_get_priority_min(struct tcb *tcp) { - if (entering(tcp)) { - printxval(schedulers, tcp->u_arg[0], "SCHED_???"); - } - return 0; + if (entering(tcp)) { + printxval(schedulers, tcp->u_arg[0], "SCHED_???"); + } + return 0; } # ifdef X86_64 @@ -3659,32 +3647,33 @@ static const struct xlat archvals[] = { }; int -sys_arch_prctl(tcp) -struct tcb *tcp; +sys_arch_prctl(struct tcb *tcp) { - if (entering(tcp)) { - printxval(archvals, tcp->u_arg[0], "ARCH_???"); - if (tcp->u_arg[0] == ARCH_SET_GS - || tcp->u_arg[0] == ARCH_SET_FS) - tprintf(", %#lx", tcp->u_arg[1]); - } else { - if (tcp->u_arg[0] == ARCH_GET_GS - || tcp->u_arg[0] == ARCH_GET_FS) { - long int v; - if (!syserror(tcp) && umove(tcp, tcp->u_arg[1], &v) != -1) - tprintf(", [%#lx]", v); - else - tprintf(", %#lx", tcp->u_arg[1]); + if (entering(tcp)) { + printxval(archvals, tcp->u_arg[0], "ARCH_???"); + if (tcp->u_arg[0] == ARCH_SET_GS + || tcp->u_arg[0] == ARCH_SET_FS + ) { + tprintf(", %#lx", tcp->u_arg[1]); + } + } else { + if (tcp->u_arg[0] == ARCH_GET_GS + || tcp->u_arg[0] == ARCH_GET_FS + ) { + long int v; + if (!syserror(tcp) && umove(tcp, tcp->u_arg[1], &v) != -1) + tprintf(", [%#lx]", v); + else + tprintf(", %#lx", tcp->u_arg[1]); + } } - } - return 0; + return 0; } # endif /* X86_64 */ int -sys_getcpu(tcp) -struct tcb *tcp; +sys_getcpu(struct tcb *tcp) { if (exiting(tcp)) { unsigned u; diff --git a/resource.c b/resource.c index 7607a7e1..8274f3e6 100644 --- a/resource.c +++ b/resource.c @@ -109,8 +109,7 @@ static const struct xlat resources[] = { #if !HAVE_LONG_LONG_RLIM_T static char * -sprintrlim(lim) -long lim; +sprintrlim(long lim) { static char buf[32]; @@ -124,8 +123,7 @@ long lim; } int -sys_getrlimit(tcp) -struct tcb *tcp; +sys_getrlimit(struct tcb *tcp) { struct rlimit rlim; @@ -147,8 +145,7 @@ struct tcb *tcp; } int -sys_setrlimit(tcp) -struct tcb *tcp; +sys_setrlimit(struct tcb *tcp) { struct rlimit rlim; @@ -170,8 +167,7 @@ struct tcb *tcp; #if _LFS64_LARGEFILE || HAVE_LONG_LONG_RLIM_T static char * -sprintrlim64(lim) -rlim64_t lim; +sprintrlim64(rlim64_t lim) { static char buf[64]; @@ -185,8 +181,7 @@ rlim64_t lim; } int -sys_getrlimit64(tcp) -struct tcb *tcp; +sys_getrlimit64(struct tcb *tcp) { struct rlimit64 rlim; @@ -208,8 +203,7 @@ struct tcb *tcp; } int -sys_setrlimit64(tcp) -struct tcb *tcp; +sys_setrlimit64(struct tcb *tcp) { struct rlimit64 rlim; @@ -242,70 +236,64 @@ static const struct xlat usagewho[] = { #ifdef ALPHA void -printrusage32(tcp, addr) -struct tcb *tcp; -long addr; +printrusage32(struct tcb *tcp, long addr) { - struct timeval32 - { - unsigned tv_sec; - unsigned tv_usec; - }; - struct rusage32 - { - struct timeval32 ru_utime; /* user time used */ - struct timeval32 ru_stime; /* system time used */ - long ru_maxrss; /* maximum resident set size */ - long ru_ixrss; /* integral shared memory size */ - long ru_idrss; /* integral unshared data size */ - long ru_isrss; /* integral unshared stack size */ - long ru_minflt; /* page reclaims */ - long ru_majflt; /* page faults */ - long ru_nswap; /* swaps */ - long ru_inblock; /* block input operations */ - long ru_oublock; /* block output operations */ - long ru_msgsnd; /* messages sent */ - long ru_msgrcv; /* messages received */ - long ru_nsignals; /* signals received */ - long ru_nvcsw; /* voluntary context switches */ - long ru_nivcsw; /* involuntary " */ - } ru; + struct timeval32 { + unsigned tv_sec; + unsigned tv_usec; + }; + struct rusage32 { + struct timeval32 ru_utime; /* user time used */ + struct timeval32 ru_stime; /* system time used */ + long ru_maxrss; /* maximum resident set size */ + long ru_ixrss; /* integral shared memory size */ + long ru_idrss; /* integral unshared data size */ + long ru_isrss; /* integral unshared stack size */ + long ru_minflt; /* page reclaims */ + long ru_majflt; /* page faults */ + long ru_nswap; /* swaps */ + long ru_inblock; /* block input operations */ + long ru_oublock; /* block output operations */ + long ru_msgsnd; /* messages sent */ + long ru_msgrcv; /* messages received */ + long ru_nsignals; /* signals received */ + long ru_nvcsw; /* voluntary context switches */ + long ru_nivcsw; /* involuntary " */ + } ru; - if (!addr) - tprintf("NULL"); - else if (syserror(tcp) || !verbose(tcp)) - tprintf("%#lx", addr); - else if (umove(tcp, addr, &ru) < 0) - tprintf("{...}"); - else if (!abbrev(tcp)) { - tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ", - (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, - (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); - tprintf("ru_maxrss=%lu, ru_ixrss=%lu, ", - ru.ru_maxrss, ru.ru_ixrss); - tprintf("ru_idrss=%lu, ru_isrss=%lu, ", - ru.ru_idrss, ru.ru_isrss); - tprintf("ru_minflt=%lu, ru_majflt=%lu, ru_nswap=%lu, ", - ru.ru_minflt, ru.ru_majflt, ru.ru_nswap); - tprintf("ru_inblock=%lu, ru_oublock=%lu, ", - ru.ru_inblock, ru.ru_oublock); - tprintf("ru_msgsnd=%lu, ru_msgrcv=%lu, ", - ru.ru_msgsnd, ru.ru_msgrcv); - tprintf("ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}", - ru.ru_nsignals, ru.ru_nvcsw, ru.ru_nivcsw); - } - else { - tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ...}", - (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, - (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); - } + if (!addr) + tprintf("NULL"); + else if (syserror(tcp) || !verbose(tcp)) + tprintf("%#lx", addr); + else if (umove(tcp, addr, &ru) < 0) + tprintf("{...}"); + else if (!abbrev(tcp)) { + tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ", + (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, + (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); + tprintf("ru_maxrss=%lu, ru_ixrss=%lu, ", + ru.ru_maxrss, ru.ru_ixrss); + tprintf("ru_idrss=%lu, ru_isrss=%lu, ", + ru.ru_idrss, ru.ru_isrss); + tprintf("ru_minflt=%lu, ru_majflt=%lu, ru_nswap=%lu, ", + ru.ru_minflt, ru.ru_majflt, ru.ru_nswap); + tprintf("ru_inblock=%lu, ru_oublock=%lu, ", + ru.ru_inblock, ru.ru_oublock); + tprintf("ru_msgsnd=%lu, ru_msgrcv=%lu, ", + ru.ru_msgsnd, ru.ru_msgrcv); + tprintf("ru_nsignals=%lu, ru_nvcsw=%lu, ru_nivcsw=%lu}", + ru.ru_nsignals, ru.ru_nvcsw, ru.ru_nivcsw); + } + else { + tprintf("{ru_utime={%lu, %lu}, ru_stime={%lu, %lu}, ...}", + (long) ru.ru_utime.tv_sec, (long) ru.ru_utime.tv_usec, + (long) ru.ru_stime.tv_sec, (long) ru.ru_stime.tv_usec); + } } #endif void -printrusage(tcp, addr) -struct tcb *tcp; -long addr; +printrusage(struct tcb *tcp, long addr) { struct rusage ru; @@ -340,8 +328,7 @@ long addr; } int -sys_getrusage(tcp) -struct tcb *tcp; +sys_getrusage(struct tcb *tcp) { if (entering(tcp)) { printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); @@ -354,8 +341,7 @@ struct tcb *tcp; #ifdef ALPHA int -sys_osf_getrusage(tcp) -struct tcb *tcp; +sys_osf_getrusage(struct tcb *tcp) { if (entering(tcp)) { printxval(usagewho, tcp->u_arg[0], "RUSAGE_???"); @@ -372,8 +358,7 @@ struct tcb *tcp; #ifdef LINUX int -sys_sysinfo(tcp) -struct tcb *tcp; +sys_sysinfo(struct tcb *tcp) { struct sysinfo si; @@ -407,8 +392,7 @@ static const struct xlat priorities[] = { }; int -sys_getpriority(tcp) -struct tcb *tcp; +sys_getpriority(struct tcb *tcp) { if (entering(tcp)) { printxval(priorities, tcp->u_arg[0], "PRIO_???"); @@ -418,8 +402,7 @@ struct tcb *tcp; } int -sys_setpriority(tcp) -struct tcb *tcp; +sys_setpriority(struct tcb *tcp) { if (entering(tcp)) { printxval(priorities, tcp->u_arg[0], "PRIO_???"); @@ -429,8 +412,7 @@ struct tcb *tcp; } int -sys_nice(tcp) -struct tcb *tcp; +sys_nice(struct tcb *tcp) { if (entering(tcp)) tprintf("%ld", tcp->u_arg[0]); @@ -440,8 +422,7 @@ struct tcb *tcp; #ifndef SUNOS4 int -sys_times(tcp) -struct tcb *tcp; +sys_times(struct tcb *tcp) { struct tms tbuf; diff --git a/signal.c b/signal.c index e0c46620..1794f7df 100644 --- a/signal.c +++ b/signal.c @@ -1873,8 +1873,7 @@ struct new_sigaction int -sys_rt_sigaction(tcp) - struct tcb *tcp; +sys_rt_sigaction(struct tcb *tcp) { struct new_sigaction sa; sigset_t sigset; @@ -1934,9 +1933,8 @@ sys_rt_sigaction(tcp) return 0; } - int -sys_rt_sigpending(tcp) - struct tcb *tcp; +int +sys_rt_sigpending(struct tcb *tcp) { sigset_t sigset; @@ -1951,9 +1949,9 @@ sys_rt_sigpending(tcp) } return 0; } - int -sys_rt_sigsuspend(tcp) - struct tcb *tcp; + +int +sys_rt_sigsuspend(struct tcb *tcp) { if (entering(tcp)) { sigset_t sigm; @@ -1964,9 +1962,9 @@ sys_rt_sigsuspend(tcp) } return 0; } - int -sys_rt_sigqueueinfo(tcp) - struct tcb *tcp; + +int +sys_rt_sigqueueinfo(struct tcb *tcp) { if (entering(tcp)) { siginfo_t si; @@ -1981,8 +1979,7 @@ sys_rt_sigqueueinfo(tcp) return 0; } -int sys_rt_sigtimedwait(tcp) - struct tcb *tcp; +int sys_rt_sigtimedwait(struct tcb *tcp) { if (entering(tcp)) { sigset_t sigset; @@ -2012,8 +2009,7 @@ int sys_rt_sigtimedwait(tcp) }; int -sys_restart_syscall(tcp) -struct tcb *tcp; +sys_restart_syscall(struct tcb *tcp) { if (entering(tcp)) tprintf("<... resuming interrupted call ...>"); diff --git a/time.c b/time.c index af68eeeb..01241d2d 100644 --- a/time.c +++ b/time.c @@ -70,9 +70,8 @@ printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special) tprintf("NULL"); else if (!verbose(tcp)) tprintf("%#lx", addr); - else - { - int rc; + else { + int rc; if (bitness == BITNESS_32 #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 @@ -92,8 +91,7 @@ printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special) else tprint_timeval32(tcp, &tv); } - } else - { + } else { struct timeval tv; if ((rc = umove(tcp, addr, &tv)) >= 0) { @@ -107,7 +105,6 @@ printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special) tprint_timeval(tcp, &tv); } } - if (rc < 0) tprintf("{...}"); } @@ -120,9 +117,8 @@ sprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf) strcpy(buf, "NULL"); else if (!verbose(tcp)) sprintf(buf, "%#lx", addr); - else - { - int rc; + else { + int rc; if (bitness == BITNESS_32 #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 @@ -135,8 +131,7 @@ sprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf) if ((rc = umove(tcp, addr, &tv)) >= 0) sprintf(buf, "{%u, %u}", tv.tv_sec, tv.tv_usec); - } else - { + } else { struct timeval tv; if ((rc = umove(tcp, addr, &tv)) >= 0) @@ -144,77 +139,68 @@ sprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf) (unsigned long) tv.tv_sec, (unsigned long) tv.tv_usec); } - if (rc < 0) strcpy(buf, "{...}"); } } -void print_timespec (struct tcb *tcp, long addr) +void print_timespec(struct tcb *tcp, long addr) { if (addr == 0) tprintf("NULL"); else if (!verbose(tcp)) tprintf("%#lx", addr); else { - int rc; + int rc; #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 - if (personality_wordsize[current_personality] == 4) - { + if (personality_wordsize[current_personality] == 4) { struct timeval32 tv; if ((rc = umove(tcp, addr, &tv)) >= 0) tprintf("{%u, %u}", tv.tv_sec, tv.tv_usec); } else - { #endif + { struct timespec ts; if ((rc = umove(tcp, addr, &ts)) >= 0) tprintf("{%lu, %lu}", (unsigned long) ts.tv_sec, (unsigned long) ts.tv_nsec); -#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 } -#endif - if (rc < 0) tprintf("{...}"); } } -void sprint_timespec (char *buf, struct tcb *tcp, long addr) +void sprint_timespec(char *buf, struct tcb *tcp, long addr) { if (addr == 0) strcpy(buf, "NULL"); else if (!verbose(tcp)) sprintf(buf, "%#lx", addr); else { - int rc; + int rc; #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 - if (personality_wordsize[current_personality] == 4) - { + if (personality_wordsize[current_personality] == 4) { struct timeval32 tv; if ((rc = umove(tcp, addr, &tv)) >= 0) sprintf(buf, "{%u, %u}", tv.tv_sec, tv.tv_usec); } else - { #endif + { struct timespec ts; if ((rc = umove(tcp, addr, &ts)) >= 0) sprintf(buf, "{%lu, %lu}", (unsigned long) ts.tv_sec, (unsigned long) ts.tv_nsec); -#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 } -#endif - if (rc < 0) strcpy(buf, "{...}"); } @@ -267,19 +253,18 @@ int sys_osf_gettimeofday(tcp) struct tcb *tcp; { - if (exiting(tcp)) { - if (syserror(tcp)) { - tprintf("%#lx, %#lx", - tcp->u_arg[0], tcp->u_arg[1]); - return 0; - } - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); + if (exiting(tcp)) { + if (syserror(tcp)) { + tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); + return 0; + } + printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); #ifndef SVR4 - tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + tprintf(", "); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); #endif /* !SVR4 */ - } - return 0; + } + return 0; } #endif @@ -302,14 +287,14 @@ int sys_osf_settimeofday(tcp) struct tcb *tcp; { - if (entering(tcp)) { - printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); + if (entering(tcp)) { + printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); #ifndef SVR4 - tprintf(", "); - printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); + tprintf(", "); + printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); #endif /* !SVR4 */ - } - return 0; + } + return 0; } #endif @@ -358,9 +343,8 @@ printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) tprintf("NULL"); else if (!verbose(tcp)) tprintf("%#lx", addr); - else - { - int rc; + else { + int rc; if (bitness == BITNESS_32 #if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 @@ -368,8 +352,7 @@ printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) #endif ) { - struct - { + struct { struct timeval32 it_interval, it_value; } itv; @@ -380,8 +363,7 @@ printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) tprint_timeval32(tcp, &itv.it_value); tprintf("}"); } - } else - { + } else { struct itimerval itv; if ((rc = umove(tcp, addr, &itv)) >= 0) { @@ -392,7 +374,6 @@ printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) tprintf("}"); } } - if (rc < 0) tprintf("{...}"); } @@ -423,16 +404,16 @@ int sys_osf_getitimer(tcp) struct tcb *tcp; { - if (entering(tcp)) { - printxval(which, tcp->u_arg[0], "ITIMER_???"); - tprintf(", "); - } else { - if (syserror(tcp)) - tprintf("%#lx", tcp->u_arg[1]); - else - printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); - } - return 0; + if (entering(tcp)) { + printxval(which, tcp->u_arg[0], "ITIMER_???"); + tprintf(", "); + } else { + if (syserror(tcp)) + tprintf("%#lx", tcp->u_arg[1]); + else + printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); + } + return 0; } #endif @@ -459,18 +440,18 @@ int sys_osf_setitimer(tcp) struct tcb *tcp; { - if (entering(tcp)) { - printxval(which, tcp->u_arg[0], "ITIMER_???"); - tprintf(", "); - printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); - tprintf(", "); - } else { - if (syserror(tcp)) - tprintf("%#lx", tcp->u_arg[2]); - else - printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32); - } - return 0; + if (entering(tcp)) { + printxval(which, tcp->u_arg[0], "ITIMER_???"); + tprintf(", "); + printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); + tprintf(", "); + } else { + if (syserror(tcp)) + tprintf("%#lx", tcp->u_arg[2]); + else + printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32); + } + return 0; } #endif @@ -574,8 +555,7 @@ static const struct xlat adjtimex_state[] = { static int tprint_timex32(struct tcb *tcp, long addr) { - struct - { + struct { unsigned int modes; int offset; int freq; @@ -761,17 +741,14 @@ static const struct xlat sigev_value[] = { static void printsigevent32(struct tcb *tcp, long arg) { - struct - { + struct { int sigev_value; int sigev_signo; int sigev_notify; - union - { + union { int tid; - struct - { + struct { int function, attribute; } thread; } un; @@ -779,8 +756,7 @@ printsigevent32(struct tcb *tcp, long arg) if (umove(tcp, arg, &sev) < 0) tprintf("{...}"); - else - { + else { tprintf("{%#x, ", sev.sigev_value); if (sev.sigev_notify == SIGEV_SIGNAL) tprintf("%s, ", signame(sev.sigev_signo));