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