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 | d856b99 | 2000-10-13 12:47:12 +0000 | [diff] [blame] | 33 | #include <sys/timex.h> |
Roland McGrath | 6afc565 | 2007-07-24 01:57:11 +0000 | [diff] [blame] | 34 | |
Dmitry V. Levin | f57edf4 | 2015-09-18 16:15:49 +0000 | [diff] [blame] | 35 | static void |
| 36 | print_timezone(struct tcb *tcp, const long addr) |
| 37 | { |
| 38 | struct timezone tz; |
| 39 | |
| 40 | if (umove_or_printaddr(tcp, addr, &tz)) |
| 41 | return; |
| 42 | |
| 43 | tprintf("{tz_minuteswest=%d, tz_dsttime=%d}", |
| 44 | tz.tz_minuteswest, tz.tz_dsttime); |
| 45 | } |
| 46 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 47 | SYS_FUNC(gettimeofday) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 48 | { |
| 49 | if (exiting(tcp)) { |
Dmitry V. Levin | f1e3a32 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 50 | print_timeval(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 51 | tprints(", "); |
Dmitry V. Levin | f57edf4 | 2015-09-18 16:15:49 +0000 | [diff] [blame] | 52 | print_timezone(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 53 | } |
| 54 | return 0; |
| 55 | } |
| 56 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 57 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 58 | SYS_FUNC(osf_gettimeofday) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 59 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 60 | if (exiting(tcp)) { |
Dmitry V. Levin | f1e3a32 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 61 | print_timeval32(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 62 | tprints(", "); |
Dmitry V. Levin | f57edf4 | 2015-09-18 16:15:49 +0000 | [diff] [blame] | 63 | print_timezone(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 64 | } |
| 65 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 66 | } |
| 67 | #endif |
| 68 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 69 | SYS_FUNC(settimeofday) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 70 | { |
Dmitry V. Levin | f1e3a32 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 71 | print_timeval(tcp, tcp->u_arg[0]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 72 | tprints(", "); |
Dmitry V. Levin | f57edf4 | 2015-09-18 16:15:49 +0000 | [diff] [blame] | 73 | print_timezone(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 74 | |
| 75 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 76 | } |
| 77 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 78 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 79 | SYS_FUNC(osf_settimeofday) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 80 | { |
Dmitry V. Levin | f1e3a32 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 81 | print_timeval32(tcp, tcp->u_arg[0]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 82 | tprints(", "); |
Dmitry V. Levin | f57edf4 | 2015-09-18 16:15:49 +0000 | [diff] [blame] | 83 | print_timezone(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 84 | |
| 85 | return RVAL_DECODED; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 86 | } |
| 87 | #endif |
| 88 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 89 | SYS_FUNC(nanosleep) |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 90 | { |
| 91 | if (entering(tcp)) { |
| 92 | print_timespec(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 93 | tprints(", "); |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 94 | } else { |
Dmitry V. Levin | 9af94a2 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 95 | |
| 96 | /* |
| 97 | * Second (returned) timespec is only significant if syscall |
| 98 | * was interrupted. On success and in case of other errors we |
| 99 | * print only its address, since kernel doesn't modify it, |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 100 | * and printing the value may show uninitialized data. |
Denys Vlasenko | 64acaa1 | 2012-01-28 02:29:36 +0100 | [diff] [blame] | 101 | */ |
Dmitry V. Levin | 9af94a2 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 102 | if (is_erestart(tcp)) { |
| 103 | temporarily_clear_syserror(tcp); |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 104 | print_timespec(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 9af94a2 | 2015-09-18 01:54:59 +0000 | [diff] [blame] | 105 | restore_cleared_syserror(tcp); |
| 106 | } else { |
| 107 | printaddr(tcp->u_arg[1]); |
Denys Vlasenko | 4793221 | 2013-06-30 23:53:49 +0200 | [diff] [blame] | 108 | } |
Dmitry V. Levin | 2e55ff4 | 2008-09-03 01:02:46 +0000 | [diff] [blame] | 109 | } |
| 110 | return 0; |
| 111 | } |
| 112 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 113 | #include "xlat/itimer_which.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 114 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 115 | SYS_FUNC(getitimer) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 116 | { |
| 117 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 118 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 119 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 120 | } else { |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 121 | print_itimerval(tcp, tcp->u_arg[1]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 122 | } |
| 123 | return 0; |
| 124 | } |
| 125 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 126 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 127 | SYS_FUNC(osf_getitimer) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 128 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 129 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 130 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 131 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 132 | } else { |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 133 | print_itimerval32(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 134 | } |
| 135 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 136 | } |
| 137 | #endif |
| 138 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 139 | SYS_FUNC(setitimer) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 140 | { |
| 141 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 142 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 143 | tprints(", "); |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 144 | print_itimerval(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 145 | tprints(", "); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 146 | } else { |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 147 | print_itimerval(tcp, tcp->u_arg[2]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 148 | } |
| 149 | return 0; |
| 150 | } |
| 151 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 152 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 153 | SYS_FUNC(osf_setitimer) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 154 | { |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 155 | if (entering(tcp)) { |
Dmitry V. Levin | 297b594 | 2014-04-25 23:39:20 +0000 | [diff] [blame] | 156 | printxval(itimer_which, tcp->u_arg[0], "ITIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 157 | tprints(", "); |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 158 | print_itimerval32(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 159 | tprints(", "); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 160 | } else { |
Dmitry V. Levin | 322be80 | 2015-09-17 20:23:31 +0000 | [diff] [blame] | 161 | print_itimerval32(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 1d63246 | 2009-04-14 12:51:00 +0000 | [diff] [blame] | 162 | } |
| 163 | return 0; |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 164 | } |
| 165 | #endif |
| 166 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 167 | #include "xlat/adjtimex_state.h" |
Dmitry V. Levin | 1a684d6 | 2006-12-13 17:42:32 +0000 | [diff] [blame] | 168 | |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 169 | static int |
| 170 | do_adjtimex(struct tcb *tcp, long addr) |
| 171 | { |
Dmitry V. Levin | dad1eef | 2015-09-16 21:58:36 +0000 | [diff] [blame] | 172 | if (print_timex(tcp, addr)) |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 173 | return 0; |
| 174 | tcp->auxstr = xlookup(adjtimex_state, tcp->u_rval); |
| 175 | if (tcp->auxstr) |
| 176 | return RVAL_STR; |
| 177 | return 0; |
| 178 | } |
| 179 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 180 | SYS_FUNC(adjtimex) |
Dmitry V. Levin | 165b15d | 2006-12-13 17:43:45 +0000 | [diff] [blame] | 181 | { |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 182 | if (exiting(tcp)) |
| 183 | return do_adjtimex(tcp, tcp->u_arg[0]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 184 | return 0; |
| 185 | } |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 186 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 187 | #include "xlat/clockflags.h" |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 188 | #include "xlat/clocknames.h" |
Roland McGrath | 54a4edd | 2004-08-31 06:52:45 +0000 | [diff] [blame] | 189 | |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 190 | static void |
| 191 | printclockname(int clockid) |
| 192 | { |
| 193 | #ifdef CLOCKID_TO_FD |
Dmitry V. Levin | d35bdca | 2014-04-26 18:10:19 +0000 | [diff] [blame] | 194 | # include "xlat/cpuclocknames.h" |
| 195 | |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 196 | if (clockid < 0) { |
| 197 | if ((clockid & CLOCKFD_MASK) == CLOCKFD) |
| 198 | tprintf("FD_TO_CLOCKID(%d)", CLOCKID_TO_FD(clockid)); |
| 199 | else { |
| 200 | if(CPUCLOCK_PERTHREAD(clockid)) |
| 201 | tprintf("MAKE_THREAD_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); |
| 202 | else |
| 203 | tprintf("MAKE_PROCESS_CPUCLOCK(%d,", CPUCLOCK_PID(clockid)); |
| 204 | printxval(cpuclocknames, clockid & CLOCKFD_MASK, "CPUCLOCK_???"); |
| 205 | tprints(")"); |
| 206 | } |
| 207 | } |
| 208 | else |
| 209 | #endif |
| 210 | printxval(clocknames, clockid, "CLOCK_???"); |
| 211 | } |
| 212 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 213 | SYS_FUNC(clock_settime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 214 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 215 | printclockname(tcp->u_arg[0]); |
| 216 | tprints(", "); |
Dmitry V. Levin | 5938526 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 217 | print_timespec(tcp, tcp->u_arg[1]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 218 | |
| 219 | return RVAL_DECODED; |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 220 | } |
| 221 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 222 | SYS_FUNC(clock_gettime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 223 | { |
| 224 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 225 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 226 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 227 | } else { |
Dmitry V. Levin | 5938526 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 228 | print_timespec(tcp, tcp->u_arg[1]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 229 | } |
| 230 | return 0; |
| 231 | } |
| 232 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 233 | SYS_FUNC(clock_nanosleep) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 234 | { |
| 235 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 236 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 237 | tprints(", "); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 238 | printflags(clockflags, tcp->u_arg[1], "TIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 239 | tprints(", "); |
Dmitry V. Levin | 5938526 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 240 | print_timespec(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 241 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 242 | } else { |
Dmitry V. Levin | c648b4a | 2015-09-18 14:24:51 +0000 | [diff] [blame] | 243 | /* |
| 244 | * Second (returned) timespec is only significant |
| 245 | * if syscall was interrupted and flags is not TIMER_ABSTIME. |
| 246 | */ |
| 247 | if (!tcp->u_arg[1] && is_erestart(tcp)) { |
| 248 | temporarily_clear_syserror(tcp); |
Dmitry V. Levin | 5938526 | 2015-09-18 15:16:11 +0000 | [diff] [blame] | 249 | print_timespec(tcp, tcp->u_arg[3]); |
Dmitry V. Levin | c648b4a | 2015-09-18 14:24:51 +0000 | [diff] [blame] | 250 | restore_cleared_syserror(tcp); |
| 251 | } else { |
| 252 | printaddr(tcp->u_arg[3]); |
| 253 | } |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 254 | } |
| 255 | return 0; |
| 256 | } |
| 257 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 258 | SYS_FUNC(clock_adjtime) |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 259 | { |
| 260 | if (exiting(tcp)) |
| 261 | return do_adjtimex(tcp, tcp->u_arg[1]); |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 262 | printclockname(tcp->u_arg[0]); |
Dmitry V. Levin | 7321547 | 2012-03-11 21:25:51 +0000 | [diff] [blame] | 263 | tprints(", "); |
| 264 | return 0; |
| 265 | } |
| 266 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 267 | SYS_FUNC(timer_create) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 268 | { |
| 269 | if (entering(tcp)) { |
Stefan Sørensen | a5fea90 | 2014-02-03 10:01:27 +0100 | [diff] [blame] | 270 | printclockname(tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 271 | tprints(", "); |
Dmitry V. Levin | 6f950cc | 2015-09-16 16:31:43 +0000 | [diff] [blame] | 272 | print_sigevent(tcp, tcp->u_arg[1]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 273 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 274 | } else { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 275 | printnum_int(tcp, tcp->u_arg[2], "%d"); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 276 | } |
| 277 | return 0; |
| 278 | } |
| 279 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 280 | SYS_FUNC(timer_settime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 281 | { |
| 282 | if (entering(tcp)) { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 283 | tprintf("%d, ", (int) tcp->u_arg[0]); |
Roland McGrath | b2dee13 | 2005-06-01 19:02:36 +0000 | [diff] [blame] | 284 | printflags(clockflags, tcp->u_arg[1], "TIMER_???"); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 285 | tprints(", "); |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 286 | print_itimerspec(tcp, tcp->u_arg[2]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 287 | tprints(", "); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 288 | } else { |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 289 | print_itimerspec(tcp, tcp->u_arg[3]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 290 | } |
| 291 | return 0; |
| 292 | } |
| 293 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 294 | SYS_FUNC(timer_gettime) |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 295 | { |
| 296 | if (entering(tcp)) { |
Dmitry V. Levin | 7117835 | 2015-07-16 18:18:09 +0000 | [diff] [blame] | 297 | tprintf("%d, ", (int) tcp->u_arg[0]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 298 | } else { |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 299 | print_itimerspec(tcp, tcp->u_arg[1]); |
Roland McGrath | 1e35679 | 2003-03-30 23:52:28 +0000 | [diff] [blame] | 300 | } |
| 301 | return 0; |
| 302 | } |
Roland McGrath | d83c50b | 2004-10-06 22:27:43 +0000 | [diff] [blame] | 303 | |
Dmitry V. Levin | 0ed617b | 2014-04-25 23:30:54 +0000 | [diff] [blame] | 304 | #include "xlat/timerfdflags.h" |
Roland McGrath | e466234 | 2007-08-02 01:25:34 +0000 | [diff] [blame] | 305 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 306 | SYS_FUNC(timerfd_create) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 307 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 308 | printclockname(tcp->u_arg[0]); |
| 309 | tprints(", "); |
| 310 | printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); |
| 311 | |
Dmitry V. Levin | 07c878a | 2015-08-02 01:37:19 +0000 | [diff] [blame] | 312 | return RVAL_DECODED | RVAL_FD; |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 313 | } |
| 314 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 315 | SYS_FUNC(timerfd_settime) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 316 | { |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 317 | printfd(tcp, tcp->u_arg[0]); |
| 318 | tprints(", "); |
| 319 | printflags(timerfdflags, tcp->u_arg[1], "TFD_???"); |
| 320 | tprints(", "); |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 321 | print_itimerspec(tcp, tcp->u_arg[2]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 322 | tprints(", "); |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 323 | print_itimerspec(tcp, tcp->u_arg[3]); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 324 | |
| 325 | return RVAL_DECODED; |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 326 | } |
| 327 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 328 | SYS_FUNC(timerfd_gettime) |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 329 | { |
| 330 | if (entering(tcp)) { |
Dmitry V. Levin | 3138213 | 2011-03-04 05:08:02 +0300 | [diff] [blame] | 331 | printfd(tcp, tcp->u_arg[0]); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 332 | tprints(", "); |
Dmitry V. Levin | 76c8f66 | 2015-07-16 21:07:06 +0000 | [diff] [blame] | 333 | } else { |
Dmitry V. Levin | 2206085 | 2015-09-17 16:47:03 +0000 | [diff] [blame] | 334 | print_itimerspec(tcp, tcp->u_arg[1]); |
Roland McGrath | de328e6 | 2008-05-20 04:56:13 +0000 | [diff] [blame] | 335 | } |
| 336 | return 0; |
| 337 | } |