]> granicus.if.org Git - strace/blob - time.c
9864118eab55c8a8ddf103daafe73970c39a8c36
[strace] / time.c
1 /*
2  * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
3  * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
4  * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  * 1. Redistributions of source code must retain the above copyright
11  *    notice, this list of conditions and the following disclaimer.
12  * 2. Redistributions in binary form must reproduce the above copyright
13  *    notice, this list of conditions and the following disclaimer in the
14  *    documentation and/or other materials provided with the distribution.
15  * 3. The name of the author may not be used to endorse or promote products
16  *    derived from this software without specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
19  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
20  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21  * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23  * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29
30 #include "defs.h"
31 #include <fcntl.h>
32 #include <linux/version.h>
33 #include <sys/timex.h>
34
35 #ifndef UTIME_NOW
36 #define UTIME_NOW ((1l << 30) - 1l)
37 #endif
38 #ifndef UTIME_OMIT
39 #define UTIME_OMIT ((1l << 30) - 2l)
40 #endif
41
42 #if SUPPORTED_PERSONALITIES > 1
43 # if defined X86_64 || defined X32
44 #  define current_time_t_is_compat (current_personality == 1)
45 # else
46 #  define current_time_t_is_compat (current_wordsize == 4)
47 # endif
48 #else
49 # define current_time_t_is_compat 0
50 #endif
51
52 struct timeval32
53 {
54         u_int32_t tv_sec, tv_usec;
55 };
56
57 static void
58 tprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
59 {
60         tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
61 }
62
63 static void
64 tprint_timeval(struct tcb *tcp, const struct timeval *tv)
65 {
66         tprintf("{%ju, %ju}", (uintmax_t) tv->tv_sec, (uintmax_t) tv->tv_usec);
67 }
68
69 void
70 printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
71 {
72         char buf[TIMEVAL_TEXT_BUFSIZE];
73         sprinttv(buf, tcp, addr, bitness, special);
74         tprints(buf);
75 }
76
77 static char *
78 do_sprinttv(char *buf, const uintmax_t sec, const uintmax_t usec,
79             const int special)
80 {
81         if (special) {
82                 switch (usec) {
83                         case UTIME_NOW:
84                                 return stpcpy(buf, "UTIME_NOW");
85                         case UTIME_OMIT:
86                                 return stpcpy(buf, "UTIME_OMIT");
87                 }
88         }
89         return buf + sprintf(buf, "{%ju, %ju}", sec, usec);
90 }
91
92 char *
93 sprinttv(char *buf, struct tcb *tcp, long addr, enum bitness_t bitness, int special)
94 {
95         if (addr == 0)
96                 return stpcpy(buf, "NULL");
97
98         if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)))
99                 return buf + sprintf(buf, "%#lx", addr);
100
101         if (bitness == BITNESS_32 || current_time_t_is_compat)
102         {
103                 struct timeval32 tv;
104
105                 if (umove(tcp, addr, &tv) >= 0)
106                         return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
107         } else {
108                 struct timeval tv;
109
110                 if (umove(tcp, addr, &tv) >= 0)
111                         return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
112         }
113
114         return buf + sprintf(buf, "%#lx", addr);
115 }
116
117 void
118 print_timespec(struct tcb *tcp, long addr)
119 {
120         char buf[TIMESPEC_TEXT_BUFSIZE];
121         sprint_timespec(buf, tcp, addr);
122         tprints(buf);
123 }
124
125 void
126 sprint_timespec(char *buf, struct tcb *tcp, long addr)
127 {
128         if (addr == 0)
129                 strcpy(buf, "NULL");
130         else if (!verbose(tcp))
131                 sprintf(buf, "%#lx", addr);
132         else {
133                 int rc;
134
135 #if SUPPORTED_PERSONALITIES > 1
136                 if (current_time_t_is_compat) {
137                         struct timeval32 tv;
138
139                         rc = umove(tcp, addr, &tv);
140                         if (rc >= 0)
141                                 sprintf(buf, "{%u, %u}",
142                                         tv.tv_sec, tv.tv_usec);
143                 } else
144 #endif
145                 {
146                         struct timespec ts;
147
148                         rc = umove(tcp, addr, &ts);
149                         if (rc >= 0)
150                                 sprintf(buf, "{%ju, %ju}",
151                                         (uintmax_t) ts.tv_sec,
152                                         (uintmax_t) ts.tv_nsec);
153                 }
154                 if (rc < 0)
155                         strcpy(buf, "{...}");
156         }
157 }
158
159 SYS_FUNC(time)
160 {
161         if (exiting(tcp)) {
162                 printnum_long(tcp, tcp->u_arg[0], "%ld");
163         }
164         return 0;
165 }
166
167 SYS_FUNC(gettimeofday)
168 {
169         if (exiting(tcp)) {
170                 printtv(tcp, tcp->u_arg[0]);
171                 tprints(", ");
172                 printtv(tcp, tcp->u_arg[1]);
173         }
174         return 0;
175 }
176
177 #ifdef ALPHA
178 SYS_FUNC(osf_gettimeofday)
179 {
180         if (exiting(tcp)) {
181                 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
182                 tprints(", ");
183                 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
184         }
185         return 0;
186 }
187 #endif
188
189 SYS_FUNC(settimeofday)
190 {
191         if (entering(tcp)) {
192                 printtv(tcp, tcp->u_arg[0]);
193                 tprints(", ");
194                 printtv(tcp, tcp->u_arg[1]);
195         }
196         return 0;
197 }
198
199 #ifdef ALPHA
200 SYS_FUNC(osf_settimeofday)
201 {
202         if (entering(tcp)) {
203                 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
204                 tprints(", ");
205                 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
206         }
207         return 0;
208 }
209 #endif
210
211 SYS_FUNC(adjtime)
212 {
213         if (entering(tcp)) {
214                 printtv(tcp, tcp->u_arg[0]);
215                 tprints(", ");
216         } else {
217                 printtv(tcp, tcp->u_arg[1]);
218         }
219         return 0;
220 }
221
222 SYS_FUNC(nanosleep)
223 {
224         if (entering(tcp)) {
225                 print_timespec(tcp, tcp->u_arg[0]);
226                 tprints(", ");
227         } else {
228                 /* Second (returned) timespec is only significant
229                  * if syscall was interrupted. On success, we print
230                  * only its address, since kernel doesn't modify it,
231                  * and printing the value may show uninitialized data.
232                  */
233                 switch (tcp->u_error) {
234                 default:
235                         /* Not interrupted (slept entire interval) */
236                         if (tcp->u_arg[1]) {
237                                 tprintf("%#lx", tcp->u_arg[1]);
238                                 break;
239                         }
240                         /* Fall through: print_timespec(NULL) prints "NULL" */
241                 case ERESTARTSYS:
242                 case ERESTARTNOINTR:
243                 case ERESTARTNOHAND:
244                 case ERESTART_RESTARTBLOCK:
245                         /* Interrupted */
246                         print_timespec(tcp, tcp->u_arg[1]);
247                 }
248         }
249         return 0;
250 }
251
252 #include "xlat/itimer_which.h"
253
254 static void
255 printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
256 {
257         if (addr == 0)
258                 tprints("NULL");
259         else if (!verbose(tcp))
260                 tprintf("%#lx", addr);
261         else {
262                 int rc;
263
264                 if (bitness == BITNESS_32 || current_time_t_is_compat) {
265                         struct {
266                                 struct timeval32 it_interval, it_value;
267                         } itv;
268
269                         rc = umove(tcp, addr, &itv);
270                         if (rc >= 0) {
271                                 tprints("{it_interval=");
272                                 tprint_timeval32(tcp, &itv.it_interval);
273                                 tprints(", it_value=");
274                                 tprint_timeval32(tcp, &itv.it_value);
275                                 tprints("}");
276                         }
277                 } else {
278                         struct itimerval itv;
279
280                         rc = umove(tcp, addr, &itv);
281                         if (rc >= 0) {
282                                 tprints("{it_interval=");
283                                 tprint_timeval(tcp, &itv.it_interval);
284                                 tprints(", it_value=");
285                                 tprint_timeval(tcp, &itv.it_value);
286                                 tprints("}");
287                         }
288                 }
289                 if (rc < 0)
290                         tprints("{...}");
291         }
292 }
293
294 #define printitv(tcp, addr)     \
295         printitv_bitness((tcp), (addr), BITNESS_CURRENT)
296
297 SYS_FUNC(getitimer)
298 {
299         if (entering(tcp)) {
300                 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
301                 tprints(", ");
302         } else {
303                 if (syserror(tcp))
304                         tprintf("%#lx", tcp->u_arg[1]);
305                 else
306                         printitv(tcp, tcp->u_arg[1]);
307         }
308         return 0;
309 }
310
311 #ifdef ALPHA
312 SYS_FUNC(osf_getitimer)
313 {
314         if (entering(tcp)) {
315                 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
316                 tprints(", ");
317         } else {
318                 if (syserror(tcp))
319                         tprintf("%#lx", tcp->u_arg[1]);
320                 else
321                         printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
322         }
323         return 0;
324 }
325 #endif
326
327 SYS_FUNC(setitimer)
328 {
329         if (entering(tcp)) {
330                 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
331                 tprints(", ");
332                 printitv(tcp, tcp->u_arg[1]);
333                 tprints(", ");
334         } else {
335                 if (syserror(tcp))
336                         tprintf("%#lx", tcp->u_arg[2]);
337                 else
338                         printitv(tcp, tcp->u_arg[2]);
339         }
340         return 0;
341 }
342
343 #ifdef ALPHA
344 SYS_FUNC(osf_setitimer)
345 {
346         if (entering(tcp)) {
347                 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
348                 tprints(", ");
349                 printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
350                 tprints(", ");
351         } else {
352                 if (syserror(tcp))
353                         tprintf("%#lx", tcp->u_arg[2]);
354                 else
355                         printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
356         }
357         return 0;
358 }
359 #endif
360
361 #include "xlat/adjtimex_modes.h"
362 #include "xlat/adjtimex_status.h"
363 #include "xlat/adjtimex_state.h"
364
365 #if SUPPORTED_PERSONALITIES > 1
366 static int
367 tprint_timex32(struct tcb *tcp, long addr)
368 {
369         struct {
370                 unsigned int modes;
371                 int     offset;
372                 int     freq;
373                 int     maxerror;
374                 int     esterror;
375                 int     status;
376                 int     constant;
377                 int     precision;
378                 int     tolerance;
379                 struct timeval32 time;
380                 int     tick;
381                 int     ppsfreq;
382                 int     jitter;
383                 int     shift;
384                 int     stabil;
385                 int     jitcnt;
386                 int     calcnt;
387                 int     errcnt;
388                 int     stbcnt;
389         } tx;
390
391         if (umove(tcp, addr, &tx) < 0)
392                 return -1;
393
394         tprints("{modes=");
395         printflags(adjtimex_modes, tx.modes, "ADJ_???");
396         tprintf(", offset=%d, freq=%d, maxerror=%d, ",
397                 tx.offset, tx.freq, tx.maxerror);
398         tprintf("esterror=%u, status=", tx.esterror);
399         printflags(adjtimex_status, tx.status, "STA_???");
400         tprintf(", constant=%d, precision=%u, ",
401                 tx.constant, tx.precision);
402         tprintf("tolerance=%d, time=", tx.tolerance);
403         tprint_timeval32(tcp, &tx.time);
404         tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
405                 tx.tick, tx.ppsfreq, tx.jitter);
406         tprintf(", shift=%d, stabil=%d, jitcnt=%d",
407                 tx.shift, tx.stabil, tx.jitcnt);
408         tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
409                 tx.calcnt, tx.errcnt, tx.stbcnt);
410         tprints("}");
411         return 0;
412 }
413 #endif /* SUPPORTED_PERSONALITIES > 1 */
414
415 static int
416 tprint_timex(struct tcb *tcp, long addr)
417 {
418         struct timex tx;
419
420 #if SUPPORTED_PERSONALITIES > 1
421         if (current_time_t_is_compat)
422                 return tprint_timex32(tcp, addr);
423 #endif
424         if (umove(tcp, addr, &tx) < 0)
425                 return -1;
426
427 #if LINUX_VERSION_CODE < 66332
428         tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
429                 tx.mode, tx.offset, tx.frequency);
430         tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
431                 tx.maxerror, tx.esterror, tx.status);
432         tprintf("time_constant=%ld, precision=%lu, ",
433                 tx.time_constant, tx.precision);
434         tprintf("tolerance=%ld, time=", tx.tolerance);
435         tprint_timeval(tcp, &tx.time);
436 #else
437         tprints("{modes=");
438         printflags(adjtimex_modes, tx.modes, "ADJ_???");
439         tprintf(", offset=%jd, freq=%jd, maxerror=%ju, esterror=%ju, status=",
440                 (intmax_t) tx.offset, (intmax_t) tx.freq,
441                 (uintmax_t) tx.maxerror, (uintmax_t) tx.esterror);
442         printflags(adjtimex_status, tx.status, "STA_???");
443         tprintf(", constant=%jd, precision=%ju, tolerance=%jd, time=",
444                 (intmax_t) tx.constant, (uintmax_t) tx.precision,
445                 (intmax_t) tx.tolerance);
446         tprint_timeval(tcp, &tx.time);
447         tprintf(", tick=%jd, ppsfreq=%jd, jitter=%jd",
448                 (intmax_t) tx.tick, (intmax_t) tx.ppsfreq, (intmax_t) tx.jitter);
449         tprintf(", shift=%d, stabil=%jd, jitcnt=%jd",
450                 tx.shift, (intmax_t) tx.stabil, (intmax_t) tx.jitcnt);
451         tprintf(", calcnt=%jd, errcnt=%jd, stbcnt=%jd",
452                 (intmax_t) tx.calcnt, (intmax_t) tx.errcnt, (intmax_t) tx.stbcnt);
453 #endif
454         tprints("}");
455         return 0;
456 }
457
458 static int
459 do_adjtimex(struct tcb *tcp, long addr)
460 {
461         if (addr == 0)
462                 tprints("NULL");
463         else if (syserror(tcp) || !verbose(tcp))
464                 tprintf("%#lx", addr);
465         else if (tprint_timex(tcp, addr) < 0)
466                 tprints("{...}");
467         if (syserror(tcp))
468                 return 0;
469         tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
470         if (tcp->auxstr)
471                 return RVAL_STR;
472         return 0;
473 }
474
475 SYS_FUNC(adjtimex)
476 {
477         if (exiting(tcp))
478                 return do_adjtimex(tcp, tcp->u_arg[0]);
479         return 0;
480 }
481
482 #include "xlat/clockflags.h"
483 #include "xlat/clocknames.h"
484
485 static void
486 printclockname(int clockid)
487 {
488 #ifdef CLOCKID_TO_FD
489 # include "xlat/cpuclocknames.h"
490
491         if (clockid < 0) {
492                 if ((clockid & CLOCKFD_MASK) == CLOCKFD)
493                         tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
494                 else {
495                         if(CPUCLOCK_PERTHREAD(clockid))
496                                 tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
497                         else
498                                 tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
499                         printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???");
500                         tprints(")");
501                 }
502         }
503         else
504 #endif
505                 printxval(clocknames, clockid, "CLOCK_???");
506 }
507
508 SYS_FUNC(clock_settime)
509 {
510         if (entering(tcp)) {
511                 printclockname(tcp->u_arg[0]);
512                 tprints(", ");
513                 printtv(tcp, tcp->u_arg[1]);
514         }
515         return 0;
516 }
517
518 SYS_FUNC(clock_gettime)
519 {
520         if (entering(tcp)) {
521                 printclockname(tcp->u_arg[0]);
522                 tprints(", ");
523         } else {
524                 printtv(tcp, tcp->u_arg[1]);
525         }
526         return 0;
527 }
528
529 SYS_FUNC(clock_nanosleep)
530 {
531         if (entering(tcp)) {
532                 printclockname(tcp->u_arg[0]);
533                 tprints(", ");
534                 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
535                 tprints(", ");
536                 printtv(tcp, tcp->u_arg[2]);
537                 tprints(", ");
538         } else {
539                 printtv(tcp, tcp->u_arg[3]);
540         }
541         return 0;
542 }
543
544 SYS_FUNC(clock_adjtime)
545 {
546         if (exiting(tcp))
547                 return do_adjtimex(tcp, tcp->u_arg[1]);
548         printclockname(tcp->u_arg[0]);
549         tprints(", ");
550         return 0;
551 }
552
553 #ifndef SIGEV_THREAD_ID
554 # define SIGEV_THREAD_ID 4
555 #endif
556 #include "xlat/sigev_value.h"
557
558 #if SUPPORTED_PERSONALITIES > 1
559 static void
560 printsigevent32(struct tcb *tcp, long arg)
561 {
562         struct {
563                 int     sigev_value;
564                 int     sigev_signo;
565                 int     sigev_notify;
566
567                 union {
568                         int     tid;
569                         struct {
570                                 int     function, attribute;
571                         } thread;
572                 } un;
573         } sev;
574
575         if (umove(tcp, arg, &sev) < 0)
576                 tprints("{...}");
577         else {
578                 tprintf("{%#x, ", sev.sigev_value);
579                 if (sev.sigev_notify == SIGEV_SIGNAL)
580                         tprintf("%s, ", signame(sev.sigev_signo));
581                 else
582                         tprintf("%u, ", sev.sigev_signo);
583                 printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
584                 tprints(", ");
585                 if (sev.sigev_notify == SIGEV_THREAD_ID)
586                         tprintf("{%d}", sev.un.tid);
587                 else if (sev.sigev_notify == SIGEV_THREAD)
588                         tprintf("{%#x, %#x}",
589                                 sev.un.thread.function,
590                                 sev.un.thread.attribute);
591                 else
592                         tprints("{...}");
593                 tprints("}");
594         }
595 }
596 #endif
597
598 void
599 printsigevent(struct tcb *tcp, long arg)
600 {
601         struct sigevent sev;
602
603 #if SUPPORTED_PERSONALITIES > 1
604         if (current_wordsize == 4) {
605                 printsigevent32(tcp, arg);
606                 return;
607         }
608 #endif
609         if (umove(tcp, arg, &sev) < 0)
610                 tprints("{...}");
611         else {
612                 tprintf("{%p, ", sev.sigev_value.sival_ptr);
613                 if (sev.sigev_notify == SIGEV_SIGNAL)
614                         tprintf("%s, ", signame(sev.sigev_signo));
615                 else
616                         tprintf("%u, ", sev.sigev_signo);
617                 printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
618                 tprints(", ");
619                 if (sev.sigev_notify == SIGEV_THREAD_ID)
620 #if defined(HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD)
621                         /* _pad[0] is the _tid field which might not be
622                            present in the userlevel definition of the
623                            struct.  */
624                         tprintf("{%d}", sev._sigev_un._pad[0]);
625 #elif defined(HAVE_STRUCT_SIGEVENT___PAD)
626                         tprintf("{%d}", sev.__pad[0]);
627 #else
628 # warning unfamiliar struct sigevent => incomplete SIGEV_THREAD_ID decoding
629                         tprints("{...}");
630 #endif
631                 else if (sev.sigev_notify == SIGEV_THREAD)
632                         tprintf("{%p, %p}", sev.sigev_notify_function,
633                                 sev.sigev_notify_attributes);
634                 else
635                         tprints("{...}");
636                 tprints("}");
637         }
638 }
639
640 SYS_FUNC(timer_create)
641 {
642         if (entering(tcp)) {
643                 printclockname(tcp->u_arg[0]);
644                 tprints(", ");
645                 printsigevent(tcp, tcp->u_arg[1]);
646                 tprints(", ");
647         } else {
648                 int timer_id;
649
650                 if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &timer_id) < 0)
651                         tprintf("%#lx", tcp->u_arg[2]);
652                 else
653                         tprintf("{%d}", timer_id);
654         }
655         return 0;
656 }
657
658 SYS_FUNC(timer_settime)
659 {
660         if (entering(tcp)) {
661                 tprintf("%#lx, ", tcp->u_arg[0]);
662                 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
663                 tprints(", ");
664                 printitv(tcp, tcp->u_arg[2]);
665                 tprints(", ");
666         } else {
667                 if (syserror(tcp))
668                         tprintf("%#lx", tcp->u_arg[3]);
669                 else
670                         printitv(tcp, tcp->u_arg[3]);
671         }
672         return 0;
673 }
674
675 SYS_FUNC(timer_gettime)
676 {
677         if (entering(tcp)) {
678                 tprintf("%#lx, ", tcp->u_arg[0]);
679         } else {
680                 if (syserror(tcp))
681                         tprintf("%#lx", tcp->u_arg[1]);
682                 else
683                         printitv(tcp, tcp->u_arg[1]);
684         }
685         return 0;
686 }
687
688 #include "xlat/timerfdflags.h"
689
690 SYS_FUNC(timerfd)
691 {
692         if (entering(tcp)) {
693                 /* It does not matter that the kernel uses itimerspec.  */
694                 tprintf("%ld, ", tcp->u_arg[0]);
695                 printclockname(tcp->u_arg[0]);
696                 tprints(", ");
697                 printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
698                 tprints(", ");
699                 printitv(tcp, tcp->u_arg[3]);
700         }
701         return 0;
702 }
703
704 SYS_FUNC(timerfd_create)
705 {
706         if (entering(tcp)) {
707                 printclockname(tcp->u_arg[0]);
708                 tprints(", ");
709                 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
710         }
711         return 0;
712 }
713
714 SYS_FUNC(timerfd_settime)
715 {
716         if (entering(tcp)) {
717                 printfd(tcp, tcp->u_arg[0]);
718                 tprints(", ");
719                 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
720                 tprints(", ");
721                 printitv(tcp, tcp->u_arg[2]);
722                 tprints(", ");
723                 printitv(tcp, tcp->u_arg[3]);
724         }
725         return 0;
726 }
727
728 SYS_FUNC(timerfd_gettime)
729 {
730         if (entering(tcp)) {
731                 printfd(tcp, tcp->u_arg[0]);
732                 tprints(", ");
733                 printitv(tcp, tcp->u_arg[1]);
734         }
735         return 0;
736 }