Decode the argument passed to cap_getmode().

The returned integer value is output.
This commit is contained in:
John Baldwin 2017-06-02 22:35:18 +00:00
parent e2005cef7f
commit ebb2cc40d1
2 changed files with 13 additions and 1 deletions

View File

@ -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,

View File

@ -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;