time.c revision d3cb392f8520cb1a6a3d6c93febe2a2424560574
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>
3976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */
4076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
41a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinstruct timeval32
4276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
43a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	u_int32_t tv_sec, tv_usec;
44a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin};
4576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
461cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
471cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval32(struct tcb *tcp, const struct timeval32 *tv)
481cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
491cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec);
501cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
511cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
521cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinstatic void
531cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levintprint_timeval(struct tcb *tcp, const struct timeval *tv)
541cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin{
551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	tprintf("{%lu, %lu}",
561cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		(unsigned long) tv->tv_sec, (unsigned long) tv->tv_usec);
571cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin}
581cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
59a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinvoid
60a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinprinttv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
61a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin{
6276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (addr == 0)
6376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("NULL");
6476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (!verbose(tcp))
6576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%#lx", addr);
6676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else
67a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	{
68a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		int     rc;
6976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
70a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (bitness == BITNESS_32
71a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
72a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		    || personality_wordsize[current_personality] == 4
73a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#endif
74a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			)
75a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
76a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval32 tv;
77a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
78a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
791cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &tv);
80a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		} else
81a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
82a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval tv;
83a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
84a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
851cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &tv);
86a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		}
87a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
88a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (rc < 0)
89a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			tprintf("{...}");
90a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	}
91a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
92221f54f721a2f74e629bb70e34888205f68e95ccWichert Akkerman
93f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanvoid
94a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinsprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf)
95f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
96a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	if (addr == 0)
97a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		strcpy(buf, "NULL");
98a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	else if (!verbose(tcp))
99a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		sprintf(buf, "%#lx", addr);
100a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	else
101a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	{
102a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		int     rc;
103a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
104a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (bitness == BITNESS_32
105a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
106a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		    || personality_wordsize[current_personality] == 4
107f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
108a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			)
109a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
110a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval32 tv;
111a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
112a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
113a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin				sprintf(buf, "{%u, %u}",
114a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					tv.tv_sec, tv.tv_usec);
115a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		} else
116a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		{
117a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			struct timeval tv;
118a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin
119a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			if ((rc = umove(tcp, addr, &tv)) >= 0)
120a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin				sprintf(buf, "{%lu, %lu}",
121a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					(unsigned long) tv.tv_sec,
122a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin					(unsigned long) tv.tv_usec);
123a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		}
124f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
125a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin		if (rc < 0)
126a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin			strcpy(buf, "{...}");
127a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	}
128a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin}
129f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
13076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
13176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_time(tcp)
13276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
13376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
13476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
13576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
13676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
13776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SVR4 */
13876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
13976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
14076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
14176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
14276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
14376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_stime(tcp)
14476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
14576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
14676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
14776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[0], "%ld");
14876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_gettimeofday(tcp)
15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp)) {
15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %#lx",
15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[0], tcp->u_arg[1]);
16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */
16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
171f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
172f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
173f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
174f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_gettimeofday(tcp)
175f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
176f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
177f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (exiting(tcp)) {
178f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp)) {
179f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx, %#lx",
180f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman		    tcp->u_arg[0], tcp->u_arg[1]);
181f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    return 0;
182f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	}
183a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32);
184f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4
185f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
186a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
187f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */
188f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
189f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
190f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
191f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
192f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
19376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
19476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_settimeofday(tcp)
19576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
19676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
19776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
19876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
19976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4
20076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
20176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[1]);
20276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */
20376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
20476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
20576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
20676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
207f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
208f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
209f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_settimeofday(tcp)
210f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
211f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
212f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
213a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32);
214f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4
215f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
216a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin	printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
217f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */
218f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
219f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
220f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
221f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
222f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_adjtime(tcp)
22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printtv(tcp, tcp->u_arg[0]);
22976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printtv(tcp, tcp->u_arg[1]);
23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
23776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
239d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat which[] = {
24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_REAL,	"ITIMER_REAL"	},
24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_VIRTUAL,"ITIMER_VIRTUAL"},
24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ITIMER_PROF,	"ITIMER_PROF"	},
24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void
2471cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinprintitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness)
24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (addr == 0)
25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("NULL");
25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (!verbose(tcp))
25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%#lx", addr);
2531cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	else
2541cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	{
2551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		int     rc;
25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
2571cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (bitness == BITNESS_32
2581cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1
2591cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		    || personality_wordsize[current_personality] == 4
2601cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#endif
2611cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			)
2621cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		{
2631cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			struct
2641cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			{
2651cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				struct timeval32 it_interval, it_value;
2661cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			} itv;
2671cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
2681cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			if ((rc = umove(tcp, addr, &itv)) >= 0)
2691cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("{it_interval=");
2701cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_interval);
2711cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf(", it_value=");
2721cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval32(tcp, &itv.it_value);
2731cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("}");
2741cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		} else
2751cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		{
2761cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			struct itimerval itv;
2771cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
2781cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			if ((rc = umove(tcp, addr, &itv)) >= 0)
2791cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("{it_interval=");
2801cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_interval);
2811cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf(", it_value=");
2821cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprint_timeval(tcp, &itv.it_value);
2831cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin				tprintf("}");
2841cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		}
285f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
2861cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin		if (rc < 0)
2871cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin			tprintf("{...}");
2881cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	}
289f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
2901cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin
2911cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#define printitv(tcp, addr)	\
2921cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	printitv_bitness((tcp), (addr), BITNESS_CURRENT)
293f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getitimer(tcp)
29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
29776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(which, tcp->u_arg[0], "ITIMER_???");
30076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
30176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
30276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
30376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[1]);
30476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
30576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[1]);
30676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
30776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
30876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
30976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
310f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
311f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
312f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
313f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_getitimer(tcp)
314f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
315f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
316f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
317f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	printxval(which, tcp->u_arg[0], "ITIMER_???");
318f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
319f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    } else {
320f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp))
321f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx", tcp->u_arg[1]);
322f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	else
3231cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	    printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
324f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
325f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
326f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
327f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
328f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
32976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
33076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_setitimer(tcp)
33176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
33276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
33376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(which, tcp->u_arg[0], "ITIMER_???");
33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
33676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printitv(tcp, tcp->u_arg[1]);
33776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[2]);
34176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
34276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printitv(tcp, tcp->u_arg[2]);
34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
34476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
34576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
34676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
347f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA
348f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint
349f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_setitimer(tcp)
350f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp;
351f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{
352f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    if (entering(tcp)) {
353f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	printxval(which, tcp->u_arg[0], "ITIMER_???");
354f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
3551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32);
356f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	tprintf(", ");
357f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    } else {
358f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	if (syserror(tcp))
359f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	    tprintf("%#lx", tcp->u_arg[2]);
360f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman	else
3611cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin	    printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32);
362f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    }
363f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman    return 0;
364f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman}
365f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif
366f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman
36776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX
36876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3691a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_modes[] = {
3701a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0, "0" },
3711a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET
3721a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_OFFSET, "ADJ_OFFSET" },
3731a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3741a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_FREQUENCY
3751a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_FREQUENCY, "ADJ_FREQUENCY" },
3761a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3771a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_MAXERROR
3781a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_MAXERROR, "ADJ_MAXERROR" },
3791a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3801a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_ESTERROR
3811a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_ESTERROR, "ADJ_ESTERROR" },
3821a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3831a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_STATUS
3841a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_STATUS, "ADJ_STATUS" },
3851a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3861a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TIMECONST
3871a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_TIMECONST, "ADJ_TIMECONST" },
3881a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3891a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TICK
3901a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_TICK, "ADJ_TICK" },
3911a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3921a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET_SINGLESHOT
3931a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { ADJ_OFFSET_SINGLESHOT, "ADJ_OFFSET_SINGLESHOT" },
3941a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
3951a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
3961a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
3971a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
3981a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_status[] = {
3991a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PLL
4001a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PLL, "STA_PLL" },
4011a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4021a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSFREQ
4031a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSFREQ, "STA_PPSFREQ" },
4041a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4051a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSTIME
4061a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSTIME, "STA_PPSTIME" },
4071a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4081a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FLL
4091a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_FLL, "STA_FLL" },
4101a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4111a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_INS
4121a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_INS, "STA_INS" },
4131a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4141a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_DEL
4151a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_DEL, "STA_DEL" },
4161a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4171a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_UNSYNC
4181a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_UNSYNC, "STA_UNSYNC" },
4191a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4201a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FREQHOLD
4211a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_FREQHOLD, "STA_FREQHOLD" },
4221a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4231a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSSIGNAL
4241a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSSIGNAL, "STA_PPSSIGNAL" },
4251a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4261a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSJITTER
4271a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSJITTER, "STA_PPSJITTER" },
4281a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4291a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSWANDER
4301a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSWANDER, "STA_PPSWANDER" },
4311a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4321a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSERROR
4331a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_PPSERROR, "STA_PPSERROR" },
4341a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4351a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_CLOCKERR
4361a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { STA_CLOCKERR, "STA_CLOCKERR" },
4371a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4381a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
4391a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
4401a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
4411a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_state[] = {
4421a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OK
4431a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_OK, "TIME_OK" },
4441a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4451a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_INS
4461a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_INS, "TIME_INS" },
4471a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4481a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_DEL
4491a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_DEL, "TIME_DEL" },
4501a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4511a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OOP
4521a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_OOP, "TIME_OOP" },
4531a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4541a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_WAIT
4551a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_WAIT, "TIME_WAIT" },
4561a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4571a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_ERROR
4581a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { TIME_ERROR, "TIME_ERROR" },
4591a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif
4601a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin  { 0,             NULL }
4611a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin};
4621a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin
463165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
464165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
465165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex32(struct tcb *tcp, long addr)
466165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
467165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	struct
468165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	{
469165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		unsigned int modes;
470165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     offset;
471165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     freq;
472165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     maxerror;
473165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     esterror;
474165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     status;
475165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     constant;
476165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     precision;
477165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tolerance;
478165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		struct timeval32 time;
479165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     tick;
480165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     ppsfreq;
481165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitter;
482165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     shift;
483165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stabil;
484165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     jitcnt;
485165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     calcnt;
486165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     errcnt;
487165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		int     stbcnt;
488165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	} tx;
489165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
490165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
491165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
492165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
493165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{modes=");
494165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printxval(adjtimex_modes, tx.modes, "ADJ_???");
495165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%d, freq=%d, maxerror=%d, ",
496165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.offset, tx.freq, tx.maxerror);
497165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("esterror=%u, status=", tx.esterror);
498165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
499165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%d, precision=%u, ",
500165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.constant, tx.precision);
501165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%d, time=", tx.tolerance);
502165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval32(tcp, &tx.time);
503165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%d, ppsfreq=%d, jitter=%d",
504165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.tick, tx.ppsfreq, tx.jitter);
505165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%d, jitcnt=%d",
506165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.shift, tx.stabil, tx.jitcnt);
507165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d",
508165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.calcnt, tx.errcnt, tx.stbcnt);
509165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("}");
510165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
511165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
512165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif /* SUPPORTED_PERSONALITIES > 1 */
513165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
514165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int
515165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex(struct tcb *tcp, long addr)
51676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
5171a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin	struct timex tx;
51876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
519165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
520165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (personality_wordsize[current_personality] == 4)
521165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return tprint_timex32(tcp, addr);
522165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
523165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	if (umove(tcp, addr, &tx) < 0)
524165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		return -1;
525165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
526165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if LINUX_VERSION_CODE < 66332
527165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{mode=%d, offset=%ld, frequency=%ld, ",
528165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.mode, tx.offset, tx.frequency);
529165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("maxerror=%ld, esterror=%lu, status=%u, ",
530165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.maxerror, tx.esterror, tx.status);
531165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("time_constant=%ld, precision=%lu, ",
532165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.time_constant, tx.precision);
533165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%ld, time=", tx.tolerance);
534165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
535165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#else
536165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("{modes=");
537165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printxval(adjtimex_modes, tx.modes, "ADJ_???");
538165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ",
539165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.offset, tx.freq, tx.maxerror);
540165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("esterror=%lu, status=", tx.esterror);
541165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	printflags(adjtimex_status, tx.status, "STA_???");
542165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", constant=%ld, precision=%lu, ",
543165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.constant, tx.precision);
544165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("tolerance=%ld, time=", tx.tolerance);
545165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprint_timeval(tcp, &tx.time);
546165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld",
547165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.tick, tx.ppsfreq, tx.jitter);
548165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", shift=%d, stabil=%ld, jitcnt=%ld",
549165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.shift, tx.stabil, tx.jitcnt);
550165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld",
551165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		tx.calcnt, tx.errcnt, tx.stbcnt);
552165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif
553165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	tprintf("}");
554165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin	return 0;
555165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin}
556165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin
557165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinint
558165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinsys_adjtimex(struct tcb *tcp)
559165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{
56076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
56176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (tcp->u_arg[0] == 0)
56276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("NULL");
56376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (syserror(tcp) || !verbose(tcp))
56476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[0]);
565165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin		else if (tprint_timex(tcp, tcp->u_arg[0]) < 0)
56676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("{...}");
5671a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin		tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval);
5681a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin		if (tcp->auxstr)
5691a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin			return RVAL_STR;
57076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
57176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
57276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
5731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
574d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clockflags[] = {
5751e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath  { TIMER_ABSTIME, "TIMER_ABSTIME" },
5761e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath  { 0,             NULL }
5771e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath};
5781e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
579d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clocknames[] = {
58055a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_REALTIME
58154a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { CLOCK_REALTIME, "CLOCK_REALTIME" },
58255a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif
58355a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_MONOTONIC
58454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" },
58555a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif
58654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath  { 0,             NULL }
58754a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath};
58854a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath
5891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
5901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_settime(tcp)
5911e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
5921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
5931e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
59454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
59554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
5961e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[1]);
5971e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
5981e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
5991e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6001e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6011e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6021e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_gettime(tcp)
6031e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
6041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
60654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
60754a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
6081e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
6091e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
6101e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
6111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
6121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[1]);
6131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
6151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
6181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_nanosleep(tcp)
6191e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
6201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
62254a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
62354a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath		tprintf(", ");
624b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
6251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
6261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printtv(tcp, tcp->u_arg[2]);
6271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
6281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
6291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
6301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
6311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
6321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printtv(tcp, tcp->u_arg[3]);
6331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
6341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
6351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
6361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
6371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#ifndef SIGEV_THREAD_ID
6381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath# define SIGEV_THREAD_ID 4
6391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#endif
640d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat sigev_value[] = {
6411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_SIGNAL+1, "SIGEV_SIGNAL" },
6421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_NONE+1, "SIGEV_NONE" },
6431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_THREAD+1, "SIGEV_THREAD" },
6441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" },
6451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	{ 0, NULL }
6461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath};
6471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
648d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
649d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinstatic void
650d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent32(struct tcb *tcp, long arg)
651d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin{
652d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	struct
653d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
654d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_value;
655d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_signo;
656d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		int     sigev_notify;
657d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
658d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		union
659d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		{
660d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			int     tid;
661d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			struct
662d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			{
663d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				int     function, attribute;
664d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			} thread;
665d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		} un;
666d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	} sev;
667d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
668d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	if (umove(tcp, arg, &sev) < 0)
669d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("{...}");
670d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	else
671d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
672d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("{%#x, ", sev.sigev_value);
673d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_SIGNAL)
674d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%s, ", signame(sev.sigev_signo));
675d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
676d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("%u, ", sev.sigev_signo);
677d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		printxval(sigev_value, sev.sigev_notify + 1, "SIGEV_???");
678d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf(", ");
679d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		if (sev.sigev_notify == SIGEV_THREAD_ID)
680d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%d}", sev.un.tid);
681d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else if (sev.sigev_notify == SIGEV_THREAD)
682d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{%#x, %#x}",
683d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.function,
684d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin				sev.un.thread.attribute);
685d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		else
686d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin			tprintf("{...}");
687d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		tprintf("}");
688d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
689d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin}
690d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
691d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
6921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathvoid
693d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent(struct tcb *tcp, long arg)
6941e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
6951e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	struct sigevent sev;
696d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin
697d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1
698d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	if (personality_wordsize[current_personality] == 4)
699d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	{
700d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		printsigevent32(tcp, arg);
701d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin		return;
702d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin	}
703d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif
7041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (umove (tcp, arg, &sev) < 0)
7051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("{...}");
7061e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	else {
707675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		tprintf("{%p, ", sev.sigev_value.sival_ptr);
708675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		if (sev.sigev_notify == SIGEV_SIGNAL)
709675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%s, ", signame(sev.sigev_signo));
710675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		else
711675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath			tprintf("%u, ", sev.sigev_signo);
7121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???");
7131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (sev.sigev_notify == SIGEV_THREAD_ID)
7151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			/* _pad[0] is the _tid field which might not be
7161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   present in the userlevel definition of the
7171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			   struct.  */
7181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{%d}", sev._sigev_un._pad[0]);
719d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath		else if (sev.sigev_notify == SIGEV_THREAD)
720d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath			tprintf("{%p, %p}", sev.sigev_notify_function,
721d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath				sev.sigev_notify_attributes);
7221e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{...}");
7241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("}");
7251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_create(tcp)
7301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
733675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		printxval(clocknames, tcp->u_arg[0], "CLOCK_???");
734675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath		tprintf(", ");
7351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printsigevent(tcp, tcp->u_arg[1]);
7361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
738ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		void *p;
739ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin
740ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &p) < 0)
7411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[2]);
742ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin		else
7431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("{%p}", p);
7441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_settime(tcp)
7501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7521e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7531e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
754b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath		printflags(clockflags, tcp->u_arg[1], "TIMER_???");
7551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		printitv(tcp, tcp->u_arg[2]);
7571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf(", ");
7581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7591e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7601e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[3]);
7611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[3]);
7631e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7641e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
7661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath
7671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint
7681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_gettime(tcp)
7691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp;
7701e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{
7711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	if (entering(tcp)) {
7721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		tprintf("%#lx, ", tcp->u_arg[0]);
7731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	} else {
7741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		if (syserror(tcp))
7751e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			tprintf("%#lx", tcp->u_arg[1]);
7761e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath		else
7771e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath			printitv(tcp, tcp->u_arg[1]);
7781e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	}
7791e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath	return 0;
7801e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}
781d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
782d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic void
783d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathprint_rtc(tcp, rt)
784d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp;
785d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathconst struct rtc_time *rt;
786d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
787d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, "
788d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		"tm_mday=%d, tm_mon=%d, tm_year=%d, ",
789d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_sec, rt->tm_min, rt->tm_hour,
790d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		rt->tm_mday, rt->tm_mon, rt->tm_year);
791d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	if (!abbrev(tcp))
792d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}",
793d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			rt->tm_wday, rt->tm_yday, rt->tm_isdst);
794d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	else
795d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		tprintf("...}");
796d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
797d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath
798d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathint
799d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathrtc_ioctl(tcp, code, arg)
800d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp;
801d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong code;
802d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong arg;
803d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{
804d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	switch (code) {
805d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_SET:
806d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_SET_TIME:
807d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
808d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
809d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &rt) < 0)
810d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
811d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
812d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", ");
813d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
814d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
815d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
816d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
817d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_ALM_READ:
818d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_RD_TIME:
819d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
820d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_time rt;
821d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &rt) < 0)
822d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
823d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
824d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", ");
825d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &rt);
826d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
827d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
828d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
829d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_SET:
830d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_SET:
831d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
832d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
833d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
834d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_IRQP_READ:
835d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_EPOCH_READ:
836d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp))
837d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %lu", arg);
838d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
839d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_SET:
840d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp)) {
841d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
842d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (umove(tcp, arg, &wk) < 0)
843d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
844d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
845d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
846d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
847d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
848d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf("}");
849d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
850d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
851d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
852d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	case RTC_WKALM_RD:
853d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (exiting(tcp)) {
854d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			struct rtc_wkalrm wk;
855d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			if (syserror(tcp) || umove(tcp, arg, &wk) < 0)
856d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", %#lx", arg);
857d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			else {
858d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf(", {enabled=%d, pending=%d, ",
859d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath					wk.enabled, wk.pending);
860d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				print_rtc(tcp, &wk.time);
861d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath				tprintf("}");
862d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			}
863d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		}
864d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
865d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	default:
866d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		if (entering(tcp))
867d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath			tprintf(", %#lx", arg);
868d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath		break;
869d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	}
870d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath	return 1;
871d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath}
87276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */
873