blob: b30fd0f2a93d133e9189fb47d571fdf1f417ffc8 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
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.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000028 */
29
30#include "defs.h"
Mike Frysingerf1639d82014-12-30 19:08:50 -050031#include <fcntl.h>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000032#include <linux/version.h>
Wichert Akkermand856b992000-10-13 12:47:12 +000033#include <sys/timex.h>
Roland McGrathd83c50b2004-10-06 22:27:43 +000034#include <linux/ioctl.h>
35#include <linux/rtc.h>
Roland McGrath6afc5652007-07-24 01:57:11 +000036
37#ifndef UTIME_NOW
38#define UTIME_NOW ((1l << 30) - 1l)
39#endif
40#ifndef UTIME_OMIT
41#define UTIME_OMIT ((1l << 30) - 2l)
42#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000043
Dmitry V. Levine61086f2015-02-27 21:46:42 +000044#if SUPPORTED_PERSONALITIES > 1
45# if defined X86_64 || defined X32
46# define current_time_t_is_compat (current_personality == 1)
47# else
48# define current_time_t_is_compat (current_wordsize == 4)
49# endif
50#else
51# define current_time_t_is_compat 0
52#endif
53
Dmitry V. Levina7945a32006-12-13 17:10:11 +000054struct timeval32
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000055{
Dmitry V. Levina7945a32006-12-13 17:10:11 +000056 u_int32_t tv_sec, tv_usec;
57};
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000058
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +000059static void
60tprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
61{
62 tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
63}
64
65static void
66tprint_timeval(struct tcb *tcp, const struct timeval *tv)
67{
Dmitry V. Levine61086f2015-02-27 21:46:42 +000068 tprintf("{%ju, %ju}", (uintmax_t) tv->tv_sec, (uintmax_t) tv->tv_usec);
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +000069}
70
Dmitry V. Levina7945a32006-12-13 17:10:11 +000071void
Roland McGrath6afc5652007-07-24 01:57:11 +000072printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
Dmitry V. Levina7945a32006-12-13 17:10:11 +000073{
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +010074 char buf[TIMEVAL_TEXT_BUFSIZE];
75 sprinttv(buf, tcp, addr, bitness, special);
76 tprints(buf);
Dmitry V. Levina7945a32006-12-13 17:10:11 +000077}
Wichert Akkerman221f54f1999-11-18 17:26:45 +000078
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000079static char *
Dmitry V. Levine61086f2015-02-27 21:46:42 +000080do_sprinttv(char *buf, const uintmax_t sec, const uintmax_t usec,
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000081 const int special)
82{
83 if (special) {
84 switch (usec) {
85 case UTIME_NOW:
86 return stpcpy(buf, "UTIME_NOW");
87 case UTIME_OMIT:
88 return stpcpy(buf, "UTIME_OMIT");
89 }
90 }
Dmitry V. Levine61086f2015-02-27 21:46:42 +000091 return buf + sprintf(buf, "{%ju, %ju}", sec, usec);
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000092}
93
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020094char *
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +010095sprinttv(char *buf, struct tcb *tcp, long addr, enum bitness_t bitness, int special)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +000096{
Dmitry V. Levina7945a32006-12-13 17:10:11 +000097 if (addr == 0)
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020098 return stpcpy(buf, "NULL");
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +000099
Denys Vlasenkob9c7ae62011-09-01 11:40:40 +0200100 if (!verbose(tcp))
101 return buf + sprintf(buf, "%#lx", addr);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200102
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000103 if (bitness == BITNESS_32 || current_time_t_is_compat)
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200104 {
105 struct timeval32 tv;
106
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +0000107 if (umove(tcp, addr, &tv) >= 0)
108 return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200109 } else {
110 struct timeval tv;
111
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +0000112 if (umove(tcp, addr, &tv) >= 0)
113 return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200114 }
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200115
Denys Vlasenkob9c7ae62011-09-01 11:40:40 +0200116 return stpcpy(buf, "{...}");
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000117}
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000118
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100119void
120print_timespec(struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000121{
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100122 char buf[TIMESPEC_TEXT_BUFSIZE];
123 sprint_timespec(buf, tcp, addr);
124 tprints(buf);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000125}
126
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100127void
128sprint_timespec(char *buf, struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000129{
130 if (addr == 0)
131 strcpy(buf, "NULL");
132 else if (!verbose(tcp))
133 sprintf(buf, "%#lx", addr);
134 else {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000135 int rc;
Roland McGrath6bc09da2007-11-01 21:50:54 +0000136
Denys Vlasenko84703742012-02-25 02:38:52 +0100137#if SUPPORTED_PERSONALITIES > 1
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000138 if (current_time_t_is_compat) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000139 struct timeval32 tv;
140
Denys Vlasenko5d645812011-08-20 12:48:18 +0200141 rc = umove(tcp, addr, &tv);
142 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000143 sprintf(buf, "{%u, %u}",
144 tv.tv_sec, tv.tv_usec);
145 } else
Roland McGrath6bc09da2007-11-01 21:50:54 +0000146#endif
Denys Vlasenko1d632462009-04-14 12:51:00 +0000147 {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000148 struct timespec ts;
149
Denys Vlasenko5d645812011-08-20 12:48:18 +0200150 rc = umove(tcp, addr, &ts);
151 if (rc >= 0)
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000152 sprintf(buf, "{%ju, %ju}",
153 (uintmax_t) ts.tv_sec,
154 (uintmax_t) ts.tv_nsec);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000155 }
Roland McGrath6bc09da2007-11-01 21:50:54 +0000156 if (rc < 0)
157 strcpy(buf, "{...}");
158 }
159}
160
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000161SYS_FUNC(time)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000162{
163 if (exiting(tcp)) {
Dmitry V. Levin1c603a92015-02-17 22:03:17 +0000164 printnum_long(tcp, tcp->u_arg[0], "%ld");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000165 }
166 return 0;
167}
168
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000169SYS_FUNC(gettimeofday)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000170{
171 if (exiting(tcp)) {
172 if (syserror(tcp)) {
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000173 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000174 return 0;
175 }
176 printtv(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200177 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000178 printtv(tcp, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000179 }
180 return 0;
181}
182
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000183#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000184SYS_FUNC(osf_gettimeofday)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000185{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000186 if (exiting(tcp)) {
187 if (syserror(tcp)) {
188 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
189 return 0;
190 }
191 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200192 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000193 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000194 }
195 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000196}
197#endif
198
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000199SYS_FUNC(settimeofday)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000200{
201 if (entering(tcp)) {
202 printtv(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200203 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000204 printtv(tcp, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000205 }
206 return 0;
207}
208
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000209#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000210SYS_FUNC(osf_settimeofday)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000211{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000212 if (entering(tcp)) {
213 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200214 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000215 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000216 }
217 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000218}
219#endif
220
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000221SYS_FUNC(adjtime)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000222{
223 if (entering(tcp)) {
224 printtv(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200225 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000226 } else {
227 if (syserror(tcp))
228 tprintf("%#lx", tcp->u_arg[1]);
229 else
230 printtv(tcp, tcp->u_arg[1]);
231 }
232 return 0;
233}
234
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000235SYS_FUNC(nanosleep)
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000236{
237 if (entering(tcp)) {
238 print_timespec(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200239 tprints(", ");
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000240 } else {
Denys Vlasenko64acaa12012-01-28 02:29:36 +0100241 /* Second (returned) timespec is only significant
Denys Vlasenko47932212013-06-30 23:53:49 +0200242 * if syscall was interrupted. On success, we print
243 * only its address, since kernel doesn't modify it,
244 * and printing the value may show uninitialized data.
Denys Vlasenko64acaa12012-01-28 02:29:36 +0100245 */
Denys Vlasenko47932212013-06-30 23:53:49 +0200246 switch (tcp->u_error) {
247 default:
248 /* Not interrupted (slept entire interval) */
249 if (tcp->u_arg[1]) {
250 tprintf("%#lx", tcp->u_arg[1]);
251 break;
252 }
253 /* Fall through: print_timespec(NULL) prints "NULL" */
254 case ERESTARTSYS:
255 case ERESTARTNOINTR:
256 case ERESTARTNOHAND:
257 case ERESTART_RESTARTBLOCK:
258 /* Interrupted */
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000259 print_timespec(tcp, tcp->u_arg[1]);
Denys Vlasenko47932212013-06-30 23:53:49 +0200260 }
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000261 }
262 return 0;
263}
264
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000265#include "xlat/itimer_which.h"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000266
267static void
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000268printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000269{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000270 if (addr == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200271 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000272 else if (!verbose(tcp))
273 tprintf("%#lx", addr);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000274 else {
275 int rc;
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000276
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000277 if (bitness == BITNESS_32 || current_time_t_is_compat) {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000278 struct {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000279 struct timeval32 it_interval, it_value;
280 } itv;
281
Denys Vlasenko5d645812011-08-20 12:48:18 +0200282 rc = umove(tcp, addr, &itv);
283 if (rc >= 0) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200284 tprints("{it_interval=");
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000285 tprint_timeval32(tcp, &itv.it_interval);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200286 tprints(", it_value=");
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000287 tprint_timeval32(tcp, &itv.it_value);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200288 tprints("}");
Roland McGrathe4662342007-08-02 01:25:34 +0000289 }
Denys Vlasenko1d632462009-04-14 12:51:00 +0000290 } else {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000291 struct itimerval itv;
292
Denys Vlasenko5d645812011-08-20 12:48:18 +0200293 rc = umove(tcp, addr, &itv);
294 if (rc >= 0) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200295 tprints("{it_interval=");
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000296 tprint_timeval(tcp, &itv.it_interval);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200297 tprints(", it_value=");
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000298 tprint_timeval(tcp, &itv.it_value);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200299 tprints("}");
Roland McGrathe4662342007-08-02 01:25:34 +0000300 }
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000301 }
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000302 if (rc < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200303 tprints("{...}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000304 }
305}
306
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000307#define printitv(tcp, addr) \
308 printitv_bitness((tcp), (addr), BITNESS_CURRENT)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000309
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000310SYS_FUNC(getitimer)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000311{
312 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000313 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200314 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000315 } else {
316 if (syserror(tcp))
317 tprintf("%#lx", tcp->u_arg[1]);
318 else
319 printitv(tcp, tcp->u_arg[1]);
320 }
321 return 0;
322}
323
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000324#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000325SYS_FUNC(osf_getitimer)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000326{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000327 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000328 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200329 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000330 } else {
331 if (syserror(tcp))
332 tprintf("%#lx", tcp->u_arg[1]);
333 else
334 printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
335 }
336 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000337}
338#endif
339
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000340SYS_FUNC(setitimer)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000341{
342 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000343 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200344 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000345 printitv(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200346 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000347 } else {
348 if (syserror(tcp))
349 tprintf("%#lx", tcp->u_arg[2]);
350 else
351 printitv(tcp, tcp->u_arg[2]);
352 }
353 return 0;
354}
355
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000356#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000357SYS_FUNC(osf_setitimer)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000358{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000359 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000360 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200361 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000362 printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200363 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000364 } else {
365 if (syserror(tcp))
366 tprintf("%#lx", tcp->u_arg[2]);
367 else
368 printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
369 }
370 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000371}
372#endif
373
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000374#include "xlat/adjtimex_modes.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000375#include "xlat/adjtimex_status.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000376#include "xlat/adjtimex_state.h"
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000377
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000378#if SUPPORTED_PERSONALITIES > 1
379static int
380tprint_timex32(struct tcb *tcp, long addr)
381{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000382 struct {
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000383 unsigned int modes;
384 int offset;
385 int freq;
386 int maxerror;
387 int esterror;
388 int status;
389 int constant;
390 int precision;
391 int tolerance;
392 struct timeval32 time;
393 int tick;
394 int ppsfreq;
395 int jitter;
396 int shift;
397 int stabil;
398 int jitcnt;
399 int calcnt;
400 int errcnt;
401 int stbcnt;
402 } tx;
403
404 if (umove(tcp, addr, &tx) < 0)
405 return -1;
406
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200407 tprints("{modes=");
Dmitry V. Levin71d70892007-01-13 11:17:38 +0000408 printflags(adjtimex_modes, tx.modes, "ADJ_???");
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000409 tprintf(", offset=%d, freq=%d, maxerror=%d, ",
410 tx.offset, tx.freq, tx.maxerror);
411 tprintf("esterror=%u, status=", tx.esterror);
412 printflags(adjtimex_status, tx.status, "STA_???");
413 tprintf(", constant=%d, precision=%u, ",
414 tx.constant, tx.precision);
415 tprintf("tolerance=%d, time=", tx.tolerance);
416 tprint_timeval32(tcp, &tx.time);
417 tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
418 tx.tick, tx.ppsfreq, tx.jitter);
419 tprintf(", shift=%d, stabil=%d, jitcnt=%d",
420 tx.shift, tx.stabil, tx.jitcnt);
421 tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
422 tx.calcnt, tx.errcnt, tx.stbcnt);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200423 tprints("}");
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000424 return 0;
425}
426#endif /* SUPPORTED_PERSONALITIES > 1 */
427
428static int
429tprint_timex(struct tcb *tcp, long addr)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000430{
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000431 struct timex tx;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000432
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000433#if SUPPORTED_PERSONALITIES > 1
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000434 if (current_time_t_is_compat)
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000435 return tprint_timex32(tcp, addr);
436#endif
437 if (umove(tcp, addr, &tx) < 0)
438 return -1;
439
440#if LINUX_VERSION_CODE < 66332
441 tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
442 tx.mode, tx.offset, tx.frequency);
443 tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
444 tx.maxerror, tx.esterror, tx.status);
445 tprintf("time_constant=%ld, precision=%lu, ",
446 tx.time_constant, tx.precision);
447 tprintf("tolerance=%ld, time=", tx.tolerance);
448 tprint_timeval(tcp, &tx.time);
449#else
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200450 tprints("{modes=");
Dmitry V. Levin71d70892007-01-13 11:17:38 +0000451 printflags(adjtimex_modes, tx.modes, "ADJ_???");
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000452 tprintf(", offset=%jd, freq=%jd, maxerror=%ju, esterror=%ju, status=",
453 (intmax_t) tx.offset, (intmax_t) tx.freq,
454 (uintmax_t) tx.maxerror, (uintmax_t) tx.esterror);
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000455 printflags(adjtimex_status, tx.status, "STA_???");
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000456 tprintf(", constant=%jd, precision=%ju, tolerance=%jd, time=",
457 (intmax_t) tx.constant, (uintmax_t) tx.precision,
458 (intmax_t) tx.tolerance);
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000459 tprint_timeval(tcp, &tx.time);
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000460 tprintf(", tick=%jd, ppsfreq=%jd, jitter=%jd",
461 (intmax_t) tx.tick, (intmax_t) tx.ppsfreq, (intmax_t) tx.jitter);
462 tprintf(", shift=%d, stabil=%jd, jitcnt=%jd",
463 tx.shift, (intmax_t) tx.stabil, (intmax_t) tx.jitcnt);
464 tprintf(", calcnt=%jd, errcnt=%jd, stbcnt=%jd",
465 (intmax_t) tx.calcnt, (intmax_t) tx.errcnt, (intmax_t) tx.stbcnt);
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000466#endif
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200467 tprints("}");
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000468 return 0;
469}
470
Dmitry V. Levin73215472012-03-11 21:25:51 +0000471static int
472do_adjtimex(struct tcb *tcp, long addr)
473{
474 if (addr == 0)
475 tprints("NULL");
476 else if (syserror(tcp) || !verbose(tcp))
477 tprintf("%#lx", addr);
478 else if (tprint_timex(tcp, addr) < 0)
479 tprints("{...}");
480 if (syserror(tcp))
481 return 0;
482 tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
483 if (tcp->auxstr)
484 return RVAL_STR;
485 return 0;
486}
487
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000488SYS_FUNC(adjtimex)
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000489{
Dmitry V. Levin73215472012-03-11 21:25:51 +0000490 if (exiting(tcp))
491 return do_adjtimex(tcp, tcp->u_arg[0]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000492 return 0;
493}
Roland McGrath1e356792003-03-30 23:52:28 +0000494
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000495#include "xlat/clockflags.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000496#include "xlat/clocknames.h"
Roland McGrath54a4edd2004-08-31 06:52:45 +0000497
Stefan Sørensena5fea902014-02-03 10:01:27 +0100498static void
499printclockname(int clockid)
500{
501#ifdef CLOCKID_TO_FD
Dmitry V. Levind35bdca2014-04-26 18:10:19 +0000502# include "xlat/cpuclocknames.h"
503
Stefan Sørensena5fea902014-02-03 10:01:27 +0100504 if (clockid < 0) {
505 if ((clockid & CLOCKFD_MASK) == CLOCKFD)
506 tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
507 else {
508 if(CPUCLOCK_PERTHREAD(clockid))
509 tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
510 else
511 tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
512 printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???");
513 tprints(")");
514 }
515 }
516 else
517#endif
518 printxval(clocknames, clockid, "CLOCK_???");
519}
520
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000521SYS_FUNC(clock_settime)
Roland McGrath1e356792003-03-30 23:52:28 +0000522{
523 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100524 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200525 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000526 printtv(tcp, tcp->u_arg[1]);
527 }
528 return 0;
529}
530
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000531SYS_FUNC(clock_gettime)
Roland McGrath1e356792003-03-30 23:52:28 +0000532{
533 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100534 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200535 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000536 } else {
537 if (syserror(tcp))
538 tprintf("%#lx", tcp->u_arg[1]);
539 else
540 printtv(tcp, tcp->u_arg[1]);
541 }
542 return 0;
543}
544
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000545SYS_FUNC(clock_nanosleep)
Roland McGrath1e356792003-03-30 23:52:28 +0000546{
547 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100548 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200549 tprints(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000550 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200551 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000552 printtv(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200553 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000554 } else {
555 if (syserror(tcp))
556 tprintf("%#lx", tcp->u_arg[3]);
557 else
558 printtv(tcp, tcp->u_arg[3]);
559 }
560 return 0;
561}
562
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000563SYS_FUNC(clock_adjtime)
Dmitry V. Levin73215472012-03-11 21:25:51 +0000564{
565 if (exiting(tcp))
566 return do_adjtimex(tcp, tcp->u_arg[1]);
Stefan Sørensena5fea902014-02-03 10:01:27 +0100567 printclockname(tcp->u_arg[0]);
Dmitry V. Levin73215472012-03-11 21:25:51 +0000568 tprints(", ");
569 return 0;
570}
571
Roland McGrath1e356792003-03-30 23:52:28 +0000572#ifndef SIGEV_THREAD_ID
573# define SIGEV_THREAD_ID 4
574#endif
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000575#include "xlat/sigev_value.h"
Roland McGrath1e356792003-03-30 23:52:28 +0000576
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000577#if SUPPORTED_PERSONALITIES > 1
578static void
579printsigevent32(struct tcb *tcp, long arg)
580{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000581 struct {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000582 int sigev_value;
583 int sigev_signo;
584 int sigev_notify;
585
Denys Vlasenko1d632462009-04-14 12:51:00 +0000586 union {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000587 int tid;
Denys Vlasenko1d632462009-04-14 12:51:00 +0000588 struct {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000589 int function, attribute;
590 } thread;
591 } un;
592 } sev;
593
594 if (umove(tcp, arg, &sev) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200595 tprints("{...}");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000596 else {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000597 tprintf("{%#x, ", sev.sigev_value);
598 if (sev.sigev_notify == SIGEV_SIGNAL)
599 tprintf("%s, ", signame(sev.sigev_signo));
600 else
601 tprintf("%u, ", sev.sigev_signo);
Dmitry V. Levinbae549e2014-02-05 01:46:10 +0000602 printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200603 tprints(", ");
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000604 if (sev.sigev_notify == SIGEV_THREAD_ID)
605 tprintf("{%d}", sev.un.tid);
606 else if (sev.sigev_notify == SIGEV_THREAD)
607 tprintf("{%#x, %#x}",
608 sev.un.thread.function,
609 sev.un.thread.attribute);
610 else
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200611 tprints("{...}");
612 tprints("}");
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000613 }
614}
615#endif
616
Roland McGrath1e356792003-03-30 23:52:28 +0000617void
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000618printsigevent(struct tcb *tcp, long arg)
Roland McGrath1e356792003-03-30 23:52:28 +0000619{
620 struct sigevent sev;
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000621
622#if SUPPORTED_PERSONALITIES > 1
Denys Vlasenko9fd4f962012-03-19 09:36:42 +0100623 if (current_wordsize == 4) {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000624 printsigevent32(tcp, arg);
625 return;
626 }
627#endif
Denys Vlasenkob63256e2011-06-07 12:13:24 +0200628 if (umove(tcp, arg, &sev) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200629 tprints("{...}");
Roland McGrath1e356792003-03-30 23:52:28 +0000630 else {
Roland McGrath675d4a62004-09-11 08:12:45 +0000631 tprintf("{%p, ", sev.sigev_value.sival_ptr);
632 if (sev.sigev_notify == SIGEV_SIGNAL)
633 tprintf("%s, ", signame(sev.sigev_signo));
634 else
635 tprintf("%u, ", sev.sigev_signo);
Dmitry V. Levinbae549e2014-02-05 01:46:10 +0000636 printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200637 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000638 if (sev.sigev_notify == SIGEV_THREAD_ID)
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000639#if defined(HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD)
Roland McGrath1e356792003-03-30 23:52:28 +0000640 /* _pad[0] is the _tid field which might not be
641 present in the userlevel definition of the
642 struct. */
643 tprintf("{%d}", sev._sigev_un._pad[0]);
Dmitry V. Levinae5aa472013-11-11 23:54:30 +0000644#elif defined(HAVE_STRUCT_SIGEVENT___PAD)
645 tprintf("{%d}", sev.__pad[0]);
646#else
647# warning unfamiliar struct sigevent => incomplete SIGEV_THREAD_ID decoding
648 tprints("{...}");
649#endif
Roland McGrathd4c85eb2004-04-16 21:48:44 +0000650 else if (sev.sigev_notify == SIGEV_THREAD)
651 tprintf("{%p, %p}", sev.sigev_notify_function,
652 sev.sigev_notify_attributes);
Roland McGrath1e356792003-03-30 23:52:28 +0000653 else
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200654 tprints("{...}");
655 tprints("}");
Roland McGrath1e356792003-03-30 23:52:28 +0000656 }
657}
658
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000659SYS_FUNC(timer_create)
Roland McGrath1e356792003-03-30 23:52:28 +0000660{
661 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100662 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200663 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000664 printsigevent(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200665 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000666 } else {
Andi Kleen732f3962011-06-13 21:37:40 +0000667 int timer_id;
Dmitry V. Levinac518d12006-12-13 17:03:02 +0000668
Andi Kleen732f3962011-06-13 21:37:40 +0000669 if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &timer_id) < 0)
Roland McGrath1e356792003-03-30 23:52:28 +0000670 tprintf("%#lx", tcp->u_arg[2]);
Dmitry V. Levinac518d12006-12-13 17:03:02 +0000671 else
Andi Kleen732f3962011-06-13 21:37:40 +0000672 tprintf("{%d}", timer_id);
Roland McGrath1e356792003-03-30 23:52:28 +0000673 }
674 return 0;
675}
676
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000677SYS_FUNC(timer_settime)
Roland McGrath1e356792003-03-30 23:52:28 +0000678{
679 if (entering(tcp)) {
680 tprintf("%#lx, ", tcp->u_arg[0]);
Roland McGrathb2dee132005-06-01 19:02:36 +0000681 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200682 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000683 printitv(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200684 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000685 } else {
686 if (syserror(tcp))
687 tprintf("%#lx", tcp->u_arg[3]);
688 else
689 printitv(tcp, tcp->u_arg[3]);
690 }
691 return 0;
692}
693
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000694SYS_FUNC(timer_gettime)
Roland McGrath1e356792003-03-30 23:52:28 +0000695{
696 if (entering(tcp)) {
697 tprintf("%#lx, ", tcp->u_arg[0]);
698 } else {
699 if (syserror(tcp))
700 tprintf("%#lx", tcp->u_arg[1]);
701 else
702 printitv(tcp, tcp->u_arg[1]);
703 }
704 return 0;
705}
Roland McGrathd83c50b2004-10-06 22:27:43 +0000706
707static void
Denys Vlasenko12014262011-05-30 14:00:14 +0200708print_rtc(struct tcb *tcp, const struct rtc_time *rt)
Roland McGrathd83c50b2004-10-06 22:27:43 +0000709{
710 tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
711 "tm_mday=%d, tm_mon=%d, tm_year=%d, ",
712 rt->tm_sec, rt->tm_min, rt->tm_hour,
713 rt->tm_mday, rt->tm_mon, rt->tm_year);
714 if (!abbrev(tcp))
715 tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
716 rt->tm_wday, rt->tm_yday, rt->tm_isdst);
717 else
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200718 tprints("...}");
Roland McGrathd83c50b2004-10-06 22:27:43 +0000719}
720
721int
Dmitry V. Levinc7afb482015-01-19 18:44:21 +0000722rtc_ioctl(struct tcb *tcp, const unsigned int code, long arg)
Roland McGrathd83c50b2004-10-06 22:27:43 +0000723{
724 switch (code) {
725 case RTC_ALM_SET:
726 case RTC_SET_TIME:
727 if (entering(tcp)) {
728 struct rtc_time rt;
729 if (umove(tcp, arg, &rt) < 0)
730 tprintf(", %#lx", arg);
731 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200732 tprints(", ");
Roland McGrathd83c50b2004-10-06 22:27:43 +0000733 print_rtc(tcp, &rt);
734 }
735 }
736 break;
737 case RTC_ALM_READ:
738 case RTC_RD_TIME:
739 if (exiting(tcp)) {
740 struct rtc_time rt;
741 if (syserror(tcp) || umove(tcp, arg, &rt) < 0)
742 tprintf(", %#lx", arg);
743 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200744 tprints(", ");
Roland McGrathd83c50b2004-10-06 22:27:43 +0000745 print_rtc(tcp, &rt);
746 }
747 }
748 break;
749 case RTC_IRQP_SET:
750 case RTC_EPOCH_SET:
751 if (entering(tcp))
752 tprintf(", %lu", arg);
753 break;
754 case RTC_IRQP_READ:
755 case RTC_EPOCH_READ:
756 if (exiting(tcp))
757 tprintf(", %lu", arg);
758 break;
759 case RTC_WKALM_SET:
760 if (entering(tcp)) {
761 struct rtc_wkalrm wk;
762 if (umove(tcp, arg, &wk) < 0)
763 tprintf(", %#lx", arg);
764 else {
765 tprintf(", {enabled=%d, pending=%d, ",
766 wk.enabled, wk.pending);
767 print_rtc(tcp, &wk.time);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200768 tprints("}");
Roland McGrathd83c50b2004-10-06 22:27:43 +0000769 }
770 }
771 break;
772 case RTC_WKALM_RD:
773 if (exiting(tcp)) {
774 struct rtc_wkalrm wk;
775 if (syserror(tcp) || umove(tcp, arg, &wk) < 0)
776 tprintf(", %#lx", arg);
777 else {
778 tprintf(", {enabled=%d, pending=%d, ",
779 wk.enabled, wk.pending);
780 print_rtc(tcp, &wk.time);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200781 tprints("}");
Roland McGrathd83c50b2004-10-06 22:27:43 +0000782 }
783 }
784 break;
785 default:
786 if (entering(tcp))
787 tprintf(", %#lx", arg);
788 break;
789 }
790 return 1;
791}
Roland McGrathe4662342007-08-02 01:25:34 +0000792
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000793#include "xlat/timerfdflags.h"
Roland McGrathe4662342007-08-02 01:25:34 +0000794
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000795SYS_FUNC(timerfd)
Roland McGrathe4662342007-08-02 01:25:34 +0000796{
797 if (entering(tcp)) {
798 /* It does not matter that the kernel uses itimerspec. */
799 tprintf("%ld, ", tcp->u_arg[0]);
Stefan Sørensena5fea902014-02-03 10:01:27 +0100800 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200801 tprints(", ");
Roland McGrathe4662342007-08-02 01:25:34 +0000802 printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200803 tprints(", ");
Roland McGrathe4662342007-08-02 01:25:34 +0000804 printitv(tcp, tcp->u_arg[3]);
805 }
806 return 0;
807}
Roland McGrathde328e62008-05-20 04:56:13 +0000808
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000809SYS_FUNC(timerfd_create)
Roland McGrathde328e62008-05-20 04:56:13 +0000810{
811 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100812 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200813 tprints(", ");
Roland McGrathde328e62008-05-20 04:56:13 +0000814 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
815 }
816 return 0;
817}
818
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000819SYS_FUNC(timerfd_settime)
Roland McGrathde328e62008-05-20 04:56:13 +0000820{
821 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +0300822 printfd(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200823 tprints(", ");
Roland McGrathde328e62008-05-20 04:56:13 +0000824 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200825 tprints(", ");
Roland McGrathde328e62008-05-20 04:56:13 +0000826 printitv(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200827 tprints(", ");
Roland McGrathde328e62008-05-20 04:56:13 +0000828 printitv(tcp, tcp->u_arg[3]);
829 }
830 return 0;
831}
832
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000833SYS_FUNC(timerfd_gettime)
Roland McGrathde328e62008-05-20 04:56:13 +0000834{
835 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +0300836 printfd(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200837 tprints(", ");
Roland McGrathde328e62008-05-20 04:56:13 +0000838 printitv(tcp, tcp->u_arg[1]);
839 }
840 return 0;
841}