blob: dc84ab5e3f7a088053ee2cee9f1a9e034467b6a4 [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
2 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
Wichert Akkerman4dc8a2a1999-12-23 14:20:14 +00003 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00004 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. The name of the author may not be used to endorse or promote products
15 * derived from this software without specific prior written permission.
16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
18 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
19 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
20 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000027 */
28
29#include "defs.h"
Wichert Akkerman42080d82001-04-10 10:32:26 +000030#ifdef HAVE_POLL_H
Denys Vlasenkoa6d91de2012-03-16 12:02:22 +010031# include <poll.h>
Wichert Akkerman42080d82001-04-10 10:32:26 +000032#endif
Pavel Machek245a6ac2000-02-01 16:12:33 +000033#ifdef HAVE_SYS_POLL_H
Denys Vlasenkoa6d91de2012-03-16 12:02:22 +010034# include <sys/poll.h>
Pavel Machek245a6ac2000-02-01 16:12:33 +000035#endif
Wichert Akkerman42080d82001-04-10 10:32:26 +000036#ifdef HAVE_STROPTS_H
Denys Vlasenkoa6d91de2012-03-16 12:02:22 +010037# include <stropts.h>
Wichert Akkerman42080d82001-04-10 10:32:26 +000038#endif
39#ifdef HAVE_SYS_CONF_H
Denys Vlasenkoa6d91de2012-03-16 12:02:22 +010040# include <sys/conf.h>
Wichert Akkerman42080d82001-04-10 10:32:26 +000041#endif
Wichert Akkerman42080d82001-04-10 10:32:26 +000042
43#ifndef HAVE_STROPTS_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000044#define RS_HIPRI 1
45struct strbuf {
Denys Vlasenkoadedb512008-12-30 18:47:55 +000046 int maxlen; /* no. of bytes in buffer */
47 int len; /* no. of bytes returned */
Dmitry V. Levin30145dd2010-09-06 22:08:24 +000048 const char *buf; /* pointer to data */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000049};
50#define MORECTL 1
51#define MOREDATA 2
Wichert Akkerman42080d82001-04-10 10:32:26 +000052#endif /* !HAVE_STROPTS_H */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000053
Roland McGrathd9f816f2004-09-04 03:39:20 +000054static const struct xlat msgflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000055 { RS_HIPRI, "RS_HIPRI" },
56 { 0, NULL },
57};
58
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000059static void
Denys Vlasenko12014262011-05-30 14:00:14 +020060printstrbuf(struct tcb *tcp, struct strbuf *sbp, int getting)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000061{
62 if (sbp->maxlen == -1 && getting)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020063 tprints("{maxlen=-1}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000064 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020065 tprints("{");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000066 if (getting)
67 tprintf("maxlen=%d, ", sbp->maxlen);
68 tprintf("len=%d, buf=", sbp->len);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000069 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020070 tprints("}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000071 }
72}
73
74static void
Denys Vlasenkoe7db4652013-03-05 16:17:46 +010075printstrbufarg(struct tcb *tcp, long arg, int getting)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000076{
77 struct strbuf buf;
78
79 if (arg == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020080 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000081 else if (umove(tcp, arg, &buf) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020082 tprints("{...}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000083 else
84 printstrbuf(tcp, &buf, getting);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020085 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000086}
87
88int
Denys Vlasenko12014262011-05-30 14:00:14 +020089sys_putmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000090{
91 int i;
92
93 if (entering(tcp)) {
94 /* fd */
95 tprintf("%ld, ", tcp->u_arg[0]);
96 /* control and data */
97 for (i = 1; i < 3; i++)
98 printstrbufarg(tcp, tcp->u_arg[i], 0);
99 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000100 printflags(msgflags, tcp->u_arg[3], "RS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000101 }
102 return 0;
103}
104
Denys Vlasenko84703742012-02-25 02:38:52 +0100105#if defined(SPARC) || defined(SPARC64)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000106int
Denys Vlasenko12014262011-05-30 14:00:14 +0200107sys_getmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000108{
109 int i, flags;
110
111 if (entering(tcp)) {
112 /* fd */
113 tprintf("%lu, ", tcp->u_arg[0]);
114 } else {
115 if (syserror(tcp)) {
116 tprintf("%#lx, %#lx, %#lx",
117 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
118 return 0;
119 }
120 /* control and data */
121 for (i = 1; i < 3; i++)
122 printstrbufarg(tcp, tcp->u_arg[i], 1);
123 /* pointer to flags */
124 if (tcp->u_arg[3] == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200125 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000126 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200127 tprints("[?]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000128 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200129 tprints("[");
Roland McGrathb2dee132005-06-01 19:02:36 +0000130 printflags(msgflags, flags, "RS_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200131 tprints("]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000132 }
133 /* decode return value */
134 switch (tcp->u_rval) {
135 case MORECTL:
136 tcp->auxstr = "MORECTL";
137 break;
138 case MORECTL|MOREDATA:
139 tcp->auxstr = "MORECTL|MOREDATA";
140 break;
141 case MOREDATA:
142 tcp->auxstr = "MORECTL";
143 break;
144 default:
145 tcp->auxstr = NULL;
146 break;
147 }
148 }
149 return RVAL_HEX | RVAL_STR;
150}
Denys Vlasenko84703742012-02-25 02:38:52 +0100151#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000152
Roland McGrath34e014a2002-12-16 20:40:59 +0000153#if defined SYS_putpmsg || defined SYS_getpmsg
Roland McGrathd9f816f2004-09-04 03:39:20 +0000154static const struct xlat pmsgflags[] = {
Wichert Akkermand856b992000-10-13 12:47:12 +0000155#ifdef MSG_HIPRI
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000156 { MSG_HIPRI, "MSG_HIPRI" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000157#endif
158#ifdef MSG_AND
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000159 { MSG_ANY, "MSG_ANY" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000160#endif
161#ifdef MSG_BAND
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000162 { MSG_BAND, "MSG_BAND" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000163#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000164 { 0, NULL },
165};
Roland McGrath34e014a2002-12-16 20:40:59 +0000166#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000167
Roland McGrath34e014a2002-12-16 20:40:59 +0000168#ifdef SYS_putpmsg
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000169int
Denys Vlasenko12014262011-05-30 14:00:14 +0200170sys_putpmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000171{
172 int i;
173
174 if (entering(tcp)) {
175 /* fd */
176 tprintf("%ld, ", tcp->u_arg[0]);
177 /* control and data */
178 for (i = 1; i < 3; i++)
179 printstrbufarg(tcp, tcp->u_arg[i], 0);
180 /* band */
181 tprintf("%ld, ", tcp->u_arg[3]);
182 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000183 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000184 }
185 return 0;
186}
Roland McGrath34e014a2002-12-16 20:40:59 +0000187#endif /* SYS_putpmsg */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000188
Roland McGrath34e014a2002-12-16 20:40:59 +0000189#ifdef SYS_getpmsg
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000190int
Denys Vlasenko12014262011-05-30 14:00:14 +0200191sys_getpmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000192{
193 int i, flags;
194
195 if (entering(tcp)) {
196 /* fd */
197 tprintf("%lu, ", tcp->u_arg[0]);
198 } else {
199 if (syserror(tcp)) {
200 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
201 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
202 return 0;
203 }
204 /* control and data */
205 for (i = 1; i < 3; i++)
206 printstrbufarg(tcp, tcp->u_arg[i], 1);
207 /* pointer to band */
208 printnum(tcp, tcp->u_arg[3], "%d");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200209 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000210 /* pointer to flags */
211 if (tcp->u_arg[4] == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200212 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000213 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200214 tprints("[?]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000215 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200216 tprints("[");
Roland McGrathb2dee132005-06-01 19:02:36 +0000217 printflags(pmsgflags, flags, "MSG_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200218 tprints("]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000219 }
220 /* decode return value */
221 switch (tcp->u_rval) {
222 case MORECTL:
223 tcp->auxstr = "MORECTL";
224 break;
225 case MORECTL|MOREDATA:
226 tcp->auxstr = "MORECTL|MOREDATA";
227 break;
228 case MOREDATA:
229 tcp->auxstr = "MORECTL";
230 break;
231 default:
232 tcp->auxstr = NULL;
233 break;
234 }
235 }
236 return RVAL_HEX | RVAL_STR;
237}
Roland McGrath34e014a2002-12-16 20:40:59 +0000238#endif /* SYS_getpmsg */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000239
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000240#ifdef HAVE_SYS_POLL_H
241
Roland McGrathd9f816f2004-09-04 03:39:20 +0000242static const struct xlat pollflags[] = {
Pavel Machek245a6ac2000-02-01 16:12:33 +0000243#ifdef POLLIN
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000244 { POLLIN, "POLLIN" },
245 { POLLPRI, "POLLPRI" },
246 { POLLOUT, "POLLOUT" },
247#ifdef POLLRDNORM
248 { POLLRDNORM, "POLLRDNORM" },
249#endif
250#ifdef POLLWRNORM
251 { POLLWRNORM, "POLLWRNORM" },
252#endif
253#ifdef POLLRDBAND
254 { POLLRDBAND, "POLLRDBAND" },
255#endif
256#ifdef POLLWRBAND
257 { POLLWRBAND, "POLLWRBAND" },
258#endif
259 { POLLERR, "POLLERR" },
260 { POLLHUP, "POLLHUP" },
261 { POLLNVAL, "POLLNVAL" },
Pavel Machek245a6ac2000-02-01 16:12:33 +0000262#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000263 { 0, NULL },
264};
265
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000266static int
Roland McGrathf17106e2007-11-01 21:49:49 +0000267decode_poll(struct tcb *tcp, long pts)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000268{
Roland McGrathaa524c82005-06-01 19:22:06 +0000269 struct pollfd fds;
270 unsigned nfds;
271 unsigned long size, start, cur, end, abbrev_end;
272 int failed = 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000273
Roland McGrathf17106e2007-11-01 21:49:49 +0000274 if (entering(tcp)) {
275 nfds = tcp->u_arg[1];
276 size = sizeof(fds) * nfds;
277 start = tcp->u_arg[0];
278 end = start + size;
279 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
280 tprintf("%#lx, %d, ",
281 tcp->u_arg[0], nfds);
282 return 0;
283 }
284 if (abbrev(tcp)) {
285 abbrev_end = start + max_strlen * sizeof(fds);
286 if (abbrev_end < start)
287 abbrev_end = end;
288 } else {
Roland McGrathaa524c82005-06-01 19:22:06 +0000289 abbrev_end = end;
Roland McGrathf17106e2007-11-01 21:49:49 +0000290 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200291 tprints("[");
Roland McGrathf17106e2007-11-01 21:49:49 +0000292 for (cur = start; cur < end; cur += sizeof(fds)) {
293 if (cur > start)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200294 tprints(", ");
Roland McGrathf17106e2007-11-01 21:49:49 +0000295 if (cur >= abbrev_end) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200296 tprints("...");
Roland McGrathf17106e2007-11-01 21:49:49 +0000297 break;
298 }
299 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200300 tprints("?");
Roland McGrathf17106e2007-11-01 21:49:49 +0000301 failed = 1;
302 break;
303 }
304 if (fds.fd < 0) {
305 tprintf("{fd=%d}", fds.fd);
306 continue;
307 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200308 tprints("{fd=");
Dmitry V. Levin31382132011-03-04 05:08:02 +0300309 printfd(tcp, fds.fd);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200310 tprints(", events=");
Roland McGrathf17106e2007-11-01 21:49:49 +0000311 printflags(pollflags, fds.events, "POLL???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200312 tprints("}");
Roland McGrathf17106e2007-11-01 21:49:49 +0000313 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200314 tprints("]");
Roland McGrathf17106e2007-11-01 21:49:49 +0000315 if (failed)
316 tprintf(" %#lx", start);
317 tprintf(", %d, ", nfds);
318 return 0;
Roland McGrathaa524c82005-06-01 19:22:06 +0000319 } else {
Roland McGrathf17106e2007-11-01 21:49:49 +0000320 static char outstr[1024];
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200321 char *outptr;
322#define end_outstr (outstr + sizeof(outstr))
Denys Vlasenkoadedb512008-12-30 18:47:55 +0000323 const char *flagstr;
Roland McGrathf17106e2007-11-01 21:49:49 +0000324
325 if (syserror(tcp))
326 return 0;
327 if (tcp->u_rval == 0) {
328 tcp->auxstr = "Timeout";
329 return RVAL_STR;
330 }
331
332 nfds = tcp->u_arg[1];
333 size = sizeof(fds) * nfds;
334 start = tcp->u_arg[0];
335 end = start + size;
336 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
337 return 0;
338 if (abbrev(tcp)) {
339 abbrev_end = start + max_strlen * sizeof(fds);
340 if (abbrev_end < start)
341 abbrev_end = end;
342 } else {
343 abbrev_end = end;
344 }
345
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200346 outptr = outstr;
Roland McGrathf17106e2007-11-01 21:49:49 +0000347
348 for (cur = start; cur < end; cur += sizeof(fds)) {
349 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200350 if (outptr < end_outstr - 2)
351 *outptr++ = '?';
Roland McGrathf17106e2007-11-01 21:49:49 +0000352 failed = 1;
353 break;
354 }
355 if (!fds.revents)
356 continue;
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200357 if (outptr == outstr) {
358 *outptr++ = '[';
Roland McGrathf17106e2007-11-01 21:49:49 +0000359 } else {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200360 if (outptr < end_outstr - 3)
361 outptr = stpcpy(outptr, ", ");
Roland McGrathf17106e2007-11-01 21:49:49 +0000362 }
363 if (cur >= abbrev_end) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200364 if (outptr < end_outstr - 4)
365 outptr = stpcpy(outptr, "...");
Roland McGrathf17106e2007-11-01 21:49:49 +0000366 break;
367 }
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200368 if (outptr < end_outstr - (sizeof("{fd=%d, revents=") + sizeof(int)*3) + 1)
369 outptr += sprintf(outptr, "{fd=%d, revents=", fds.fd);
Denys Vlasenkob63256e2011-06-07 12:13:24 +0200370 flagstr = sprintflags("", pollflags, fds.revents);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200371 if (outptr < end_outstr - (strlen(flagstr) + 2)) {
372 outptr = stpcpy(outptr, flagstr);
373 *outptr++ = '}';
Roland McGrathf17106e2007-11-01 21:49:49 +0000374 }
375 }
376 if (failed)
377 return 0;
378
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200379 if (outptr != outstr /* && outptr < end_outstr - 1 (always true)*/)
380 *outptr++ = ']';
Roland McGrathf17106e2007-11-01 21:49:49 +0000381
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200382 *outptr = '\0';
Roland McGrathf17106e2007-11-01 21:49:49 +0000383 if (pts) {
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100384 if (outptr < end_outstr - (10 + TIMESPEC_TEXT_BUFSIZE)) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200385 outptr = stpcpy(outptr, outptr == outstr ? "left " : ", left ");
386 sprint_timespec(outptr, tcp, pts);
387 }
Roland McGrathf17106e2007-11-01 21:49:49 +0000388 }
389
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200390 if (outptr == outstr)
Roland McGrathf17106e2007-11-01 21:49:49 +0000391 return 0;
392
393 tcp->auxstr = outstr;
394 return RVAL_STR;
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200395#undef end_outstr
Roland McGrathaa524c82005-06-01 19:22:06 +0000396 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000397}
398
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000399int
400sys_poll(struct tcb *tcp)
401{
Roland McGrathf17106e2007-11-01 21:49:49 +0000402 int rc = decode_poll(tcp, 0);
403 if (entering(tcp)) {
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000404#ifdef INFTIM
405 if (tcp->u_arg[2] == INFTIM)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200406 tprints("INFTIM");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000407 else
408#endif
409 tprintf("%ld", tcp->u_arg[2]);
410 }
411 return rc;
412}
413
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000414int
415sys_ppoll(struct tcb *tcp)
416{
Roland McGrathf17106e2007-11-01 21:49:49 +0000417 int rc = decode_poll(tcp, tcp->u_arg[2]);
418 if (entering(tcp)) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000419 print_timespec(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200420 tprints(", ");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000421 print_sigset(tcp, tcp->u_arg[3], 0);
422 tprintf(", %lu", tcp->u_arg[4]);
423 }
424 return rc;
425}
Roland McGrathaa524c82005-06-01 19:22:06 +0000426
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000427#else /* !HAVE_SYS_POLL_H */
428int
Denys Vlasenko12014262011-05-30 14:00:14 +0200429sys_poll(struct tcb *tcp)
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000430{
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +0000431 return 0;
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000432}
433#endif