From ebb2cc40d1f62e204166a72f9141416c16c11210 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Fri, 2 Jun 2017 22:35:18 +0000 Subject: [PATCH] Decode the argument passed to cap_getmode(). The returned integer value is output. --- usr.bin/truss/syscall.h | 2 +- usr.bin/truss/syscalls.c | 12 ++++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/usr.bin/truss/syscall.h b/usr.bin/truss/syscall.h index f0b39b468bbf..6c6babb5b241 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, + Sockoptname, Msgflags, CapRights, PUInt, CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags, CloudABIFDStat, CloudABIFileStat, CloudABIFileType, diff --git a/usr.bin/truss/syscalls.c b/usr.bin/truss/syscalls.c index f8c1943125ec..f4195642276d 100644 --- a/usr.bin/truss/syscalls.c +++ b/usr.bin/truss/syscalls.c @@ -99,6 +99,8 @@ static struct syscall decoded_syscalls[] = { .args = { { Int, 0 }, { CapFcntlRights | OUT, 1 } } }, { .name = "cap_fcntls_limit", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CapFcntlRights, 1 } } }, + { .name = "cap_getmode", .ret_type = 1, .nargs = 1, + .args = { { PUInt | OUT, 0 } } }, { .name = "cap_rights_limit", .ret_type = 1, .nargs = 2, .args = { { Int, 0 }, { CapRights, 1 } } }, { .name = "chdir", .ret_type = 1, .nargs = 1, @@ -1190,6 +1192,16 @@ print_arg(struct syscall_args *sc, unsigned long *args, long *retval, case UInt: fprintf(fp, "%u", (unsigned int)args[sc->offset]); break; + case PUInt: { + unsigned int val; + + if (get_struct(pid, (void *)args[sc->offset], &val, + sizeof(val)) == 0) + fprintf(fp, "{ %u }", val); + else + fprintf(fp, "0x%lx", args[sc->offset]); + break; + } case LongHex: fprintf(fp, "0x%lx", args[sc->offset]); break;