Author: jhb
Date: Fri Jun  2 22:35:18 2017
New Revision: 319509
URL: https://svnweb.freebsd.org/changeset/base/319509

Log:
  Decode the argument passed to cap_getmode().
  
  The returned integer value is output.

Modified:
  head/usr.bin/truss/syscall.h
  head/usr.bin/truss/syscalls.c

Modified: head/usr.bin/truss/syscall.h
==============================================================================
--- head/usr.bin/truss/syscall.h        Fri Jun  2 20:25:25 2017        
(r319508)
+++ head/usr.bin/truss/syscall.h        Fri Jun  2 22:35:18 2017        
(r319509)
@@ -48,7 +48,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe
        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,

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c       Fri Jun  2 20:25:25 2017        
(r319508)
+++ head/usr.bin/truss/syscalls.c       Fri Jun  2 22:35:18 2017        
(r319509)
@@ -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
        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;
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "[email protected]"

Reply via email to