blob: 7f287c5dc34b3f010f86a21233ebd197dcebe01c [file] [log] [blame]
Wichert Akkerman76baf7c1999-02-19 00:21:36 +00001/*
2 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
15 *
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * $Id$
28 */
29
30#include "defs.h"
31
Wichert Akkermand4d8e921999-04-18 23:30:29 +000032#if defined(HAVE_SYS_STREAM_H) || defined(linux)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000033
Wichert Akkermand4d8e921999-04-18 23:30:29 +000034#if defined(linux)
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000035#include <sys/poll.h>
36
37#define RS_HIPRI 1
38struct strbuf {
39 int maxlen; /* no. of bytes in buffer */
40 int len; /* no. of bytes returned */
41 char *buf; /* pointer to data */
42};
43#define MORECTL 1
44#define MOREDATA 2
45
Wichert Akkermand4d8e921999-04-18 23:30:29 +000046#else /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000047
48#include <stropts.h>
49#include <poll.h>
50#include <sys/conf.h>
51#include <sys/stream.h>
52#include <sys/tihdr.h>
53
Wichert Akkermand4d8e921999-04-18 23:30:29 +000054#endif /* linux */
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000055
56#ifdef HAVE_SYS_TIUSER_H
57#include <sys/tiuser.h>
58#include <sys/sockmod.h>
59#include <sys/timod.h>
60#endif /* HAVE_SYS_TIUSER_H */
61
62static struct xlat msgflags[] = {
63 { RS_HIPRI, "RS_HIPRI" },
64 { 0, NULL },
65};
66
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000067
68static void
69printstrbuf(tcp, sbp, getting)
70struct tcb *tcp;
71struct strbuf *sbp;
72int getting;
73{
74 if (sbp->maxlen == -1 && getting)
75 tprintf("{maxlen=-1}");
76 else {
77 tprintf("{");
78 if (getting)
79 tprintf("maxlen=%d, ", sbp->maxlen);
80 tprintf("len=%d, buf=", sbp->len);
Wichert Akkerman2e2553a1999-05-09 00:29:58 +000081 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
Wichert Akkerman76baf7c1999-02-19 00:21:36 +000082 tprintf("}");
83 }
84}
85
86static void
87printstrbufarg(tcp, arg, getting)
88struct tcb *tcp;
89int arg;
90int getting;
91{
92 struct strbuf buf;
93
94 if (arg == 0)
95 tprintf("NULL");
96 else if (umove(tcp, arg, &buf) < 0)
97 tprintf("{...}");
98 else
99 printstrbuf(tcp, &buf, getting);
100 tprintf(", ");
101}
102
103int
104sys_putmsg(tcp)
105struct tcb *tcp;
106{
107 int i;
108
109 if (entering(tcp)) {
110 /* fd */
111 tprintf("%ld, ", tcp->u_arg[0]);
112 /* control and data */
113 for (i = 1; i < 3; i++)
114 printstrbufarg(tcp, tcp->u_arg[i], 0);
115 /* flags */
116 if (!printflags(msgflags, tcp->u_arg[3]))
117 tprintf("0");
118 }
119 return 0;
120}
121
122int
123sys_getmsg(tcp)
124struct tcb *tcp;
125{
126 int i, flags;
127
128 if (entering(tcp)) {
129 /* fd */
130 tprintf("%lu, ", tcp->u_arg[0]);
131 } else {
132 if (syserror(tcp)) {
133 tprintf("%#lx, %#lx, %#lx",
134 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
135 return 0;
136 }
137 /* control and data */
138 for (i = 1; i < 3; i++)
139 printstrbufarg(tcp, tcp->u_arg[i], 1);
140 /* pointer to flags */
141 if (tcp->u_arg[3] == 0)
142 tprintf("NULL");
143 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
144 tprintf("[?]");
145 else {
146 tprintf("[");
147 if (!printflags(msgflags, flags))
148 tprintf("0");
149 tprintf("]");
150 }
151 /* decode return value */
152 switch (tcp->u_rval) {
153 case MORECTL:
154 tcp->auxstr = "MORECTL";
155 break;
156 case MORECTL|MOREDATA:
157 tcp->auxstr = "MORECTL|MOREDATA";
158 break;
159 case MOREDATA:
160 tcp->auxstr = "MORECTL";
161 break;
162 default:
163 tcp->auxstr = NULL;
164 break;
165 }
166 }
167 return RVAL_HEX | RVAL_STR;
168}
169
170#ifdef HAVE_PUTPMSG
171
172static struct xlat pmsgflags[] = {
173 { MSG_HIPRI, "MSG_HIPRI" },
174 { MSG_ANY, "MSG_ANY" },
175 { MSG_BAND, "MSG_BAND" },
176 { 0, NULL },
177};
178
179int
180sys_putpmsg(tcp)
181struct tcb *tcp;
182{
183 int i;
184
185 if (entering(tcp)) {
186 /* fd */
187 tprintf("%ld, ", tcp->u_arg[0]);
188 /* control and data */
189 for (i = 1; i < 3; i++)
190 printstrbufarg(tcp, tcp->u_arg[i], 0);
191 /* band */
192 tprintf("%ld, ", tcp->u_arg[3]);
193 /* flags */
194 if (!printflags(pmsgflags, tcp->u_arg[4]))
195 tprintf("0");
196 }
197 return 0;
198}
199
200int
201sys_getpmsg(tcp)
202struct tcb *tcp;
203{
204 int i, flags;
205
206 if (entering(tcp)) {
207 /* fd */
208 tprintf("%lu, ", tcp->u_arg[0]);
209 } else {
210 if (syserror(tcp)) {
211 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
212 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
213 return 0;
214 }
215 /* control and data */
216 for (i = 1; i < 3; i++)
217 printstrbufarg(tcp, tcp->u_arg[i], 1);
218 /* pointer to band */
219 printnum(tcp, tcp->u_arg[3], "%d");
Wichert Akkerman906dade1999-11-26 09:18:37 +0000220 tprintf(", ");
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000221 /* pointer to flags */
222 if (tcp->u_arg[4] == 0)
223 tprintf("NULL");
224 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
225 tprintf("[?]");
226 else {
227 tprintf("[");
228 if (!printflags(pmsgflags, flags))
229 tprintf("0");
230 tprintf("]");
231 }
232 /* decode return value */
233 switch (tcp->u_rval) {
234 case MORECTL:
235 tcp->auxstr = "MORECTL";
236 break;
237 case MORECTL|MOREDATA:
238 tcp->auxstr = "MORECTL|MOREDATA";
239 break;
240 case MOREDATA:
241 tcp->auxstr = "MORECTL";
242 break;
243 default:
244 tcp->auxstr = NULL;
245 break;
246 }
247 }
248 return RVAL_HEX | RVAL_STR;
249}
250
251#endif /* HAVE_PUTPMSG */
252
Wichert Akkerman76baf7c1999-02-19 00:21:36 +0000253
254static struct xlat pollflags[] = {
255 { POLLIN, "POLLIN" },
256 { POLLPRI, "POLLPRI" },
257 { POLLOUT, "POLLOUT" },
258#ifdef POLLRDNORM
259 { POLLRDNORM, "POLLRDNORM" },
260#endif
261#ifdef POLLWRNORM
262 { POLLWRNORM, "POLLWRNORM" },
263#endif
264#ifdef POLLRDBAND
265 { POLLRDBAND, "POLLRDBAND" },
266#endif
267#ifdef POLLWRBAND
268 { POLLWRBAND, "POLLWRBAND" },
269#endif
270 { POLLERR, "POLLERR" },
271 { POLLHUP, "POLLHUP" },
272 { POLLNVAL, "POLLNVAL" },
273 { 0, NULL },
274};
275
276int
277sys_poll(tcp)
278struct tcb *tcp;
279{
280 struct pollfd *pollp;
281
282 if (exiting(tcp)) {
283 int i;
284 int nfds = tcp->u_arg[1];
285
286 if (nfds <= 0) {
287 tprintf("%#lx, %d, %ld\n",
288 tcp->u_arg[0], nfds, tcp->u_arg[2]);
289 return 0;
290 }
291 pollp = (struct pollfd *) malloc(nfds * sizeof(*pollp));
292 if (pollp == NULL) {
293 fprintf(stderr, "sys_poll: no memory\n");
294 tprintf("%#lx, %d, %ld",
295 tcp->u_arg[0], nfds, tcp->u_arg[2]);
296 return 0;
297 }
298 if (umoven(tcp, tcp->u_arg[0],
299 (nfds * sizeof(*pollp)), (char *) pollp) < 0) {
300 tprintf("%#lx", tcp->u_arg[0]);
301 }
302 else {
303 tprintf("[");
304 for (i = 0; i < nfds; i++) {
305 if (i)
306 tprintf(", ");
307 if (pollp[i].fd < 0) {
308 tprintf("{fd=%d}", pollp[i].fd);
309 continue;
310 }
311 tprintf("{fd=%d, events=", pollp[i].fd);
312 if (!printflags(pollflags, pollp[i].events))
313 tprintf("0");
314 if (!syserror(tcp) && pollp[i].revents) {
315 tprintf(", revents=");
316 if (!printflags(pollflags,
317 pollp[i].revents))
318 tprintf("0");
319 }
320 tprintf("}");
321 }
322 tprintf("]");
323 }
324 tprintf(", %d, ", nfds);
325#ifdef INFTIM
326 if (tcp->u_arg[2] == INFTIM)
327 tprintf("INFTIM");
328 else
329#endif
330 tprintf("%ld", tcp->u_arg[2]);
331 free(pollp);
332 }
333 return 0;
334}
335
336#ifndef linux
337
338static struct xlat stream_flush_options[] = {
339 { FLUSHR, "FLUSHR" },
340 { FLUSHW, "FLUSHW" },
341 { FLUSHRW, "FLUSHRW" },
342#ifdef FLUSHBAND
343 { FLUSHBAND, "FLUSHBAND" },
344#endif
345 { 0, NULL },
346};
347
348static struct xlat stream_setsig_flags[] = {
349 { S_INPUT, "S_INPUT" },
350 { S_HIPRI, "S_HIPRI" },
351 { S_OUTPUT, "S_OUTPUT" },
352 { S_MSG, "S_MSG" },
353#ifdef S_ERROR
354 { S_ERROR, "S_ERROR" },
355#endif
356#ifdef S_HANGUP
357 { S_HANGUP, "S_HANGUP" },
358#endif
359#ifdef S_RDNORM
360 { S_RDNORM, "S_RDNORM" },
361#endif
362#ifdef S_WRNORM
363 { S_WRNORM, "S_WRNORM" },
364#endif
365#ifdef S_RDBAND
366 { S_RDBAND, "S_RDBAND" },
367#endif
368#ifdef S_WRBAND
369 { S_WRBAND, "S_WRBAND" },
370#endif
371#ifdef S_BANDURG
372 { S_BANDURG, "S_BANDURG" },
373#endif
374 { 0, NULL },
375};
376
377static struct xlat stream_read_options[] = {
378 { RNORM, "RNORM" },
379 { RMSGD, "RMSGD" },
380 { RMSGN, "RMSGN" },
381 { 0, NULL },
382};
383
384static struct xlat stream_read_flags[] = {
385#ifdef RPROTDAT
386 { RPROTDAT, "RPROTDAT" },
387#endif
388#ifdef RPROTDIS
389 { RPROTDIS, "RPROTDIS" },
390#endif
391#ifdef RPROTNORM
392 { RPROTNORM, "RPROTNORM" },
393#endif
394 { 0, NULL },
395};
396
397#ifndef RMODEMASK
398#define RMODEMASK (~0)
399#endif
400
401#ifdef I_SWROPT
402static struct xlat stream_write_flags[] = {
403 { SNDZERO, "SNDZERO" },
404 { SNDPIPE, "SNDPIPE" },
405 { 0, NULL },
406};
407#endif /* I_SWROPT */
408
409#ifdef I_ATMARK
410static struct xlat stream_atmark_options[] = {
411 { ANYMARK, "ANYMARK" },
412 { LASTMARK, "LASTMARK" },
413 { 0, NULL },
414};
415#endif /* I_ATMARK */
416
417#ifdef TI_BIND
418static struct xlat transport_user_options[] = {
419 { T_CONN_REQ, "T_CONN_REQ" },
420 { T_CONN_RES, "T_CONN_RES" },
421 { T_DISCON_REQ, "T_DISCON_REQ" },
422 { T_DATA_REQ, "T_DATA_REQ" },
423 { T_EXDATA_REQ, "T_EXDATA_REQ" },
424 { T_INFO_REQ, "T_INFO_REQ" },
425 { T_BIND_REQ, "T_BIND_REQ" },
426 { T_UNBIND_REQ, "T_UNBIND_REQ" },
427 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
428 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
429 { T_ORDREL_REQ, "T_ORDREL_REQ" },
430 { 0, NULL },
431};
432
433static struct xlat transport_provider_options[] = {
434 { T_CONN_IND, "T_CONN_IND" },
435 { T_CONN_CON, "T_CONN_CON" },
436 { T_DISCON_IND, "T_DISCON_IND" },
437 { T_DATA_IND, "T_DATA_IND" },
438 { T_EXDATA_IND, "T_EXDATA_IND" },
439 { T_INFO_ACK, "T_INFO_ACK" },
440 { T_BIND_ACK, "T_BIND_ACK" },
441 { T_ERROR_ACK, "T_ERROR_ACK" },
442 { T_OK_ACK, "T_OK_ACK" },
443 { T_UNITDATA_IND,"T_UNITDATA_IND"},
444 { T_UDERROR_IND,"T_UDERROR_IND" },
445 { T_OPTMGMT_ACK,"T_OPTMGMT_ACK" },
446 { T_ORDREL_IND, "T_ORDREL_IND" },
447 { 0, NULL },
448};
449#endif /* TI_BIND */
450
451static int
452internal_stream_ioctl(tcp, arg)
453struct tcb *tcp;
454int arg;
455{
456 struct strioctl si;
457 char *name;
458 int in_and_out;
459#ifdef SI_GETUDATA
460 struct si_udata udata;
461#endif /* SI_GETUDATA */
462
463 if (!arg)
464 return 0;
465 if (umove(tcp, arg, &si) < 0) {
466 if (entering(tcp))
467 tprintf(", {...}");
468 return 1;
469 }
470 if (entering(tcp)) {
471 name = ioctl_lookup(si.ic_cmd);
472 if (name)
473 tprintf(", {ic_cmd=%s", name);
474 else
475 tprintf(", {ic_cmd=%#x", si.ic_cmd);
476 if (si.ic_timout == INFTIM)
477 tprintf(", ic_timout=INFTIM, ");
478 else
479 tprintf(" ic_timout=%d, ", si.ic_timout);
480 }
481 in_and_out = 1;
482 switch (si.ic_cmd) {
483#ifdef SI_GETUDATA
484 case SI_GETUDATA:
485 in_and_out = 0;
486 break;
487#endif /* SI_GETUDATA */
488 }
489 if (in_and_out) {
490 if (entering(tcp))
491 tprintf("/* in */ ");
492 else
493 tprintf(", /* out */ ");
494 }
495 if (in_and_out || entering(tcp))
496 tprintf("ic_len=%d, ic_dp=", si.ic_len);
497 switch (si.ic_cmd) {
498#ifdef TI_BIND
499 case TI_BIND:
500 /* in T_BIND_REQ, out T_BIND_ACK */
501 if (entering(tcp)) {
502 struct T_bind_req data;
503
504#if 0
505 tprintf("struct T_bind_req ");
506#endif
507 if (umove(tcp, (int) si.ic_dp, &data) < 0)
508 tprintf("{...}");
509 else {
510 tprintf("{PRIM_type=");
511 printxval(transport_user_options,
512 data.PRIM_type, "T_???");
513 tprintf(", ADDR_length=%ld, ADDR_offset=%ld",
514 data.ADDR_length, data.ADDR_offset);
515 tprintf(", CONIND_number=%ld}",
516 data.CONIND_number);
517 }
518 }
519 else {
520 struct T_bind_ack data;
521
522#if 0
523 tprintf("struct T_bind_ack ");
524#endif
525 if (umove(tcp, (int) si.ic_dp, &data) < 0)
526 tprintf("{...}");
527 else {
528 tprintf("[");
529 tprintf("{PRIM_type=");
530 printxval(transport_provider_options,
531 data.PRIM_type, "T_???");
532 tprintf(", ADDR_length=%ld, ADDR_offset=%ld",
533 data.ADDR_length, data.ADDR_offset);
534 tprintf(", CONIND_number=%ld}",
535 data.CONIND_number);
536 tprintf(", ");
537 printstr(tcp,
538 (int) si.ic_dp + data.ADDR_offset,
539 data.ADDR_length);
540 tprintf("]");
541 }
542 }
543 break;
544#endif /* TI_BIND */
545#if 0
546#ifdef TI_UNBIND
547 case TI_UNBIND:
548 /* in T_UNBIND_REQ, out T_OK_ACK */
549 break;
550#endif /* TI_UNBIND */
551#ifdef TI_GETINFO
552 case TI_GETINFO:
553 /* in T_INFO_REQ, out T_INFO_ACK */
554 break;
555#endif /* TI_GETINFO */
556#ifdef TI_OPTMGMT
557 case TI_OPTMGMT:
558 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
559 break;
560#endif /* TI_OPTMGMT */
561#endif
562#ifdef SI_GETUDATA
563 case SI_GETUDATA:
564 if (entering(tcp))
565 break;
566#if 0
567 tprintf("struct si_udata ");
568#endif
569 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
570 tprintf("{...}");
571 else {
572 tprintf("{tidusize=%d, addrsize=%d, ",
573 udata.tidusize, udata.addrsize);
574 tprintf("optsize=%d, etsdusize=%d, ",
575 udata.optsize, udata.etsdusize);
576 tprintf("servtype=%d, so_state=%d, ",
577 udata.servtype, udata.so_state);
578 tprintf("so_options=%d", udata.so_options);
579#if 0
580 tprintf(", tsdusize=%d", udata.tsdusize);
581#endif
582 tprintf("}");
583 }
584 break;
585#endif /* SI_GETUDATA */
586 default:
587 printstr(tcp, (int) si.ic_dp, si.ic_len);
588 break;
589 }
590 if (exiting(tcp))
591 tprintf("}");
592 return 1;
593}
594
595int
596stream_ioctl(tcp, code, arg)
597struct tcb *tcp;
598int code, arg;
599{
600#ifdef I_LIST
601 int i;
602#endif
603 int val;
604#ifdef I_FLUSHBAND
605 struct bandinfo bi;
606#endif
607 struct strpeek sp;
608 struct strfdinsert sfi;
609 struct strrecvfd srf;
610#ifdef I_LIST
611 struct str_list sl;
612#endif
613
614 /* I_STR is a special case because the data is read & written. */
615 if (code == I_STR)
616 return internal_stream_ioctl(tcp, arg);
617 if (entering(tcp))
618 return 0;
619
620 switch (code) {
621 case I_PUSH:
622 case I_LOOK:
623 case I_FIND:
624 /* arg is a string */
625 tprintf(", ");
626 printpath(tcp, arg);
627 return 1;
628 case I_POP:
629 /* doesn't take an argument */
630 return 1;
631 case I_FLUSH:
632 /* argument is an option */
633 tprintf(", ");
634 printxval(stream_flush_options, arg, "FLUSH???");
635 return 1;
636#ifdef I_FLUSHBAND
637 case I_FLUSHBAND:
638 /* argument is a pointer to a bandinfo struct */
639 if (umove(tcp, arg, &bi) < 0)
640 tprintf(", {...}");
641 else {
642 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
643 if (!printflags(stream_flush_options, bi.bi_flag))
644 tprintf("0");
645 tprintf("}");
646 }
647 return 1;
648#endif /* I_FLUSHBAND */
649 case I_SETSIG:
650 /* argument is a set of flags */
651 tprintf(", ");
652 if (!printflags(stream_setsig_flags, arg))
653 tprintf("0");
654 return 1;
655 case I_GETSIG:
656 /* argument is a pointer to a set of flags */
657 if (syserror(tcp))
658 return 0;
659 tprintf(", [");
660 if (umove(tcp, arg, &val) < 0)
661 tprintf("?");
662 else if (!printflags(stream_setsig_flags, val))
663 tprintf("0");
664 tprintf("]");
665 return 1;
666 case I_PEEK:
667 /* argument is a pointer to a strpeek structure */
668 if (syserror(tcp) || !arg)
669 return 0;
670 if (umove(tcp, arg, &sp) < 0) {
671 tprintf(", {...}");
672 return 1;
673 }
674 tprintf(", {ctlbuf=");
675 printstrbuf(tcp, &sp.ctlbuf, 1);
676 tprintf(", databuf=");
677 printstrbuf(tcp, &sp.databuf, 1);
678 if (!printflags(msgflags, sp.flags))
679 tprintf("0");
680 return 1;
681 case I_SRDOPT:
682 /* argument is an option with flags */
683 tprintf(", ");
684 printxval(stream_read_options, arg & RMODEMASK, "R???");
685 addflags(stream_read_flags, arg & ~RMODEMASK);
686 return 1;
687 case I_GRDOPT:
688 /* argument is an pointer to an option with flags */
689 if (syserror(tcp))
690 return 0;
691 tprintf(", [");
692 if (umove(tcp, arg, &val) < 0)
693 tprintf("?");
694 else {
695 printxval(stream_read_options,
696 arg & RMODEMASK, "R???");
697 addflags(stream_read_flags, arg & ~RMODEMASK);
698 }
699 tprintf("]");
700 return 1;
701 case I_NREAD:
702#ifdef I_GETBAND
703 case I_GETBAND:
704#endif
705#ifdef I_SETCLTIME
706 case I_SETCLTIME:
707#endif
708#ifdef I_GETCLTIME
709 case I_GETCLTIME:
710#endif
711 /* argument is a pointer to a decimal integer */
712 if (syserror(tcp))
713 return 0;
714 tprintf(", ");
715 printnum(tcp, arg, "%d");
716 return 1;
717 case I_FDINSERT:
718 /* argument is a pointer to a strfdinsert structure */
719 if (syserror(tcp) || !arg)
720 return 0;
721 if (umove(tcp, arg, &sfi) < 0) {
722 tprintf(", {...}");
723 return 1;
724 }
725 tprintf(", {ctlbuf=");
726 printstrbuf(tcp, &sfi.ctlbuf, 1);
727 tprintf(", databuf=");
728 printstrbuf(tcp, &sfi.databuf, 1);
729 if (!printflags(msgflags, sfi.flags))
730 tprintf("0");
731 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
732 return 1;
733#ifdef I_SWROPT
734 case I_SWROPT:
735 /* argument is a set of flags */
736 tprintf(", ");
737 if (!printflags(stream_write_flags, arg))
738 tprintf("0");
739 return 1;
740#endif /* I_SWROPT */
741#ifdef I_GWROPT
742 case I_GWROPT:
743 /* argument is an pointer to an option with flags */
744 if (syserror(tcp))
745 return 0;
746 tprintf(", [");
747 if (umove(tcp, arg, &val) < 0)
748 tprintf("?");
749 else if (!printflags(stream_write_flags, arg))
750 tprintf("0");
751 tprintf("]");
752 return 1;
753#endif /* I_GWROPT */
754 case I_SENDFD:
755#ifdef I_CKBAND
756 case I_CKBAND:
757#endif
758#ifdef I_CANPUT
759 case I_CANPUT:
760#endif
761 case I_LINK:
762 case I_UNLINK:
763 case I_PLINK:
764 case I_PUNLINK:
765 /* argument is a decimal integer */
766 tprintf(", %d", arg);
767 return 1;
768 case I_RECVFD:
769 /* argument is a pointer to a strrecvfd structure */
770 if (syserror(tcp) || !arg)
771 return 0;
772 if (umove(tcp, arg, &srf) < 0) {
773 tprintf(", {...}");
774 return 1;
775 }
776 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
777 (unsigned long) srf.uid, (unsigned long) srf.gid);
778 return 1;
779#ifdef I_LIST
780 case I_LIST:
781 if (syserror(tcp))
782 return 0;
783 if (arg == 0) {
784 tprintf(", NULL");
785 return 1;
786 }
787 if (umove(tcp, arg, &sl) < 0) {
788 tprintf(", {...}");
789 return 1;
790 }
791 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
792 for (i = 0; i < tcp->u_rval; i++) {
793 if (i)
794 tprintf(", ");
795 printpath(tcp, (int) sl.sl_modlist[i].l_name);
796 }
797 tprintf("]}");
798 return 1;
799#endif /* I_LIST */
800#ifdef I_ATMARK
801 case I_ATMARK:
802 tprintf(", ");
803 printxval(stream_atmark_options, arg, "???MARK");
804 return 1;
805#endif /* I_ATMARK */
806 default:
807 return 0;
808 }
809}
810
811#endif /* linux */
812
813#endif /* LINUXSPARC && linux */
814