blob: e37f26e0b81c75154b78e35ddc6d9824328fcc45 [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>
Dmitry V. Levin0e946ab2015-07-17 23:56:54 +000032#include <signal.h>
Wichert Akkermand856b992000-10-13 12:47:12 +000033#include <sys/timex.h>
Roland McGrath6afc5652007-07-24 01:57:11 +000034
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
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000041
Dmitry V. Levine61086f2015-02-27 21:46:42 +000042#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
Dmitry V. Levina7945a32006-12-13 17:10:11 +000052struct timeval32
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000053{
Dmitry V. Levina7945a32006-12-13 17:10:11 +000054 u_int32_t tv_sec, tv_usec;
55};
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000056
Dmitry V. Levina7945a32006-12-13 17:10:11 +000057void
Roland McGrath6afc5652007-07-24 01:57:11 +000058printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
Dmitry V. Levina7945a32006-12-13 17:10:11 +000059{
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +010060 char buf[TIMEVAL_TEXT_BUFSIZE];
61 sprinttv(buf, tcp, addr, bitness, special);
62 tprints(buf);
Dmitry V. Levina7945a32006-12-13 17:10:11 +000063}
Wichert Akkerman221f54f1999-11-18 17:26:45 +000064
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000065static char *
Dmitry V. Levine61086f2015-02-27 21:46:42 +000066do_sprinttv(char *buf, const uintmax_t sec, const uintmax_t usec,
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000067 const int special)
68{
69 if (special) {
70 switch (usec) {
71 case UTIME_NOW:
72 return stpcpy(buf, "UTIME_NOW");
73 case UTIME_OMIT:
74 return stpcpy(buf, "UTIME_OMIT");
75 }
76 }
Dmitry V. Levine61086f2015-02-27 21:46:42 +000077 return buf + sprintf(buf, "{%ju, %ju}", sec, usec);
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000078}
79
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020080char *
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +010081sprinttv(char *buf, struct tcb *tcp, long addr, enum bitness_t bitness, int special)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +000082{
Dmitry V. Levina7945a32006-12-13 17:10:11 +000083 if (addr == 0)
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020084 return stpcpy(buf, "NULL");
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +000085
Dmitry V. Levin9f702732015-07-16 16:22:07 +000086 if (!verbose(tcp) || (exiting(tcp) && syserror(tcp)))
Denys Vlasenkob9c7ae62011-09-01 11:40:40 +020087 return buf + sprintf(buf, "%#lx", addr);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020088
Dmitry V. Levine61086f2015-02-27 21:46:42 +000089 if (bitness == BITNESS_32 || current_time_t_is_compat)
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020090 {
91 struct timeval32 tv;
92
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000093 if (umove(tcp, addr, &tv) >= 0)
94 return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +020095 } else {
96 struct timeval tv;
97
Dmitry V. Levinee21a5b2014-12-26 23:55:38 +000098 if (umove(tcp, addr, &tv) >= 0)
99 return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200100 }
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200101
Dmitry V. Levin9f702732015-07-16 16:22:07 +0000102 return buf + sprintf(buf, "%#lx", addr);
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000103}
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000104
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100105void
106print_timespec(struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000107{
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100108 char buf[TIMESPEC_TEXT_BUFSIZE];
109 sprint_timespec(buf, tcp, addr);
110 tprints(buf);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000111}
112
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100113void
114sprint_timespec(char *buf, struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000115{
116 if (addr == 0)
117 strcpy(buf, "NULL");
118 else if (!verbose(tcp))
119 sprintf(buf, "%#lx", addr);
120 else {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000121 int rc;
Roland McGrath6bc09da2007-11-01 21:50:54 +0000122
Denys Vlasenko84703742012-02-25 02:38:52 +0100123#if SUPPORTED_PERSONALITIES > 1
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000124 if (current_time_t_is_compat) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000125 struct timeval32 tv;
126
Denys Vlasenko5d645812011-08-20 12:48:18 +0200127 rc = umove(tcp, addr, &tv);
128 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000129 sprintf(buf, "{%u, %u}",
130 tv.tv_sec, tv.tv_usec);
131 } else
Roland McGrath6bc09da2007-11-01 21:50:54 +0000132#endif
Denys Vlasenko1d632462009-04-14 12:51:00 +0000133 {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000134 struct timespec ts;
135
Denys Vlasenko5d645812011-08-20 12:48:18 +0200136 rc = umove(tcp, addr, &ts);
137 if (rc >= 0)
Dmitry V. Levine61086f2015-02-27 21:46:42 +0000138 sprintf(buf, "{%ju, %ju}",
139 (uintmax_t) ts.tv_sec,
140 (uintmax_t) ts.tv_nsec);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000141 }
Roland McGrath6bc09da2007-11-01 21:50:54 +0000142 if (rc < 0)
143 strcpy(buf, "{...}");
144 }
145}
146
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000147SYS_FUNC(gettimeofday)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000148{
149 if (exiting(tcp)) {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000150 printtv(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200151 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000152 printtv(tcp, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000153 }
154 return 0;
155}
156
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000157#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000158SYS_FUNC(osf_gettimeofday)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000159{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000160 if (exiting(tcp)) {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000161 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200162 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000163 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000164 }
165 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000166}
167#endif
168
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000169SYS_FUNC(settimeofday)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000170{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000171 printtv(tcp, tcp->u_arg[0]);
172 tprints(", ");
173 printtv(tcp, tcp->u_arg[1]);
174
175 return RVAL_DECODED;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000176}
177
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000178#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000179SYS_FUNC(osf_settimeofday)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000180{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000181 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 RVAL_DECODED;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000186}
187#endif
188
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000189SYS_FUNC(adjtime)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000190{
191 if (entering(tcp)) {
192 printtv(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200193 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000194 } else {
Dmitry V. Levin9f702732015-07-16 16:22:07 +0000195 printtv(tcp, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000196 }
197 return 0;
198}
199
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000200SYS_FUNC(nanosleep)
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000201{
202 if (entering(tcp)) {
203 print_timespec(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200204 tprints(", ");
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000205 } else {
Denys Vlasenko64acaa12012-01-28 02:29:36 +0100206 /* Second (returned) timespec is only significant
Denys Vlasenko47932212013-06-30 23:53:49 +0200207 * if syscall was interrupted. On success, we print
208 * only its address, since kernel doesn't modify it,
209 * and printing the value may show uninitialized data.
Denys Vlasenko64acaa12012-01-28 02:29:36 +0100210 */
Denys Vlasenko47932212013-06-30 23:53:49 +0200211 switch (tcp->u_error) {
212 default:
213 /* Not interrupted (slept entire interval) */
Dmitry V. Levin71178352015-07-16 18:18:09 +0000214 printaddr(tcp->u_arg[1]);
215 break;
Denys Vlasenko47932212013-06-30 23:53:49 +0200216 case ERESTARTSYS:
217 case ERESTARTNOINTR:
218 case ERESTARTNOHAND:
219 case ERESTART_RESTARTBLOCK:
220 /* Interrupted */
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000221 print_timespec(tcp, tcp->u_arg[1]);
Denys Vlasenko47932212013-06-30 23:53:49 +0200222 }
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000223 }
224 return 0;
225}
226
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000227#include "xlat/itimer_which.h"
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000228
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000229SYS_FUNC(getitimer)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000230{
231 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000232 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200233 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000234 } else {
Dmitry V. Levin322be802015-09-17 20:23:31 +0000235 print_itimerval(tcp, tcp->u_arg[1]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000236 }
237 return 0;
238}
239
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000240#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000241SYS_FUNC(osf_getitimer)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000242{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000243 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000244 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200245 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000246 } else {
Dmitry V. Levin322be802015-09-17 20:23:31 +0000247 print_itimerval32(tcp, tcp->u_arg[1]);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000248 }
249 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000250}
251#endif
252
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000253SYS_FUNC(setitimer)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000254{
255 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000256 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200257 tprints(", ");
Dmitry V. Levin322be802015-09-17 20:23:31 +0000258 print_itimerval(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200259 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000260 } else {
Dmitry V. Levin322be802015-09-17 20:23:31 +0000261 print_itimerval(tcp, tcp->u_arg[2]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000262 }
263 return 0;
264}
265
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000266#ifdef ALPHA
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000267SYS_FUNC(osf_setitimer)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000268{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000269 if (entering(tcp)) {
Dmitry V. Levin297b5942014-04-25 23:39:20 +0000270 printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200271 tprints(", ");
Dmitry V. Levin322be802015-09-17 20:23:31 +0000272 print_itimerval32(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200273 tprints(", ");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000274 } else {
Dmitry V. Levin322be802015-09-17 20:23:31 +0000275 print_itimerval32(tcp, tcp->u_arg[2]);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000276 }
277 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000278}
279#endif
280
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000281#include "xlat/adjtimex_state.h"
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000282
Dmitry V. Levin73215472012-03-11 21:25:51 +0000283static int
284do_adjtimex(struct tcb *tcp, long addr)
285{
Dmitry V. Levindad1eef2015-09-16 21:58:36 +0000286 if (print_timex(tcp, addr))
Dmitry V. Levin73215472012-03-11 21:25:51 +0000287 return 0;
288 tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
289 if (tcp->auxstr)
290 return RVAL_STR;
291 return 0;
292}
293
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000294SYS_FUNC(adjtimex)
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000295{
Dmitry V. Levin73215472012-03-11 21:25:51 +0000296 if (exiting(tcp))
297 return do_adjtimex(tcp, tcp->u_arg[0]);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000298 return 0;
299}
Roland McGrath1e356792003-03-30 23:52:28 +0000300
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000301#include "xlat/clockflags.h"
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000302#include "xlat/clocknames.h"
Roland McGrath54a4edd2004-08-31 06:52:45 +0000303
Stefan Sørensena5fea902014-02-03 10:01:27 +0100304static void
305printclockname(int clockid)
306{
307#ifdef CLOCKID_TO_FD
Dmitry V. Levind35bdca2014-04-26 18:10:19 +0000308# include "xlat/cpuclocknames.h"
309
Stefan Sørensena5fea902014-02-03 10:01:27 +0100310 if (clockid < 0) {
311 if ((clockid & CLOCKFD_MASK) == CLOCKFD)
312 tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
313 else {
314 if(CPUCLOCK_PERTHREAD(clockid))
315 tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
316 else
317 tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
318 printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???");
319 tprints(")");
320 }
321 }
322 else
323#endif
324 printxval(clocknames, clockid, "CLOCK_???");
325}
326
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000327SYS_FUNC(clock_settime)
Roland McGrath1e356792003-03-30 23:52:28 +0000328{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000329 printclockname(tcp->u_arg[0]);
330 tprints(", ");
331 printtv(tcp, tcp->u_arg[1]);
332
333 return RVAL_DECODED;
Roland McGrath1e356792003-03-30 23:52:28 +0000334}
335
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000336SYS_FUNC(clock_gettime)
Roland McGrath1e356792003-03-30 23:52:28 +0000337{
338 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100339 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200340 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000341 } else {
Dmitry V. Levin9f702732015-07-16 16:22:07 +0000342 printtv(tcp, tcp->u_arg[1]);
Roland McGrath1e356792003-03-30 23:52:28 +0000343 }
344 return 0;
345}
346
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000347SYS_FUNC(clock_nanosleep)
Roland McGrath1e356792003-03-30 23:52:28 +0000348{
349 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100350 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200351 tprints(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000352 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200353 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000354 printtv(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200355 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000356 } else {
Dmitry V. Levin9f702732015-07-16 16:22:07 +0000357 printtv(tcp, tcp->u_arg[3]);
Roland McGrath1e356792003-03-30 23:52:28 +0000358 }
359 return 0;
360}
361
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000362SYS_FUNC(clock_adjtime)
Dmitry V. Levin73215472012-03-11 21:25:51 +0000363{
364 if (exiting(tcp))
365 return do_adjtimex(tcp, tcp->u_arg[1]);
Stefan Sørensena5fea902014-02-03 10:01:27 +0100366 printclockname(tcp->u_arg[0]);
Dmitry V. Levin73215472012-03-11 21:25:51 +0000367 tprints(", ");
368 return 0;
369}
370
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000371SYS_FUNC(timer_create)
Roland McGrath1e356792003-03-30 23:52:28 +0000372{
373 if (entering(tcp)) {
Stefan Sørensena5fea902014-02-03 10:01:27 +0100374 printclockname(tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200375 tprints(", ");
Dmitry V. Levin6f950cc2015-09-16 16:31:43 +0000376 print_sigevent(tcp, tcp->u_arg[1]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200377 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000378 } else {
Dmitry V. Levin71178352015-07-16 18:18:09 +0000379 printnum_int(tcp, tcp->u_arg[2], "%d");
Roland McGrath1e356792003-03-30 23:52:28 +0000380 }
381 return 0;
382}
383
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000384SYS_FUNC(timer_settime)
Roland McGrath1e356792003-03-30 23:52:28 +0000385{
386 if (entering(tcp)) {
Dmitry V. Levin71178352015-07-16 18:18:09 +0000387 tprintf("%d, ", (int) tcp->u_arg[0]);
Roland McGrathb2dee132005-06-01 19:02:36 +0000388 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200389 tprints(", ");
Dmitry V. Levin22060852015-09-17 16:47:03 +0000390 print_itimerspec(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200391 tprints(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000392 } else {
Dmitry V. Levin22060852015-09-17 16:47:03 +0000393 print_itimerspec(tcp, tcp->u_arg[3]);
Roland McGrath1e356792003-03-30 23:52:28 +0000394 }
395 return 0;
396}
397
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000398SYS_FUNC(timer_gettime)
Roland McGrath1e356792003-03-30 23:52:28 +0000399{
400 if (entering(tcp)) {
Dmitry V. Levin71178352015-07-16 18:18:09 +0000401 tprintf("%d, ", (int) tcp->u_arg[0]);
Roland McGrath1e356792003-03-30 23:52:28 +0000402 } else {
Dmitry V. Levin22060852015-09-17 16:47:03 +0000403 print_itimerspec(tcp, tcp->u_arg[1]);
Roland McGrath1e356792003-03-30 23:52:28 +0000404 }
405 return 0;
406}
Roland McGrathd83c50b2004-10-06 22:27:43 +0000407
Dmitry V. Levin0ed617b2014-04-25 23:30:54 +0000408#include "xlat/timerfdflags.h"
Roland McGrathe4662342007-08-02 01:25:34 +0000409
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000410SYS_FUNC(timerfd)
Roland McGrathe4662342007-08-02 01:25:34 +0000411{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000412 tprintf("%ld, ", tcp->u_arg[0]);
413 printclockname(tcp->u_arg[0]);
414 tprints(", ");
415 printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
416 tprints(", ");
Dmitry V. Levin22060852015-09-17 16:47:03 +0000417 print_itimerspec(tcp, tcp->u_arg[3]);
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000418
Dmitry V. Levin07c878a2015-08-02 01:37:19 +0000419 return RVAL_DECODED | RVAL_FD;
Roland McGrathe4662342007-08-02 01:25:34 +0000420}
Roland McGrathde328e62008-05-20 04:56:13 +0000421
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000422SYS_FUNC(timerfd_create)
Roland McGrathde328e62008-05-20 04:56:13 +0000423{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000424 printclockname(tcp->u_arg[0]);
425 tprints(", ");
426 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
427
Dmitry V. Levin07c878a2015-08-02 01:37:19 +0000428 return RVAL_DECODED | RVAL_FD;
Roland McGrathde328e62008-05-20 04:56:13 +0000429}
430
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000431SYS_FUNC(timerfd_settime)
Roland McGrathde328e62008-05-20 04:56:13 +0000432{
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000433 printfd(tcp, tcp->u_arg[0]);
434 tprints(", ");
435 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
436 tprints(", ");
Dmitry V. Levin22060852015-09-17 16:47:03 +0000437 print_itimerspec(tcp, tcp->u_arg[2]);
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000438 tprints(", ");
Dmitry V. Levin22060852015-09-17 16:47:03 +0000439 print_itimerspec(tcp, tcp->u_arg[3]);
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000440
441 return RVAL_DECODED;
Roland McGrathde328e62008-05-20 04:56:13 +0000442}
443
Dmitry V. Levina0bd3742015-04-07 01:36:50 +0000444SYS_FUNC(timerfd_gettime)
Roland McGrathde328e62008-05-20 04:56:13 +0000445{
446 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +0300447 printfd(tcp, tcp->u_arg[0]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200448 tprints(", ");
Dmitry V. Levin76c8f662015-07-16 21:07:06 +0000449 } else {
Dmitry V. Levin22060852015-09-17 16:47:03 +0000450 print_itimerspec(tcp, tcp->u_arg[1]);
Roland McGrathde328e62008-05-20 04:56:13 +0000451 }
452 return 0;
453}