time.c revision 5d64581e106f47c474707001f924ee15ef22830b
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); 731d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else { 741d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko int rc; 7576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 76a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (bitness == BITNESS_32 77a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 78a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin || personality_wordsize[current_personality] == 4 79a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#endif 80a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin ) 81a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 82a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval32 tv; 83a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 845d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 855d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 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 } 951d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } else { 96a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval tv; 97a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 985d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 995d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 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 if (rc < 0) 111a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin tprintf("{...}"); 112a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 113a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin} 114221f54f721a2f74e629bb70e34888205f68e95ccWichert Akkerman 115f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanvoid 116a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levinsprinttv(struct tcb *tcp, long addr, enum bitness_t bitness, char *buf) 117f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 118a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (addr == 0) 119a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin strcpy(buf, "NULL"); 120a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin else if (!verbose(tcp)) 121a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "%#lx", addr); 1221d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else { 1231d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko int rc; 124a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 125a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (bitness == BITNESS_32 126a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 127a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin || personality_wordsize[current_personality] == 4 128f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 129a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin ) 130a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin { 131a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval32 tv; 132a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 1335d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 1345d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 135a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "{%u, %u}", 136a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin tv.tv_sec, tv.tv_usec); 1371d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } else { 138a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin struct timeval tv; 139a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin 1405d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 1415d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 142a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin sprintf(buf, "{%lu, %lu}", 143a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin (unsigned long) tv.tv_sec, 144a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin (unsigned long) tv.tv_usec); 145a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 146a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin if (rc < 0) 147a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin strcpy(buf, "{...}"); 148a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin } 149a7945a3d4e144674a8dd1d885e7086bc274e391bDmitry V. Levin} 150f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 1511d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenkovoid print_timespec(struct tcb *tcp, long addr) 1526bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{ 1536bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (addr == 0) 1546bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("NULL"); 1556bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else if (!verbose(tcp)) 1566bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("%#lx", addr); 1576bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else { 1581d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko int rc; 1596bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1606bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 1611d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (personality_wordsize[current_personality] == 4) { 1626bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timeval32 tv; 1636bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1645d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 1655d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 1666bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{%u, %u}", 1676bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tv.tv_sec, tv.tv_usec); 1686bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } else 1696bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 1701d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko { 1716bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timespec ts; 1726bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1735d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &ts); 1745d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 1756bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{%lu, %lu}", 1766bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_sec, 1776bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_nsec); 1786bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 1796bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (rc < 0) 1806bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tprintf("{...}"); 1816bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 1826bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath} 1836bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1841d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenkovoid sprint_timespec(char *buf, struct tcb *tcp, long addr) 1856bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath{ 1866bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (addr == 0) 1876bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath strcpy(buf, "NULL"); 1886bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else if (!verbose(tcp)) 1896bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "%#lx", addr); 1906bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath else { 1911d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko int rc; 1926bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1936bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 1941d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (personality_wordsize[current_personality] == 4) { 1956bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timeval32 tv; 1966bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 1975d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &tv); 1985d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 1996bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "{%u, %u}", 2006bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath tv.tv_sec, tv.tv_usec); 2016bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } else 2026bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath#endif 2031d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko { 2046bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath struct timespec ts; 2056bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 2065d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &ts); 2075d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) 2086bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath sprintf(buf, "{%lu, %lu}", 2096bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_sec, 2106bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath (unsigned long) ts.tv_nsec); 2116bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 2126bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath if (rc < 0) 2136bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath strcpy(buf, "{...}"); 2146bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath } 2156bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath} 2166bc09daaf6b249b35dec4283b165b1f39e6d6a0dRoland McGrath 21776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 2181201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_time(struct tcb *tcp) 21976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 22176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 22276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printnum(tcp, tcp->u_arg[0], "%ld"); 22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SVR4 */ 22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 2291201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_stime(struct tcb *tcp) 23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printnum(tcp, tcp->u_arg[0], "%ld"); 23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 23776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 2381201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_gettimeofday(struct tcb *tcp) 23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 24076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) { 24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx, %#lx", 24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tcp->u_arg[0], tcp->u_arg[1]); 24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */ 25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 255f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 256f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 257f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 2581201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_gettimeofday(struct tcb *tcp) 259f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 2601d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (exiting(tcp)) { 2611d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (syserror(tcp)) { 2621d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf("%#lx, %#lx", tcp->u_arg[0], tcp->u_arg[1]); 2631d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko return 0; 2641d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } 2651d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); 266f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4 2671d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf(", "); 2681d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); 269f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */ 2701d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } 2711d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko return 0; 272f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 273f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 274f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 27576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 2761201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_settimeofday(struct tcb *tcp) 27776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 27876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 27976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 28076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef SVR4 28176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 28276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* !SVR4 */ 28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 28576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 288f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 289f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 2901201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_settimeofday(struct tcb *tcp) 291f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 2921d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (entering(tcp)) { 2931d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); 294f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifndef SVR4 2951d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf(", "); 2961d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); 297f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif /* !SVR4 */ 2981d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } 2991d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko return 0; 300f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 301f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 302f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 30376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 3041201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_adjtime(struct tcb *tcp) 30576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 30676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 30776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[0]); 30876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 30976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 31076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 31176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 31276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 31376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printtv(tcp, tcp->u_arg[1]); 31476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 31576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 31776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3182e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinint 3192e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levinsys_nanosleep(struct tcb *tcp) 3202e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin{ 3212e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin if (entering(tcp)) { 3222e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin print_timespec(tcp, tcp->u_arg[0]); 3232e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin tprintf(", "); 3242e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin } else { 3252e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin if (!tcp->u_arg[1] || is_restart_error(tcp)) 3262e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin print_timespec(tcp, tcp->u_arg[1]); 3272e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin else 3282e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin tprintf("%#lx", tcp->u_arg[1]); 3292e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin } 3302e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin return 0; 3312e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin} 3322e55ff4562e87f8361f0c1db5a42ee6e9ac0cc56Dmitry V. Levin 333d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat which[] = { 33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_REAL, "ITIMER_REAL" }, 33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_VIRTUAL,"ITIMER_VIRTUAL"}, 33676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { ITIMER_PROF, "ITIMER_PROF" }, 33776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman { 0, NULL }, 33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}; 33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void 3411cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levinprintitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) 34276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (addr == 0) 34476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("NULL"); 34576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else if (!verbose(tcp)) 34676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", addr); 3471d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else { 3481d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko int rc; 34976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 3501cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin if (bitness == BITNESS_32 3511cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#if defined(LINUX) && SUPPORTED_PERSONALITIES > 1 3521cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin || personality_wordsize[current_personality] == 4 3531cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#endif 3541cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin ) 3551cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin { 3561d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko struct { 3571cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin struct timeval32 it_interval, it_value; 3581cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } itv; 3591cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 3605d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &itv); 3615d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) { 3621cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{it_interval="); 3631cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval32(tcp, &itv.it_interval); 3641cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf(", it_value="); 3651cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval32(tcp, &itv.it_value); 3661cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("}"); 367e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 3681d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } else { 3691cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin struct itimerval itv; 3701cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 3715d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko rc = umove(tcp, addr, &itv); 3725d64581e106f47c474707001f924ee15ef22830bDenys Vlasenko if (rc >= 0) { 3731cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{it_interval="); 3741cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval(tcp, &itv.it_interval); 3751cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf(", it_value="); 3761cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprint_timeval(tcp, &itv.it_value); 3771cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("}"); 378e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 3791cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } 3801cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin if (rc < 0) 3811cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin tprintf("{...}"); 3821cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin } 383f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 3841cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin 3851cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin#define printitv(tcp, addr) \ 3861cad25dd44afc58a5345e704dcbe4ec0d57e58ebDmitry V. Levin printitv_bitness((tcp), (addr), BITNESS_CURRENT) 387f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 38876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 3891201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_getitimer(struct tcb *tcp) 39076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 39176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 39276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 39376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 39476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 39576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 39676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[1]); 39776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 39876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[1]); 39976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 40076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 40176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 40276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 403f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 404f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 405f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 4061201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_getitimer(struct tcb *tcp) 407f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 4081d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (entering(tcp)) { 4091d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printxval(which, tcp->u_arg[0], "ITIMER_???"); 4101d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf(", "); 4111d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } else { 4121d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (syserror(tcp)) 4131d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf("%#lx", tcp->u_arg[1]); 4141d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else 4151d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); 4161d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } 4171d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko return 0; 418f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 419f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 420f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 42176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint 4221201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_setitimer(struct tcb *tcp) 42376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 42476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (entering(tcp)) { 42576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printxval(which, tcp->u_arg[0], "ITIMER_???"); 42676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 42776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[1]); 42876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf(", "); 42976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } else { 43076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (syserror(tcp)) 43176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[2]); 43276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else 43376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman printitv(tcp, tcp->u_arg[2]); 43476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 43576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 43676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 43776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 438f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#ifdef ALPHA 439f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkermanint 4401201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_osf_setitimer(struct tcb *tcp) 441f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman{ 4421d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (entering(tcp)) { 4431d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printxval(which, tcp->u_arg[0], "ITIMER_???"); 4441d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf(", "); 4451d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); 4461d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf(", "); 4471d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } else { 4481d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko if (syserror(tcp)) 4491d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko tprintf("%#lx", tcp->u_arg[2]); 4501d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else 4511d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32); 4521d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko } 4531d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko return 0; 454f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman} 455f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman#endif 456f5eeabb156641482abd504fb98b039e1aae4ae87Wichert Akkerman 45776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef LINUX 45876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 4591a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_modes[] = { 4601a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, "0" }, 4611a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET 4621a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_OFFSET, "ADJ_OFFSET" }, 4631a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4641a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_FREQUENCY 4651a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_FREQUENCY, "ADJ_FREQUENCY" }, 4661a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4671a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_MAXERROR 4681a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_MAXERROR, "ADJ_MAXERROR" }, 4691a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4701a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_ESTERROR 4711a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_ESTERROR, "ADJ_ESTERROR" }, 4721a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4731a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_STATUS 4741a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_STATUS, "ADJ_STATUS" }, 4751a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4761a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TIMECONST 4771a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_TIMECONST, "ADJ_TIMECONST" }, 4781a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4791a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_TICK 4801a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_TICK, "ADJ_TICK" }, 4811a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4821a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef ADJ_OFFSET_SINGLESHOT 4831a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { ADJ_OFFSET_SINGLESHOT, "ADJ_OFFSET_SINGLESHOT" }, 4841a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4851a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 4861a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 4871a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 4881a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_status[] = { 4891a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PLL 4901a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PLL, "STA_PLL" }, 4911a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4921a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSFREQ 4931a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSFREQ, "STA_PPSFREQ" }, 4941a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4951a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSTIME 4961a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSTIME, "STA_PPSTIME" }, 4971a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 4981a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FLL 4991a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_FLL, "STA_FLL" }, 5001a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5011a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_INS 5021a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_INS, "STA_INS" }, 5031a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5041a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_DEL 5051a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_DEL, "STA_DEL" }, 5061a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5071a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_UNSYNC 5081a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_UNSYNC, "STA_UNSYNC" }, 5091a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5101a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_FREQHOLD 5111a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_FREQHOLD, "STA_FREQHOLD" }, 5121a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5131a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSSIGNAL 5141a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSSIGNAL, "STA_PPSSIGNAL" }, 5151a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5161a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSJITTER 5171a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSJITTER, "STA_PPSJITTER" }, 5181a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5191a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSWANDER 5201a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSWANDER, "STA_PPSWANDER" }, 5211a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5221a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_PPSERROR 5231a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_PPSERROR, "STA_PPSERROR" }, 5241a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5251a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef STA_CLOCKERR 5261a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { STA_CLOCKERR, "STA_CLOCKERR" }, 5271a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5281a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 5291a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 5301a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 5311a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levinstatic const struct xlat adjtimex_state[] = { 5321a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OK 5331a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_OK, "TIME_OK" }, 5341a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5351a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_INS 5361a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_INS, "TIME_INS" }, 5371a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5381a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_DEL 5391a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_DEL, "TIME_DEL" }, 5401a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5411a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_OOP 5421a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_OOP, "TIME_OOP" }, 5431a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5441a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_WAIT 5451a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_WAIT, "TIME_WAIT" }, 5461a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5471a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#ifdef TIME_ERROR 5481a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { TIME_ERROR, "TIME_ERROR" }, 5491a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin#endif 5501a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin { 0, NULL } 5511a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin}; 5521a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin 553165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 554165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int 555165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex32(struct tcb *tcp, long addr) 556165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{ 5571d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko struct { 558165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin unsigned int modes; 559165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int offset; 560165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int freq; 561165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int maxerror; 562165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int esterror; 563165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int status; 564165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int constant; 565165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int precision; 566165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int tolerance; 567165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin struct timeval32 time; 568165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int tick; 569165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int ppsfreq; 570165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int jitter; 571165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int shift; 572165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int stabil; 573165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int jitcnt; 574165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int calcnt; 575165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int errcnt; 576165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin int stbcnt; 577165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin } tx; 578165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 579165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (umove(tcp, addr, &tx) < 0) 580165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return -1; 581165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 582165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{modes="); 58371d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin printflags(adjtimex_modes, tx.modes, "ADJ_???"); 584165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", offset=%d, freq=%d, maxerror=%d, ", 585165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.offset, tx.freq, tx.maxerror); 586165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("esterror=%u, status=", tx.esterror); 587165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin printflags(adjtimex_status, tx.status, "STA_???"); 588165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", constant=%d, precision=%u, ", 589165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.constant, tx.precision); 590165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%d, time=", tx.tolerance); 591165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval32(tcp, &tx.time); 592165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", tick=%d, ppsfreq=%d, jitter=%d", 593165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.tick, tx.ppsfreq, tx.jitter); 594165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", shift=%d, stabil=%d, jitcnt=%d", 595165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.shift, tx.stabil, tx.jitcnt); 596165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d", 597165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.calcnt, tx.errcnt, tx.stbcnt); 598165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("}"); 599165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return 0; 600165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin} 601165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif /* SUPPORTED_PERSONALITIES > 1 */ 602165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 603165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinstatic int 604165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levintprint_timex(struct tcb *tcp, long addr) 60576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{ 6061a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin struct timex tx; 60776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman 608165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 609165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (personality_wordsize[current_personality] == 4) 610165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return tprint_timex32(tcp, addr); 611165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif 612165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin if (umove(tcp, addr, &tx) < 0) 613165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return -1; 614165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 615165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#if LINUX_VERSION_CODE < 66332 616165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{mode=%d, offset=%ld, frequency=%ld, ", 617165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.mode, tx.offset, tx.frequency); 618165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("maxerror=%ld, esterror=%lu, status=%u, ", 619165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.maxerror, tx.esterror, tx.status); 620165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("time_constant=%ld, precision=%lu, ", 621165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.time_constant, tx.precision); 622165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%ld, time=", tx.tolerance); 623165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval(tcp, &tx.time); 624165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#else 625165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("{modes="); 62671d7089055b0ce830bf13d9322f06b87d6ce47c0Dmitry V. Levin printflags(adjtimex_modes, tx.modes, "ADJ_???"); 627165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", offset=%ld, freq=%ld, maxerror=%ld, ", 628165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.offset, tx.freq, tx.maxerror); 629165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("esterror=%lu, status=", tx.esterror); 630165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin printflags(adjtimex_status, tx.status, "STA_???"); 631165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", constant=%ld, precision=%lu, ", 632165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.constant, tx.precision); 633165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("tolerance=%ld, time=", tx.tolerance); 634165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprint_timeval(tcp, &tx.time); 635165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", tick=%ld, ppsfreq=%ld, jitter=%ld", 636165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.tick, tx.ppsfreq, tx.jitter); 637165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", shift=%d, stabil=%ld, jitcnt=%ld", 638165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.shift, tx.stabil, tx.jitcnt); 639165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf(", calcnt=%ld, errcnt=%ld, stbcnt=%ld", 640165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tx.calcnt, tx.errcnt, tx.stbcnt); 641165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin#endif 642165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin tprintf("}"); 643165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin return 0; 644165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin} 645165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin 646165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinint 647165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levinsys_adjtimex(struct tcb *tcp) 648165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin{ 64976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (exiting(tcp)) { 65076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman if (tcp->u_arg[0] == 0) 65176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("NULL"); 65276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman else if (syserror(tcp) || !verbose(tcp)) 65376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("%#lx", tcp->u_arg[0]); 654165b15dbe8ca39334dd7059883c955829c95ac70Dmitry V. Levin else if (tprint_timex(tcp, tcp->u_arg[0]) < 0) 65576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman tprintf("{...}"); 65621a75347451b5178a0eb85a48042b8db0e45b318Dmitry V. Levin if (syserror(tcp)) 65721a75347451b5178a0eb85a48042b8db0e45b318Dmitry V. Levin return 0; 6581a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval); 6591a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin if (tcp->auxstr) 6601a684d6ebee655035b06facee28c83f94c7dfbb9Dmitry V. Levin return RVAL_STR; 66176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman } 66276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman return 0; 66376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman} 6641e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 665d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clockflags[] = { 6661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { TIMER_ABSTIME, "TIMER_ABSTIME" }, 6671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { 0, NULL } 6681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}; 6691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 670d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat clocknames[] = { 67155a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_REALTIME 67254a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath { CLOCK_REALTIME, "CLOCK_REALTIME" }, 67355a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif 67455a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#ifdef CLOCK_MONOTONIC 67554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath { CLOCK_MONOTONIC, "CLOCK_MONOTONIC" }, 67655a00f8092d9596a4ca619017bfba0dea2e085d1Roland McGrath#endif 677cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#ifdef CLOCK_PROCESS_CPUTIME_ID 678cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { CLOCK_PROCESS_CPUTIME_ID, "CLOCK_PROCESS_CPUTIME_ID" }, 679cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#endif 680cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#ifdef CLOCK_THREAD_CPUTIME_ID 681cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { CLOCK_THREAD_CPUTIME_ID, "CLOCK_THREAD_CPUTIME_ID" }, 682cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#endif 683cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#ifdef CLOCK_MONOTONIC_RAW 684cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { CLOCK_MONOTONIC_RAW, "CLOCK_MONOTONIC_RAW" }, 685cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#endif 686cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#ifdef CLOCK_REALTIME_COARSE 687cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { CLOCK_REALTIME_COARSE, "CLOCK_REALTIME_COARSE" }, 688cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#endif 689cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#ifdef CLOCK_MONOTONIC_COARSE 690cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { CLOCK_MONOTONIC_COARSE, "CLOCK_MONOTONIC_COARSE" }, 691cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin#endif 692cbaaf799115b2354b0db69013324f4c9ada9afcdDmitry V. Levin { 0, NULL } 69354a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath}; 69454a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath 6951e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 6961201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_settime(struct tcb *tcp) 6971e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 6981e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 69954a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 70054a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 7011e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[1]); 7021e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7031e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7051e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7061e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 7071201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_gettime(struct tcb *tcp) 7081e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7091e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 71054a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 71154a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 7121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 7131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 7141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[1]); 7151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 7161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[1]); 7171e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7181e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7191e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 7221201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_clock_nanosleep(struct tcb *tcp) 7231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 72554a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 72654a4edd69a320542ddd0dffec05dacab7443d453Roland McGrath tprintf(", "); 727b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath printflags(clockflags, tcp->u_arg[1], "TIMER_???"); 7281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 7291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[2]); 7301e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 7311e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 7321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 7331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[3]); 7341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 7351e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printtv(tcp, tcp->u_arg[3]); 7361e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 7371e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 7381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 7391e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 7401e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#ifndef SIGEV_THREAD_ID 7411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath# define SIGEV_THREAD_ID 4 7421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath#endif 743d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat sigev_value[] = { 7441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_SIGNAL+1, "SIGEV_SIGNAL" }, 7451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_NONE+1, "SIGEV_NONE" }, 7461e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_THREAD+1, "SIGEV_THREAD" }, 7471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { SIGEV_THREAD_ID+1, "SIGEV_THREAD_ID" }, 7481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath { 0, NULL } 7491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath}; 7501e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 751d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 752d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinstatic void 753d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent32(struct tcb *tcp, long arg) 754d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin{ 7551d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko struct { 756d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_value; 757d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_signo; 758d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int sigev_notify; 759d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 7601d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko union { 761d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int tid; 7621d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko struct { 763d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin int function, attribute; 764d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } thread; 765d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } un; 766d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } sev; 767d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 768d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (umove(tcp, arg, &sev) < 0) 769d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{...}"); 7701d632468c09756d3382d1a92f99a8413636e75d3Denys Vlasenko else { 771d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%#x, ", sev.sigev_value); 772d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (sev.sigev_notify == SIGEV_SIGNAL) 773d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("%s, ", signame(sev.sigev_signo)); 774d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else 775d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("%u, ", sev.sigev_signo); 776d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin printxval(sigev_value, sev.sigev_notify + 1, "SIGEV_???"); 777d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf(", "); 778d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin if (sev.sigev_notify == SIGEV_THREAD_ID) 779d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%d}", sev.un.tid); 780d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else if (sev.sigev_notify == SIGEV_THREAD) 781d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{%#x, %#x}", 782d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin sev.un.thread.function, 783d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin sev.un.thread.attribute); 784d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin else 785d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("{...}"); 786d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin tprintf("}"); 787d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } 788d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin} 789d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif 790d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 7911e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathvoid 792d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levinprintsigevent(struct tcb *tcp, long arg) 7931e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 7941e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath struct sigevent sev; 795d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin 796d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#if SUPPORTED_PERSONALITIES > 1 7977b609d5ba0852e6c56ba311350ebd4412361777bDenys Vlasenko if (personality_wordsize[current_personality] == 4) { 798d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin printsigevent32(tcp, arg); 799d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin return; 800d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin } 801d3cb392f8520cb1a6a3d6c93febe2a2424560574Dmitry V. Levin#endif 802b63256e69bf3f1a74aadb0e14556490bc8f4ef95Denys Vlasenko if (umove(tcp, arg, &sev) < 0) 8031e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{...}"); 8041e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else { 805675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("{%p, ", sev.sigev_value.sival_ptr); 806675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath if (sev.sigev_notify == SIGEV_SIGNAL) 807675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("%s, ", signame(sev.sigev_signo)); 808675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath else 809675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf("%u, ", sev.sigev_signo); 8101e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printxval(sigev_value, sev.sigev_notify+1, "SIGEV_???"); 8111e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8121e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (sev.sigev_notify == SIGEV_THREAD_ID) 8131e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath /* _pad[0] is the _tid field which might not be 8141e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath present in the userlevel definition of the 8151e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath struct. */ 8161e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{%d}", sev._sigev_un._pad[0]); 817d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath else if (sev.sigev_notify == SIGEV_THREAD) 818d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath tprintf("{%p, %p}", sev.sigev_notify_function, 819d4c85ebbc64b1eb141b310a4634c6ca37fd352c1Roland McGrath sev.sigev_notify_attributes); 8201e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8211e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("{...}"); 8221e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("}"); 8231e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8241e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8251e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8261e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8271201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_create(struct tcb *tcp) 8281e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8291e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 830675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 831675d4a6dba13915527309c962c38f5f961ec2996Roland McGrath tprintf(", "); 8321e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printsigevent(tcp, tcp->u_arg[1]); 8331e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8341e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 835732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen int timer_id; 836ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin 837732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen if (syserror(tcp) || umove(tcp, tcp->u_arg[2], &timer_id) < 0) 8381e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[2]); 839ac518d10777f9dd95aad22939da6c867cf4c193eDmitry V. Levin else 840732f39656d933c6112a0586bbefcf8288d57bda4Andi Kleen tprintf("{%d}", timer_id); 8411e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8421e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8431e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8441e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8451e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8461201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_settime(struct tcb *tcp) 8471e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8481e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 8491e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx, ", tcp->u_arg[0]); 850b2dee13345a62c80a677f3342cd525d611fbc632Roland McGrath printflags(clockflags, tcp->u_arg[1], "TIMER_???"); 8511e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8521e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[2]); 8531e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf(", "); 8541e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 8551e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 8561e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[3]); 8571e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8581e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[3]); 8591e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8601e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8611e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 8621e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath 8631e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrathint 8641201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timer_gettime(struct tcb *tcp) 8651e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath{ 8661e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (entering(tcp)) { 8671e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx, ", tcp->u_arg[0]); 8681e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } else { 8691e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath if (syserror(tcp)) 8701e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath tprintf("%#lx", tcp->u_arg[1]); 8711e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath else 8721e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath printitv(tcp, tcp->u_arg[1]); 8731e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath } 8741e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath return 0; 8751e35679bbb8c840bd0b107c68cb187feeb3e3282Roland McGrath} 876d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath 877d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathstatic void 8781201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkoprint_rtc(struct tcb *tcp, const struct rtc_time *rt) 879d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{ 880d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("{tm_sec=%d, tm_min=%d, tm_hour=%d, " 881d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath "tm_mday=%d, tm_mon=%d, tm_year=%d, ", 882d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_sec, rt->tm_min, rt->tm_hour, 883d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_mday, rt->tm_mon, rt->tm_year); 884d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (!abbrev(tcp)) 885d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("tm_wday=%d, tm_yday=%d, tm_isdst=%d}", 886d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath rt->tm_wday, rt->tm_yday, rt->tm_isdst); 887d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else 888d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("...}"); 889d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath} 890d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath 891d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrathint 8921201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkortc_ioctl(struct tcb *tcp, long code, long arg) 893d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath{ 894d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath switch (code) { 895d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_ALM_SET: 896d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_SET_TIME: 897d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) { 898d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_time rt; 899d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (umove(tcp, arg, &rt) < 0) 900d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 901d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 902d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", "); 903d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &rt); 904d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 905d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 906d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 907d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_ALM_READ: 908d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_RD_TIME: 909d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) { 910d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_time rt; 911d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (syserror(tcp) || umove(tcp, arg, &rt) < 0) 912d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 913d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 914d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", "); 915d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &rt); 916d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 917d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 918d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 919d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_IRQP_SET: 920d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_EPOCH_SET: 921d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) 922d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %lu", arg); 923d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 924d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_IRQP_READ: 925d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_EPOCH_READ: 926d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) 927d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %lu", arg); 928d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 929d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_WKALM_SET: 930d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) { 931d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_wkalrm wk; 932d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (umove(tcp, arg, &wk) < 0) 933d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 934d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 935d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", {enabled=%d, pending=%d, ", 936d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath wk.enabled, wk.pending); 937d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &wk.time); 938d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("}"); 939d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 940d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 941d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 942d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath case RTC_WKALM_RD: 943d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (exiting(tcp)) { 944d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath struct rtc_wkalrm wk; 945d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (syserror(tcp) || umove(tcp, arg, &wk) < 0) 946d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 947d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath else { 948d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", {enabled=%d, pending=%d, ", 949d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath wk.enabled, wk.pending); 950d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath print_rtc(tcp, &wk.time); 951d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf("}"); 952d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 953d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 954d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 955d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath default: 956d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath if (entering(tcp)) 957d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath tprintf(", %#lx", arg); 958d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath break; 959d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath } 960d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath return 1; 961d83c50b8e44db2a2e19d048ab7d1e1caf1fa1996Roland McGrath} 962e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 963e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#ifndef TFD_TIMER_ABSTIME 964e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#define TFD_TIMER_ABSTIME (1 << 0) 965e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath#endif 966e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 967e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathstatic const struct xlat timerfdflags[] = { 968e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath { TFD_TIMER_ABSTIME, "TFD_TIMER_ABSTIME" }, 969e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath { 0, NULL } 970e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath}; 971e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath 972e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrathint 9731201426dd43f5b4e12dfe520e2a9c5027d33dc11Denys Vlasenkosys_timerfd(struct tcb *tcp) 974e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath{ 975e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath if (entering(tcp)) { 976e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath /* It does not matter that the kernel uses itimerspec. */ 977e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf("%ld, ", tcp->u_arg[0]); 978e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printxval(clocknames, tcp->u_arg[1], "CLOCK_???"); 979e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf(", "); 980e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printflags(timerfdflags, tcp->u_arg[2], "TFD_???"); 981e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath tprintf(", "); 982e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath printitv(tcp, tcp->u_arg[3]); 983e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath } 984e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath return 0; 985e46623403567c7dab387c8a9c6e40ae891c6ab21Roland McGrath} 986de328e684f86405d85881cdc489b88a27332d256Roland McGrath 987de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 988de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_create(struct tcb *tcp) 989de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 990de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 991de328e684f86405d85881cdc489b88a27332d256Roland McGrath printxval(clocknames, tcp->u_arg[0], "CLOCK_???"); 992de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 993de328e684f86405d85881cdc489b88a27332d256Roland McGrath printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); 994de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 995de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 996de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 997de328e684f86405d85881cdc489b88a27332d256Roland McGrath 998de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 999de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_settime(struct tcb *tcp) 1000de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 1001de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 10023138213bc9a827a372ad9f8009ebcc5d8797ce2dDmitry V. Levin printfd(tcp, tcp->u_arg[0]); 10033138213bc9a827a372ad9f8009ebcc5d8797ce2dDmitry V. Levin tprintf(", "); 1004de328e684f86405d85881cdc489b88a27332d256Roland McGrath printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); 1005de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1006de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[2]); 1007de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1008de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[3]); 1009de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 1010de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 1011de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 1012de328e684f86405d85881cdc489b88a27332d256Roland McGrath 1013de328e684f86405d85881cdc489b88a27332d256Roland McGrathint 1014de328e684f86405d85881cdc489b88a27332d256Roland McGrathsys_timerfd_gettime(struct tcb *tcp) 1015de328e684f86405d85881cdc489b88a27332d256Roland McGrath{ 1016de328e684f86405d85881cdc489b88a27332d256Roland McGrath if (entering(tcp)) { 10173138213bc9a827a372ad9f8009ebcc5d8797ce2dDmitry V. Levin printfd(tcp, tcp->u_arg[0]); 1018de328e684f86405d85881cdc489b88a27332d256Roland McGrath tprintf(", "); 1019de328e684f86405d85881cdc489b88a27332d256Roland McGrath printitv(tcp, tcp->u_arg[1]); 1020de328e684f86405d85881cdc489b88a27332d256Roland McGrath } 1021de328e684f86405d85881cdc489b88a27332d256Roland McGrath return 0; 1022de328e684f86405d85881cdc489b88a27332d256Roland McGrath} 1023de328e684f86405d85881cdc489b88a27332d256Roland McGrath 102476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* LINUX */ 1025