blob: c5d7f6507ef85d15a0347adfca46da3a6b5c9a99 [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.
27 *
28 * $Id$
29 */
30
31#include "defs.h"
32
Wichert Akkerman42080d82001-04-10 10:32:26 +000033#ifdef HAVE_POLL_H
34#include <poll.h>
35#endif
Pavel Machek245a6ac2000-02-01 16:12:33 +000036#ifdef HAVE_SYS_POLL_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000037#include <sys/poll.h>
Pavel Machek245a6ac2000-02-01 16:12:33 +000038#endif
Wichert Akkerman42080d82001-04-10 10:32:26 +000039#ifdef HAVE_STROPTS_H
40#include <stropts.h>
41#endif
42#ifdef HAVE_SYS_CONF_H
43#include <sys/conf.h>
44#endif
Wichert Akkerman42080d82001-04-10 10:32:26 +000045
46#ifndef HAVE_STROPTS_H
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000047#define RS_HIPRI 1
48struct strbuf {
Denys Vlasenkoadedb512008-12-30 18:47:55 +000049 int maxlen; /* no. of bytes in buffer */
50 int len; /* no. of bytes returned */
Dmitry V. Levin30145dd2010-09-06 22:08:24 +000051 const char *buf; /* pointer to data */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000052};
53#define MORECTL 1
54#define MOREDATA 2
Wichert Akkerman42080d82001-04-10 10:32:26 +000055#endif /* !HAVE_STROPTS_H */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000056
Roland McGrathd9f816f2004-09-04 03:39:20 +000057static const struct xlat msgflags[] = {
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000058 { RS_HIPRI, "RS_HIPRI" },
59 { 0, NULL },
60};
61
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000062static void
Denys Vlasenko12014262011-05-30 14:00:14 +020063printstrbuf(struct tcb *tcp, struct strbuf *sbp, int getting)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000064{
65 if (sbp->maxlen == -1 && getting)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020066 tprints("{maxlen=-1}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000067 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020068 tprints("{");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000069 if (getting)
70 tprintf("maxlen=%d, ", sbp->maxlen);
71 tprintf("len=%d, buf=", sbp->len);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000072 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020073 tprints("}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000074 }
75}
76
77static void
Denys Vlasenko12014262011-05-30 14:00:14 +020078printstrbufarg(struct tcb *tcp, int arg, int getting)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000079{
80 struct strbuf buf;
81
82 if (arg == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020083 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000084 else if (umove(tcp, arg, &buf) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020085 tprints("{...}");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000086 else
87 printstrbuf(tcp, &buf, getting);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +020088 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000089}
90
91int
Denys Vlasenko12014262011-05-30 14:00:14 +020092sys_putmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000093{
94 int i;
95
96 if (entering(tcp)) {
97 /* fd */
98 tprintf("%ld, ", tcp->u_arg[0]);
99 /* control and data */
100 for (i = 1; i < 3; i++)
101 printstrbufarg(tcp, tcp->u_arg[i], 0);
102 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000103 printflags(msgflags, tcp->u_arg[3], "RS_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000104 }
105 return 0;
106}
107
Denys Vlasenko84703742012-02-25 02:38:52 +0100108#if defined(SPARC) || defined(SPARC64)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000109int
Denys Vlasenko12014262011-05-30 14:00:14 +0200110sys_getmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000111{
112 int i, flags;
113
114 if (entering(tcp)) {
115 /* fd */
116 tprintf("%lu, ", tcp->u_arg[0]);
117 } else {
118 if (syserror(tcp)) {
119 tprintf("%#lx, %#lx, %#lx",
120 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
121 return 0;
122 }
123 /* control and data */
124 for (i = 1; i < 3; i++)
125 printstrbufarg(tcp, tcp->u_arg[i], 1);
126 /* pointer to flags */
127 if (tcp->u_arg[3] == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200128 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000129 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200130 tprints("[?]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000131 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200132 tprints("[");
Roland McGrathb2dee132005-06-01 19:02:36 +0000133 printflags(msgflags, flags, "RS_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200134 tprints("]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000135 }
136 /* decode return value */
137 switch (tcp->u_rval) {
138 case MORECTL:
139 tcp->auxstr = "MORECTL";
140 break;
141 case MORECTL|MOREDATA:
142 tcp->auxstr = "MORECTL|MOREDATA";
143 break;
144 case MOREDATA:
145 tcp->auxstr = "MORECTL";
146 break;
147 default:
148 tcp->auxstr = NULL;
149 break;
150 }
151 }
152 return RVAL_HEX | RVAL_STR;
153}
Denys Vlasenko84703742012-02-25 02:38:52 +0100154#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000155
Roland McGrath34e014a2002-12-16 20:40:59 +0000156#if defined SYS_putpmsg || defined SYS_getpmsg
Roland McGrathd9f816f2004-09-04 03:39:20 +0000157static const struct xlat pmsgflags[] = {
Wichert Akkermand856b992000-10-13 12:47:12 +0000158#ifdef MSG_HIPRI
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000159 { MSG_HIPRI, "MSG_HIPRI" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000160#endif
161#ifdef MSG_AND
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000162 { MSG_ANY, "MSG_ANY" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000163#endif
164#ifdef MSG_BAND
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000165 { MSG_BAND, "MSG_BAND" },
Wichert Akkermand856b992000-10-13 12:47:12 +0000166#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000167 { 0, NULL },
168};
Roland McGrath34e014a2002-12-16 20:40:59 +0000169#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000170
Roland McGrath34e014a2002-12-16 20:40:59 +0000171#ifdef SYS_putpmsg
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000172int
Denys Vlasenko12014262011-05-30 14:00:14 +0200173sys_putpmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000174{
175 int i;
176
177 if (entering(tcp)) {
178 /* fd */
179 tprintf("%ld, ", tcp->u_arg[0]);
180 /* control and data */
181 for (i = 1; i < 3; i++)
182 printstrbufarg(tcp, tcp->u_arg[i], 0);
183 /* band */
184 tprintf("%ld, ", tcp->u_arg[3]);
185 /* flags */
Roland McGrathb2dee132005-06-01 19:02:36 +0000186 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000187 }
188 return 0;
189}
Roland McGrath34e014a2002-12-16 20:40:59 +0000190#endif /* SYS_putpmsg */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000191
Roland McGrath34e014a2002-12-16 20:40:59 +0000192#ifdef SYS_getpmsg
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000193int
Denys Vlasenko12014262011-05-30 14:00:14 +0200194sys_getpmsg(struct tcb *tcp)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000195{
196 int i, flags;
197
198 if (entering(tcp)) {
199 /* fd */
200 tprintf("%lu, ", tcp->u_arg[0]);
201 } else {
202 if (syserror(tcp)) {
203 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
204 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
205 return 0;
206 }
207 /* control and data */
208 for (i = 1; i < 3; i++)
209 printstrbufarg(tcp, tcp->u_arg[i], 1);
210 /* pointer to band */
211 printnum(tcp, tcp->u_arg[3], "%d");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200212 tprints(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000213 /* pointer to flags */
214 if (tcp->u_arg[4] == 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200215 tprints("NULL");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000216 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200217 tprints("[?]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000218 else {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200219 tprints("[");
Roland McGrathb2dee132005-06-01 19:02:36 +0000220 printflags(pmsgflags, flags, "MSG_???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200221 tprints("]");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000222 }
223 /* decode return value */
224 switch (tcp->u_rval) {
225 case MORECTL:
226 tcp->auxstr = "MORECTL";
227 break;
228 case MORECTL|MOREDATA:
229 tcp->auxstr = "MORECTL|MOREDATA";
230 break;
231 case MOREDATA:
232 tcp->auxstr = "MORECTL";
233 break;
234 default:
235 tcp->auxstr = NULL;
236 break;
237 }
238 }
239 return RVAL_HEX | RVAL_STR;
240}
Roland McGrath34e014a2002-12-16 20:40:59 +0000241#endif /* SYS_getpmsg */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000242
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000243#ifdef HAVE_SYS_POLL_H
244
Roland McGrathd9f816f2004-09-04 03:39:20 +0000245static const struct xlat pollflags[] = {
Pavel Machek245a6ac2000-02-01 16:12:33 +0000246#ifdef POLLIN
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000247 { POLLIN, "POLLIN" },
248 { POLLPRI, "POLLPRI" },
249 { POLLOUT, "POLLOUT" },
250#ifdef POLLRDNORM
251 { POLLRDNORM, "POLLRDNORM" },
252#endif
253#ifdef POLLWRNORM
254 { POLLWRNORM, "POLLWRNORM" },
255#endif
256#ifdef POLLRDBAND
257 { POLLRDBAND, "POLLRDBAND" },
258#endif
259#ifdef POLLWRBAND
260 { POLLWRBAND, "POLLWRBAND" },
261#endif
262 { POLLERR, "POLLERR" },
263 { POLLHUP, "POLLHUP" },
264 { POLLNVAL, "POLLNVAL" },
Pavel Machek245a6ac2000-02-01 16:12:33 +0000265#endif
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000266 { 0, NULL },
267};
268
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000269static int
Roland McGrathf17106e2007-11-01 21:49:49 +0000270decode_poll(struct tcb *tcp, long pts)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000271{
Roland McGrathaa524c82005-06-01 19:22:06 +0000272 struct pollfd fds;
273 unsigned nfds;
274 unsigned long size, start, cur, end, abbrev_end;
275 int failed = 0;
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000276
Roland McGrathf17106e2007-11-01 21:49:49 +0000277 if (entering(tcp)) {
278 nfds = tcp->u_arg[1];
279 size = sizeof(fds) * nfds;
280 start = tcp->u_arg[0];
281 end = start + size;
282 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
283 tprintf("%#lx, %d, ",
284 tcp->u_arg[0], nfds);
285 return 0;
286 }
287 if (abbrev(tcp)) {
288 abbrev_end = start + max_strlen * sizeof(fds);
289 if (abbrev_end < start)
290 abbrev_end = end;
291 } else {
Roland McGrathaa524c82005-06-01 19:22:06 +0000292 abbrev_end = end;
Roland McGrathf17106e2007-11-01 21:49:49 +0000293 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200294 tprints("[");
Roland McGrathf17106e2007-11-01 21:49:49 +0000295 for (cur = start; cur < end; cur += sizeof(fds)) {
296 if (cur > start)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200297 tprints(", ");
Roland McGrathf17106e2007-11-01 21:49:49 +0000298 if (cur >= abbrev_end) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200299 tprints("...");
Roland McGrathf17106e2007-11-01 21:49:49 +0000300 break;
301 }
302 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200303 tprints("?");
Roland McGrathf17106e2007-11-01 21:49:49 +0000304 failed = 1;
305 break;
306 }
307 if (fds.fd < 0) {
308 tprintf("{fd=%d}", fds.fd);
309 continue;
310 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200311 tprints("{fd=");
Dmitry V. Levin31382132011-03-04 05:08:02 +0300312 printfd(tcp, fds.fd);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200313 tprints(", events=");
Roland McGrathf17106e2007-11-01 21:49:49 +0000314 printflags(pollflags, fds.events, "POLL???");
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200315 tprints("}");
Roland McGrathf17106e2007-11-01 21:49:49 +0000316 }
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200317 tprints("]");
Roland McGrathf17106e2007-11-01 21:49:49 +0000318 if (failed)
319 tprintf(" %#lx", start);
320 tprintf(", %d, ", nfds);
321 return 0;
Roland McGrathaa524c82005-06-01 19:22:06 +0000322 } else {
Roland McGrathf17106e2007-11-01 21:49:49 +0000323 static char outstr[1024];
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200324 char *outptr;
325#define end_outstr (outstr + sizeof(outstr))
Denys Vlasenkoadedb512008-12-30 18:47:55 +0000326 const char *flagstr;
Roland McGrathf17106e2007-11-01 21:49:49 +0000327
328 if (syserror(tcp))
329 return 0;
330 if (tcp->u_rval == 0) {
331 tcp->auxstr = "Timeout";
332 return RVAL_STR;
333 }
334
335 nfds = tcp->u_arg[1];
336 size = sizeof(fds) * nfds;
337 start = tcp->u_arg[0];
338 end = start + size;
339 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
340 return 0;
341 if (abbrev(tcp)) {
342 abbrev_end = start + max_strlen * sizeof(fds);
343 if (abbrev_end < start)
344 abbrev_end = end;
345 } else {
346 abbrev_end = end;
347 }
348
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200349 outptr = outstr;
Roland McGrathf17106e2007-11-01 21:49:49 +0000350
351 for (cur = start; cur < end; cur += sizeof(fds)) {
352 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200353 if (outptr < end_outstr - 2)
354 *outptr++ = '?';
Roland McGrathf17106e2007-11-01 21:49:49 +0000355 failed = 1;
356 break;
357 }
358 if (!fds.revents)
359 continue;
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200360 if (outptr == outstr) {
361 *outptr++ = '[';
Roland McGrathf17106e2007-11-01 21:49:49 +0000362 } else {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200363 if (outptr < end_outstr - 3)
364 outptr = stpcpy(outptr, ", ");
Roland McGrathf17106e2007-11-01 21:49:49 +0000365 }
366 if (cur >= abbrev_end) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200367 if (outptr < end_outstr - 4)
368 outptr = stpcpy(outptr, "...");
Roland McGrathf17106e2007-11-01 21:49:49 +0000369 break;
370 }
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200371 if (outptr < end_outstr - (sizeof("{fd=%d, revents=") + sizeof(int)*3) + 1)
372 outptr += sprintf(outptr, "{fd=%d, revents=", fds.fd);
Denys Vlasenkob63256e2011-06-07 12:13:24 +0200373 flagstr = sprintflags("", pollflags, fds.revents);
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200374 if (outptr < end_outstr - (strlen(flagstr) + 2)) {
375 outptr = stpcpy(outptr, flagstr);
376 *outptr++ = '}';
Roland McGrathf17106e2007-11-01 21:49:49 +0000377 }
378 }
379 if (failed)
380 return 0;
381
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200382 if (outptr != outstr /* && outptr < end_outstr - 1 (always true)*/)
383 *outptr++ = ']';
Roland McGrathf17106e2007-11-01 21:49:49 +0000384
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200385 *outptr = '\0';
Roland McGrathf17106e2007-11-01 21:49:49 +0000386 if (pts) {
Denys Vlasenkoa1d541e2012-01-20 11:04:04 +0100387 if (outptr < end_outstr - (10 + TIMESPEC_TEXT_BUFSIZE)) {
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200388 outptr = stpcpy(outptr, outptr == outstr ? "left " : ", left ");
389 sprint_timespec(outptr, tcp, pts);
390 }
Roland McGrathf17106e2007-11-01 21:49:49 +0000391 }
392
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200393 if (outptr == outstr)
Roland McGrathf17106e2007-11-01 21:49:49 +0000394 return 0;
395
396 tcp->auxstr = outstr;
397 return RVAL_STR;
Denys Vlasenko2fb4db32011-08-31 12:26:03 +0200398#undef end_outstr
Roland McGrathaa524c82005-06-01 19:22:06 +0000399 }
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000400}
401
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000402int
403sys_poll(struct tcb *tcp)
404{
Roland McGrathf17106e2007-11-01 21:49:49 +0000405 int rc = decode_poll(tcp, 0);
406 if (entering(tcp)) {
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000407#ifdef INFTIM
408 if (tcp->u_arg[2] == INFTIM)
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200409 tprints("INFTIM");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000410 else
411#endif
412 tprintf("%ld", tcp->u_arg[2]);
413 }
414 return rc;
415}
416
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000417int
418sys_ppoll(struct tcb *tcp)
419{
Roland McGrathf17106e2007-11-01 21:49:49 +0000420 int rc = decode_poll(tcp, tcp->u_arg[2]);
421 if (entering(tcp)) {
Roland McGrath6bc09da2007-11-01 21:50:54 +0000422 print_timespec(tcp, tcp->u_arg[2]);
Denys Vlasenko60fe8c12011-09-01 10:00:28 +0200423 tprints(", ");
Dmitry V. Levin95ebf5a2006-10-13 20:25:12 +0000424 print_sigset(tcp, tcp->u_arg[3], 0);
425 tprintf(", %lu", tcp->u_arg[4]);
426 }
427 return rc;
428}
Roland McGrathaa524c82005-06-01 19:22:06 +0000429
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000430#else /* !HAVE_SYS_POLL_H */
431int
Denys Vlasenko12014262011-05-30 14:00:14 +0200432sys_poll(struct tcb *tcp)
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000433{
Denys Vlasenko5ae2b7c2009-02-27 20:32:52 +0000434 return 0;
Wichert Akkermanfaf72222000-02-19 23:59:03 +0000435}
436#endif