Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 1991, 1992 Paul Kranenburg <pk@cs.few.eur.nl> |
| 3 | * Copyright (c) 1993 Branko Lankester <branko@hacktic.nl> |
| 4 | * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com> |
| 5 | * All rights reserved. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * 3. The name of the author may not be used to endorse or promote products |
| 16 | * derived from this software without specific prior written permission. |
| 17 | * |
| 18 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 19 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 20 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 21 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 22 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 23 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 24 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 25 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 26 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 27 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 28 | */ |
| 29 | |
| 30 | #include "defs.h" |
Mike Frysinger | f1639d8 | 2014-12-30 19:08:50 -0500 | [diff] [blame] | 31 | #include <fcntl.h> |
Dmitry V. Levin | 0e946ab | 2015-07-17 23:56:54 +0000 | [diff] [blame] | 32 | #include <signal.h> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 33 | #include <linux/version.h> |
Wichert Akkerman | d856b99 | 2000-10-13 12:47:12 +0000 | [diff] [blame] | 34 | #include <sys/timex.h> |
Roland McGrath | 6afc565 | 2007-07-24 01:57:11 +0000 | [diff] [blame] | 35 | |
| 36 | #ifndef UTIME_NOW |
| 37 | #define UTIME_NOW ((1l << 30) - 1l) |
| 38 | #endif |
| 39 | #ifndef UTIME_OMIT |
| 40 | #define UTIME_OMIT ((1l << 30) - 2l) |
| 41 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 42 | |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 43 | #if SUPPORTED_PERSONALITIES > 1 |
| 44 | # if defined X86_64 || defined X32 |
| 45 | # define current_time_t_is_compat (current_personality == 1) |
| 46 | # else |
| 47 | # define current_time_t_is_compat (current_wordsize == 4) |
| 48 | # endif |
Dmitry V. Levin | f9b455c | 2015-08-18 13:25:36 +0000 | [diff] [blame] | 49 | # define current_time_t_is_int32 current_time_t_is_compat |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 50 | #else |
| 51 | # define current_time_t_is_compat 0 |
Dmitry V. Levin | f9b455c | 2015-08-18 13:25:36 +0000 | [diff] [blame] | 52 | # define current_time_t_is_int32 (sizeof(time_t) == 4) |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 53 | #endif |
| 54 | |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 55 | struct timeval32 |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 56 | { |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 57 | u_int32_t tv_sec, tv_usec; |
| 58 | }; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 59 | |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 60 | static void |
| 61 | tprint_timeval32(struct tcb *tcp, const struct timeval32 *tv) |
| 62 | { |
| 63 | tprintf("{%u, %u}", tv->tv_sec, tv->tv_usec); |
| 64 | } |
| 65 | |
| 66 | static void |
| 67 | tprint_timeval(struct tcb *tcp, const struct timeval *tv) |
| 68 | { |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 69 | tprintf("{%ju, %ju}", (uintmax_t) tv->tv_sec, (uintmax_t) tv->tv_usec); |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 70 | } |
| 71 | |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 72 | void |
Roland McGrath | 6afc565 | 2007-07-24 01:57:11 +0000 | [diff] [blame] | 73 | printtv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness, int special) |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 74 | { |
Denys Vlasenko | a1d541e | 2012-01-20 11:04:04 +0100 | [diff] [blame] | 75 | char buf[TIMEVAL_TEXT_BUFSIZE]; |
| 76 | sprinttv(buf, tcp, addr, bitness, special); |
| 77 | tprints(buf); |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 78 | } |
Wichert Akkerman | 221f54f | 1999-11-18 17:26:45 +0000 | [diff] [blame] | 79 | |
Dmitry V. Levin | ee21a5b | 2014-12-26 23:55:38 +0000 | [diff] [blame] | 80 | static char * |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 81 | do_sprinttv(char *buf, const uintmax_t sec, const uintmax_t usec, |
Dmitry V. Levin | ee21a5b | 2014-12-26 23:55:38 +0000 | [diff] [blame] | 82 | const int special) |
| 83 | { |
| 84 | if (special) { |
| 85 | switch (usec) { |
| 86 | case UTIME_NOW: |
| 87 | return stpcpy(buf, "UTIME_NOW"); |
| 88 | case UTIME_OMIT: |
| 89 | return stpcpy(buf, "UTIME_OMIT"); |
| 90 | } |
| 91 | } |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 92 | return buf + sprintf(buf, "{%ju, %ju}", sec, usec); |
Dmitry V. Levin | ee21a5b | 2014-12-26 23:55:38 +0000 | [diff] [blame] | 93 | } |
| 94 | |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 95 | char * |
Denys Vlasenko | a1d541e | 2012-01-20 11:04:04 +0100 | [diff] [blame] | 96 | sprinttv(char *buf, struct tcb *tcp, long addr, enum bitness_t bitness, int special) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 97 | { |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 98 | if (addr == 0) |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 99 | return stpcpy(buf, "NULL"); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 100 | |
Dmitry V. Levin | 9f70273 | 2015-07-16 16:22:07 +0000 | [diff] [blame] | 101 | if (!verbose(tcp) || (exiting(tcp) && syserror(tcp))) |
Denys Vlasenko | b9c7ae6 | 2011-09-01 11:40:40 +0200 | [diff] [blame] | 102 | return buf + sprintf(buf, "%#lx", addr); |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 103 | |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 104 | if (bitness == BITNESS_32 || current_time_t_is_compat) |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 105 | { |
| 106 | struct timeval32 tv; |
| 107 | |
Dmitry V. Levin | ee21a5b | 2014-12-26 23:55:38 +0000 | [diff] [blame] | 108 | if (umove(tcp, addr, &tv) >= 0) |
| 109 | return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special); |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 110 | } else { |
| 111 | struct timeval tv; |
| 112 | |
Dmitry V. Levin | ee21a5b | 2014-12-26 23:55:38 +0000 | [diff] [blame] | 113 | if (umove(tcp, addr, &tv) >= 0) |
| 114 | return do_sprinttv(buf, tv.tv_sec, tv.tv_usec, special); |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 115 | } |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 116 | |
Dmitry V. Levin | 9f70273 | 2015-07-16 16:22:07 +0000 | [diff] [blame] | 117 | return buf + sprintf(buf, "%#lx", addr); |
Dmitry V. Levin | a7945a3 | 2006-12-13 17:10:11 +0000 | [diff] [blame] | 118 | } |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 119 | |
Denys Vlasenko | a1d541e | 2012-01-20 11:04:04 +0100 | [diff] [blame] | 120 | void |
| 121 | print_timespec(struct tcb *tcp, long addr) |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 122 | { |
Denys Vlasenko | a1d541e | 2012-01-20 11:04:04 +0100 | [diff] [blame] | 123 | char buf[TIMESPEC_TEXT_BUFSIZE]; |
| 124 | sprint_timespec(buf, tcp, addr); |
| 125 | tprints(buf); |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 126 | } |
| 127 | |
Denys Vlasenko | a1d541e | 2012-01-20 11:04:04 +0100 | [diff] [blame] | 128 | void |
| 129 | sprint_timespec(char *buf, struct tcb *tcp, long addr) |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 130 | { |
| 131 | if (addr == 0) |
| 132 | strcpy(buf, "NULL"); |
| 133 | else if (!verbose(tcp)) |
| 134 | sprintf(buf, "%#lx", addr); |
| 135 | else { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 136 | int rc; |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 137 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 138 | #if SUPPORTED_PERSONALITIES > 1 |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 139 | if (current_time_t_is_compat) { |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 140 | struct timeval32 tv; |
| 141 | |
Denys Vlasenko | 5d64581 | 2011-08-20 12:48:18 +0200 | [diff] [blame] | 142 | rc = umove(tcp, addr, &tv); |
| 143 | if (rc >= 0) |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 144 | sprintf(buf, "{%u, %u}", |
| 145 | tv.tv_sec, tv.tv_usec); |
| 146 | } else |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 147 | #endif |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 148 | { |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 149 | struct timespec ts; |
| 150 | |
Denys Vlasenko | 5d64581 | 2011-08-20 12:48:18 +0200 | [diff] [blame] | 151 | rc = umove(tcp, addr, &ts); |
| 152 | if (rc >= 0) |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 153 | sprintf(buf, "{%ju, %ju}", |
| 154 | (uintmax_t) ts.tv_sec, |
| 155 | (uintmax_t) ts.tv_nsec); |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 156 | } |
Roland McGrath | 6bc09da | 2007-11-01 21:50:54 +0000 | [diff] [blame] | 157 | if (rc < 0) |
| 158 | strcpy(buf, "{...}"); |
| 159 | } |
| 160 | } |
| 161 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 162 | SYS_FUNC(time) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 163 | { |
| 164 | if (exiting(tcp)) { |
Dmitry V. Levin | f9b455c | 2015-08-18 13:25:36 +0000 | [diff] [blame] | 165 | if (current_time_t_is_int32) |
| 166 | printnum_int(tcp, tcp->u_arg[0], "%d"); |
| 167 | else |
| 168 | printnum_int64(tcp, tcp->u_arg[0], "%" PRId64); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 169 | } |
| 170 | return 0; |
| 171 | } |
| 172 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 173 | SYS_FUNC(gettimeofday) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 174 | { |
| 175 | if (exiting(tcp)) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 176 | printtv(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 177 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 178 | printtv(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 179 | } |
| 180 | return 0; |
| 181 | } |
| 182 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 183 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 184 | SYS_FUNC(osf_gettimeofday) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 185 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 186 | if (exiting(tcp)) { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 187 | printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 188 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 189 | printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 190 | } |
| 191 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 192 | } |
| 193 | #endif |
| 194 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 195 | SYS_FUNC(settimeofday) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 196 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 197 | printtv(tcp, tcp->u_arg[0]); |
| 198 | tprints(", "); |
| 199 | printtv(tcp, tcp->u_arg[1]); |
| 200 | |
| 201 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 202 | } |
| 203 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 204 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 205 | SYS_FUNC(osf_settimeofday) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 206 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 207 | printtv_bitness(tcp, tcp->u_arg[0], BITNESS_32, 0); |
| 208 | tprints(", "); |
| 209 | printtv_bitness(tcp, tcp->u_arg[1], BITNESS_32, 0); |
| 210 | |
| 211 | return RVAL_DECODED; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 212 | } |
| 213 | #endif |
| 214 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 215 | SYS_FUNC(adjtime) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 216 | { |
| 217 | if (entering(tcp)) { |
| 218 | printtv(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 219 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 220 | } else { |
Dmitry V. Levin | 9f70273 | 2015-07-16 16:22:07 +0000 | [diff] [blame] | 221 | printtv(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 222 | } |
| 223 | return 0; |
| 224 | } |
| 225 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 226 | SYS_FUNC(nanosleep) |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 227 | { |
| 228 | if (entering(tcp)) { |
| 229 | print_timespec(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 230 | tprints(", "); |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 231 | } else { |
Denys Vlasenko | 64acaa1 | 2012-01-28 02:29:36 +0100 | [diff] [blame] | 232 | /* Second (returned) timespec is only significant |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 233 | * if syscall was interrupted. On success, we print |
| 234 | * only its address, since kernel doesn't modify it, |
| 235 | * and printing the value may show uninitialized data. |
Denys Vlasenko | 64acaa1 | 2012-01-28 02:29:36 +0100 | [diff] [blame] | 236 | */ |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 237 | switch (tcp->u_error) { |
| 238 | default: |
| 239 | /* Not interrupted (slept entire interval) */ |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 240 | printaddr(tcp->u_arg[1]); |
| 241 | break; |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 242 | case ERESTARTSYS: |
| 243 | case ERESTARTNOINTR: |
| 244 | case ERESTARTNOHAND: |
| 245 | case ERESTART_RESTARTBLOCK: |
| 246 | /* Interrupted */ |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 247 | print_timespec(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 248 | } |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 249 | } |
| 250 | return 0; |
| 251 | } |
| 252 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 253 | #include "xlat/itimer_which.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 254 | |
| 255 | static void |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 256 | printitv_bitness(struct tcb *tcp, long addr, enum bitness_t bitness) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 257 | { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 258 | if (bitness == BITNESS_32 || current_time_t_is_compat) { |
| 259 | struct { |
| 260 | struct timeval32 it_interval, it_value; |
| 261 | } itv; |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 262 | |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 263 | if (!umove_or_printaddr(tcp, addr, &itv)) { |
| 264 | tprints("{it_interval="); |
| 265 | tprint_timeval32(tcp, &itv.it_interval); |
| 266 | tprints(", it_value="); |
| 267 | tprint_timeval32(tcp, &itv.it_value); |
| 268 | tprints("}"); |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 269 | } |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 270 | } else { |
| 271 | struct itimerval itv; |
| 272 | |
| 273 | if (!umove_or_printaddr(tcp, addr, &itv)) { |
| 274 | tprints("{it_interval="); |
| 275 | tprint_timeval(tcp, &itv.it_interval); |
| 276 | tprints(", it_value="); |
| 277 | tprint_timeval(tcp, &itv.it_value); |
| 278 | tprints("}"); |
| 279 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 280 | } |
| 281 | } |
| 282 | |
Dmitry V. Levin | 1cad25d | 2006-12-13 17:14:36 +0000 | [diff] [blame] | 283 | #define printitv(tcp, addr) \ |
| 284 | printitv_bitness((tcp), (addr), BITNESS_CURRENT) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 285 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 286 | SYS_FUNC(getitimer) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 287 | { |
| 288 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 289 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 290 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 291 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 292 | printitv(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 293 | } |
| 294 | return 0; |
| 295 | } |
| 296 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 297 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 298 | SYS_FUNC(osf_getitimer) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 299 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 300 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 301 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 302 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 303 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 304 | printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 305 | } |
| 306 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 307 | } |
| 308 | #endif |
| 309 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 310 | SYS_FUNC(setitimer) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 311 | { |
| 312 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 313 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 314 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 315 | printitv(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 316 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 317 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 318 | printitv(tcp, tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 319 | } |
| 320 | return 0; |
| 321 | } |
| 322 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 323 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 324 | SYS_FUNC(osf_setitimer) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 325 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 326 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 327 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 328 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 329 | printitv_bitness(tcp, tcp->u_arg[1], BITNESS_32); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 330 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 331 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 332 | printitv_bitness(tcp, tcp->u_arg[2], BITNESS_32); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 333 | } |
| 334 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 335 | } |
| 336 | #endif |
| 337 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 338 | #include "xlat/adjtimex_modes.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 339 | #include "xlat/adjtimex_status.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 340 | #include "xlat/adjtimex_state.h" |
Dmitry V. Levin | 1a684d6 | 2006-12-13 17:42:32 +0000 | [diff] [blame] | 341 | |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 342 | #if SUPPORTED_PERSONALITIES > 1 |
| 343 | static int |
| 344 | tprint_timex32(struct tcb *tcp, long addr) |
| 345 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 346 | struct { |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 347 | unsigned int modes; |
| 348 | int offset; |
| 349 | int freq; |
| 350 | int maxerror; |
| 351 | int esterror; |
| 352 | int status; |
| 353 | int constant; |
| 354 | int precision; |
| 355 | int tolerance; |
| 356 | struct timeval32 time; |
| 357 | int tick; |
| 358 | int ppsfreq; |
| 359 | int jitter; |
| 360 | int shift; |
| 361 | int stabil; |
| 362 | int jitcnt; |
| 363 | int calcnt; |
| 364 | int errcnt; |
| 365 | int stbcnt; |
| 366 | } tx; |
| 367 | |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 368 | if (umove_or_printaddr(tcp, addr, &tx)) |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 369 | return -1; |
| 370 | |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 371 | tprints("{modes="); |
Dmitry V. Levin | 71d7089 | 2007-01-13 11:17:38 +0000 | [diff] [blame] | 372 | printflags(adjtimex_modes, tx.modes, "ADJ_???"); |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 373 | tprintf(", offset=%d, freq=%d, maxerror=%d, ", |
| 374 | tx.offset, tx.freq, tx.maxerror); |
| 375 | tprintf("esterror=%u, status=", tx.esterror); |
| 376 | printflags(adjtimex_status, tx.status, "STA_???"); |
| 377 | tprintf(", constant=%d, precision=%u, ", |
| 378 | tx.constant, tx.precision); |
| 379 | tprintf("tolerance=%d, time=", tx.tolerance); |
| 380 | tprint_timeval32(tcp, &tx.time); |
| 381 | tprintf(", tick=%d, ppsfreq=%d, jitter=%d", |
| 382 | tx.tick, tx.ppsfreq, tx.jitter); |
| 383 | tprintf(", shift=%d, stabil=%d, jitcnt=%d", |
| 384 | tx.shift, tx.stabil, tx.jitcnt); |
| 385 | tprintf(", calcnt=%d, errcnt=%d, stbcnt=%d", |
| 386 | tx.calcnt, tx.errcnt, tx.stbcnt); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 387 | tprints("}"); |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 388 | return 0; |
| 389 | } |
| 390 | #endif /* SUPPORTED_PERSONALITIES > 1 */ |
| 391 | |
| 392 | static int |
| 393 | tprint_timex(struct tcb *tcp, long addr) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 394 | { |
Dmitry V. Levin | 1a684d6 | 2006-12-13 17:42:32 +0000 | [diff] [blame] | 395 | struct timex tx; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 396 | |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 397 | #if SUPPORTED_PERSONALITIES > 1 |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 398 | if (current_time_t_is_compat) |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 399 | return tprint_timex32(tcp, addr); |
| 400 | #endif |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 401 | if (umove_or_printaddr(tcp, addr, &tx)) |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 402 | return -1; |
| 403 | |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 404 | tprints("{modes="); |
Dmitry V. Levin | 71d7089 | 2007-01-13 11:17:38 +0000 | [diff] [blame] | 405 | printflags(adjtimex_modes, tx.modes, "ADJ_???"); |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 406 | tprintf(", offset=%jd, freq=%jd, maxerror=%ju, esterror=%ju, status=", |
| 407 | (intmax_t) tx.offset, (intmax_t) tx.freq, |
| 408 | (uintmax_t) tx.maxerror, (uintmax_t) tx.esterror); |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 409 | printflags(adjtimex_status, tx.status, "STA_???"); |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 410 | tprintf(", constant=%jd, precision=%ju, tolerance=%jd, time=", |
| 411 | (intmax_t) tx.constant, (uintmax_t) tx.precision, |
| 412 | (intmax_t) tx.tolerance); |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 413 | tprint_timeval(tcp, &tx.time); |
Dmitry V. Levin | e61086f | 2015-02-27 21:46:42 +0000 | [diff] [blame] | 414 | tprintf(", tick=%jd, ppsfreq=%jd, jitter=%jd", |
| 415 | (intmax_t) tx.tick, (intmax_t) tx.ppsfreq, (intmax_t) tx.jitter); |
| 416 | tprintf(", shift=%d, stabil=%jd, jitcnt=%jd", |
| 417 | tx.shift, (intmax_t) tx.stabil, (intmax_t) tx.jitcnt); |
| 418 | tprintf(", calcnt=%jd, errcnt=%jd, stbcnt=%jd", |
| 419 | (intmax_t) tx.calcnt, (intmax_t) tx.errcnt, (intmax_t) tx.stbcnt); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 420 | tprints("}"); |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 421 | return 0; |
| 422 | } |
| 423 | |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 424 | static int |
| 425 | do_adjtimex(struct tcb *tcp, long addr) |
| 426 | { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 427 | if (tprint_timex(tcp, addr)) |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 428 | return 0; |
| 429 | tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval); |
| 430 | if (tcp->auxstr) |
| 431 | return RVAL_STR; |
| 432 | return 0; |
| 433 | } |
| 434 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 435 | SYS_FUNC(adjtimex) |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 436 | { |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 437 | if (exiting(tcp)) |
| 438 | return do_adjtimex(tcp, tcp->u_arg[0]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 439 | return 0; |
| 440 | } |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 441 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 442 | #include "xlat/clockflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 443 | #include "xlat/clocknames.h" |
Roland McGrath | 54a4edd | 2004-08-31 06:52:45 +0000 | [diff] [blame] | 444 | |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 445 | static void |
| 446 | printclockname(int clockid) |
| 447 | { |
| 448 | #ifdef CLOCKID_TO_FD |
Dmitry V. Levin | d35bdca | 2014-04-26 18:10:19 +0000 | [diff] [blame] | 449 | # include "xlat/cpuclocknames.h" |
| 450 | |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 451 | if (clockid < 0) { |
| 452 | if ((clockid & CLOCKFD_MASK) == CLOCKFD) |
| 453 | tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid)); |
| 454 | else { |
| 455 | if(CPUCLOCK_PERTHREAD(clockid)) |
| 456 | tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); |
| 457 | else |
| 458 | tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); |
| 459 | printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???"); |
| 460 | tprints(")"); |
| 461 | } |
| 462 | } |
| 463 | else |
| 464 | #endif |
| 465 | printxval(clocknames, clockid, "CLOCK_???"); |
| 466 | } |
| 467 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 468 | SYS_FUNC(clock_settime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 469 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 470 | printclockname(tcp->u_arg[0]); |
| 471 | tprints(", "); |
| 472 | printtv(tcp, tcp->u_arg[1]); |
| 473 | |
| 474 | return RVAL_DECODED; |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 475 | } |
| 476 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 477 | SYS_FUNC(clock_gettime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 478 | { |
| 479 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 480 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 481 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 482 | } else { |
Dmitry V. Levin | 9f70273 | 2015-07-16 16:22:07 +0000 | [diff] [blame] | 483 | printtv(tcp, tcp->u_arg[1]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 484 | } |
| 485 | return 0; |
| 486 | } |
| 487 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 488 | SYS_FUNC(clock_nanosleep) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 489 | { |
| 490 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 491 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 492 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 493 | printflags(clockflags, tcp->u_arg[1], "TIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 494 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 495 | printtv(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 496 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 497 | } else { |
Dmitry V. Levin | 9f70273 | 2015-07-16 16:22:07 +0000 | [diff] [blame] | 498 | printtv(tcp, tcp->u_arg[3]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 499 | } |
| 500 | return 0; |
| 501 | } |
| 502 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 503 | SYS_FUNC(clock_adjtime) |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 504 | { |
| 505 | if (exiting(tcp)) |
| 506 | return do_adjtimex(tcp, tcp->u_arg[1]); |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 507 | printclockname(tcp->u_arg[0]); |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 508 | tprints(", "); |
| 509 | return 0; |
| 510 | } |
| 511 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 512 | SYS_FUNC(timer_create) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 513 | { |
| 514 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 515 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 516 | tprints(", "); |
Dmitry V. Levin | 6f950cc | 2015-09-16 16:31:43 +0000 | [diff] [blame^] | 517 | print_sigevent(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 518 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 519 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 520 | printnum_int(tcp, tcp->u_arg[2], "%d"); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 521 | } |
| 522 | return 0; |
| 523 | } |
| 524 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 525 | SYS_FUNC(timer_settime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 526 | { |
| 527 | if (entering(tcp)) { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 528 | tprintf("%d, ", (int) tcp->u_arg[0]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 529 | printflags(clockflags, tcp->u_arg[1], "TIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 530 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 531 | printitv(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 532 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 533 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 534 | printitv(tcp, tcp->u_arg[3]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 535 | } |
| 536 | return 0; |
| 537 | } |
| 538 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 539 | SYS_FUNC(timer_gettime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 540 | { |
| 541 | if (entering(tcp)) { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 542 | tprintf("%d, ", (int) tcp->u_arg[0]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 543 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 544 | printitv(tcp, tcp->u_arg[1]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 545 | } |
| 546 | return 0; |
| 547 | } |
Roland McGrath | d83c50b | 2004-10-06 22:27:43 +0000 | [diff] [blame] | 548 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 549 | #include "xlat/timerfdflags.h" |
Roland McGrath | e466234 | 2007-08-02 01:25:34 +0000 | [diff] [blame] | 550 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 551 | SYS_FUNC(timerfd) |
Roland McGrath | e466234 | 2007-08-02 01:25:34 +0000 | [diff] [blame] | 552 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 553 | /* It does not matter that the kernel uses itimerspec. */ |
| 554 | tprintf("%ld, ", tcp->u_arg[0]); |
| 555 | printclockname(tcp->u_arg[0]); |
| 556 | tprints(", "); |
| 557 | printflags(timerfdflags, tcp->u_arg[2], "TFD_???"); |
| 558 | tprints(", "); |
| 559 | printitv(tcp, tcp->u_arg[3]); |
| 560 | |
Dmitry V. Levin | 07c878a | 2015-08-02 01:37:19 +0000 | [diff] [blame] | 561 | return RVAL_DECODED | RVAL_FD; |
Roland McGrath | e466234 | 2007-08-02 01:25:34 +0000 | [diff] [blame] | 562 | } |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 563 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 564 | SYS_FUNC(timerfd_create) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 565 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 566 | printclockname(tcp->u_arg[0]); |
| 567 | tprints(", "); |
| 568 | printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); |
| 569 | |
Dmitry V. Levin | 07c878a | 2015-08-02 01:37:19 +0000 | [diff] [blame] | 570 | return RVAL_DECODED | RVAL_FD; |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 571 | } |
| 572 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 573 | SYS_FUNC(timerfd_settime) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 574 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 575 | printfd(tcp, tcp->u_arg[0]); |
| 576 | tprints(", "); |
| 577 | printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); |
| 578 | tprints(", "); |
| 579 | printitv(tcp, tcp->u_arg[2]); |
| 580 | tprints(", "); |
| 581 | printitv(tcp, tcp->u_arg[3]); |
| 582 | |
| 583 | return RVAL_DECODED; |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 584 | } |
| 585 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 586 | SYS_FUNC(timerfd_gettime) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 587 | { |
| 588 | if (entering(tcp)) { |
Dmitry V. Levin | 3138213 | 2011-03-04 05:08:02 +0300 | [diff] [blame] | 589 | printfd(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 590 | tprints(", "); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 591 | } else { |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 592 | printitv(tcp, tcp->u_arg[1]); |
| 593 | } |
| 594 | return 0; |
| 595 | } |