Date: Wed, 20 Jul 2016 15:07:52 +0000 (UTC) From: Konstantin Belousov <kib@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r303093 - in stable/10: sys/kern sys/sys usr.bin/kdump Message-ID: <201607201507.u6KF7qp4068218@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: kib Date: Wed Jul 20 15:07:52 2016 New Revision: 303093 URL: https://svnweb.freebsd.org/changeset/base/303093 Log: MFC r302770: Trace timeval parameters to the getitimer(2) and setitimer(2) syscalls. Modified: stable/10/sys/kern/kern_time.c stable/10/sys/sys/ktrace.h stable/10/usr.bin/kdump/kdump.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/kern/kern_time.c ============================================================================== --- stable/10/sys/kern/kern_time.c Wed Jul 20 15:02:37 2016 (r303092) +++ stable/10/sys/kern/kern_time.c Wed Jul 20 15:07:52 2016 (r303093) @@ -32,6 +32,8 @@ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" + #include <sys/param.h> #include <sys/systm.h> #include <sys/limits.h> @@ -54,6 +56,9 @@ __FBSDID("$FreeBSD$"); #include <sys/timers.h> #include <sys/timetc.h> #include <sys/vnode.h> +#ifdef KTRACE +#include <sys/ktrace.h> +#endif #include <vm/vm.h> #include <vm/vm_extern.h> @@ -699,6 +704,10 @@ kern_getitimer(struct thread *td, u_int *aitv = p->p_stats->p_timer[which]; PROC_ITIMUNLOCK(p); } +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(aitv); +#endif return (0); } @@ -740,6 +749,10 @@ kern_setitimer(struct thread *td, u_int if (which > ITIMER_PROF) return (EINVAL); +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(aitv); +#endif if (itimerfix(&aitv->it_value) || aitv->it_value.tv_sec > INT32_MAX / 2) return (EINVAL); @@ -784,6 +797,10 @@ kern_setitimer(struct thread *td, u_int p->p_stats->p_timer[which] = *aitv; PROC_ITIMUNLOCK(p); } +#ifdef KTRACE + if (KTRPOINT(td, KTR_STRUCT)) + ktritimerval(oitv); +#endif return (0); } Modified: stable/10/sys/sys/ktrace.h ============================================================================== --- stable/10/sys/sys/ktrace.h Wed Jul 20 15:02:37 2016 (r303092) +++ stable/10/sys/sys/ktrace.h Wed Jul 20 15:07:52 2016 (r303093) @@ -270,6 +270,8 @@ void ktrcapfail(enum ktr_cap_fail_type, const cap_rights_t *); #define ktrcaprights(s) \ ktrstruct("caprights", (s), sizeof(cap_rights_t)) +#define ktritimerval(s) \ + ktrstruct("itimerval", (s), sizeof(struct itimerval)) #define ktrsockaddr(s) \ ktrstruct("sockaddr", (s), ((struct sockaddr *)(s))->sa_len) #define ktrstat(s) \ Modified: stable/10/usr.bin/kdump/kdump.c ============================================================================== --- stable/10/usr.bin/kdump/kdump.c Wed Jul 20 15:02:37 2016 (r303092) +++ stable/10/usr.bin/kdump/kdump.c Wed Jul 20 15:07:52 2016 (r303093) @@ -106,6 +106,7 @@ void ktruser_malloc(void *); void ktruser_rtld(int, void *); void ktruser(int, void *); void ktrcaprights(cap_rights_t *); +void ktritimerval(struct itimerval *it); void ktrsockaddr(struct sockaddr *); void ktrstat(struct stat *); void ktrstruct(char *, size_t); @@ -1616,6 +1617,24 @@ ktrcaprights(cap_rights_t *rightsp) printf("\n"); } +static void +ktrtimeval(struct timeval *tv) +{ + + printf("{%ld, %ld}", (long)tv->tv_sec, tv->tv_usec); +} + +void +ktritimerval(struct itimerval *it) +{ + + printf("itimerval { .interval = "); + ktrtimeval(&it->it_interval); + printf(", .value = "); + ktrtimeval(&it->it_value); + printf(" }\n"); +} + void ktrsockaddr(struct sockaddr *sa) { @@ -1799,6 +1818,7 @@ ktrstruct(char *buf, size_t buflen) size_t namelen, datalen; int i; cap_rights_t rights; + struct itimerval it; struct stat sb; struct sockaddr_storage ss; @@ -1823,6 +1843,11 @@ ktrstruct(char *buf, size_t buflen) goto invalid; memcpy(&rights, data, datalen); ktrcaprights(&rights); + } else if (strcmp(name, "itimerval") == 0) { + if (datalen != sizeof(struct itimerval)) + goto invalid; + memcpy(&it, data, datalen); + ktritimerval(&it); } else if (strcmp(name, "stat") == 0) { if (datalen != sizeof(struct stat)) goto invalid;
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607201507.u6KF7qp4068218>