time.c revision 6afc5659acc3df3d2e446ba4aa3a76bdd7264e1b
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 *	$Id$
3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */
3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h"
3376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX
3576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <linux/version.h>
36d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#include <sys/timex.h>
37d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath#include <linux/ioctl.h>
38d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath#include <linux/rtc.h>
396afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath
406afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#ifndef UTIME_NOW
416afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#define UTIME_NOW ((1l << 30) - 1l)
426afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#endif
436afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#ifndef UTIME_OMIT
446afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#define UTIME_OMIT ((1l << 30) - 2l)
456afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath#endif
4676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */
4776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
48a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinstruct timeval32
4976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
50a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	u_int32_t tv_sec, tv_usec;
51a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin};
5276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
531cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
541cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
561cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
571cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
581cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
591cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
601cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval(struct tcb *tcp, const struct timeval *tv)
611cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
621cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%lu, %lu}",
631cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		(unsigned long) tv->tv_sec, (unsigned long) tv->tv_usec);
641cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
651cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
66a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinvoid
676afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrathprinttv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special)
68a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin{
6976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (addr == 0)
7076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("NULL");
7176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (!verbose(tcp))
7276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%#lx", addr);
7376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else
74a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	{
75a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		int     rc;
7676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
77a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (bitness == BITNESS_32
78a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
79a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		    || personality_wordsize[current_personality] == 4
80a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#endif
81a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			)
82a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
83a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval32 tv;
84a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
856afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath			if ((rc = umove(tcp, addr, &tv)) >= 0) {
866afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				if (special && tv.tv_usec == UTIME_NOW)
876afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprintf("UTIME_NOW");
886afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				else if (special && tv.tv_usec == UTIME_OMIT)
896afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprintf("UTIME_OMIT");
906afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				else
916afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprint_timeval32(tcp, &tv);
926afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath			}
93a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		} else
94a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
95a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval tv;
96a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
976afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath			if ((rc = umove(tcp, addr, &tv)) >= 0) {
986afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				if (special && tv.tv_usec == UTIME_NOW)
996afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprintf("UTIME_NOW");
1006afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				else if (special && tv.tv_usec == UTIME_OMIT)
1016afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprintf("UTIME_OMIT");
1026afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath				else
1036afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath					tprint_timeval(tcp, &tv);
1046afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath			}
105a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		}
106a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
107a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (rc < 0)
108a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			tprintf("{...}");
109a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	}
110a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
111221f54f721a2f74e629bb70e34888205f68e95ccWichert Akkerman
112f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanvoid
113a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinsprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf)
114f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
115a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	if (addr == 0)
116a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		strcpy(buf, "NULL");
117a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	else if (!verbose(tcp))
118a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		sprintf(buf, "%#lx", addr);
119a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	else
120a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	{
121a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		int     rc;
122a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
123a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (bitness == BITNESS_32
124a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
125a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		    || personality_wordsize[current_personality] == 4
126f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
127a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			)
128a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
129a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval32 tv;
130a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
131a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
132a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin				sprintf(buf, "{%u, %u}",
133a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					tv.tv_sec, tv.tv_usec);
134a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		} else
135a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
136a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval tv;
137a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
138a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
139a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin				sprintf(buf, "{%lu, %lu}",
140a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					(unsigned long) tv.tv_sec,
141a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					(unsigned long) tv.tv_usec);
142a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		}
143f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
144a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (rc < 0)
145a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			strcpy(buf, "{...}");
146a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	}
147a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
148f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_time(tcp)
15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SVR4 */
15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_stime(tcp)
16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
17176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
17276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_gettimeofday(tcp)
17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
17476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp)) {
17776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %#lx",
17876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[0], tcp->u_arg[1]);
17976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
18076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
18176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
18276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
18376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
18476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
18576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */
18676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
18776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
18876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
18976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
190f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
191f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
192f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
193f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_gettimeofday(tcp)
194f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
195f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
196f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (exiting(tcp)) {
197f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp)) {
198f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx, %#lx",
199f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman		    tcp->u_arg[0], tcp->u_arg[1]);
200f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    return 0;
201f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	}
2026afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath	printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
203f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4
204f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
2056afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath	printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
206f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */
207f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
208f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
209f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
210f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
211f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
21376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_settimeofday(tcp)
21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
21576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
21676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
21776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
21876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
21976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
22176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */
22276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
226f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
227f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
228f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_settimeofday(tcp)
229f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
230f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
231f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
2326afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath	printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0);
233f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4
234f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
2356afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath	printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0);
236f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */
237f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
238f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
239f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
240f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
241f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_adjtime(tcp)
24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printtv(tcp, tcp->u_arg[1]);
25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
25576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
25776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
258d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat which[] = {
25976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_REAL,	"ITIMER_REAL"	},
26076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_VIRTUAL,"ITIMER_VIRTUAL"},
26176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_PROF,	"ITIMER_PROF"	},
26276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
26376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
26476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
26576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void
2661cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinprintitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
26776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
26876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (addr == 0)
26976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("NULL");
27076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (!verbose(tcp))
27176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%#lx", addr);
2721cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	else
2731cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	{
2741cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		int     rc;
27576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
2761cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (bitness == BITNESS_32
2771cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
2781cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		    || personality_wordsize[current_personality] == 4
2791cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#endif
2801cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			)
2811cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		{
2821cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			struct
2831cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			{
2841cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				struct timeval32 it_interval, it_value;
2851cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			} itv;
2861cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
2871cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			if ((rc = umove(tcp, addr, &itv)) >= 0)
2881cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("{it_interval=");
2891cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_interval);
2901cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf(", it_value=");
2911cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_value);
2921cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("}");
2931cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		} else
2941cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		{
2951cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			struct itimerval itv;
2961cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
2971cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			if ((rc = umove(tcp, addr, &itv)) >= 0)
2981cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("{it_interval=");
2991cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_interval);
3001cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf(", it_value=");
3011cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_value);
3021cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("}");
3031cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		}
304f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
3051cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (rc < 0)
3061cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			tprintf("{...}");
3071cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	}
308f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
3091cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
3101cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#define printitv(tcp, addr)	\
3111cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	printitv_bitness((tcp), (addr), BITNESS_CURRENT)
312f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
31376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
31476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getitimer(tcp)
31576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
31776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
31876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(which, tcp->u_arg[0], "ITIMER_???");
31976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
32076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
32176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
32276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
32376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
32476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[1]);
32576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
32676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
32776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
32876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
329f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
330f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
331f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
332f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_getitimer(tcp)
333f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
334f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
335f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
336f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	printxval(which, tcp->u_arg[0], "ITIMER_???");
337f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
338f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    } else {
339f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp))
340f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx", tcp->u_arg[1]);
341f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	else
3421cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	    printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
343f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
344f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
345f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
346f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
347f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
34876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
34976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_setitimer(tcp)
35076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
35176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
35276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
35376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(which, tcp->u_arg[0], "ITIMER_???");
35476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
35576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printitv(tcp, tcp->u_arg[1]);
35676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
35776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
35876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
35976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[2]);
36076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
36176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[2]);
36276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
36376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
36476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
36576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
366f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
367f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
368f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_setitimer(tcp)
369f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
370f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
371f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
372f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	printxval(which, tcp->u_arg[0], "ITIMER_???");
373f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
3741cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
375f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
376f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    } else {
377f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp))
378f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx", tcp->u_arg[2]);
379f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	else
3801cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	    printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
381f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
382f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
383f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
384f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
385f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
38676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX
38776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3881a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_modes[] = {
3891a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0, "0" },
3901a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET
3911a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_OFFSET, "ADJ_OFFSET" },
3921a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3931a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_FREQUENCY
3941a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_FREQUENCY, "ADJ_FREQUENCY" },
3951a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3961a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_MAXERROR
3971a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_MAXERROR, "ADJ_MAXERROR" },
3981a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3991a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_ESTERROR
4001a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_ESTERROR, "ADJ_ESTERROR" },
4011a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4021a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_STATUS
4031a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_STATUS, "ADJ_STATUS" },
4041a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4051a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TIMECONST
4061a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_TIMECONST, "ADJ_TIMECONST" },
4071a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4081a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TICK
4091a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_TICK, "ADJ_TICK" },
4101a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4111a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET_SINGLESHOT
4121a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_OFFSET_SINGLESHOT, "ADJ_OFFSET_SINGLESHOT" },
4131a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4141a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
4151a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
4161a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
4171a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_status[] = {
4181a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PLL
4191a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PLL, "STA_PLL" },
4201a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4211a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSFREQ
4221a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSFREQ, "STA_PPSFREQ" },
4231a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4241a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSTIME
4251a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSTIME, "STA_PPSTIME" },
4261a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4271a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FLL
4281a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_FLL, "STA_FLL" },
4291a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4301a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_INS
4311a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_INS, "STA_INS" },
4321a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4331a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_DEL
4341a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_DEL, "STA_DEL" },
4351a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4361a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_UNSYNC
4371a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_UNSYNC, "STA_UNSYNC" },
4381a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4391a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FREQHOLD
4401a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_FREQHOLD, "STA_FREQHOLD" },
4411a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4421a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSSIGNAL
4431a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSSIGNAL, "STA_PPSSIGNAL" },
4441a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4451a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSJITTER
4461a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSJITTER, "STA_PPSJITTER" },
4471a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4481a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSWANDER
4491a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSWANDER, "STA_PPSWANDER" },
4501a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4511a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSERROR
4521a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSERROR, "STA_PPSERROR" },
4531a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4541a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_CLOCKERR
4551a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_CLOCKERR, "STA_CLOCKERR" },
4561a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4571a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
4581a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
4591a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
4601a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_state[] = {
4611a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OK
4621a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_OK, "TIME_OK" },
4631a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4641a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_INS
4651a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_INS, "TIME_INS" },
4661a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4671a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_DEL
4681a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_DEL, "TIME_DEL" },
4691a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4701a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OOP
4711a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_OOP, "TIME_OOP" },
4721a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4731a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_WAIT
4741a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_WAIT, "TIME_WAIT" },
4751a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4761a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_ERROR
4771a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_ERROR, "TIME_ERROR" },
4781a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4791a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
4801a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
4811a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
482165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
483165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
484165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex32(struct tcb *tcp, long addr)
485165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
486165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	struct
487165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	{
488165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		unsigned int modes;
489165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     offset;
490165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     freq;
491165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     maxerror;
492165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     esterror;
493165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     status;
494165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     constant;
495165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     precision;
496165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tolerance;
497165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		struct timeval32 time;
498165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tick;
499165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     ppsfreq;
500165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitter;
501165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     shift;
502165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stabil;
503165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitcnt;
504165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     calcnt;
505165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     errcnt;
506165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stbcnt;
507165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	} tx;
508165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
509165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
510165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
511165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
512165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{modes=");
51371d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin	printflags(adjtimex_modes, tx.modes, "ADJ_???");
514165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%d, freq=%d, maxerror=%d, ",
515165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.offset, tx.freq, tx.maxerror);
516165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("esterror=%u, status=", tx.esterror);
517165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
518165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%d, precision=%u, ",
519165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.constant, tx.precision);
520165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%d, time=", tx.tolerance);
521165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval32(tcp, &tx.time);
522165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
523165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.tick, tx.ppsfreq, tx.jitter);
524165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%d, jitcnt=%d",
525165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.shift, tx.stabil, tx.jitcnt);
526165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
527165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.calcnt, tx.errcnt, tx.stbcnt);
528165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("}");
529165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
530165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
531165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif /* SUPPORTED_PERSONALITIES > 1 */
532165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
533165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
534165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex(struct tcb *tcp, long addr)
53576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
5361a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin	struct timex tx;
53776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
538165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
539165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (personality_wordsize[current_personality] == 4)
540165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return tprint_timex32(tcp, addr);
541165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
542165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
543165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
544165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
545165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if LINUX_VERSION_CODE < 66332
546165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
547165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.mode, tx.offset, tx.frequency);
548165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
549165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.maxerror, tx.esterror, tx.status);
550165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("time_constant=%ld, precision=%lu, ",
551165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.time_constant, tx.precision);
552165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%ld, time=", tx.tolerance);
553165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
554165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#else
555165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{modes=");
55671d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin	printflags(adjtimex_modes, tx.modes, "ADJ_???");
557165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
558165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.offset, tx.freq, tx.maxerror);
559165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("esterror=%lu, status=", tx.esterror);
560165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
561165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%ld, precision=%lu, ",
562165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.constant, tx.precision);
563165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%ld, time=", tx.tolerance);
564165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
565165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
566165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.tick, tx.ppsfreq, tx.jitter);
567165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
568165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.shift, tx.stabil, tx.jitcnt);
569165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
570165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.calcnt, tx.errcnt, tx.stbcnt);
571165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
572165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("}");
573165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
574165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
575165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
576165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinint
577165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinsys_adjtimex(struct tcb *tcp)
578165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
57976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
58076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (tcp->u_arg[0] == 0)
58176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("NULL");
58276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (syserror(tcp) || !verbose(tcp))
58376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[0]);
584165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
58576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("{...}");
5861a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin		tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
5871a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin		if (tcp->auxstr)
5881a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin			return RVAL_STR;
58976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
59076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
59176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
5921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
593d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clockflags[] = {
5941e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath  { TIMER_ABSTIME, "TIMER_ABSTIME" },
5951e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath  { 0,             NULL }
5961e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath};
5971e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
598d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clocknames[] = {
59955a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_REALTIME
60054a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { CLOCK_REALTIME, "CLOCK_REALTIME" },
60155a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif
60255a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_MONOTONIC
60354a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
60455a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif
60554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { 0,             NULL }
60654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath};
60754a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath
6081e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6091e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_settime(tcp)
6101e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
6111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
61354a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
61454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
6151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[1]);
6161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
6181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6191e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_gettime(tcp)
6221e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
6231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
62554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
62654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
6271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
6281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
6291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
6301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
6311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[1]);
6321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
6341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_nanosleep(tcp)
6381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
6391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6401e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
64154a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
64254a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
643b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
6441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
6451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[2]);
6461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
6471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
6481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
6491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
6501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
6511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[3]);
6521e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6531e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
6541e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#ifndef SIGEV_THREAD_ID
6571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath# define SIGEV_THREAD_ID 4
6581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#endif
659d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat sigev_value[] = {
6601e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
6611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_NONE+1, "SIGEV_NONE" },
6621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_THREAD+1, "SIGEV_THREAD" },
6631e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
6641e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ 0, NULL }
6651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath};
6661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
667d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
668d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinstatic void
669d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent32(struct tcb *tcp, long arg)
670d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin{
671d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	struct
672d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
673d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_value;
674d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_signo;
675d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_notify;
676d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
677d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		union
678d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		{
679d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			int     tid;
680d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			struct
681d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			{
682d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				int     function, attribute;
683d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			} thread;
684d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		} un;
685d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	} sev;
686d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
687d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	if (umove(tcp, arg, &sev) < 0)
688d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("{...}");
689d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	else
690d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
691d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("{%#x, ", sev.sigev_value);
692d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_SIGNAL)
693d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%s, ", signame(sev.sigev_signo));
694d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
695d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%u, ", sev.sigev_signo);
696d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		printxval(sigev_value, sev.sigev_notify + 1, "SIGEV_???");
697d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf(", ");
698d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_THREAD_ID)
699d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%d}", sev.un.tid);
700d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else if (sev.sigev_notify == SIGEV_THREAD)
701d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%#x, %#x}",
702d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.function,
703d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.attribute);
704d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
705d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{...}");
706d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("}");
707d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
708d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin}
709d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
710d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
7111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathvoid
712d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent(struct tcb *tcp, long arg)
7131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	struct sigevent sev;
715d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
716d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
717d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	if (personality_wordsize[current_personality] == 4)
718d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
719d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		printsigevent32(tcp, arg);
720d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		return;
721d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
722d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
7231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (umove (tcp, arg, &sev) < 0)
7241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("{...}");
7251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	else {
726675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		tprintf("{%p, ", sev.sigev_value.sival_ptr);
727675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		if (sev.sigev_notify == SIGEV_SIGNAL)
728675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%s, ", signame(sev.sigev_signo));
729675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		else
730675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%u, ", sev.sigev_signo);
7311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
7321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (sev.sigev_notify == SIGEV_THREAD_ID)
7341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			/* _pad[0] is the _tid field which might not be
7351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   present in the userlevel definition of the
7361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   struct.  */
7371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{%d}", sev._sigev_un._pad[0]);
738d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath		else if (sev.sigev_notify == SIGEV_THREAD)
739d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath			tprintf("{%p, %p}", sev.sigev_notify_function,
740d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath				sev.sigev_notify_attributes);
7411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{...}");
7431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("}");
7441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_create(tcp)
7491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
752675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
753675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		tprintf(", ");
7541e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printsigevent(tcp, tcp->u_arg[1]);
7551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
757ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		void *p;
758ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin
759ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &p) < 0)
7601e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[2]);
761ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		else
7621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{%p}", p);
7631e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7641e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_settime(tcp)
7691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7701e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
773b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
7741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7751e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printitv(tcp, tcp->u_arg[2]);
7761e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7771e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7781e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7791e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
7801e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7811e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[3]);
7821e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7831e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7841e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7851e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7861e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7871e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_gettime(tcp)
7881e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7911e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
7921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7931e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7941e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
7951e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7961e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[1]);
7971e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7981e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7991e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
800d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
801d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic void
802d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathprint_rtc(tcp, rt)
803d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp;
804d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathconst struct rtc_time *rt;
805d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
806d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
807d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		"tm_mday=%d, tm_mon=%d, tm_year=%d, ",
808d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_sec, rt->tm_min, rt->tm_hour,
809d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_mday, rt->tm_mon, rt->tm_year);
810d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	if (!abbrev(tcp))
811d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
812d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			rt->tm_wday, rt->tm_yday, rt->tm_isdst);
813d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	else
814d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		tprintf("...}");
815d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
816d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
817d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathint
818d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathrtc_ioctl(tcp, code, arg)
819d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp;
820d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong code;
821d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong arg;
822d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
823d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	switch (code) {
824d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_SET:
825d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_SET_TIME:
826d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
827d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
828d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &rt) < 0)
829d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
830d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
831d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", ");
832d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
833d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
834d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
835d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
836d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_READ:
837d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_RD_TIME:
838d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
839d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
840d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &rt) < 0)
841d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
842d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
843d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", ");
844d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
845d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
846d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
847d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
848d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_SET:
849d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_SET:
850d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
851d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
852d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
853d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_READ:
854d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_READ:
855d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp))
856d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
857d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
858d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_SET:
859d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
860d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
861d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &wk) < 0)
862d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
863d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
864d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
865d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
866d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
867d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf("}");
868d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
869d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
870d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
871d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_RD:
872d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
873d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
874d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &wk) < 0)
875d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
876d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
877d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
878d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
879d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
880d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf("}");
881d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
882d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
883d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
884d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	default:
885d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
886d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %#lx", arg);
887d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
888d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	}
889d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	return 1;
890d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
89176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */
892