-/* $OpenBSD: kern_time.c,v 1.168 2024/07/08 13:17:12 claudio Exp $ */
+/* $OpenBSD: kern_time.c,v 1.169 2024/07/26 19:16:31 guenther Exp $ */
/* $NetBSD: kern_time.c,v 1.20 1996/02/18 11:57:06 fvdl Exp $ */
/*
syscallarg(struct itimerval *) itv;
} */ *uap = v;
struct itimerval aitv;
- int which;
+ int which, error;
which = SCARG(uap, which);
if (which < ITIMER_REAL || which > ITIMER_PROF)
setitimer(which, NULL, &aitv);
- return copyout(&aitv, SCARG(uap, itv), sizeof(aitv));
+ error = copyout(&aitv, SCARG(uap, itv), sizeof(aitv));
+#ifdef KTRACE
+ if (error == 0 && KTRPOINT(p, KTR_STRUCT))
+ ktritimerval(p, &aitv);
+#endif
+ return (error);
}
int
error = copyin(SCARG(uap, itv), &aitv, sizeof(aitv));
if (error)
return error;
+#ifdef KTRACE
+ if (KTRPOINT(p, KTR_STRUCT))
+ ktritimerval(p, &aitv);
+#endif
error = itimerfix(&aitv);
if (error)
return error;
setitimer(which, newitvp, olditvp);
- if (SCARG(uap, oitv) != NULL)
- return copyout(&olditv, SCARG(uap, oitv), sizeof(olditv));
+ if (SCARG(uap, oitv) != NULL) {
+ error = copyout(&olditv, SCARG(uap, oitv), sizeof(olditv));
+#ifdef KTRACE
+ if (error == 0 && KTRPOINT(p, KTR_STRUCT))
+ ktritimerval(p, &aitv);
+#endif
+ return error;
+ }
return 0;
}
-/* $OpenBSD: ktrace.h,v 1.48 2023/12/15 15:12:08 deraadt Exp $ */
+/* $OpenBSD: ktrace.h,v 1.49 2024/07/26 19:16:31 guenther Exp $ */
/* $NetBSD: ktrace.h,v 1.12 1996/02/04 02:12:29 christos Exp $ */
/*
ktrstruct((p), "abstimeval", (s), sizeof(struct timeval))
#define ktrreltimeval(p, s) \
ktrstruct((p), "reltimeval", (s), sizeof(struct timeval))
+#define ktritimerval(p, s) \
+ ktrstruct((p), "itimerval", (s), sizeof(struct itimerval))
#define ktrsigaction(p, s) \
ktrstruct((p), "sigaction", (s), sizeof(struct sigaction))
#define ktrrlimit(p, s) \
-/* $OpenBSD: ktrstruct.c,v 1.31 2022/12/29 01:36:36 guenther Exp $ */
+/* $OpenBSD: ktrstruct.c,v 1.32 2024/07/26 19:16:31 guenther Exp $ */
/*-
* Copyright (c) 1988, 1993
printf(" }\n");
}
+static void
+ktritimerval(const struct itimerval *itvp)
+{
+ printf("struct itimerval { value=");
+ print_timeval(&itvp->it_value, 0);
+ if (timerisset(&itvp->it_interval)) {
+ printf(", interval=");
+ print_timeval(&itvp->it_interval, 1);
+ }
+ printf(" }\n");
+}
+
static void
ktrsigaction(const struct sigaction *sa)
{
goto invalid;
memcpy(&tv, data, datalen);
ktrtimeval(&tv, name[0] == 'r');
+ } else if (strcmp(name, "itimerval") == 0) {
+ struct itimerval itv;
+
+ if (datalen != sizeof(itv))
+ goto invalid;
+ memcpy(&itv, data, datalen);
+ ktritimerval(&itv);
} else if (strcmp(name, "sigaction") == 0) {
struct sigaction sa;