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> |
Wichert Akkerman | 4dc8a2a | 1999-12-23 14:20:14 +0000 | [diff] [blame] | 5 | * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl> |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 6 | * All rights reserved. |
| 7 | * |
| 8 | * Redistribution and use in source and binary forms, with or without |
| 9 | * modification, are permitted provided that the following conditions |
| 10 | * are met: |
| 11 | * 1. Redistributions of source code must retain the above copyright |
| 12 | * notice, this list of conditions and the following disclaimer. |
| 13 | * 2. Redistributions in binary form must reproduce the above copyright |
| 14 | * notice, this list of conditions and the following disclaimer in the |
| 15 | * documentation and/or other materials provided with the distribution. |
| 16 | * 3. The name of the author may not be used to endorse or promote products |
| 17 | * derived from this software without specific prior written permission. |
| 18 | * |
| 19 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR |
| 20 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES |
| 21 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. |
| 22 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, |
| 23 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT |
| 24 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
| 28 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 29 | */ |
| 30 | |
| 31 | #include "defs.h" |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 32 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 33 | SYS_FUNC(close) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 34 | { |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 35 | printfd(tcp, tcp->u_arg[0]); |
| 36 | |
| 37 | return RVAL_DECODED; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 38 | } |
| 39 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 40 | SYS_FUNC(dup) |
Zubin Mithra | 64aa1b1 | 2014-06-04 08:30:41 +0530 | [diff] [blame] | 41 | { |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 42 | printfd(tcp, tcp->u_arg[0]); |
| 43 | |
| 44 | return RVAL_DECODED | RVAL_FD; |
Zubin Mithra | 64aa1b1 | 2014-06-04 08:30:41 +0530 | [diff] [blame] | 45 | } |
| 46 | |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 47 | static int |
| 48 | do_dup2(struct tcb *tcp, int flags_arg) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 49 | { |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 50 | printfd(tcp, tcp->u_arg[0]); |
| 51 | tprints(", "); |
| 52 | printfd(tcp, tcp->u_arg[1]); |
| 53 | if (flags_arg >= 0) { |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 54 | tprints(", "); |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 55 | printflags(open_mode_flags, tcp->u_arg[flags_arg], "O_???"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 56 | } |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 57 | |
| 58 | return RVAL_DECODED | RVAL_FD; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 59 | } |
| 60 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 61 | SYS_FUNC(dup2) |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 62 | { |
| 63 | return do_dup2(tcp, -1); |
| 64 | } |
| 65 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 66 | SYS_FUNC(dup3) |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 67 | { |
| 68 | return do_dup2(tcp, 2); |
| 69 | } |
Dmitry V. Levin | 4371b10 | 2008-11-10 22:53:02 +0000 | [diff] [blame] | 70 | |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 71 | #if defined(ALPHA) |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 72 | SYS_FUNC(getdtablesize) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 73 | { |
| 74 | return 0; |
| 75 | } |
Denys Vlasenko | 8470374 | 2012-02-25 02:38:52 +0100 | [diff] [blame] | 76 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 77 | |
Dmitry V. Levin | c2982b5 | 2013-11-05 23:00:22 +0000 | [diff] [blame] | 78 | static int |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 79 | decode_select(struct tcb *tcp, long *args, |
| 80 | void (*print_tv_ts) (struct tcb *, const long), |
| 81 | const char * (*sprint_tv_ts) (struct tcb *, const long)) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 82 | { |
Denys Vlasenko | ad5155a | 2011-09-01 18:18:04 +0200 | [diff] [blame] | 83 | int i, j; |
Denys Vlasenko | 1f65c3c | 2013-11-05 16:20:16 +0100 | [diff] [blame] | 84 | int nfds, fdsize; |
Dmitry V. Levin | 6522f13 | 2014-09-09 22:42:12 +0000 | [diff] [blame] | 85 | fd_set *fds = NULL; |
Dmitry V. Levin | 30145dd | 2010-09-06 22:08:24 +0000 | [diff] [blame] | 86 | const char *sep; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 87 | long arg; |
| 88 | |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 89 | /* Kernel truncates arg[0] to int, we do the same. */ |
| 90 | nfds = (int) args[0]; |
| 91 | |
| 92 | /* Kernel rejects negative nfds, so we don't parse it either. */ |
Dmitry V. Levin | 6522f13 | 2014-09-09 22:42:12 +0000 | [diff] [blame] | 93 | if (nfds < 0) |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 94 | nfds = 0; |
Dmitry V. Levin | 6522f13 | 2014-09-09 22:42:12 +0000 | [diff] [blame] | 95 | |
Denys Vlasenko | 79a79ea | 2011-09-01 16:35:44 +0200 | [diff] [blame] | 96 | /* Beware of select(2^31-1, NULL, NULL, NULL) and similar... */ |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 97 | if (nfds > 1024*1024) |
| 98 | nfds = 1024*1024; |
| 99 | |
| 100 | /* |
| 101 | * We had bugs a-la "while (j < args[0])" and "umoven(args[0])" below. |
Dr. David Alan Gilbert | 025f108 | 2013-11-05 11:54:51 +0100 | [diff] [blame] | 102 | * Instead of args[0], use nfds for fd count, fdsize for array lengths. |
| 103 | */ |
Denys Vlasenko | b338f2d | 2013-11-09 20:40:31 +0100 | [diff] [blame] | 104 | fdsize = (((nfds + 7) / 8) + current_wordsize-1) & -current_wordsize; |
Denys Vlasenko | 79a79ea | 2011-09-01 16:35:44 +0200 | [diff] [blame] | 105 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 106 | if (entering(tcp)) { |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 107 | tprintf("%d", (int) args[0]); |
| 108 | |
Dmitry V. Levin | 3e9d71f | 2015-05-25 20:41:02 +0000 | [diff] [blame] | 109 | if (verbose(tcp) && fdsize > 0) |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 110 | fds = malloc(fdsize); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 111 | for (i = 0; i < 3; i++) { |
| 112 | arg = args[i+1]; |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 113 | tprints(", "); |
Dmitry V. Levin | 2fc5d80 | 2015-01-28 01:26:04 +0000 | [diff] [blame] | 114 | if (!fds) { |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 115 | printaddr(arg); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 116 | continue; |
| 117 | } |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 118 | if (umoven_or_printaddr(tcp, arg, fdsize, fds)) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 119 | continue; |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 120 | tprints("["); |
Denys Vlasenko | b338f2d | 2013-11-09 20:40:31 +0100 | [diff] [blame] | 121 | for (j = 0, sep = "";; j++) { |
| 122 | j = next_set_bit(fds, j, nfds); |
| 123 | if (j < 0) |
| 124 | break; |
| 125 | tprints(sep); |
| 126 | printfd(tcp, j); |
| 127 | sep = " "; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 128 | } |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 129 | tprints("]"); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 130 | } |
Roland McGrath | e85aaa4 | 2005-02-06 01:55:12 +0000 | [diff] [blame] | 131 | free(fds); |
Denys Vlasenko | 60fe8c1 | 2011-09-01 10:00:28 +0200 | [diff] [blame] | 132 | tprints(", "); |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 133 | print_tv_ts(tcp, args[4]); |
Dmitry V. Levin | df0c18c | 2015-07-20 16:59:50 +0000 | [diff] [blame] | 134 | } else { |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 135 | static char outstr[1024]; |
| 136 | char *outptr; |
| 137 | #define end_outstr (outstr + sizeof(outstr)) |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 138 | int ready_fds; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 139 | |
| 140 | if (syserror(tcp)) |
| 141 | return 0; |
| 142 | |
Dr. David Alan Gilbert | 025f108 | 2013-11-05 11:54:51 +0100 | [diff] [blame] | 143 | ready_fds = tcp->u_rval; |
| 144 | if (ready_fds == 0) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 145 | tcp->auxstr = "Timeout"; |
| 146 | return RVAL_STR; |
| 147 | } |
Roland McGrath | e85aaa4 | 2005-02-06 01:55:12 +0000 | [diff] [blame] | 148 | |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 149 | fds = malloc(fdsize); |
Roland McGrath | e85aaa4 | 2005-02-06 01:55:12 +0000 | [diff] [blame] | 150 | |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 151 | outptr = outstr; |
| 152 | sep = ""; |
Dmitry V. Levin | f3696b3 | 2013-11-05 22:46:43 +0000 | [diff] [blame] | 153 | for (i = 0; i < 3 && ready_fds > 0; i++) { |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 154 | int first = 1; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 155 | |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 156 | arg = args[i+1]; |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 157 | if (!arg || !fds || umoven(tcp, arg, fdsize, fds) < 0) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 158 | continue; |
Denys Vlasenko | b338f2d | 2013-11-09 20:40:31 +0100 | [diff] [blame] | 159 | for (j = 0;; j++) { |
| 160 | j = next_set_bit(fds, j, nfds); |
| 161 | if (j < 0) |
| 162 | break; |
| 163 | /* +2 chars needed at the end: ']',NUL */ |
| 164 | if (outptr < end_outstr - (sizeof(", except [") + sizeof(int)*3 + 2)) { |
| 165 | if (first) { |
| 166 | outptr += sprintf(outptr, "%s%s [%u", |
| 167 | sep, |
| 168 | i == 0 ? "in" : i == 1 ? "out" : "except", |
| 169 | j |
| 170 | ); |
| 171 | first = 0; |
| 172 | sep = ", "; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 173 | } |
Denys Vlasenko | b338f2d | 2013-11-09 20:40:31 +0100 | [diff] [blame] | 174 | else { |
| 175 | outptr += sprintf(outptr, " %u", j); |
| 176 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 177 | } |
Denys Vlasenko | b338f2d | 2013-11-09 20:40:31 +0100 | [diff] [blame] | 178 | if (--ready_fds == 0) |
| 179 | break; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 180 | } |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 181 | if (outptr != outstr) |
| 182 | *outptr++ = ']'; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 183 | } |
Roland McGrath | e85aaa4 | 2005-02-06 01:55:12 +0000 | [diff] [blame] | 184 | free(fds); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 185 | /* This contains no useful information on SunOS. */ |
| 186 | if (args[4]) { |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 187 | const char *str = sprint_tv_ts(tcp, args[4]); |
| 188 | if (outptr + sizeof("left ") + strlen(sep) + strlen(str) < end_outstr) { |
| 189 | outptr += sprintf(outptr, "%sleft %s", sep, str); |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 190 | } |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 191 | } |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 192 | *outptr = '\0'; |
Denys Vlasenko | 1161725 | 2011-09-01 11:27:37 +0200 | [diff] [blame] | 193 | tcp->auxstr = outstr; |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 194 | return RVAL_STR; |
Denys Vlasenko | 2fb4db3 | 2011-08-31 12:26:03 +0200 | [diff] [blame] | 195 | #undef end_outstr |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 196 | } |
| 197 | return 0; |
| 198 | } |
| 199 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 200 | SYS_FUNC(oldselect) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 201 | { |
Elvira Khabirova | c44df3e | 2015-07-29 21:38:54 +0300 | [diff] [blame] | 202 | long long_args[5]; |
| 203 | #undef oldselect_args |
| 204 | #if SIZEOF_LONG == 4 |
| 205 | # define oldselect_args long_args |
| 206 | #else |
| 207 | unsigned int oldselect_args[5]; |
| 208 | unsigned int i; |
| 209 | #endif |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 210 | |
Elvira Khabirova | c44df3e | 2015-07-29 21:38:54 +0300 | [diff] [blame] | 211 | if (umove(tcp, tcp->u_arg[0], &oldselect_args) < 0) { |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 212 | printaddr(tcp->u_arg[0]); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 213 | return 0; |
| 214 | } |
Elvira Khabirova | c44df3e | 2015-07-29 21:38:54 +0300 | [diff] [blame] | 215 | #ifndef oldselect_args |
| 216 | for (i = 0; i < 5; i++) { |
| 217 | long_args[i] = oldselect_args[i]; |
| 218 | } |
| 219 | #endif |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 220 | return decode_select(tcp, long_args, print_timeval, sprint_timeval); |
Elvira Khabirova | c44df3e | 2015-07-29 21:38:54 +0300 | [diff] [blame] | 221 | #undef oldselect_args |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 222 | } |
| 223 | |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 224 | #ifdef ALPHA |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 225 | SYS_FUNC(osf_select) |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 226 | { |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 227 | return decode_select(tcp, tcp->u_arg, print_timeval32, sprint_timeval32); |
Wichert Akkerman | f5eeabb | 1999-11-18 17:09:47 +0000 | [diff] [blame] | 228 | } |
| 229 | #endif |
| 230 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 231 | SYS_FUNC(select) |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 232 | { |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 233 | return decode_select(tcp, tcp->u_arg, print_timeval, sprint_timeval); |
Wichert Akkerman | 76baf7c | 1999-02-19 00:21:36 +0000 | [diff] [blame] | 234 | } |
Dmitry V. Levin | 95ebf5a | 2006-10-13 20:25:12 +0000 | [diff] [blame] | 235 | |
Dmitry V. Levin | 4408e85 | 2015-11-27 04:37:46 +0000 | [diff] [blame] | 236 | #include "kernel_types.h" |
| 237 | |
| 238 | static int |
| 239 | umove_kulong_array_or_printaddr(struct tcb *tcp, const long addr, |
| 240 | kernel_ulong_t *ptr, size_t n) |
| 241 | { |
| 242 | #if defined X86_64 || defined X32 |
| 243 | if (current_personality == 1) { |
| 244 | #else |
| 245 | if (current_wordsize < sizeof(*ptr)) { |
| 246 | #endif |
| 247 | uint32_t ptr32[n]; |
| 248 | int r = umove_or_printaddr(tcp, addr, &ptr32); |
| 249 | if (!r) { |
| 250 | size_t i; |
| 251 | |
| 252 | for (i = 0; i < n; ++i) |
| 253 | ptr[i] = (kernel_ulong_t) ptr32[i]; |
| 254 | } |
| 255 | return r; |
| 256 | } |
| 257 | return umoven_or_printaddr(tcp, addr, n * sizeof(*ptr), ptr); |
| 258 | } |
| 259 | |
Dmitry V. Levin | a0bd374 | 2015-04-07 01:36:50 +0000 | [diff] [blame] | 260 | SYS_FUNC(pselect6) |
Dmitry V. Levin | 95ebf5a | 2006-10-13 20:25:12 +0000 | [diff] [blame] | 261 | { |
Dmitry V. Levin | 4cb5ccc | 2015-09-18 18:02:50 +0000 | [diff] [blame] | 262 | int rc = decode_select(tcp, tcp->u_arg, print_timespec, sprint_timespec); |
Roland McGrath | fe10aa7 | 2007-11-01 21:52:20 +0000 | [diff] [blame] | 263 | if (entering(tcp)) { |
Dmitry V. Levin | 4408e85 | 2015-11-27 04:37:46 +0000 | [diff] [blame] | 264 | kernel_ulong_t data[2]; |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 265 | |
| 266 | tprints(", "); |
Dmitry V. Levin | 4408e85 | 2015-11-27 04:37:46 +0000 | [diff] [blame] | 267 | if (!umove_kulong_array_or_printaddr(tcp, tcp->u_arg[5], |
| 268 | data, ARRAY_SIZE(data))) { |
Dmitry V. Levin | e6019fd | 2015-07-20 16:44:51 +0000 | [diff] [blame] | 269 | tprints("{"); |
Dmitry V. Levin | b172a94 | 2015-09-15 02:17:32 +0000 | [diff] [blame] | 270 | /* NB: kernel requires data[1] == NSIG / 8 */ |
Dmitry V. Levin | 4408e85 | 2015-11-27 04:37:46 +0000 | [diff] [blame] | 271 | print_sigset_addr_len(tcp, (unsigned long) data[0], |
| 272 | (unsigned long) data[1]); |
Dmitry V. Levin | e67c8e4 | 2015-12-16 00:07:16 +0000 | [diff] [blame] | 273 | tprintf(", %llu}", (unsigned long long) data[1]); |
Dmitry V. Levin | 95ebf5a | 2006-10-13 20:25:12 +0000 | [diff] [blame] | 274 | } |
| 275 | } |
Dmitry V. Levin | 4408e85 | 2015-11-27 04:37:46 +0000 | [diff] [blame] | 276 | |
Dmitry V. Levin | 95ebf5a | 2006-10-13 20:25:12 +0000 | [diff] [blame] | 277 | return rc; |
| 278 | } |