176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/*
276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl>
376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl>
476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * All rights reserved.
676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Redistribution and use in source and binary forms, with or without
876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * modification, are permitted provided that the following conditions
976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * are met:
1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1. Redistributions of source code must retain the above copyright
1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer.
1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 2. Redistributions in binary form must reproduce the above copyright
1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer in the
1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    documentation and/or other materials provided with the distribution.
1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3. The name of the author may not be used to endorse or promote products
1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    derived from this software without specific prior written permission.
1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */
2976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h"
3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <linux/version.h>
32d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#include <sys/timex.h>
33d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath#include <linux/ioctl.h>
34d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath#include <linux/rtc.h>
356afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath
366afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#ifndef UTIME_NOW
376afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#define UTIME_NOW ((1l << 30) - 1l)
386afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#endif
396afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#ifndef UTIME_OMIT
406afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#define UTIME_OMIT ((1l << 30) - 2l)
416afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#endif
4276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
43a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinstruct timeval32
4476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
45a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	u_int32_t tv_sec, tv_usec;
46a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin};
4776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
481cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
491cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
501cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
511cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
521cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
531cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
541cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval(struct tcb *tcp, const struct timeval *tv)
561cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
571cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%lu, %lu}",
581cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		(unsigned long) tv->tv_sec, (unsigned long) tv->tv_usec);
591cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
601cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
61a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinvoid
626afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrathprinttv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
63a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin{
64a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	char buf[TIMEVAL_TEXT_BUFSIZE];
65a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	sprinttv(buf, tcp, addr, bitness, special);
66a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	tprints(buf);
67a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
68221f54f721a2f74e629bb70e34888205f68e95ccWichert Akkerman
692fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenkochar *
70a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenkosprinttv(char *buf, struct tcb *tcp, long addr, enum bitness_t bitness, int special)
71f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
722fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko	int rc;
732fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko
74a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	if (addr == 0)
752fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		return stpcpy(buf, "NULL");
76a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
77b9c7ae621172bba141ef96e95e43f658c3643c71Denys Vlasenko	if (!verbose(tcp))
78b9c7ae621172bba141ef96e95e43f658c3643c71Denys Vlasenko		return buf + sprintf(buf, "%#lx", addr);
792fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko
802fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko	if (bitness == BITNESS_32
818470374cba7df0e70653d95c4f336a4082c68d82Denys Vlasenko#if SUPPORTED_PERSONALITIES > 1
829fd4f96d2a2527ac7ca90c156bfc11ce10118684Denys Vlasenko	    || current_wordsize == 4
83f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
842fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		)
852fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko	{
862fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		struct timeval32 tv;
872fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko
882fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		rc = umove(tcp, addr, &tv);
89a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko		if (rc >= 0) {
90a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko			if (special && tv.tv_sec == 0) {
91a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko				if (tv.tv_usec == UTIME_NOW)
92a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko					return stpcpy(buf, "UTIME_NOW");
93a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko				if (tv.tv_usec == UTIME_OMIT)
94a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko					return stpcpy(buf, "UTIME_OMIT");
95a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko			}
96b9c7ae621172bba141ef96e95e43f658c3643c71Denys Vlasenko			return buf + sprintf(buf, "{%u, %u}",
972fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko				tv.tv_sec, tv.tv_usec);
98a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko		}
992fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko	} else {
1002fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		struct timeval tv;
1012fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko
1022fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko		rc = umove(tcp, addr, &tv);
103a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko		if (rc >= 0) {
104a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko			if (special && tv.tv_sec == 0) {
105a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko				if (tv.tv_usec == UTIME_NOW)
106a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko					return stpcpy(buf, "UTIME_NOW");
107a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko				if (tv.tv_usec == UTIME_OMIT)
108a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko					return stpcpy(buf, "UTIME_OMIT");
109a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko			}
110b9c7ae621172bba141ef96e95e43f658c3643c71Denys Vlasenko			return buf + sprintf(buf, "{%lu, %lu}",
1112fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko				(unsigned long) tv.tv_sec,
1122fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko				(unsigned long) tv.tv_usec);
113a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko		}
114a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	}
1152fb4db3e7aa1d6ac6b4b43f47597197492a846ddDenys Vlasenko
116b9c7ae621172bba141ef96e95e43f658c3643c71Denys Vlasenko	return stpcpy(buf, "{...}");
117a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
118f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
119a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenkovoid
120a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenkoprint_timespec(struct tcb *tcp, long addr)
1216bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{
122a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	char buf[TIMESPEC_TEXT_BUFSIZE];
123a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	sprint_timespec(buf, tcp, addr);
124a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenko	tprints(buf);
1256bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath}
1266bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath
127a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenkovoid
128a1d541ec56e2fb4716f083fcc814b1dedde63d87Denys Vlasenkosprint_timespec(char *buf, struct tcb *tcp, long addr)
1296bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{
1306bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath	if (addr == 0)
1316bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath		strcpy(buf, "NULL");
1326bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath	else if (!verbose(tcp))
1336bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath		sprintf(buf, "%#lx", addr);
1346bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath	else {
1351d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		int rc;
1366bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath
1378470374cba7df0e70653d95c4f336a4082c68d82Denys Vlasenko#if SUPPORTED_PERSONALITIES > 1
1389fd4f96d2a2527ac7ca90c156bfc11ce10118684Denys Vlasenko		if (current_wordsize == 4) {
1396bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath			struct timeval32 tv;
1406bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath
1415d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			rc = umove(tcp, addr, &tv);
1425d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			if (rc >= 0)
1436bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath				sprintf(buf, "{%u, %u}",
1446bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath					tv.tv_sec, tv.tv_usec);
1456bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath		} else
1466bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif
1471d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		{
1486bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath			struct timespec ts;
1496bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath
1505d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			rc = umove(tcp, addr, &ts);
1515d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			if (rc >= 0)
1526bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath				sprintf(buf, "{%lu, %lu}",
1536bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath					(unsigned long) ts.tv_sec,
1546bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath					(unsigned long) ts.tv_nsec);
1556bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath		}
1566bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath		if (rc < 0)
1576bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath			strcpy(buf, "{...}");
1586bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath	}
1596bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath}
1606bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath
16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
1621201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_time(struct tcb *tcp)
16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
1711201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_stime(struct tcb *tcp)
17276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
17476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
17776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
17876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
17976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
1801201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_gettimeofday(struct tcb *tcp)
18176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
18276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
18376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp)) {
18476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %#lx",
18576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[0], tcp->u_arg[1]);
18676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
18776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
18876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
18960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
19076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
19176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
19276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
19376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
19476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
195f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
196f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
1971201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_gettimeofday(struct tcb *tcp)
198f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
1991d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	if (exiting(tcp)) {
2001d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		if (syserror(tcp)) {
2011d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]);
2021d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			return 0;
2031d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		}
2041d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
20560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
2061d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2071d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	}
2081d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	return 0;
209f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
210f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
211f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
2131201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_settimeofday(struct tcb *tcp)
21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
21576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
21676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
21760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
21876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
21976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
22176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
22276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
223f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
224f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
2251201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_settimeofday(struct tcb *tcp)
226f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
2271d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	if (entering(tcp)) {
2281d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
22960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
2301d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
2311d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	}
2321d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	return 0;
233f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
234f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
235f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
2371201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_adjtime(struct tcb *tcp)
23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
24160fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printtv(tcp, tcp->u_arg[1]);
24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
2512e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinint
2522e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinsys_nanosleep(struct tcb *tcp)
2532e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin{
2542e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin	if (entering(tcp)) {
2552e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin		print_timespec(tcp, tcp->u_arg[0]);
25660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
2572e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin	} else {
25864acaa1193173c965ef32919aa5c092ce912d57cDenys Vlasenko		/* Second (returned) timespec is only significant
2594793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		 * if syscall was interrupted. On success, we print
2604793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		 * only its address, since kernel doesn't modify it,
2614793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		 * and printing the value may show uninitialized data.
26264acaa1193173c965ef32919aa5c092ce912d57cDenys Vlasenko		 */
2634793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		switch (tcp->u_error) {
2644793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		default:
2654793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko			/* Not interrupted (slept entire interval) */
2664793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko			if (tcp->u_arg[1]) {
2674793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko				tprintf("%#lx", tcp->u_arg[1]);
2684793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko				break;
2694793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko			}
2704793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko			/* Fall through: print_timespec(NULL) prints "NULL" */
2714793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		case ERESTARTSYS:
2724793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		case ERESTARTNOINTR:
2734793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		case ERESTARTNOHAND:
2744793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		case ERESTART_RESTARTBLOCK:
2754793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko			/* Interrupted */
2762e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin			print_timespec(tcp, tcp->u_arg[1]);
2774793221a53fb69aa519bc91ab19a79524c0df097Denys Vlasenko		}
2782e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin	}
2792e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin	return 0;
2802e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin}
2812e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin
2820ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/itimer_which.h"
28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void
2851cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinprintitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (addr == 0)
28860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("NULL");
28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (!verbose(tcp))
29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%#lx", addr);
2911d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	else {
2921d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		int rc;
29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
2941cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (bitness == BITNESS_32
2958470374cba7df0e70653d95c4f336a4082c68d82Denys Vlasenko#if SUPPORTED_PERSONALITIES > 1
2969fd4f96d2a2527ac7ca90c156bfc11ce10118684Denys Vlasenko		    || current_wordsize == 4
2971cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#endif
2981cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			)
2991cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		{
3001d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			struct {
3011cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				struct timeval32 it_interval, it_value;
3021cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			} itv;
3031cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
3045d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			rc = umove(tcp, addr, &itv);
3055d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			if (rc >= 0) {
30660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("{it_interval=");
3071cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_interval);
30860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(", it_value=");
3091cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_value);
31060fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("}");
311e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath			}
3121d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		} else {
3131cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			struct itimerval itv;
3141cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
3155d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			rc = umove(tcp, addr, &itv);
3165d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko			if (rc >= 0) {
31760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("{it_interval=");
3181cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_interval);
31960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(", it_value=");
3201cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_value);
32160fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("}");
322e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath			}
3231cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		}
3241cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (rc < 0)
32560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko			tprints("{...}");
3261cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	}
327f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
3281cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
3291cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#define printitv(tcp, addr)	\
3301cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	printitv_bitness((tcp), (addr), BITNESS_CURRENT)
331f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
33276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
3331201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_getitimer(struct tcb *tcp)
33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
336297b59401c998a2154b2fd1af7b234e2fa3a9305Dmitry V. Levin		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
33760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
34176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
34276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[1]);
34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
34476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
34576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
34676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
347f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
348f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
3491201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_getitimer(struct tcb *tcp)
350f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
3511d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	if (entering(tcp)) {
352297b59401c998a2154b2fd1af7b234e2fa3a9305Dmitry V. Levin		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
35360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
3541d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	} else {
3551d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		if (syserror(tcp))
3561d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			tprintf("%#lx", tcp->u_arg[1]);
3571d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		else
3581d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
3591d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	}
3601d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	return 0;
361f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
362f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
363f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
36476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
3651201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_setitimer(struct tcb *tcp)
36676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
36776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
368297b59401c998a2154b2fd1af7b234e2fa3a9305Dmitry V. Levin		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
36960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
37076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printitv(tcp, tcp->u_arg[1]);
37160fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
37276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
37376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
37476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[2]);
37576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
37676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[2]);
37776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
37876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
37976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
38076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
381f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
382f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
3831201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_setitimer(struct tcb *tcp)
384f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
3851d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	if (entering(tcp)) {
386297b59401c998a2154b2fd1af7b234e2fa3a9305Dmitry V. Levin		printxval(itimer_which, tcp->u_arg[0], "ITIMER_???");
38760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
3881d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
38960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
3901d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	} else {
3911d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		if (syserror(tcp))
3921d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			tprintf("%#lx", tcp->u_arg[2]);
3931d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		else
3941d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
3951d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	}
3961d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	return 0;
397f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
398f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
399f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
4000ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/adjtimex_modes.h"
4010ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/adjtimex_status.h"
4020ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/adjtimex_state.h"
4031a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
404165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
405165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
406165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex32(struct tcb *tcp, long addr)
407165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
4081d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	struct {
409165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		unsigned int modes;
410165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     offset;
411165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     freq;
412165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     maxerror;
413165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     esterror;
414165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     status;
415165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     constant;
416165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     precision;
417165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tolerance;
418165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		struct timeval32 time;
419165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tick;
420165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     ppsfreq;
421165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitter;
422165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     shift;
423165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stabil;
424165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitcnt;
425165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     calcnt;
426165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     errcnt;
427165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stbcnt;
428165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	} tx;
429165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
430165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
431165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
432165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
43360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko	tprints("{modes=");
43471d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin	printflags(adjtimex_modes, tx.modes, "ADJ_???");
435165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%d, freq=%d, maxerror=%d, ",
436165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.offset, tx.freq, tx.maxerror);
437165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("esterror=%u, status=", tx.esterror);
438165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
439165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%d, precision=%u, ",
440165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.constant, tx.precision);
441165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%d, time=", tx.tolerance);
442165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval32(tcp, &tx.time);
443165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
444165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.tick, tx.ppsfreq, tx.jitter);
445165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%d, jitcnt=%d",
446165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.shift, tx.stabil, tx.jitcnt);
447165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
448165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.calcnt, tx.errcnt, tx.stbcnt);
44960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko	tprints("}");
450165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
451165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
452165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif /* SUPPORTED_PERSONALITIES > 1 */
453165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
454165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
455165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex(struct tcb *tcp, long addr)
45676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
4571a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin	struct timex tx;
45876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
459165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
4609fd4f96d2a2527ac7ca90c156bfc11ce10118684Denys Vlasenko	if (current_wordsize == 4)
461165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return tprint_timex32(tcp, addr);
462165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
463165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
464165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
465165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
466165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if LINUX_VERSION_CODE < 66332
467165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
468165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.mode, tx.offset, tx.frequency);
469165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
470165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.maxerror, tx.esterror, tx.status);
471165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("time_constant=%ld, precision=%lu, ",
472165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.time_constant, tx.precision);
473165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%ld, time=", tx.tolerance);
474165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
475165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#else
47660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko	tprints("{modes=");
47771d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin	printflags(adjtimex_modes, tx.modes, "ADJ_???");
478165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
4790b315b65432cda20c7e5608c5124289036522fa7H.J. Lu		(long) tx.offset, (long) tx.freq, (long) tx.maxerror);
4800b315b65432cda20c7e5608c5124289036522fa7H.J. Lu	tprintf("esterror=%lu, status=", (long) tx.esterror);
481165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
482165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%ld, precision=%lu, ",
4830b315b65432cda20c7e5608c5124289036522fa7H.J. Lu		(long) tx.constant, (long) tx.precision);
4840b315b65432cda20c7e5608c5124289036522fa7H.J. Lu	tprintf("tolerance=%ld, time=", (long) tx.tolerance);
485165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
486165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
4870b315b65432cda20c7e5608c5124289036522fa7H.J. Lu		(long) tx.tick, (long) tx.ppsfreq, (long) tx.jitter);
488165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
4890b315b65432cda20c7e5608c5124289036522fa7H.J. Lu		tx.shift, (long) tx.stabil, (long) tx.jitcnt);
490165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
4910b315b65432cda20c7e5608c5124289036522fa7H.J. Lu		(long) tx.calcnt, (long) tx.errcnt, (long) tx.stbcnt);
492165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
49360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko	tprints("}");
494165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
495165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
496165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
49773215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levinstatic int
49873215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levindo_adjtimex(struct tcb *tcp, long addr)
49973215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin{
50073215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	if (addr == 0)
50173215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		tprints("NULL");
50273215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	else if (syserror(tcp) || !verbose(tcp))
50373215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		tprintf("%#lx", addr);
50473215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	else if (tprint_timex(tcp, addr) < 0)
50573215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		tprints("{...}");
50673215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	if (syserror(tcp))
50773215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		return 0;
50873215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
50973215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	if (tcp->auxstr)
51073215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		return RVAL_STR;
51173215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	return 0;
51273215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin}
51373215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin
514165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinint
515165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinsys_adjtimex(struct tcb *tcp)
516165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
51773215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	if (exiting(tcp))
51873215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		return do_adjtimex(tcp, tcp->u_arg[0]);
51976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
52076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
5211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
5220ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/clockflags.h"
5230ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/clocknames.h"
52454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath
525a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensenstatic void
526a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensenprintclockname(int clockid)
527a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen{
528a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen#ifdef CLOCKID_TO_FD
529d35bdcad13caac3e167735e1f0fc50355b2f9523Dmitry V. Levin# include "xlat/cpuclocknames.h"
530d35bdcad13caac3e167735e1f0fc50355b2f9523Dmitry V. Levin
531a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen	if (clockid < 0) {
532a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		if ((clockid & CLOCKFD_MASK) == CLOCKFD)
533a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen			tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid));
534a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		else {
535a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen			if(CPUCLOCK_PERTHREAD(clockid))
536a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen				tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
537a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen			else
538a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen				tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid));
539a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen			printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???");
540a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen			tprints(")");
541a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		}
542a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen	}
543a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen	else
544a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen#endif
545a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printxval(clocknames, clockid, "CLOCK_???");
546a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen}
547a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen
5481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
5491201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_settime(struct tcb *tcp)
5501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
5511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
552a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
55360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
5541e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[1]);
5551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
5561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
5571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
5581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
5591e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
5601201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_gettime(struct tcb *tcp)
5611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
5621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
563a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
56460fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
5651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
5661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
5671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
5681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
5691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[1]);
5701e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
5711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
5721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
5731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
5741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
5751201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_nanosleep(struct tcb *tcp)
5761e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
5771e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
578a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
57960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
580b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
58160fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
5821e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[2]);
58360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
5841e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
5851e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
5861e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
5871e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
5881e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[3]);
5891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
5901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
5911e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
5921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
59373215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levinint
59473215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levinsys_clock_adjtime(struct tcb *tcp)
59573215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin{
59673215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	if (exiting(tcp))
59773215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin		return do_adjtimex(tcp, tcp->u_arg[1]);
598a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen	printclockname(tcp->u_arg[0]);
59973215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	tprints(", ");
60073215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin	return 0;
60173215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin}
60273215473cea2bc53a520b5285775be84501b1f2dDmitry V. Levin
6031e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#ifndef SIGEV_THREAD_ID
6041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath# define SIGEV_THREAD_ID 4
6051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#endif
6060ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/sigev_value.h"
6071e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
608d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
609d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinstatic void
610d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent32(struct tcb *tcp, long arg)
611d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin{
6121d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	struct {
613d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_value;
614d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_signo;
615d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_notify;
616d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
6171d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko		union {
618d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			int     tid;
6191d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko			struct {
620d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				int     function, attribute;
621d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			} thread;
622d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		} un;
623d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	} sev;
624d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
625d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	if (umove(tcp, arg, &sev) < 0)
62660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("{...}");
6271d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko	else {
628d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("{%#x, ", sev.sigev_value);
629d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_SIGNAL)
630d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%s, ", signame(sev.sigev_signo));
631d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
632d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%u, ", sev.sigev_signo);
633bae549e91b1bf0d2261d1137c7f2bf08180ad9e6Dmitry V. Levin		printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
63460fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
635d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_THREAD_ID)
636d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%d}", sev.un.tid);
637d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else if (sev.sigev_notify == SIGEV_THREAD)
638d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%#x, %#x}",
639d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.function,
640d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.attribute);
641d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
64260fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko			tprints("{...}");
64360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("}");
644d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
645d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin}
646d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
647d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
6481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathvoid
649d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent(struct tcb *tcp, long arg)
6501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	struct sigevent sev;
652d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
653d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
6549fd4f96d2a2527ac7ca90c156bfc11ce10118684Denys Vlasenko	if (current_wordsize == 4) {
655d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		printsigevent32(tcp, arg);
656d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		return;
657d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
658d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
659b63256e69bf3f1a74aadb0e14556490bc8f4ef95Denys Vlasenko	if (umove(tcp, arg, &sev) < 0)
66060fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("{...}");
6611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	else {
662675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		tprintf("{%p, ", sev.sigev_value.sival_ptr);
663675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		if (sev.sigev_notify == SIGEV_SIGNAL)
664675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%s, ", signame(sev.sigev_signo));
665675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		else
666675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%u, ", sev.sigev_signo);
667bae549e91b1bf0d2261d1137c7f2bf08180ad9e6Dmitry V. Levin		printxval(sigev_value, sev.sigev_notify, "SIGEV_???");
66860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
6691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (sev.sigev_notify == SIGEV_THREAD_ID)
670ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin#if defined(HAVE_STRUCT_SIGEVENT__SIGEV_UN__PAD)
6711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			/* _pad[0] is the _tid field which might not be
6721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   present in the userlevel definition of the
6731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   struct.  */
6741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{%d}", sev._sigev_un._pad[0]);
675ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin#elif defined(HAVE_STRUCT_SIGEVENT___PAD)
676ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin			tprintf("{%d}", sev.__pad[0]);
677ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin#else
678ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin# warning unfamiliar struct sigevent => incomplete SIGEV_THREAD_ID decoding
679ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin			tprints("{...}");
680ae5aa47370455123bf84e52dd8354d26c29efea8Dmitry V. Levin#endif
681d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath		else if (sev.sigev_notify == SIGEV_THREAD)
682d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath			tprintf("{%p, %p}", sev.sigev_notify_function,
683d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath				sev.sigev_notify_attributes);
6841e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
68560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko			tprints("{...}");
68660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("}");
6871e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6881e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6911201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_create(struct tcb *tcp)
6921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6931e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
694a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
69560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
6961e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printsigevent(tcp, tcp->u_arg[1]);
69760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
6981e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
699732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen		int timer_id;
700ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin
701732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen		if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &timer_id) < 0)
7021e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[2]);
703ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		else
704732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen			tprintf("{%d}", timer_id);
7051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7061e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7071e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7081e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7091e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7101201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_settime(struct tcb *tcp)
7111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
714b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
71560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
7161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printitv(tcp, tcp->u_arg[2]);
71760fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
7181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7191e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
7211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7221e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[3]);
7231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7281201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_gettime(struct tcb *tcp)
7291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
7321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
7351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[1]);
7371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
740d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
741d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic void
7421201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkoprint_rtc(struct tcb *tcp, const struct rtc_time *rt)
743d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
744d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
745d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		"tm_mday=%d, tm_mon=%d, tm_year=%d, ",
746d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_sec, rt->tm_min, rt->tm_hour,
747d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_mday, rt->tm_mon, rt->tm_year);
748d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	if (!abbrev(tcp))
749d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
750d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			rt->tm_wday, rt->tm_yday, rt->tm_isdst);
751d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	else
75260fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints("...}");
753d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
754d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
755d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathint
7561201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkortc_ioctl(struct tcb *tcp, long code, long arg)
757d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
758d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	switch (code) {
759d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_SET:
760d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_SET_TIME:
761d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
762d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
763d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &rt) < 0)
764d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
765d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
76660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(", ");
767d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
768d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
769d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
770d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
771d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_READ:
772d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_RD_TIME:
773d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
774d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
775d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &rt) < 0)
776d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
777d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
77860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints(", ");
779d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
780d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
781d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
782d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
783d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_SET:
784d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_SET:
785d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
786d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
787d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
788d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_READ:
789d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_READ:
790d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp))
791d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
792d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
793d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_SET:
794d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
795d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
796d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &wk) < 0)
797d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
798d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
799d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
800d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
801d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
80260fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("}");
803d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
804d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
805d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
806d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_RD:
807d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
808d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
809d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &wk) < 0)
810d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
811d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
812d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
813d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
814d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
81560fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko				tprints("}");
816d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
817d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
818d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
819d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	default:
820d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
821d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %#lx", arg);
822d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
823d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	}
824d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	return 1;
825d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
826e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath
827e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#ifndef TFD_TIMER_ABSTIME
828e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#define TFD_TIMER_ABSTIME (1 << 0)
829e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#endif
830e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath
8310ed617bd66624cec6138102545d73b2e2346f1f6Dmitry V. Levin#include "xlat/timerfdflags.h"
832e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath
833e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathint
8341201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timerfd(struct tcb *tcp)
835e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath{
836e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath	if (entering(tcp)) {
837e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath		/* It does not matter that the kernel uses itimerspec.  */
838e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath		tprintf("%ld, ", tcp->u_arg[0]);
839a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
84060fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
841e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath		printflags(timerfdflags, tcp->u_arg[2], "TFD_???");
84260fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
843e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath		printitv(tcp, tcp->u_arg[3]);
844e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath	}
845e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath	return 0;
846e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath}
847de328e684f86405d85881cdc489b88a27332d256Roland McGrath
848de328e684f86405d85881cdc489b88a27332d256Roland McGrathint
849de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_create(struct tcb *tcp)
850de328e684f86405d85881cdc489b88a27332d256Roland McGrath{
851de328e684f86405d85881cdc489b88a27332d256Roland McGrath	if (entering(tcp)) {
852a5fea9060f382fb57f3c4c6492184cd2a7f92b40Stefan Sørensen		printclockname(tcp->u_arg[0]);
85360fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
854de328e684f86405d85881cdc489b88a27332d256Roland McGrath		printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
855de328e684f86405d85881cdc489b88a27332d256Roland McGrath	}
856de328e684f86405d85881cdc489b88a27332d256Roland McGrath	return 0;
857de328e684f86405d85881cdc489b88a27332d256Roland McGrath}
858de328e684f86405d85881cdc489b88a27332d256Roland McGrath
859de328e684f86405d85881cdc489b88a27332d256Roland McGrathint
860de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_settime(struct tcb *tcp)
861de328e684f86405d85881cdc489b88a27332d256Roland McGrath{
862de328e684f86405d85881cdc489b88a27332d256Roland McGrath	if (entering(tcp)) {
8633138213bc9a827a372ad9f8009ebcc5d8797ce2dDmitry V. Levin		printfd(tcp, tcp->u_arg[0]);
86460fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
865de328e684f86405d85881cdc489b88a27332d256Roland McGrath		printflags(timerfdflags, tcp->u_arg[1], "TFD_???");
86660fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
867de328e684f86405d85881cdc489b88a27332d256Roland McGrath		printitv(tcp, tcp->u_arg[2]);
86860fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
869de328e684f86405d85881cdc489b88a27332d256Roland McGrath		printitv(tcp, tcp->u_arg[3]);
870de328e684f86405d85881cdc489b88a27332d256Roland McGrath	}
871de328e684f86405d85881cdc489b88a27332d256Roland McGrath	return 0;
872de328e684f86405d85881cdc489b88a27332d256Roland McGrath}
873de328e684f86405d85881cdc489b88a27332d256Roland McGrath
874de328e684f86405d85881cdc489b88a27332d256Roland McGrathint
875de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_gettime(struct tcb *tcp)
876de328e684f86405d85881cdc489b88a27332d256Roland McGrath{
877de328e684f86405d85881cdc489b88a27332d256Roland McGrath	if (entering(tcp)) {
8783138213bc9a827a372ad9f8009ebcc5d8797ce2dDmitry V. Levin		printfd(tcp, tcp->u_arg[0]);
87960fe8c139c6f2febefe595781812ddf0864a6ab8Denys Vlasenko		tprints(", ");
880de328e684f86405d85881cdc489b88a27332d256Roland McGrath		printitv(tcp, tcp->u_arg[1]);
881de328e684f86405d85881cdc489b88a27332d256Roland McGrath	}
882de328e684f86405d85881cdc489b88a27332d256Roland McGrath	return 0;
883de328e684f86405d85881cdc489b88a27332d256Roland McGrath}
884