blob: a4599f708f02c5df0bae0e96d5263c58f9a54edb [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.
28 *
29 * $Id$
30 */
31
32#include "defs.h"
33
34#ifdef LINUX
35#include <linux/version.h>
Wichert Akkermand856b992000-10-13 12:47:12 +000036#include <sys/timex.h>
Roland McGrathd83c50b2004-10-06 22:27:43 +000037#include <linux/ioctl.h>
38#include <linux/rtc.h>
Roland McGrath6afc5652007-07-24 01:57:11 +000039
40#ifndef UTIME_NOW
41#define UTIME_NOW ((1l << 30) - 1l)
42#endif
43#ifndef UTIME_OMIT
44#define UTIME_OMIT ((1l << 30) - 2l)
45#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000046#endif /* LINUX */
47
Dmitry V. Levina7945a32006-12-13 17:10:11 +000048struct timeval32
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000049{
Dmitry V. Levina7945a32006-12-13 17:10:11 +000050 u_int32_t tv_sec, tv_usec;
51};
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000052
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +000053static void
54tprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
55{
56 tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
57}
58
59static void
60tprint_timeval(struct tcb *tcp, const struct timeval *tv)
61{
62 tprintf("{%lu, %lu}",
63 (unsigned long) tv->tv_sec, (unsigned long) tv->tv_usec);
64}
65
Dmitry V. Levina7945a32006-12-13 17:10:11 +000066void
Roland McGrath6afc5652007-07-24 01:57:11 +000067printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
Dmitry V. Levina7945a32006-12-13 17:10:11 +000068{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000069 if (addr == 0)
70 tprintf("NULL");
71 else if (!verbose(tcp))
72 tprintf("%#lx", addr);
Denys Vlasenko1d632462009-04-14 12:51:00 +000073 else {
74 int rc;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000075
Dmitry V. Levina7945a32006-12-13 17:10:11 +000076 if (bitness == BITNESS_32
77#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
78 || personality_wordsize[current_personality] == 4
79#endif
80 )
81 {
82 struct timeval32 tv;
83
Denys Vlasenko5d645812011-08-20 12:48:18 +020084 rc = umove(tcp, addr, &tv);
85 if (rc >= 0) {
Roland McGrath41383392007-07-24 01:58:52 +000086 if (special && tv.tv_sec == 0 &&
87 tv.tv_usec == UTIME_NOW)
Roland McGrath6afc5652007-07-24 01:57:11 +000088 tprintf("UTIME_NOW");
Roland McGrath41383392007-07-24 01:58:52 +000089 else if (special && tv.tv_sec == 0 &&
90 tv.tv_usec == UTIME_OMIT)
Roland McGrath6afc5652007-07-24 01:57:11 +000091 tprintf("UTIME_OMIT");
92 else
93 tprint_timeval32(tcp, &tv);
94 }
Denys Vlasenko1d632462009-04-14 12:51:00 +000095 } else {
Dmitry V. Levina7945a32006-12-13 17:10:11 +000096 struct timeval tv;
97
Denys Vlasenko5d645812011-08-20 12:48:18 +020098 rc = umove(tcp, addr, &tv);
99 if (rc >= 0) {
Roland McGrath41383392007-07-24 01:58:52 +0000100 if (special && tv.tv_sec == 0 &&
101 tv.tv_usec == UTIME_NOW)
Roland McGrath6afc5652007-07-24 01:57:11 +0000102 tprintf("UTIME_NOW");
Roland McGrath41383392007-07-24 01:58:52 +0000103 else if (special && tv.tv_sec == 0 &&
104 tv.tv_usec == UTIME_OMIT)
Roland McGrath6afc5652007-07-24 01:57:11 +0000105 tprintf("UTIME_OMIT");
106 else
107 tprint_timeval(tcp, &tv);
108 }
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000109 }
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000110 if (rc < 0)
111 tprintf("{...}");
112 }
113}
Wichert Akkerman221f54f1999-11-18 17:26:45 +0000114
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000115void
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000116sprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000117{
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000118 if (addr == 0)
119 strcpy(buf, "NULL");
120 else if (!verbose(tcp))
121 sprintf(buf, "%#lx", addr);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000122 else {
123 int rc;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000124
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000125 if (bitness == BITNESS_32
126#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
127 || personality_wordsize[current_personality] == 4
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000128#endif
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000129 )
130 {
131 struct timeval32 tv;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000132
Denys Vlasenko5d645812011-08-20 12:48:18 +0200133 rc = umove(tcp, addr, &tv);
134 if (rc >= 0)
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000135 sprintf(buf, "{%u, %u}",
136 tv.tv_sec, tv.tv_usec);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000137 } else {
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000138 struct timeval tv;
139
Denys Vlasenko5d645812011-08-20 12:48:18 +0200140 rc = umove(tcp, addr, &tv);
141 if (rc >= 0)
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000142 sprintf(buf, "{%lu, %lu}",
143 (unsigned long) tv.tv_sec,
144 (unsigned long) tv.tv_usec);
145 }
Dmitry V. Levina7945a32006-12-13 17:10:11 +0000146 if (rc < 0)
147 strcpy(buf, "{...}");
148 }
149}
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000150
Denys Vlasenko1d632462009-04-14 12:51:00 +0000151void print_timespec(struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000152{
153 if (addr == 0)
154 tprintf("NULL");
155 else if (!verbose(tcp))
156 tprintf("%#lx", addr);
157 else {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000158 int rc;
Roland McGrath6bc09da2007-11-01 21:50:54 +0000159
160#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
Denys Vlasenko1d632462009-04-14 12:51:00 +0000161 if (personality_wordsize[current_personality] == 4) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000162 struct timeval32 tv;
163
Denys Vlasenko5d645812011-08-20 12:48:18 +0200164 rc = umove(tcp, addr, &tv);
165 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000166 tprintf("{%u, %u}",
167 tv.tv_sec, tv.tv_usec);
168 } else
Roland McGrath6bc09da2007-11-01 21:50:54 +0000169#endif
Denys Vlasenko1d632462009-04-14 12:51:00 +0000170 {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000171 struct timespec ts;
172
Denys Vlasenko5d645812011-08-20 12:48:18 +0200173 rc = umove(tcp, addr, &ts);
174 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000175 tprintf("{%lu, %lu}",
176 (unsigned long) ts.tv_sec,
177 (unsigned long) ts.tv_nsec);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000178 }
Roland McGrath6bc09da2007-11-01 21:50:54 +0000179 if (rc < 0)
180 tprintf("{...}");
181 }
182}
183
Denys Vlasenko1d632462009-04-14 12:51:00 +0000184void sprint_timespec(char *buf, struct tcb *tcp, long addr)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000185{
186 if (addr == 0)
187 strcpy(buf, "NULL");
188 else if (!verbose(tcp))
189 sprintf(buf, "%#lx", addr);
190 else {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000191 int rc;
Roland McGrath6bc09da2007-11-01 21:50:54 +0000192
193#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
Denys Vlasenko1d632462009-04-14 12:51:00 +0000194 if (personality_wordsize[current_personality] == 4) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000195 struct timeval32 tv;
196
Denys Vlasenko5d645812011-08-20 12:48:18 +0200197 rc = umove(tcp, addr, &tv);
198 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000199 sprintf(buf, "{%u, %u}",
200 tv.tv_sec, tv.tv_usec);
201 } else
Roland McGrath6bc09da2007-11-01 21:50:54 +0000202#endif
Denys Vlasenko1d632462009-04-14 12:51:00 +0000203 {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000204 struct timespec ts;
205
Denys Vlasenko5d645812011-08-20 12:48:18 +0200206 rc = umove(tcp, addr, &ts);
207 if (rc >= 0)
Roland McGrath6bc09da2007-11-01 21:50:54 +0000208 sprintf(buf, "{%lu, %lu}",
209 (unsigned long) ts.tv_sec,
210 (unsigned long) ts.tv_nsec);
Roland McGrath6bc09da2007-11-01 21:50:54 +0000211 }
Roland McGrath6bc09da2007-11-01 21:50:54 +0000212 if (rc < 0)
213 strcpy(buf, "{...}");
214 }
215}
216
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000217int
Denys Vlasenko12014262011-05-30 14:00:14 +0200218sys_time(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000219{
220 if (exiting(tcp)) {
221#ifndef SVR4
222 printnum(tcp, tcp->u_arg[0], "%ld");
223#endif /* SVR4 */
224 }
225 return 0;
226}
227
228int
Denys Vlasenko12014262011-05-30 14:00:14 +0200229sys_stime(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000230{
231 if (exiting(tcp)) {
232 printnum(tcp, tcp->u_arg[0], "%ld");
233 }
234 return 0;
235}
236
237int
Denys Vlasenko12014262011-05-30 14:00:14 +0200238sys_gettimeofday(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000239{
240 if (exiting(tcp)) {
241 if (syserror(tcp)) {
242 tprintf("%#lx, %#lx",
243 tcp->u_arg[0], tcp->u_arg[1]);
244 return 0;
245 }
246 printtv(tcp, tcp->u_arg[0]);
247#ifndef SVR4
248 tprintf(", ");
249 printtv(tcp, tcp->u_arg[1]);
250#endif /* !SVR4 */
251 }
252 return 0;
253}
254
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000255
256#ifdef ALPHA
257int
Denys Vlasenko12014262011-05-30 14:00:14 +0200258sys_osf_gettimeofday(struct tcb *tcp)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000259{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000260 if (exiting(tcp)) {
261 if (syserror(tcp)) {
262 tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
263 return 0;
264 }
265 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000266#ifndef SVR4
Denys Vlasenko1d632462009-04-14 12:51:00 +0000267 tprintf(", ");
268 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000269#endif /* !SVR4 */
Denys Vlasenko1d632462009-04-14 12:51:00 +0000270 }
271 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000272}
273#endif
274
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000275int
Denys Vlasenko12014262011-05-30 14:00:14 +0200276sys_settimeofday(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000277{
278 if (entering(tcp)) {
279 printtv(tcp, tcp->u_arg[0]);
280#ifndef SVR4
281 tprintf(", ");
282 printtv(tcp, tcp->u_arg[1]);
283#endif /* !SVR4 */
284 }
285 return 0;
286}
287
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000288#ifdef ALPHA
289int
Denys Vlasenko12014262011-05-30 14:00:14 +0200290sys_osf_settimeofday(struct tcb *tcp)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000291{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000292 if (entering(tcp)) {
293 printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000294#ifndef SVR4
Denys Vlasenko1d632462009-04-14 12:51:00 +0000295 tprintf(", ");
296 printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000297#endif /* !SVR4 */
Denys Vlasenko1d632462009-04-14 12:51:00 +0000298 }
299 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000300}
301#endif
302
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000303int
Denys Vlasenko12014262011-05-30 14:00:14 +0200304sys_adjtime(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000305{
306 if (entering(tcp)) {
307 printtv(tcp, tcp->u_arg[0]);
308 tprintf(", ");
309 } else {
310 if (syserror(tcp))
311 tprintf("%#lx", tcp->u_arg[1]);
312 else
313 printtv(tcp, tcp->u_arg[1]);
314 }
315 return 0;
316}
317
Dmitry V. Levin2e55ff42008-09-03 01:02:46 +0000318int
319sys_nanosleep(struct tcb *tcp)
320{
321 if (entering(tcp)) {
322 print_timespec(tcp, tcp->u_arg[0]);
323 tprintf(", ");
324 } else {
325 if (!tcp->u_arg[1] || is_restart_error(tcp))
326 print_timespec(tcp, tcp->u_arg[1]);
327 else
328 tprintf("%#lx", tcp->u_arg[1]);
329 }
330 return 0;
331}
332
Roland McGrathd9f816f2004-09-04 03:39:20 +0000333static const struct xlat which[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000334 { ITIMER_REAL, "ITIMER_REAL" },
335 { ITIMER_VIRTUAL,"ITIMER_VIRTUAL"},
336 { ITIMER_PROF, "ITIMER_PROF" },
337 { 0, NULL },
338};
339
340static void
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000341printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000342{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000343 if (addr == 0)
344 tprintf("NULL");
345 else if (!verbose(tcp))
346 tprintf("%#lx", addr);
Denys Vlasenko1d632462009-04-14 12:51:00 +0000347 else {
348 int rc;
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000349
350 if (bitness == BITNESS_32
351#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
352 || personality_wordsize[current_personality] == 4
353#endif
354 )
355 {
Denys Vlasenko1d632462009-04-14 12:51:00 +0000356 struct {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000357 struct timeval32 it_interval, it_value;
358 } itv;
359
Denys Vlasenko5d645812011-08-20 12:48:18 +0200360 rc = umove(tcp, addr, &itv);
361 if (rc >= 0) {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000362 tprintf("{it_interval=");
363 tprint_timeval32(tcp, &itv.it_interval);
364 tprintf(", it_value=");
365 tprint_timeval32(tcp, &itv.it_value);
366 tprintf("}");
Roland McGrathe4662342007-08-02 01:25:34 +0000367 }
Denys Vlasenko1d632462009-04-14 12:51:00 +0000368 } else {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000369 struct itimerval itv;
370
Denys Vlasenko5d645812011-08-20 12:48:18 +0200371 rc = umove(tcp, addr, &itv);
372 if (rc >= 0) {
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000373 tprintf("{it_interval=");
374 tprint_timeval(tcp, &itv.it_interval);
375 tprintf(", it_value=");
376 tprint_timeval(tcp, &itv.it_value);
377 tprintf("}");
Roland McGrathe4662342007-08-02 01:25:34 +0000378 }
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000379 }
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000380 if (rc < 0)
381 tprintf("{...}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000382 }
383}
384
Dmitry V. Levin1cad25d2006-12-13 17:14:36 +0000385#define printitv(tcp, addr) \
386 printitv_bitness((tcp), (addr), BITNESS_CURRENT)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000387
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000388int
Denys Vlasenko12014262011-05-30 14:00:14 +0200389sys_getitimer(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000390{
391 if (entering(tcp)) {
392 printxval(which, tcp->u_arg[0], "ITIMER_???");
393 tprintf(", ");
394 } else {
395 if (syserror(tcp))
396 tprintf("%#lx", tcp->u_arg[1]);
397 else
398 printitv(tcp, tcp->u_arg[1]);
399 }
400 return 0;
401}
402
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000403
404#ifdef ALPHA
405int
Denys Vlasenko12014262011-05-30 14:00:14 +0200406sys_osf_getitimer(struct tcb *tcp)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000407{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000408 if (entering(tcp)) {
409 printxval(which, tcp->u_arg[0], "ITIMER_???");
410 tprintf(", ");
411 } else {
412 if (syserror(tcp))
413 tprintf("%#lx", tcp->u_arg[1]);
414 else
415 printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
416 }
417 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000418}
419#endif
420
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000421int
Denys Vlasenko12014262011-05-30 14:00:14 +0200422sys_setitimer(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000423{
424 if (entering(tcp)) {
425 printxval(which, tcp->u_arg[0], "ITIMER_???");
426 tprintf(", ");
427 printitv(tcp, tcp->u_arg[1]);
428 tprintf(", ");
429 } else {
430 if (syserror(tcp))
431 tprintf("%#lx", tcp->u_arg[2]);
432 else
433 printitv(tcp, tcp->u_arg[2]);
434 }
435 return 0;
436}
437
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000438#ifdef ALPHA
439int
Denys Vlasenko12014262011-05-30 14:00:14 +0200440sys_osf_setitimer(struct tcb *tcp)
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000441{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000442 if (entering(tcp)) {
443 printxval(which, tcp->u_arg[0], "ITIMER_???");
444 tprintf(", ");
445 printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
446 tprintf(", ");
447 } else {
448 if (syserror(tcp))
449 tprintf("%#lx", tcp->u_arg[2]);
450 else
451 printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
452 }
453 return 0;
Wichert Akkermanf5eeabb1999-11-18 17:09:47 +0000454}
455#endif
456
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000457#ifdef LINUX
458
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000459static const struct xlat adjtimex_modes[] = {
460 { 0, "0" },
461#ifdef ADJ_OFFSET
462 { ADJ_OFFSET, "ADJ_OFFSET" },
463#endif
464#ifdef ADJ_FREQUENCY
465 { ADJ_FREQUENCY, "ADJ_FREQUENCY" },
466#endif
467#ifdef ADJ_MAXERROR
468 { ADJ_MAXERROR, "ADJ_MAXERROR" },
469#endif
470#ifdef ADJ_ESTERROR
471 { ADJ_ESTERROR, "ADJ_ESTERROR" },
472#endif
473#ifdef ADJ_STATUS
474 { ADJ_STATUS, "ADJ_STATUS" },
475#endif
476#ifdef ADJ_TIMECONST
477 { ADJ_TIMECONST, "ADJ_TIMECONST" },
478#endif
479#ifdef ADJ_TICK
480 { ADJ_TICK, "ADJ_TICK" },
481#endif
482#ifdef ADJ_OFFSET_SINGLESHOT
483 { ADJ_OFFSET_SINGLESHOT, "ADJ_OFFSET_SINGLESHOT" },
484#endif
485 { 0, NULL }
486};
487
488static const struct xlat adjtimex_status[] = {
489#ifdef STA_PLL
490 { STA_PLL, "STA_PLL" },
491#endif
492#ifdef STA_PPSFREQ
493 { STA_PPSFREQ, "STA_PPSFREQ" },
494#endif
495#ifdef STA_PPSTIME
496 { STA_PPSTIME, "STA_PPSTIME" },
497#endif
498#ifdef STA_FLL
499 { STA_FLL, "STA_FLL" },
500#endif
501#ifdef STA_INS
502 { STA_INS, "STA_INS" },
503#endif
504#ifdef STA_DEL
505 { STA_DEL, "STA_DEL" },
506#endif
507#ifdef STA_UNSYNC
508 { STA_UNSYNC, "STA_UNSYNC" },
509#endif
510#ifdef STA_FREQHOLD
511 { STA_FREQHOLD, "STA_FREQHOLD" },
512#endif
513#ifdef STA_PPSSIGNAL
514 { STA_PPSSIGNAL, "STA_PPSSIGNAL" },
515#endif
516#ifdef STA_PPSJITTER
517 { STA_PPSJITTER, "STA_PPSJITTER" },
518#endif
519#ifdef STA_PPSWANDER
520 { STA_PPSWANDER, "STA_PPSWANDER" },
521#endif
522#ifdef STA_PPSERROR
523 { STA_PPSERROR, "STA_PPSERROR" },
524#endif
525#ifdef STA_CLOCKERR
526 { STA_CLOCKERR, "STA_CLOCKERR" },
527#endif
528 { 0, NULL }
529};
530
531static const struct xlat adjtimex_state[] = {
532#ifdef TIME_OK
533 { TIME_OK, "TIME_OK" },
534#endif
535#ifdef TIME_INS
536 { TIME_INS, "TIME_INS" },
537#endif
538#ifdef TIME_DEL
539 { TIME_DEL, "TIME_DEL" },
540#endif
541#ifdef TIME_OOP
542 { TIME_OOP, "TIME_OOP" },
543#endif
544#ifdef TIME_WAIT
545 { TIME_WAIT, "TIME_WAIT" },
546#endif
547#ifdef TIME_ERROR
548 { TIME_ERROR, "TIME_ERROR" },
549#endif
550 { 0, NULL }
551};
552
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000553#if SUPPORTED_PERSONALITIES > 1
554static int
555tprint_timex32(struct tcb *tcp, long addr)
556{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000557 struct {
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000558 unsigned int modes;
559 int offset;
560 int freq;
561 int maxerror;
562 int esterror;
563 int status;
564 int constant;
565 int precision;
566 int tolerance;
567 struct timeval32 time;
568 int tick;
569 int ppsfreq;
570 int jitter;
571 int shift;
572 int stabil;
573 int jitcnt;
574 int calcnt;
575 int errcnt;
576 int stbcnt;
577 } tx;
578
579 if (umove(tcp, addr, &tx) < 0)
580 return -1;
581
582 tprintf("{modes=");
Dmitry V. Levin71d70892007-01-13 11:17:38 +0000583 printflags(adjtimex_modes, tx.modes, "ADJ_???");
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000584 tprintf(", offset=%d, freq=%d, maxerror=%d, ",
585 tx.offset, tx.freq, tx.maxerror);
586 tprintf("esterror=%u, status=", tx.esterror);
587 printflags(adjtimex_status, tx.status, "STA_???");
588 tprintf(", constant=%d, precision=%u, ",
589 tx.constant, tx.precision);
590 tprintf("tolerance=%d, time=", tx.tolerance);
591 tprint_timeval32(tcp, &tx.time);
592 tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
593 tx.tick, tx.ppsfreq, tx.jitter);
594 tprintf(", shift=%d, stabil=%d, jitcnt=%d",
595 tx.shift, tx.stabil, tx.jitcnt);
596 tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
597 tx.calcnt, tx.errcnt, tx.stbcnt);
598 tprintf("}");
599 return 0;
600}
601#endif /* SUPPORTED_PERSONALITIES > 1 */
602
603static int
604tprint_timex(struct tcb *tcp, long addr)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000605{
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000606 struct timex tx;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000607
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000608#if SUPPORTED_PERSONALITIES > 1
609 if (personality_wordsize[current_personality] == 4)
610 return tprint_timex32(tcp, addr);
611#endif
612 if (umove(tcp, addr, &tx) < 0)
613 return -1;
614
615#if LINUX_VERSION_CODE < 66332
616 tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
617 tx.mode, tx.offset, tx.frequency);
618 tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
619 tx.maxerror, tx.esterror, tx.status);
620 tprintf("time_constant=%ld, precision=%lu, ",
621 tx.time_constant, tx.precision);
622 tprintf("tolerance=%ld, time=", tx.tolerance);
623 tprint_timeval(tcp, &tx.time);
624#else
625 tprintf("{modes=");
Dmitry V. Levin71d70892007-01-13 11:17:38 +0000626 printflags(adjtimex_modes, tx.modes, "ADJ_???");
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000627 tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
628 tx.offset, tx.freq, tx.maxerror);
629 tprintf("esterror=%lu, status=", tx.esterror);
630 printflags(adjtimex_status, tx.status, "STA_???");
631 tprintf(", constant=%ld, precision=%lu, ",
632 tx.constant, tx.precision);
633 tprintf("tolerance=%ld, time=", tx.tolerance);
634 tprint_timeval(tcp, &tx.time);
635 tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
636 tx.tick, tx.ppsfreq, tx.jitter);
637 tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
638 tx.shift, tx.stabil, tx.jitcnt);
639 tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
640 tx.calcnt, tx.errcnt, tx.stbcnt);
641#endif
642 tprintf("}");
643 return 0;
644}
645
646int
647sys_adjtimex(struct tcb *tcp)
648{
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000649 if (exiting(tcp)) {
650 if (tcp->u_arg[0] == 0)
651 tprintf("NULL");
652 else if (syserror(tcp) || !verbose(tcp))
653 tprintf("%#lx", tcp->u_arg[0]);
Dmitry V. Levin165b15d2006-12-13 17:43:45 +0000654 else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000655 tprintf("{...}");
Dmitry V. Levin21a75342008-09-03 01:22:18 +0000656 if (syserror(tcp))
657 return 0;
Dmitry V. Levin1a684d62006-12-13 17:42:32 +0000658 tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
659 if (tcp->auxstr)
660 return RVAL_STR;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000661 }
662 return 0;
663}
Roland McGrath1e356792003-03-30 23:52:28 +0000664
Roland McGrathd9f816f2004-09-04 03:39:20 +0000665static const struct xlat clockflags[] = {
Roland McGrath1e356792003-03-30 23:52:28 +0000666 { TIMER_ABSTIME, "TIMER_ABSTIME" },
667 { 0, NULL }
668};
669
Roland McGrathd9f816f2004-09-04 03:39:20 +0000670static const struct xlat clocknames[] = {
Roland McGrath55a00f82004-08-31 08:26:39 +0000671#ifdef CLOCK_REALTIME
Roland McGrath54a4edd2004-08-31 06:52:45 +0000672 { CLOCK_REALTIME, "CLOCK_REALTIME" },
Roland McGrath55a00f82004-08-31 08:26:39 +0000673#endif
674#ifdef CLOCK_MONOTONIC
Roland McGrath54a4edd2004-08-31 06:52:45 +0000675 { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
Roland McGrath55a00f82004-08-31 08:26:39 +0000676#endif
Dmitry V. Levincbaaf792010-09-17 09:19:49 +0000677#ifdef CLOCK_PROCESS_CPUTIME_ID
678 { CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID" },
679#endif
680#ifdef CLOCK_THREAD_CPUTIME_ID
681 { CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID" },
682#endif
683#ifdef CLOCK_MONOTONIC_RAW
684 { CLOCK_MONOTONIC_RAW, "CLOCK_MONOTONIC_RAW" },
685#endif
686#ifdef CLOCK_REALTIME_COARSE
687 { CLOCK_REALTIME_COARSE, "CLOCK_REALTIME_COARSE" },
688#endif
689#ifdef CLOCK_MONOTONIC_COARSE
690 { CLOCK_MONOTONIC_COARSE, "CLOCK_MONOTONIC_COARSE" },
691#endif
692 { 0, NULL }
Roland McGrath54a4edd2004-08-31 06:52:45 +0000693};
694
Roland McGrath1e356792003-03-30 23:52:28 +0000695int
Denys Vlasenko12014262011-05-30 14:00:14 +0200696sys_clock_settime(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000697{
698 if (entering(tcp)) {
Roland McGrath54a4edd2004-08-31 06:52:45 +0000699 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
700 tprintf(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000701 printtv(tcp, tcp->u_arg[1]);
702 }
703 return 0;
704}
705
706int
Denys Vlasenko12014262011-05-30 14:00:14 +0200707sys_clock_gettime(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000708{
709 if (entering(tcp)) {
Roland McGrath54a4edd2004-08-31 06:52:45 +0000710 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
711 tprintf(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000712 } else {
713 if (syserror(tcp))
714 tprintf("%#lx", tcp->u_arg[1]);
715 else
716 printtv(tcp, tcp->u_arg[1]);
717 }
718 return 0;
719}
720
721int
Denys Vlasenko12014262011-05-30 14:00:14 +0200722sys_clock_nanosleep(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000723{
724 if (entering(tcp)) {
Roland McGrath54a4edd2004-08-31 06:52:45 +0000725 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
726 tprintf(", ");
Roland McGrathb2dee132005-06-01 19:02:36 +0000727 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Roland McGrath1e356792003-03-30 23:52:28 +0000728 tprintf(", ");
729 printtv(tcp, tcp->u_arg[2]);
730 tprintf(", ");
731 } else {
732 if (syserror(tcp))
733 tprintf("%#lx", tcp->u_arg[3]);
734 else
735 printtv(tcp, tcp->u_arg[3]);
736 }
737 return 0;
738}
739
740#ifndef SIGEV_THREAD_ID
741# define SIGEV_THREAD_ID 4
742#endif
Roland McGrathd9f816f2004-09-04 03:39:20 +0000743static const struct xlat sigev_value[] = {
Roland McGrath1e356792003-03-30 23:52:28 +0000744 { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
745 { SIGEV_NONE+1, "SIGEV_NONE" },
746 { SIGEV_THREAD+1, "SIGEV_THREAD" },
747 { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
748 { 0, NULL }
749};
750
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000751#if SUPPORTED_PERSONALITIES > 1
752static void
753printsigevent32(struct tcb *tcp, long arg)
754{
Denys Vlasenko1d632462009-04-14 12:51:00 +0000755 struct {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000756 int sigev_value;
757 int sigev_signo;
758 int sigev_notify;
759
Denys Vlasenko1d632462009-04-14 12:51:00 +0000760 union {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000761 int tid;
Denys Vlasenko1d632462009-04-14 12:51:00 +0000762 struct {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000763 int function, attribute;
764 } thread;
765 } un;
766 } sev;
767
768 if (umove(tcp, arg, &sev) < 0)
769 tprintf("{...}");
Denys Vlasenko1d632462009-04-14 12:51:00 +0000770 else {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000771 tprintf("{%#x, ", sev.sigev_value);
772 if (sev.sigev_notify == SIGEV_SIGNAL)
773 tprintf("%s, ", signame(sev.sigev_signo));
774 else
775 tprintf("%u, ", sev.sigev_signo);
776 printxval(sigev_value, sev.sigev_notify + 1, "SIGEV_???");
777 tprintf(", ");
778 if (sev.sigev_notify == SIGEV_THREAD_ID)
779 tprintf("{%d}", sev.un.tid);
780 else if (sev.sigev_notify == SIGEV_THREAD)
781 tprintf("{%#x, %#x}",
782 sev.un.thread.function,
783 sev.un.thread.attribute);
784 else
785 tprintf("{...}");
786 tprintf("}");
787 }
788}
789#endif
790
Roland McGrath1e356792003-03-30 23:52:28 +0000791void
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000792printsigevent(struct tcb *tcp, long arg)
Roland McGrath1e356792003-03-30 23:52:28 +0000793{
794 struct sigevent sev;
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000795
796#if SUPPORTED_PERSONALITIES > 1
Denys Vlasenko7b609d52011-06-22 14:32:43 +0200797 if (personality_wordsize[current_personality] == 4) {
Dmitry V. Levind3cb3922006-12-13 17:45:02 +0000798 printsigevent32(tcp, arg);
799 return;
800 }
801#endif
Denys Vlasenkob63256e2011-06-07 12:13:24 +0200802 if (umove(tcp, arg, &sev) < 0)
Roland McGrath1e356792003-03-30 23:52:28 +0000803 tprintf("{...}");
804 else {
Roland McGrath675d4a62004-09-11 08:12:45 +0000805 tprintf("{%p, ", sev.sigev_value.sival_ptr);
806 if (sev.sigev_notify == SIGEV_SIGNAL)
807 tprintf("%s, ", signame(sev.sigev_signo));
808 else
809 tprintf("%u, ", sev.sigev_signo);
Roland McGrath1e356792003-03-30 23:52:28 +0000810 printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
811 tprintf(", ");
812 if (sev.sigev_notify == SIGEV_THREAD_ID)
813 /* _pad[0] is the _tid field which might not be
814 present in the userlevel definition of the
815 struct. */
816 tprintf("{%d}", sev._sigev_un._pad[0]);
Roland McGrathd4c85eb2004-04-16 21:48:44 +0000817 else if (sev.sigev_notify == SIGEV_THREAD)
818 tprintf("{%p, %p}", sev.sigev_notify_function,
819 sev.sigev_notify_attributes);
Roland McGrath1e356792003-03-30 23:52:28 +0000820 else
821 tprintf("{...}");
822 tprintf("}");
823 }
824}
825
826int
Denys Vlasenko12014262011-05-30 14:00:14 +0200827sys_timer_create(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000828{
829 if (entering(tcp)) {
Roland McGrath675d4a62004-09-11 08:12:45 +0000830 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
831 tprintf(", ");
Roland McGrath1e356792003-03-30 23:52:28 +0000832 printsigevent(tcp, tcp->u_arg[1]);
833 tprintf(", ");
834 } else {
Andi Kleen732f3962011-06-13 21:37:40 +0000835 int timer_id;
Dmitry V. Levinac518d12006-12-13 17:03:02 +0000836
Andi Kleen732f3962011-06-13 21:37:40 +0000837 if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &timer_id) < 0)
Roland McGrath1e356792003-03-30 23:52:28 +0000838 tprintf("%#lx", tcp->u_arg[2]);
Dmitry V. Levinac518d12006-12-13 17:03:02 +0000839 else
Andi Kleen732f3962011-06-13 21:37:40 +0000840 tprintf("{%d}", timer_id);
Roland McGrath1e356792003-03-30 23:52:28 +0000841 }
842 return 0;
843}
844
845int
Denys Vlasenko12014262011-05-30 14:00:14 +0200846sys_timer_settime(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000847{
848 if (entering(tcp)) {
849 tprintf("%#lx, ", tcp->u_arg[0]);
Roland McGrathb2dee132005-06-01 19:02:36 +0000850 printflags(clockflags, tcp->u_arg[1], "TIMER_???");
Roland McGrath1e356792003-03-30 23:52:28 +0000851 tprintf(", ");
852 printitv(tcp, tcp->u_arg[2]);
853 tprintf(", ");
854 } else {
855 if (syserror(tcp))
856 tprintf("%#lx", tcp->u_arg[3]);
857 else
858 printitv(tcp, tcp->u_arg[3]);
859 }
860 return 0;
861}
862
863int
Denys Vlasenko12014262011-05-30 14:00:14 +0200864sys_timer_gettime(struct tcb *tcp)
Roland McGrath1e356792003-03-30 23:52:28 +0000865{
866 if (entering(tcp)) {
867 tprintf("%#lx, ", tcp->u_arg[0]);
868 } else {
869 if (syserror(tcp))
870 tprintf("%#lx", tcp->u_arg[1]);
871 else
872 printitv(tcp, tcp->u_arg[1]);
873 }
874 return 0;
875}
Roland McGrathd83c50b2004-10-06 22:27:43 +0000876
877static void
Denys Vlasenko12014262011-05-30 14:00:14 +0200878print_rtc(struct tcb *tcp, const struct rtc_time *rt)
Roland McGrathd83c50b2004-10-06 22:27:43 +0000879{
880 tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
881 "tm_mday=%d, tm_mon=%d, tm_year=%d, ",
882 rt->tm_sec, rt->tm_min, rt->tm_hour,
883 rt->tm_mday, rt->tm_mon, rt->tm_year);
884 if (!abbrev(tcp))
885 tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
886 rt->tm_wday, rt->tm_yday, rt->tm_isdst);
887 else
888 tprintf("...}");
889}
890
891int
Denys Vlasenko12014262011-05-30 14:00:14 +0200892rtc_ioctl(struct tcb *tcp, long code, long arg)
Roland McGrathd83c50b2004-10-06 22:27:43 +0000893{
894 switch (code) {
895 case RTC_ALM_SET:
896 case RTC_SET_TIME:
897 if (entering(tcp)) {
898 struct rtc_time rt;
899 if (umove(tcp, arg, &rt) < 0)
900 tprintf(", %#lx", arg);
901 else {
902 tprintf(", ");
903 print_rtc(tcp, &rt);
904 }
905 }
906 break;
907 case RTC_ALM_READ:
908 case RTC_RD_TIME:
909 if (exiting(tcp)) {
910 struct rtc_time rt;
911 if (syserror(tcp) || umove(tcp, arg, &rt) < 0)
912 tprintf(", %#lx", arg);
913 else {
914 tprintf(", ");
915 print_rtc(tcp, &rt);
916 }
917 }
918 break;
919 case RTC_IRQP_SET:
920 case RTC_EPOCH_SET:
921 if (entering(tcp))
922 tprintf(", %lu", arg);
923 break;
924 case RTC_IRQP_READ:
925 case RTC_EPOCH_READ:
926 if (exiting(tcp))
927 tprintf(", %lu", arg);
928 break;
929 case RTC_WKALM_SET:
930 if (entering(tcp)) {
931 struct rtc_wkalrm wk;
932 if (umove(tcp, arg, &wk) < 0)
933 tprintf(", %#lx", arg);
934 else {
935 tprintf(", {enabled=%d, pending=%d, ",
936 wk.enabled, wk.pending);
937 print_rtc(tcp, &wk.time);
938 tprintf("}");
939 }
940 }
941 break;
942 case RTC_WKALM_RD:
943 if (exiting(tcp)) {
944 struct rtc_wkalrm wk;
945 if (syserror(tcp) || umove(tcp, arg, &wk) < 0)
946 tprintf(", %#lx", arg);
947 else {
948 tprintf(", {enabled=%d, pending=%d, ",
949 wk.enabled, wk.pending);
950 print_rtc(tcp, &wk.time);
951 tprintf("}");
952 }
953 }
954 break;
955 default:
956 if (entering(tcp))
957 tprintf(", %#lx", arg);
958 break;
959 }
960 return 1;
961}
Roland McGrathe4662342007-08-02 01:25:34 +0000962
963#ifndef TFD_TIMER_ABSTIME
964#define TFD_TIMER_ABSTIME (1 << 0)
965#endif
966
967static const struct xlat timerfdflags[] = {
968 { TFD_TIMER_ABSTIME, "TFD_TIMER_ABSTIME" },
969 { 0, NULL }
970};
971
972int
Denys Vlasenko12014262011-05-30 14:00:14 +0200973sys_timerfd(struct tcb *tcp)
Roland McGrathe4662342007-08-02 01:25:34 +0000974{
975 if (entering(tcp)) {
976 /* It does not matter that the kernel uses itimerspec. */
977 tprintf("%ld, ", tcp->u_arg[0]);
978 printxval(clocknames, tcp->u_arg[1], "CLOCK_???");
979 tprintf(", ");
980 printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
981 tprintf(", ");
982 printitv(tcp, tcp->u_arg[3]);
983 }
984 return 0;
985}
Roland McGrathde328e62008-05-20 04:56:13 +0000986
987int
988sys_timerfd_create(struct tcb *tcp)
989{
990 if (entering(tcp)) {
991 printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
992 tprintf(", ");
993 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
994 }
995 return 0;
996}
997
998int
999sys_timerfd_settime(struct tcb *tcp)
1000{
1001 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +03001002 printfd(tcp, tcp->u_arg[0]);
1003 tprintf(", ");
Roland McGrathde328e62008-05-20 04:56:13 +00001004 printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
1005 tprintf(", ");
1006 printitv(tcp, tcp->u_arg[2]);
1007 tprintf(", ");
1008 printitv(tcp, tcp->u_arg[3]);
1009 }
1010 return 0;
1011}
1012
1013int
1014sys_timerfd_gettime(struct tcb *tcp)
1015{
1016 if (entering(tcp)) {
Dmitry V. Levin31382132011-03-04 05:08:02 +03001017 printfd(tcp, tcp->u_arg[0]);
Roland McGrathde328e62008-05-20 04:56:13 +00001018 tprintf(", ");
1019 printitv(tcp, tcp->u_arg[1]);
1020 }
1021 return 0;
1022}
1023
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001024#endif /* LINUX */