diff options
author | John Baldwin <jhb@FreeBSD.org> | 2017-06-05 05:25:50 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2017-06-05 05:25:50 +0000 |
commit | b60a095b93b48fa8e2417afcad5d8ff53218654c (patch) | |
tree | c37f43be1f537207f1bb048e1679ca726c7ba24c /usr.bin | |
parent | c8fab231f19b69aec506bae20982ea794757add5 (diff) | |
download | src-b60a095b93b48fa8e2417afcad5d8ff53218654c.tar.gz src-b60a095b93b48fa8e2417afcad5d8ff53218654c.zip |
Decode arguments to dup, dup2, getdirentries, pread, and pwrite.
- dup and dup2 print fd arguments in decimal.
- pread and pwrite are similar to read and write with the addition of the
file offset.
- getdirentries displays the output entries as a string for now and also
prints the value returned in *basep. Eventually the buffer for
getdirentries should perhaps be decoded as an array of dirent
structures.
PR: 214885
Submitted by: Jonathan de Boyne Pollard <J.deBoynePollard-newsgroups@NTLWorld.COM>
Notes
Notes:
svn path=/head/; revision=319595
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/truss/syscall.h | 2 | ||||
-rw-r--r-- | usr.bin/truss/syscalls.c | 23 |
2 files changed, 24 insertions, 1 deletions
diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index 51f7f67a4bb1..a9813f8e9bff 100644 --- a/usr.bin/truss/syscall.h +++ b/usr.bin/truss/syscall.h @@ -48,7 +48,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHex, Name, Ptr, Stat, Ioctl, Sysarch, ExecArgs, ExecEnv, PipeFds, QuadHex, Utrace, IntArray, Pipe2, CapFcntlRights, Fadvice, FileFlags, Flockop, Getfsstatmode, Kldsymcmd, Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel, - Sockoptname, Msgflags, CapRights, PUInt, + Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index 7a923198024a..e6877e31dddc 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -125,6 +125,10 @@ static struct syscall decoded_syscalls[] = { { .name = "connectat", .ret_type = 1, .nargs = 4, .args = { { Atfd, 0 }, { Int, 1 }, { Sockaddr | IN, 2 }, { Int, 3 } } }, + { .name = "dup", .ret_type = 1, .nargs = 1, + .args = { { Int, 0 } } }, + { .name = "dup2", .ret_type = 1, .nargs = 2, + .args = { { Int, 0 }, { Int, 1 } } }, { .name = "eaccess", .ret_type = 1, .nargs = 2, .args = { { Name | IN, 0 }, { Accessmode, 1 } } }, { .name = "execve", .ret_type = 1, .nargs = 3, @@ -165,6 +169,9 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { Timeval2 | IN, 1 } } }, { .name = "futimesat", .ret_type = 1, .nargs = 3, .args = { { Atfd, 0 }, { Name | IN, 1 }, { Timeval2 | IN, 2 } } }, + { .name = "getdirentries", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Int, 2 }, + { PQuadHex | OUT, 3 } } }, { .name = "getfsstat", .ret_type = 1, .nargs = 3, .args = { { Ptr, 0 }, { Long, 1 }, { Getfsstatmode, 2 } } }, { .name = "getitimer", .ret_type = 1, .nargs = 2, @@ -275,8 +282,14 @@ static struct syscall decoded_syscalls[] = { { Fadvice, 3 } } }, { .name = "posix_openpt", .ret_type = 1, .nargs = 1, .args = { { Open, 0 } } }, + { .name = "pread", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 }, + { QuadHex, 3 } } }, { .name = "procctl", .ret_type = 1, .nargs = 4, .args = { { Idtype, 0 }, { Quad, 1 }, { Procctl, 2 }, { Ptr, 3 } } }, + { .name = "pwrite", .ret_type = 1, .nargs = 4, + .args = { { Int, 0 }, { BinString | IN, 1 }, { Sizet, 2 }, + { QuadHex, 3 } } }, { .name = "read", .ret_type = 1, .nargs = 3, .args = { { Int, 0 }, { BinString | OUT, 1 }, { Sizet, 2 } } }, { .name = "readlink", .ret_type = 1, .nargs = 3, @@ -1354,6 +1367,16 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, break; } #endif + case PQuadHex: { + uint64_t val; + + if (get_struct(pid, (void *)args[sc->offset], &val, + sizeof(val)) == 0) + fprintf(fp, "{ 0x%jx }", (uintmax_t)val); + else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } case Ptr: fprintf(fp, "0x%lx", args[sc->offset]); break; |