From owner-svn-src-stable@freebsd.org Wed Jul 20 15:07:53 2016 Return-Path: Delivered-To: svn-src-stable@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD428B9FA80; Wed, 20 Jul 2016 15:07:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id B51DE1F80; Wed, 20 Jul 2016 15:07:53 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u6KF7qYp068222; Wed, 20 Jul 2016 15:07:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u6KF7qp4068218; Wed, 20 Jul 2016 15:07:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201607201507.u6KF7qp4068218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 20 Jul 2016 15:07:52 +0000 (UTC) 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 X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 20 Jul 2016 15:07:54 -0000 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 __FBSDID("$FreeBSD$"); +#include "opt_ktrace.h" + #include #include #include @@ -54,6 +56,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef KTRACE +#include +#endif #include #include @@ -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;