]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - cddl/usr.sbin/dwatch/libexec/nanosleep
Upgrade LDNS to 1.7.0.
[FreeBSD/FreeBSD.git] / cddl / usr.sbin / dwatch / libexec / nanosleep
1 # -*- tab-width: 4 -*- ;; Emacs
2 # vi: set filetype=sh tabstop=8 shiftwidth=8 noexpandtab :: Vi/ViM
3 ############################################################ IDENT(1)
4 #
5 # $Title: dwatch(8) module for nanosleep(2) [or similar] entry $
6 # $Copyright: 2014-2018 Devin Teske. All rights reserved. $
7 # $FreeBSD$
8 #
9 ############################################################ DESCRIPTION
10 #
11 # Print arguments being passed to nanosleep(2) [or similar]
12 #
13 ############################################################ PROBE
14
15 : ${PROBE:=syscall::$PROFILE:entry}
16
17 ############################################################ ACTIONS
18
19 exec 9<<EOF
20 this struct timespec *  rqtp;
21 this time_t             requested_sec;
22 this long               requested_nsec;
23
24 $PROBE /* probe ID $ID */
25 {${TRACE:+
26         print("<$ID>");
27 }
28         /*
29          * const struct timespec *
30          */
31         this->rqtp = (struct timespec *)copyin(arg0, sizeof(struct timespec));
32         this->requested_sec  = (time_t)this->rqtp->tv_sec;
33         this->requested_nsec = (long)this->rqtp->tv_nsec;
34 }
35 EOF
36 ACTIONS=$( cat <&9 )
37 ID=$(( $ID + 1 ))
38
39 ############################################################ EVENT DETAILS
40
41 if [ ! "$CUSTOM_DETAILS" ]; then
42 exec 9<<EOF
43         /*
44          * Dump nanosleep(2) arguments
45          */
46         printf("%d.%d seconds",
47                 this->requested_sec, this->requested_nsec / 100000);
48 EOF
49 EVENT_DETAILS=$( cat <&9 )
50 fi
51
52 ################################################################################
53 # END
54 ################################################################################