Author: jhb
Date: Fri Jun 16 20:03:09 2017
New Revision: 320010
URL: https://svnweb.freebsd.org/changeset/base/320010

Log:
  Decode arguments to sched_* family of system calls.
  
  This includes decoding both scheduler policy constants and the sched_param
  structure for sched_get_priority_max(), sched_get_priority_min(),
  sched_getparam(), sched_getscheduler(), sched_rr_get_interval(),
  sched_setparam(), and sched_setscheduler().

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 16 20:00:39 2017        
(r320009)
+++ head/usr.bin/truss/syscall.h        Fri Jun 16 20:03:09 2017        
(r320010)
@@ -50,7 +50,7 @@ enum Argtype { None = 1, Hex, Octal, Int, UInt, LongHe
        Kldunloadflags, Sizet, Madvice, Socklent, Sockprotocol, Sockoptlevel,
        Sockoptname, Msgflags, CapRights, PUInt, PQuadHex, Acltype,
        Extattrnamespace, Minherit, Mlockall, Mountflags, Msync, Priowhich,
-       Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc,
+       Ptraceop, Quotactlcmd, Reboothowto, Rtpriofunc, Schedpolicy, Schedparam,
 
        CloudABIAdvice, CloudABIClockID, ClouduABIFDSFlags,
        CloudABIFDStat, CloudABIFileStat, CloudABIFileType,

Modified: head/usr.bin/truss/syscalls.c
==============================================================================
--- head/usr.bin/truss/syscalls.c       Fri Jun 16 20:00:39 2017        
(r320009)
+++ head/usr.bin/truss/syscalls.c       Fri Jun 16 20:03:09 2017        
(r320010)
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$");
 #include <err.h>
 #include <fcntl.h>
 #include <poll.h>
+#include <sched.h>
 #include <signal.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -395,6 +396,20 @@ static struct syscall decoded_syscalls[] = {
          .args = { { Rtpriofunc, 0 }, { Int, 1 }, { Ptr, 2 } } },
        { .name = "rtprio_thread", .ret_type = 1, .nargs = 3,
          .args = { { Rtpriofunc, 0 }, { Int, 1 }, { Ptr, 2 } } },
+       { .name = "sched_get_priority_max", .ret_type = 1, .nargs = 1,
+         .args = { { Schedpolicy, 0 } } },
+       { .name = "sched_get_priority_min", .ret_type = 1, .nargs = 1,
+         .args = { { Schedpolicy, 0 } } },
+       { .name = "sched_getparam", .ret_type = 1, .nargs = 2,
+         .args = { { Int, 0 }, { Schedparam | OUT, 1 } } },
+       { .name = "sched_getscheduler", .ret_type = 1, .nargs = 1,
+         .args = { { Int, 0 } } },
+       { .name = "sched_rr_get_interval", .ret_type = 1, .nargs = 2,
+         .args = { { Int, 0 }, { Timespec | OUT, 1 } } },
+       { .name = "sched_setparam", .ret_type = 1, .nargs = 2,
+         .args = { { Int, 0 }, { Schedparam, 1 } } },
+       { .name = "sched_setscheduler", .ret_type = 1, .nargs = 3,
+         .args = { { Int, 0 }, { Schedpolicy, 1 }, { Schedparam, 2 } } },
        { .name = "sctp_generic_recvmsg", .ret_type = 1, .nargs = 7,
          .args = { { Int, 0 }, { Ptr | IN, 1 }, { Int, 2 },
                    { Sockaddr | OUT, 3 }, { Ptr | OUT, 4 }, { Ptr | OUT, 5 },
@@ -2155,6 +2170,20 @@ print_arg(struct syscall_args *sc, unsigned long *args
                print_integer_arg(sysdecode_rtprio_function, fp,
                    args[sc->offset]);
                break;
+       case Schedpolicy:
+               print_integer_arg(sysdecode_scheduler_policy, fp,
+                   args[sc->offset]);
+               break;
+       case Schedparam: {
+               struct sched_param sp;
+
+               if (get_struct(pid, (void *)args[sc->offset], &sp,
+                   sizeof(sp)) != -1)
+                       fprintf(fp, "{ %d }", sp.sched_priority);
+               else
+                       fprintf(fp, "0x%lx", args[sc->offset]);
+               break;
+       }
 
        case CloudABIAdvice:
                fputs(xlookup(cloudabi_advice, args[sc->offset]), fp);
_______________________________________________
[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