time.c revision 21a75347451b5178a0eb85a48042b8db0e45b318
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) { 8641383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath if (special && tv.tv_sec == 0 && 8741383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath tv.tv_usec == UTIME_NOW) 886afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprintf("UTIME_NOW"); 8941383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath else if (special && tv.tv_sec == 0 && 9041383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath tv.tv_usec == UTIME_OMIT) 916afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprintf("UTIME_OMIT"); 926afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath else 936afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprint_timeval32(tcp, &tv); 946afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath } 95a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } else 96a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 97a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval tv; 98a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 996afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath if ((rc = umove(tcp, addr, &tv)) >= 0) { 10041383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath if (special && tv.tv_sec == 0 && 10141383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath tv.tv_usec == UTIME_NOW) 1026afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprintf("UTIME_NOW"); 10341383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath else if (special && tv.tv_sec == 0 && 10441383399cd72de811e983fbbd4b3c7d6cfcfd98dRoland McGrath tv.tv_usec == UTIME_OMIT) 1056afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprintf("UTIME_OMIT"); 1066afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath else 1076afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath tprint_timeval(tcp, &tv); 1086afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath } 109a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 110a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 111a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (rc < 0) 112a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin tprintf("{...}"); 113a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 114a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin} 115221f54f721a2f74e629bb70e34888205f68e95ccWichert Akkerman 116f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanvoid 117a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinsprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf) 118f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 119a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (addr == 0) 120a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin strcpy(buf, "NULL"); 121a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin else if (!verbose(tcp)) 122a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "%#lx", addr); 123a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin else 124a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 125a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin int rc; 126a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 127a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (bitness == BITNESS_32 128a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 129a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin || personality_wordsize[current_personality] == 4 130f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 131a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin ) 132a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 133a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval32 tv; 134a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 135a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if ((rc = umove(tcp, addr, &tv)) >= 0) 136a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "{%u, %u}", 137a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin tv.tv_sec, tv.tv_usec); 138a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } else 139a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 140a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval tv; 141a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 142a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if ((rc = umove(tcp, addr, &tv)) >= 0) 143a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "{%lu, %lu}", 144a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin (unsigned long) tv.tv_sec, 145a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin (unsigned long) tv.tv_usec); 146a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 147f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 148a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (rc < 0) 149a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin strcpy(buf, "{...}"); 150a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 151a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin} 152f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 1536bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrathvoid print_timespec (struct tcb *tcp, long addr) 1546bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{ 1556bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (addr == 0) 1566bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("NULL"); 1576bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else if (!verbose(tcp)) 1586bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("%#lx", addr); 1596bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else { 1606bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath int rc; 1616bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1626bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 1636bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (personality_wordsize[current_personality] == 4) 1646bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath { 1656bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timeval32 tv; 1666bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1676bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if ((rc = umove(tcp, addr, &tv)) >= 0) 1686bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{%u, %u}", 1696bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tv.tv_sec, tv.tv_usec); 1706bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } else 1716bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath { 1726bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 1736bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timespec ts; 1746bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1756bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if ((rc = umove(tcp, addr, &ts)) >= 0) 1766bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{%lu, %lu}", 1776bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_sec, 1786bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_nsec); 1796bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 1806bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 1816bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 1826bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1836bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (rc < 0) 1846bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{...}"); 1856bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 1866bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath} 1876bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1886bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrathvoid sprint_timespec (char *buf, struct tcb *tcp, long addr) 1896bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{ 1906bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (addr == 0) 1916bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath strcpy(buf, "NULL"); 1926bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else if (!verbose(tcp)) 1936bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "%#lx", addr); 1946bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else { 1956bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath int rc; 1966bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1976bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 1986bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (personality_wordsize[current_personality] == 4) 1996bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath { 2006bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timeval32 tv; 2016bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 2026bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if ((rc = umove(tcp, addr, &tv)) >= 0) 2036bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "{%u, %u}", 2046bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tv.tv_sec, tv.tv_usec); 2056bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } else 2066bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath { 2076bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 2086bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timespec ts; 2096bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 2106bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if ((rc = umove(tcp, addr, &ts)) >= 0) 2116bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "{%lu, %lu}", 2126bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_sec, 2136bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_nsec); 2146bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 2156bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 2166bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 2176bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 2186bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (rc < 0) 2196bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath strcpy(buf, "{...}"); 2206bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 2216bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath} 2226bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_time(tcp) 22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 22976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printnum(tcp, tcp->u_arg[0], "%ld"); 23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SVR4 */ 23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_stime(tcp) 23776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printnum(tcp, tcp->u_arg[0], "%ld"); 24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_gettimeofday(tcp) 24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) { 25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx, %#lx", 25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tcp->u_arg[0], tcp->u_arg[1]); 25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 25576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 25776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 25876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 25976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */ 26076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 26176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 26276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 26376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 264f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 265f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 266f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 267f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_gettimeofday(tcp) 268f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp; 269f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 270f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (exiting(tcp)) { 271f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (syserror(tcp)) { 272f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%#lx, %#lx", 273f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tcp->u_arg[0], tcp->u_arg[1]); 274f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman return 0; 275f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 2766afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); 277f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4 278f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 2796afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); 280f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */ 281f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 282f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman return 0; 283f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 284f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 285f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_settimeofday(tcp) 28876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 29176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 29276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */ 29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 29776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 300f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 301f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 302f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_settimeofday(tcp) 303f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp; 304f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 305f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (entering(tcp)) { 3066afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); 307f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4 308f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 3096afc5659acc3df3d2e446ba4aa3a76bdd7264e1bRoland McGrath printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); 310f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */ 311f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 312f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman return 0; 313f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 314f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 315f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 31776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_adjtime(tcp) 31876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 31976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 32076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 32176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 32276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 32376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 32476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 32576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 32676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 32776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 32876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 32976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 33076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 33176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3322e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinint 3332e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinsys_nanosleep(struct tcb *tcp) 3342e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin{ 3352e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin if (entering(tcp)) { 3362e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin print_timespec(tcp, tcp->u_arg[0]); 3372e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin tprintf(", "); 3382e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin } else { 3392e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin if (!tcp->u_arg[1] || is_restart_error(tcp)) 3402e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin print_timespec(tcp, tcp->u_arg[1]); 3412e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin else 3422e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin tprintf("%#lx", tcp->u_arg[1]); 3432e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin } 3442e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin return 0; 3452e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin} 3462e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin 347d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat which[] = { 34876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_REAL, "ITIMER_REAL" }, 34976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_VIRTUAL,"ITIMER_VIRTUAL"}, 35076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_PROF, "ITIMER_PROF" }, 35176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 35276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 35376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 35476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void 3551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinprintitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) 35676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 35776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (addr == 0) 35876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("NULL"); 35976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else if (!verbose(tcp)) 36076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", addr); 3611cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin else 3621cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin { 3631cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin int rc; 36476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3651cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin if (bitness == BITNESS_32 3661cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 3671cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin || personality_wordsize[current_personality] == 4 3681cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#endif 3691cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin ) 3701cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin { 3711cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin struct 3721cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin { 3731cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin struct timeval32 it_interval, it_value; 3741cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } itv; 3751cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 376e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath if ((rc = umove(tcp, addr, &itv)) >= 0) { 3771cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{it_interval="); 3781cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval32(tcp, &itv.it_interval); 3791cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf(", it_value="); 3801cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval32(tcp, &itv.it_value); 3811cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("}"); 382e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 3831cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } else 3841cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin { 3851cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin struct itimerval itv; 3861cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 387e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath if ((rc = umove(tcp, addr, &itv)) >= 0) { 3881cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{it_interval="); 3891cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval(tcp, &itv.it_interval); 3901cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf(", it_value="); 3911cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval(tcp, &itv.it_value); 3921cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("}"); 393e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 3941cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } 395f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 3961cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin if (rc < 0) 3971cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{...}"); 3981cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } 399f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 4001cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 4011cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#define printitv(tcp, addr) \ 4021cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin printitv_bitness((tcp), (addr), BITNESS_CURRENT) 403f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 40476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 40576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getitimer(tcp) 40676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 40776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 40876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 40976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 41076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 41176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 41276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 41376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 41476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 41576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[1]); 41676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 41776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 41876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 41976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 420f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 421f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 422f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 423f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_getitimer(tcp) 424f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp; 425f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 426f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (entering(tcp)) { 427f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 428f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 429f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } else { 430f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (syserror(tcp)) 431f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 432f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman else 4331cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); 434f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 435f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman return 0; 436f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 437f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 438f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 43976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 44076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_setitimer(tcp) 44176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp; 44276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 44376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 44476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 44576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 44676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[1]); 44776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 44876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 44976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 45076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[2]); 45176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 45276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[2]); 45376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 45476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 45576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 45676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 457f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 458f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 459f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermansys_osf_setitimer(tcp) 460f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanstruct tcb *tcp; 461f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 462f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (entering(tcp)) { 463f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 464f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 4651cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); 466f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf(", "); 467f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } else { 468f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman if (syserror(tcp)) 469f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman tprintf("%#lx", tcp->u_arg[2]); 470f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman else 4711cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32); 472f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman } 473f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman return 0; 474f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 475f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 476f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 47776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX 47876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 4791a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_modes[] = { 4801a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, "0" }, 4811a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET 4821a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_OFFSET, "ADJ_OFFSET" }, 4831a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4841a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_FREQUENCY 4851a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_FREQUENCY, "ADJ_FREQUENCY" }, 4861a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4871a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_MAXERROR 4881a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_MAXERROR, "ADJ_MAXERROR" }, 4891a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4901a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_ESTERROR 4911a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_ESTERROR, "ADJ_ESTERROR" }, 4921a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4931a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_STATUS 4941a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_STATUS, "ADJ_STATUS" }, 4951a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4961a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TIMECONST 4971a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_TIMECONST, "ADJ_TIMECONST" }, 4981a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4991a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TICK 5001a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_TICK, "ADJ_TICK" }, 5011a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5021a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET_SINGLESHOT 5031a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_OFFSET_SINGLESHOT, "ADJ_OFFSET_SINGLESHOT" }, 5041a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5051a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 5061a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 5071a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 5081a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_status[] = { 5091a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PLL 5101a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PLL, "STA_PLL" }, 5111a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5121a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSFREQ 5131a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSFREQ, "STA_PPSFREQ" }, 5141a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5151a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSTIME 5161a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSTIME, "STA_PPSTIME" }, 5171a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5181a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FLL 5191a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_FLL, "STA_FLL" }, 5201a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5211a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_INS 5221a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_INS, "STA_INS" }, 5231a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5241a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_DEL 5251a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_DEL, "STA_DEL" }, 5261a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5271a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_UNSYNC 5281a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_UNSYNC, "STA_UNSYNC" }, 5291a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5301a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FREQHOLD 5311a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_FREQHOLD, "STA_FREQHOLD" }, 5321a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5331a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSSIGNAL 5341a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSSIGNAL, "STA_PPSSIGNAL" }, 5351a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5361a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSJITTER 5371a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSJITTER, "STA_PPSJITTER" }, 5381a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5391a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSWANDER 5401a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSWANDER, "STA_PPSWANDER" }, 5411a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5421a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSERROR 5431a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSERROR, "STA_PPSERROR" }, 5441a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5451a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_CLOCKERR 5461a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_CLOCKERR, "STA_CLOCKERR" }, 5471a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5481a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 5491a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 5501a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 5511a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_state[] = { 5521a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OK 5531a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_OK, "TIME_OK" }, 5541a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5551a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_INS 5561a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_INS, "TIME_INS" }, 5571a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5581a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_DEL 5591a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_DEL, "TIME_DEL" }, 5601a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5611a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OOP 5621a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_OOP, "TIME_OOP" }, 5631a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5641a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_WAIT 5651a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_WAIT, "TIME_WAIT" }, 5661a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5671a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_ERROR 5681a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_ERROR, "TIME_ERROR" }, 5691a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5701a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 5711a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 5721a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 573165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 574165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int 575165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex32(struct tcb *tcp, long addr) 576165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{ 577165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin struct 578165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin { 579165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin unsigned int modes; 580165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int offset; 581165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int freq; 582165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int maxerror; 583165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int esterror; 584165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int status; 585165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int constant; 586165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int precision; 587165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int tolerance; 588165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin struct timeval32 time; 589165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int tick; 590165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int ppsfreq; 591165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int jitter; 592165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int shift; 593165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int stabil; 594165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int jitcnt; 595165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int calcnt; 596165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int errcnt; 597165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int stbcnt; 598165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin } tx; 599165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 600165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (umove(tcp, addr, &tx) < 0) 601165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return -1; 602165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 603165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{modes="); 60471d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin printflags(adjtimex_modes, tx.modes, "ADJ_???"); 605165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", offset=%d, freq=%d, maxerror=%d, ", 606165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.offset, tx.freq, tx.maxerror); 607165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("esterror=%u, status=", tx.esterror); 608165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin printflags(adjtimex_status, tx.status, "STA_???"); 609165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", constant=%d, precision=%u, ", 610165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.constant, tx.precision); 611165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%d, time=", tx.tolerance); 612165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval32(tcp, &tx.time); 613165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", tick=%d, ppsfreq=%d, jitter=%d", 614165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.tick, tx.ppsfreq, tx.jitter); 615165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", shift=%d, stabil=%d, jitcnt=%d", 616165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.shift, tx.stabil, tx.jitcnt); 617165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d", 618165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.calcnt, tx.errcnt, tx.stbcnt); 619165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("}"); 620165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return 0; 621165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin} 622165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif /* SUPPORTED_PERSONALITIES > 1 */ 623165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 624165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int 625165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex(struct tcb *tcp, long addr) 62676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 6271a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin struct timex tx; 62876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 629165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 630165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (personality_wordsize[current_personality] == 4) 631165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return tprint_timex32(tcp, addr); 632165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif 633165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (umove(tcp, addr, &tx) < 0) 634165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return -1; 635165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 636165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if LINUX_VERSION_CODE < 66332 637165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{mode=%d, offset=%ld, frequency=%ld, ", 638165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.mode, tx.offset, tx.frequency); 639165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("maxerror=%ld, esterror=%lu, status=%u, ", 640165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.maxerror, tx.esterror, tx.status); 641165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("time_constant=%ld, precision=%lu, ", 642165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.time_constant, tx.precision); 643165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%ld, time=", tx.tolerance); 644165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval(tcp, &tx.time); 645165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#else 646165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{modes="); 64771d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin printflags(adjtimex_modes, tx.modes, "ADJ_???"); 648165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ", 649165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.offset, tx.freq, tx.maxerror); 650165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("esterror=%lu, status=", tx.esterror); 651165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin printflags(adjtimex_status, tx.status, "STA_???"); 652165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", constant=%ld, precision=%lu, ", 653165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.constant, tx.precision); 654165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%ld, time=", tx.tolerance); 655165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval(tcp, &tx.time); 656165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld", 657165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.tick, tx.ppsfreq, tx.jitter); 658165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", shift=%d, stabil=%ld, jitcnt=%ld", 659165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.shift, tx.stabil, tx.jitcnt); 660165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld", 661165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.calcnt, tx.errcnt, tx.stbcnt); 662165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif 663165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("}"); 664165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return 0; 665165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin} 666165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 667165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinint 668165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinsys_adjtimex(struct tcb *tcp) 669165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{ 67076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 67176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (tcp->u_arg[0] == 0) 67276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("NULL"); 67376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else if (syserror(tcp) || !verbose(tcp)) 67476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[0]); 675165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin else if (tprint_timex(tcp, tcp->u_arg[0]) < 0) 67676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("{...}"); 67721a75347451b5178a0eb85a48042b8db0e45b318Dmitry V. Levin if (syserror(tcp)) 67821a75347451b5178a0eb85a48042b8db0e45b318Dmitry V. Levin return 0; 6791a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval); 6801a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin if (tcp->auxstr) 6811a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin return RVAL_STR; 68276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 68376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 68476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 6851e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 686d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clockflags[] = { 6871e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { TIMER_ABSTIME, "TIMER_ABSTIME" }, 6881e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { 0, NULL } 6891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}; 6901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 691d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clocknames[] = { 69255a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_REALTIME 69354a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath { CLOCK_REALTIME, "CLOCK_REALTIME" }, 69455a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif 69555a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_MONOTONIC 69654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, 69755a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif 69854a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath { 0, NULL } 69954a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath}; 70054a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath 7011e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 7021e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_settime(tcp) 7031e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 7041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 70654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 70754a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 7081e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[1]); 7091e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7101e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 7141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_gettime(tcp) 7151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 7161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 71854a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 71954a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 7201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 7211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 7221e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[1]); 7231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 7241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[1]); 7251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 7301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_clock_nanosleep(tcp) 7311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 7321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 73454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 73554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 736b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath printflags(clockflags, tcp->u_arg[1], "TIMER_???"); 7371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 7381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[2]); 7391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 7401e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 7411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 7421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[3]); 7431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 7441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[3]); 7451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#ifndef SIGEV_THREAD_ID 7501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath# define SIGEV_THREAD_ID 4 7511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#endif 752d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat sigev_value[] = { 7531e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" }, 7541e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_NONE+1, "SIGEV_NONE" }, 7551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_THREAD+1, "SIGEV_THREAD" }, 7561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" }, 7571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { 0, NULL } 7581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}; 7591e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 760d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 761d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinstatic void 762d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent32(struct tcb *tcp, long arg) 763d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin{ 764d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin struct 765d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin { 766d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_value; 767d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_signo; 768d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_notify; 769d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 770d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin union 771d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin { 772d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int tid; 773d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin struct 774d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin { 775d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int function, attribute; 776d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } thread; 777d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } un; 778d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } sev; 779d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 780d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (umove(tcp, arg, &sev) < 0) 781d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{...}"); 782d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else 783d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin { 784d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%#x, ", sev.sigev_value); 785d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (sev.sigev_notify == SIGEV_SIGNAL) 786d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("%s, ", signame(sev.sigev_signo)); 787d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else 788d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("%u, ", sev.sigev_signo); 789d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin printxval(sigev_value, sev.sigev_notify + 1, "SIGEV_???"); 790d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf(", "); 791d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (sev.sigev_notify == SIGEV_THREAD_ID) 792d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%d}", sev.un.tid); 793d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else if (sev.sigev_notify == SIGEV_THREAD) 794d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%#x, %#x}", 795d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin sev.un.thread.function, 796d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin sev.un.thread.attribute); 797d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else 798d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{...}"); 799d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("}"); 800d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } 801d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin} 802d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif 803d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 8041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathvoid 805d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent(struct tcb *tcp, long arg) 8061e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8071e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath struct sigevent sev; 808d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 809d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 810d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (personality_wordsize[current_personality] == 4) 811d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin { 812d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin printsigevent32(tcp, arg); 813d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin return; 814d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } 815d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif 8161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (umove (tcp, arg, &sev) < 0) 8171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{...}"); 8181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else { 819675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("{%p, ", sev.sigev_value.sival_ptr); 820675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath if (sev.sigev_notify == SIGEV_SIGNAL) 821675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("%s, ", signame(sev.sigev_signo)); 822675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath else 823675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("%u, ", sev.sigev_signo); 8241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???"); 8251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (sev.sigev_notify == SIGEV_THREAD_ID) 8271e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath /* _pad[0] is the _tid field which might not be 8281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath present in the userlevel definition of the 8291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath struct. */ 8301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{%d}", sev._sigev_un._pad[0]); 831d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath else if (sev.sigev_notify == SIGEV_THREAD) 832d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath tprintf("{%p, %p}", sev.sigev_notify_function, 833d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath sev.sigev_notify_attributes); 8341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{...}"); 8361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("}"); 8371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8401e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_create(tcp) 8421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 8431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 845675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 846675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf(", "); 8471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printsigevent(tcp, tcp->u_arg[1]); 8481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 850ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin void *p; 851ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin 852ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &p) < 0) 8531e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[2]); 854ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin else 8551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{%p}", p); 8561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8591e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8601e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_settime(tcp) 8621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 8631e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8641e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 8651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx, ", tcp->u_arg[0]); 866b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath printflags(clockflags, tcp->u_arg[1], "TIMER_???"); 8671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[2]); 8691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8701e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 8711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 8721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[3]); 8731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[3]); 8751e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8761e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8771e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8781e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8791e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8801e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathsys_timer_gettime(tcp) 8811e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathstruct tcb *tcp; 8821e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8831e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 8841e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx, ", tcp->u_arg[0]); 8851e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 8861e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 8871e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[1]); 8881e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8891e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[1]); 8901e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8911e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8921e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 893d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath 894d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic void 895d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathprint_rtc(tcp, rt) 896d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp; 897d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathconst struct rtc_time *rt; 898d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{ 899d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, " 900d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath "tm_mday=%d, tm_mon=%d, tm_year=%d, ", 901d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_sec, rt->tm_min, rt->tm_hour, 902d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_mday, rt->tm_mon, rt->tm_year); 903d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (!abbrev(tcp)) 904d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}", 905d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_wday, rt->tm_yday, rt->tm_isdst); 906d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else 907d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("...}"); 908d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath} 909d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath 910d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathint 911d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathrtc_ioctl(tcp, code, arg) 912d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstruct tcb *tcp; 913d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong code; 914d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathlong arg; 915d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{ 916d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath switch (code) { 917d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_ALM_SET: 918d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_SET_TIME: 919d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) { 920d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_time rt; 921d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (umove(tcp, arg, &rt) < 0) 922d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 923d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 924d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", "); 925d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &rt); 926d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 927d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 928d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 929d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_ALM_READ: 930d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_RD_TIME: 931d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) { 932d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_time rt; 933d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (syserror(tcp) || umove(tcp, arg, &rt) < 0) 934d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 935d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 936d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", "); 937d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &rt); 938d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 939d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 940d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 941d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_IRQP_SET: 942d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_EPOCH_SET: 943d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) 944d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %lu", arg); 945d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 946d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_IRQP_READ: 947d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_EPOCH_READ: 948d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) 949d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %lu", arg); 950d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 951d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_WKALM_SET: 952d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) { 953d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_wkalrm wk; 954d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (umove(tcp, arg, &wk) < 0) 955d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 956d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 957d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", {enabled=%d, pending=%d, ", 958d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath wk.enabled, wk.pending); 959d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &wk.time); 960d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("}"); 961d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 962d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 963d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 964d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_WKALM_RD: 965d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) { 966d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_wkalrm wk; 967d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (syserror(tcp) || umove(tcp, arg, &wk) < 0) 968d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 969d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 970d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", {enabled=%d, pending=%d, ", 971d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath wk.enabled, wk.pending); 972d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &wk.time); 973d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("}"); 974d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 975d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 976d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 977d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath default: 978d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) 979d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 980d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 981d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 982d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath return 1; 983d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath} 984e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 985e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#ifndef TFD_TIMER_ABSTIME 986e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#define TFD_TIMER_ABSTIME (1 << 0) 987e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#endif 988e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 989e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathstatic const struct xlat timerfdflags[] = { 990e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath { TFD_TIMER_ABSTIME, "TFD_TIMER_ABSTIME" }, 991e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath { 0, NULL } 992e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath}; 993e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 994e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathint 995e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathsys_timerfd(tcp) 996e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathstruct tcb *tcp; 997e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath{ 998e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath if (entering(tcp)) { 999e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath /* It does not matter that the kernel uses itimerspec. */ 1000e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf("%ld, ", tcp->u_arg[0]); 1001e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printxval(clocknames, tcp->u_arg[1], "CLOCK_???"); 1002e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf(", "); 1003e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printflags(timerfdflags, tcp->u_arg[2], "TFD_???"); 1004e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf(", "); 1005e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printitv(tcp, tcp->u_arg[3]); 1006e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 1007e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath return 0; 1008e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath} 1009de328e684f86405d85881cdc489b88a27332d256Roland McGrath 1010de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 1011de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_create(struct tcb *tcp) 1012de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 1013de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 1014de328e684f86405d85881cdc489b88a27332d256Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 1015de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1016de328e684f86405d85881cdc489b88a27332d256Roland McGrath printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); 1017de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 1018de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 1019de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 1020de328e684f86405d85881cdc489b88a27332d256Roland McGrath 1021de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 1022de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_settime(struct tcb *tcp) 1023de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 1024de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 1025de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf("%ld, ", tcp->u_arg[0]); 1026de328e684f86405d85881cdc489b88a27332d256Roland McGrath printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); 1027de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1028de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[2]); 1029de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1030de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[3]); 1031de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 1032de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 1033de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 1034de328e684f86405d85881cdc489b88a27332d256Roland McGrath 1035de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 1036de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_gettime(struct tcb *tcp) 1037de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 1038de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 1039de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf("%ld, ", tcp->u_arg[0]); 1040de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1041de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[1]); 1042de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 1043de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 1044de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 1045de328e684f86405d85881cdc489b88a27332d256Roland McGrath 104676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */ 1047