2 * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
3 * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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.
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.
32 #include <sys/syscall.h>
37 #ifdef HAVE_SYS_POLL_H
43 #ifdef HAVE_SYS_CONF_H
46 #ifdef HAVE_SYS_STREAM_H
47 #include <sys/stream.h>
49 #ifdef HAVE_SYS_TIHDR_H
50 #include <sys/tihdr.h>
53 #if defined(HAVE_SYS_STREAM_H) || defined(LINUX) || defined(FREEBSD)
55 #ifndef HAVE_STROPTS_H
58 int maxlen; /* no. of bytes in buffer */
59 int len; /* no. of bytes returned */
60 char *buf; /* pointer to data */
64 #endif /* !HAVE_STROPTS_H */
66 #ifdef HAVE_SYS_TIUSER_H
67 #include <sys/tiuser.h>
68 #include <sys/sockmod.h>
69 #include <sys/timod.h>
70 #endif /* HAVE_SYS_TIUSER_H */
73 static const struct xlat msgflags[] = {
74 { RS_HIPRI, "RS_HIPRI" },
80 printstrbuf(tcp, sbp, getting)
85 if (sbp->maxlen == -1 && getting)
86 tprintf("{maxlen=-1}");
90 tprintf("maxlen=%d, ", sbp->maxlen);
91 tprintf("len=%d, buf=", sbp->len);
92 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
98 printstrbufarg(tcp, arg, getting)
107 else if (umove(tcp, arg, &buf) < 0)
110 printstrbuf(tcp, &buf, getting);
122 tprintf("%ld, ", tcp->u_arg[0]);
123 /* control and data */
124 for (i = 1; i < 3; i++)
125 printstrbufarg(tcp, tcp->u_arg[i], 0);
127 printflags(msgflags, tcp->u_arg[3], "RS_???");
140 tprintf("%lu, ", tcp->u_arg[0]);
143 tprintf("%#lx, %#lx, %#lx",
144 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
147 /* control and data */
148 for (i = 1; i < 3; i++)
149 printstrbufarg(tcp, tcp->u_arg[i], 1);
150 /* pointer to flags */
151 if (tcp->u_arg[3] == 0)
153 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
157 printflags(msgflags, flags, "RS_???");
160 /* decode return value */
161 switch (tcp->u_rval) {
163 tcp->auxstr = "MORECTL";
165 case MORECTL|MOREDATA:
166 tcp->auxstr = "MORECTL|MOREDATA";
169 tcp->auxstr = "MORECTL";
176 return RVAL_HEX | RVAL_STR;
179 #if defined SYS_putpmsg || defined SYS_getpmsg
180 static const struct xlat pmsgflags[] = {
182 { MSG_HIPRI, "MSG_HIPRI" },
185 { MSG_ANY, "MSG_ANY" },
188 { MSG_BAND, "MSG_BAND" },
203 tprintf("%ld, ", tcp->u_arg[0]);
204 /* control and data */
205 for (i = 1; i < 3; i++)
206 printstrbufarg(tcp, tcp->u_arg[i], 0);
208 tprintf("%ld, ", tcp->u_arg[3]);
210 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
214 #endif /* SYS_putpmsg */
225 tprintf("%lu, ", tcp->u_arg[0]);
228 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
229 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
232 /* control and data */
233 for (i = 1; i < 3; i++)
234 printstrbufarg(tcp, tcp->u_arg[i], 1);
235 /* pointer to band */
236 printnum(tcp, tcp->u_arg[3], "%d");
238 /* pointer to flags */
239 if (tcp->u_arg[4] == 0)
241 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
245 printflags(pmsgflags, flags, "MSG_???");
248 /* decode return value */
249 switch (tcp->u_rval) {
251 tcp->auxstr = "MORECTL";
253 case MORECTL|MOREDATA:
254 tcp->auxstr = "MORECTL|MOREDATA";
257 tcp->auxstr = "MORECTL";
264 return RVAL_HEX | RVAL_STR;
266 #endif /* SYS_getpmsg */
268 #endif /* !FREEBSD */
271 #ifdef HAVE_SYS_POLL_H
273 static const struct xlat pollflags[] = {
275 { POLLIN, "POLLIN" },
276 { POLLPRI, "POLLPRI" },
277 { POLLOUT, "POLLOUT" },
279 { POLLRDNORM, "POLLRDNORM" },
282 { POLLWRNORM, "POLLWRNORM" },
285 { POLLRDBAND, "POLLRDBAND" },
288 { POLLWRBAND, "POLLWRBAND" },
290 { POLLERR, "POLLERR" },
291 { POLLHUP, "POLLHUP" },
292 { POLLNVAL, "POLLNVAL" },
298 decode_poll(struct tcb *tcp)
302 unsigned long size, start, cur, end, abbrev_end;
308 nfds = tcp->u_arg[1];
309 size = sizeof(fds) * nfds;
310 start = tcp->u_arg[0];
312 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
313 tprintf("%#lx, %d, ",
314 tcp->u_arg[0], nfds);
318 abbrev_end = start + max_strlen * sizeof(fds);
319 if (abbrev_end < start)
325 for (cur = start; cur < end; cur += sizeof(fds)) {
328 if (cur >= abbrev_end) {
332 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
338 tprintf("{fd=%d}", fds.fd);
341 tprintf("{fd=%d, events=", fds.fd);
342 printflags(pollflags, fds.events, "POLL???");
343 if (!syserror(tcp) && fds.revents) {
344 tprintf(", revents=");
345 printflags(pollflags, fds.revents, "POLL???");
351 tprintf(" %#lx", start);
352 tprintf(", %d, ", nfds);
357 sys_poll(struct tcb *tcp)
359 int rc = decode_poll(tcp);
362 if (tcp->u_arg[2] == INFTIM)
366 tprintf("%ld", tcp->u_arg[2]);
373 sys_ppoll(struct tcb *tcp)
375 int rc = decode_poll(tcp);
378 if (umove(tcp, tcp->u_arg[2], &ts) == 0)
379 tprintf("{%lu, %lu}, ", ts.tv_sec, ts.tv_nsec);
382 print_sigset(tcp, tcp->u_arg[3], 0);
383 tprintf(", %lu", tcp->u_arg[4]);
389 #else /* !HAVE_SYS_POLL_H */
398 #if !defined(LINUX) && !defined(FREEBSD)
400 static const struct xlat stream_flush_options[] = {
401 { FLUSHR, "FLUSHR" },
402 { FLUSHW, "FLUSHW" },
403 { FLUSHRW, "FLUSHRW" },
405 { FLUSHBAND, "FLUSHBAND" },
410 static const struct xlat stream_setsig_flags[] = {
411 { S_INPUT, "S_INPUT" },
412 { S_HIPRI, "S_HIPRI" },
413 { S_OUTPUT, "S_OUTPUT" },
416 { S_ERROR, "S_ERROR" },
419 { S_HANGUP, "S_HANGUP" },
422 { S_RDNORM, "S_RDNORM" },
425 { S_WRNORM, "S_WRNORM" },
428 { S_RDBAND, "S_RDBAND" },
431 { S_WRBAND, "S_WRBAND" },
434 { S_BANDURG, "S_BANDURG" },
439 static const struct xlat stream_read_options[] = {
446 static const struct xlat stream_read_flags[] = {
448 { RPROTDAT, "RPROTDAT" },
451 { RPROTDIS, "RPROTDIS" },
454 { RPROTNORM, "RPROTNORM" },
460 #define RMODEMASK (~0)
464 static const struct xlat stream_write_flags[] = {
465 { SNDZERO, "SNDZERO" },
466 { SNDPIPE, "SNDPIPE" },
469 #endif /* I_SWROPT */
472 static const struct xlat stream_atmark_options[] = {
473 { ANYMARK, "ANYMARK" },
474 { LASTMARK, "LASTMARK" },
477 #endif /* I_ATMARK */
480 static const struct xlat transport_user_options[] = {
481 { T_CONN_REQ, "T_CONN_REQ" },
482 { T_CONN_RES, "T_CONN_RES" },
483 { T_DISCON_REQ, "T_DISCON_REQ" },
484 { T_DATA_REQ, "T_DATA_REQ" },
485 { T_EXDATA_REQ, "T_EXDATA_REQ" },
486 { T_INFO_REQ, "T_INFO_REQ" },
487 { T_BIND_REQ, "T_BIND_REQ" },
488 { T_UNBIND_REQ, "T_UNBIND_REQ" },
489 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
490 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
491 { T_ORDREL_REQ, "T_ORDREL_REQ" },
495 static const struct xlat transport_user_flags [] = {
497 { T_MORE, "T_MORE" },
498 { T_EXPEDITED, "T_EXPEDITED" },
499 { T_NEGOTIATE, "T_NEGOTIATE" },
500 { T_CHECK, "T_CHECK" },
501 { T_DEFAULT, "T_DEFAULT" },
502 { T_SUCCESS, "T_SUCCESS" },
503 { T_FAILURE, "T_FAILURE" },
504 { T_CURRENT, "T_CURRENT" },
505 { T_PARTSUCCESS,"T_PARTSUCCESS" },
506 { T_READONLY, "T_READONLY" },
507 { T_NOTSUPPORT, "T_NOTSUPPORT" },
512 #ifdef HAVE_STRUCT_T_OPTHDR
514 static const struct xlat xti_level [] = {
515 { XTI_GENERIC, "XTI_GENERIC" },
519 static const struct xlat xti_generic [] = {
520 { XTI_DEBUG, "XTI_DEBUG" },
521 { XTI_LINGER, "XTI_LINGER" },
522 { XTI_RCVBUF, "XTI_RCVBUF" },
523 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
524 { XTI_SNDBUF, "XTI_SNDBUF" },
525 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
532 print_xti_optmgmt (tcp, addr, len)
540 while (len >= (int) sizeof hdr) {
541 if (umove(tcp, addr, &hdr) < 0) break;
545 else if (len > hdr.len + sizeof hdr) {
549 printxval (xti_level, hdr.level, "???");
553 printxval (xti_generic, hdr.name, "XTI_???");
556 tprintf ("%ld", hdr.name);
559 tprintf (", status=");
560 printxval (transport_user_flags, hdr.status, "T_???");
563 if ((hdr.len -= sizeof hdr) > 0) {
564 if (hdr.len > len) break;
566 if (len == sizeof (int))
567 printnum (tcp, addr, "%d");
569 printstr (tcp, addr, hdr.len);
576 if (c++) tprintf (", ");
577 printstr (tcp, addr, len);
579 if (c > 1) tprintf ("]");
586 print_optmgmt (tcp, addr, len)
591 /* We don't know how to tell if TLI (socket) or XTI
592 optmgmt is being used yet, assume TLI. */
593 #if defined (HAVE_STRUCT_OPTHDR)
594 print_sock_optmgmt (tcp, addr, len);
595 #elif defined (HAVE_STRUCT_T_OPTHDR)
596 print_xti_optmgmt (tcp, addr, len);
598 printstr (tcp, addr, len);
605 static const struct xlat service_type [] = {
606 { T_COTS, "T_COTS" },
607 { T_COTS_ORD, "T_COTS_ORD" },
608 { T_CLTS, "T_CLTS" },
612 static const struct xlat ts_state [] = {
613 { TS_UNBND, "TS_UNBND" },
614 { TS_WACK_BREQ, "TS_WACK_BREQ" },
615 { TS_WACK_UREQ, "TS_WACK_UREQ" },
616 { TS_IDLE, "TS_IDLE" },
617 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
618 { TS_WACK_CREQ, "TS_WACK_CREQ" },
619 { TS_WCON_CREQ, "TS_WCON_CREQ" },
620 { TS_WRES_CIND, "TS_WRES_CIND" },
621 { TS_WACK_CRES, "TS_WACK_CRES" },
622 { TS_DATA_XFER, "TS_DATA_XFER" },
623 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
624 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
625 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
626 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
627 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
628 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
629 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
633 static const struct xlat provider_flags [] = {
635 { SENDZERO, "SENDZERO" },
636 { EXPINLINE, "EXPINLINE" },
637 { XPG4_1, "XPG4_1" },
642 static const struct xlat tli_errors [] = {
643 { TBADADDR, "TBADADDR" },
644 { TBADOPT, "TBADOPT" },
645 { TACCES, "TACCES" },
647 { TNOADDR, "TNOADDR" },
648 { TOUTSTATE, "TOUTSTATE" },
649 { TBADSEQ, "TBADSEQ" },
650 { TSYSERR, "TSYSERR" },
652 { TBADDATA, "TBADDATA" },
653 { TBUFOVFLW, "TBUFOVFLW" },
655 { TNODATA, "TNODATA" },
656 { TNODIS, "TNODIS" },
657 { TNOUDERR, "TNOUDERR" },
658 { TBADFLAG, "TBADFLAG" },
659 { TNOREL, "TNOREL" },
660 { TNOTSUPPORT, "TNOTSUPPORT" },
661 { TSTATECHNG, "TSTATECHNG" },
662 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
663 { TBADNAME, "TBADNAME" },
664 { TBADQLEN, "TBADQLEN" },
665 { TADDRBUSY, "TADDRBUSY" },
666 { TINDOUT, "TINDOUT" },
667 { TPROVMISMATCH,"TPROVMISMATCH" },
668 { TRESQLEN, "TRESQLEN" },
669 { TRESADDR, "TRESADDR" },
670 { TQFULL, "TQFULL" },
671 { TPROTO, "TPROTO" },
677 print_transport_message (tcp, expect, addr, len)
683 union T_primitives m;
686 if (len < sizeof m.type) goto dump;
688 if (umove (tcp, addr, &m.type) < 0) goto dump;
690 #define GET(type, struct) \
692 if (len < sizeof m.struct) goto dump; \
693 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
695 if (expect != type) { \
703 do { if (c++) tprintf (", "); } while (0)
706 #define STRUCT(struct, elem, print) \
709 if (m.struct.elem##_length < 0 || \
710 m.struct.elem##_offset < sizeof m.struct || \
711 m.struct.elem##_offset + m.struct.elem##_length > len) \
713 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
714 m.struct.elem##_length, \
715 m.struct.elem##_offset); \
718 tprintf (#elem "="); \
720 addr + m.struct.elem##_offset, \
721 m.struct.elem##_length); \
726 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
730 case T_CONN_REQ: /* connect request */
731 GET (T_CONN_REQ, conn_req);
732 ADDR (conn_req, DEST);
733 ADDR (conn_req, OPT);
737 case T_CONN_RES: /* connect response */
738 GET (T_CONN_RES, conn_res);
739 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
741 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
742 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
744 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
746 ADDR (conn_res, OPT);
748 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
752 case T_DISCON_REQ: /* disconnect request */
753 GET (T_DISCON_REQ, discon_req);
755 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
759 case T_DATA_REQ: /* data request */
760 GET (T_DATA_REQ, data_req);
762 tprintf ("MORE=%ld", m.data_req.MORE_flag);
766 case T_EXDATA_REQ: /* expedited data req */
767 GET (T_EXDATA_REQ, exdata_req);
769 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
773 case T_INFO_REQ: /* information req */
774 GET (T_INFO_REQ, info_req);
778 case T_BIND_REQ: /* bind request */
780 case O_T_BIND_REQ: /* Ugly xti/tli hack */
782 GET (T_BIND_REQ, bind_req);
783 ADDR (bind_req, ADDR);
785 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
789 case T_UNBIND_REQ: /* unbind request */
790 GET (T_UNBIND_REQ, unbind_req);
793 #ifdef T_UNITDATA_REQ
794 case T_UNITDATA_REQ: /* unitdata requset */
795 GET (T_UNITDATA_REQ, unitdata_req);
796 ADDR (unitdata_req, DEST);
797 ADDR (unitdata_req, OPT);
801 case T_OPTMGMT_REQ: /* manage opt req */
802 GET (T_OPTMGMT_REQ, optmgmt_req);
805 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
807 STRUCT (optmgmt_req, OPT, print_optmgmt);
811 case T_ORDREL_REQ: /* orderly rel req */
812 GET (T_ORDREL_REQ, ordrel_req);
816 case T_CONN_IND: /* connect indication */
817 GET (T_CONN_IND, conn_ind);
818 ADDR (conn_ind, SRC);
819 ADDR (conn_ind, OPT);
820 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
824 case T_CONN_CON: /* connect corfirm */
825 GET (T_CONN_CON, conn_con);
826 ADDR (conn_con, RES);
827 ADDR (conn_con, OPT);
831 case T_DISCON_IND: /* discon indication */
832 GET (T_DISCON_IND, discon_ind);
834 tprintf ("DISCON=%ld, SEQ=%ld",
835 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
839 case T_DATA_IND: /* data indication */
840 GET (T_DATA_IND, data_ind);
842 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
846 case T_EXDATA_IND: /* expedited data ind */
847 GET (T_EXDATA_IND, exdata_ind);
849 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
853 case T_INFO_ACK: /* info ack */
854 GET (T_INFO_ACK, info_ack);
856 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
857 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
858 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
859 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
860 m.info_ack.ADDR_size, m.info_ack.OPT_size,
861 m.info_ack.TIDU_size);
862 printxval (service_type, m.info_ack.SERV_type, "T_???");
863 tprintf (", CURRENT=");
864 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
865 tprintf (", PROVIDER=");
866 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
870 case T_BIND_ACK: /* bind ack */
871 GET (T_BIND_ACK, bind_ack);
872 ADDR (bind_ack, ADDR);
873 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
877 case T_ERROR_ACK: /* error ack */
878 GET (T_ERROR_ACK, error_ack);
881 printxval (transport_user_options,
882 m.error_ack.ERROR_prim, "TI_???");
884 printxval (tli_errors, m.error_ack.TLI_error, "T???");
885 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
889 case T_OK_ACK: /* ok ack */
890 GET (T_OK_ACK, ok_ack);
892 tprintf ("CORRECT=");
893 printxval (transport_user_options,
894 m.ok_ack.CORRECT_prim, "TI_???");
897 #ifdef T_UNITDATA_IND
898 case T_UNITDATA_IND: /* unitdata ind */
899 GET (T_UNITDATA_IND, unitdata_ind);
900 ADDR (unitdata_ind, SRC);
901 ADDR (unitdata_ind, OPT);
905 case T_UDERROR_IND: /* unitdata error ind */
906 GET (T_UDERROR_IND, uderror_ind);
907 ADDR (uderror_ind, DEST);
908 ADDR (uderror_ind, OPT);
909 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
913 case T_OPTMGMT_ACK: /* manage opt ack */
914 GET (T_OPTMGMT_ACK, optmgmt_ack);
917 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
919 STRUCT (optmgmt_ack, OPT, print_optmgmt);
923 case T_ORDREL_IND: /* orderly rel ind */
924 GET (T_ORDREL_IND, ordrel_ind);
928 case T_ADDR_REQ: /* address req */
929 GET (T_ADDR_REQ, addr_req);
933 case T_ADDR_ACK: /* address response */
934 GET (T_ADDR_ACK, addr_ack);
935 ADDR (addr_ack, LOCADDR);
936 ADDR (addr_ack, REMADDR);
942 printstr(tcp, addr, len);
946 if (c >= 0) tprintf ("}");
960 internal_stream_ioctl(tcp, arg)
965 struct ioctlent *iop;
969 struct si_udata udata;
970 #endif /* SI_GETUDATA */
974 if (umove(tcp, arg, &si) < 0) {
980 iop = ioctl_lookup(si.ic_cmd);
982 tprintf(", {ic_cmd=%s", iop->symbol);
983 while ((iop = ioctl_next_match(iop)))
984 tprintf(" or %s", iop->symbol);
986 tprintf(", {ic_cmd=%#x", si.ic_cmd);
987 if (si.ic_timout == INFTIM)
988 tprintf(", ic_timout=INFTIM, ");
990 tprintf(" ic_timout=%d, ", si.ic_timout);
998 #endif /* SI_GETUDATA */
1002 tprintf("/* in */ ");
1004 tprintf(", /* out */ ");
1006 if (in_and_out || entering(tcp))
1007 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1008 switch (si.ic_cmd) {
1011 /* in T_BIND_REQ, out T_BIND_ACK */
1013 if (entering(tcp)) {
1014 print_transport_message (tcp,
1016 si.ic_dp, si.ic_len);
1019 print_transport_message (tcp,
1021 si.ic_dp, si.ic_len);
1024 #endif /* TI_BIND */
1027 /* in T_UNBIND_REQ, out T_OK_ACK */
1029 if (entering(tcp)) {
1030 print_transport_message (tcp,
1032 si.ic_dp, si.ic_len);
1035 print_transport_message (tcp,
1037 si.ic_dp, si.ic_len);
1040 #endif /* TI_UNBIND */
1043 /* in T_INFO_REQ, out T_INFO_ACK */
1045 if (entering(tcp)) {
1046 print_transport_message (tcp,
1048 si.ic_dp, si.ic_len);
1051 print_transport_message (tcp,
1053 si.ic_dp, si.ic_len);
1056 #endif /* TI_GETINFO */
1059 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1061 if (entering(tcp)) {
1062 print_transport_message (tcp,
1064 si.ic_dp, si.ic_len);
1067 print_transport_message (tcp,
1069 si.ic_dp, si.ic_len);
1072 #endif /* TI_OPTMGMT */
1078 tprintf("struct si_udata ");
1080 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1083 tprintf("{tidusize=%d, addrsize=%d, ",
1084 udata.tidusize, udata.addrsize);
1085 tprintf("optsize=%d, etsdusize=%d, ",
1086 udata.optsize, udata.etsdusize);
1087 tprintf("servtype=%d, so_state=%d, ",
1088 udata.servtype, udata.so_state);
1089 tprintf("so_options=%d", udata.so_options);
1091 tprintf(", tsdusize=%d", udata.tsdusize);
1096 #endif /* SI_GETUDATA */
1098 printstr(tcp, (long) si.ic_dp, si.ic_len);
1103 if (timod && tcp->u_rval) {
1104 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1105 return RVAL_STR + 1;
1113 stream_ioctl(tcp, code, arg)
1125 struct strfdinsert sfi;
1126 struct strrecvfd srf;
1131 /* I_STR is a special case because the data is read & written. */
1133 return internal_stream_ioctl(tcp, arg);
1141 /* arg is a string */
1143 printpath(tcp, arg);
1146 /* doesn't take an argument */
1149 /* argument is an option */
1151 printxval(stream_flush_options, arg, "FLUSH???");
1155 /* argument is a pointer to a bandinfo struct */
1156 if (umove(tcp, arg, &bi) < 0)
1159 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1160 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1164 #endif /* I_FLUSHBAND */
1166 /* argument is a set of flags */
1168 printflags(stream_setsig_flags, arg, "S_???");
1171 /* argument is a pointer to a set of flags */
1175 if (umove(tcp, arg, &val) < 0)
1178 printflags(stream_setsig_flags, val, "S_???");
1182 /* argument is a pointer to a strpeek structure */
1183 if (syserror(tcp) || !arg)
1185 if (umove(tcp, arg, &sp) < 0) {
1189 tprintf(", {ctlbuf=");
1190 printstrbuf(tcp, &sp.ctlbuf, 1);
1191 tprintf(", databuf=");
1192 printstrbuf(tcp, &sp.databuf, 1);
1193 tprintf(", flags=");
1194 printflags(msgflags, sp.flags, "RS_???");
1198 /* argument is an option with flags */
1200 printxval(stream_read_options, arg & RMODEMASK, "R???");
1201 addflags(stream_read_flags, arg & ~RMODEMASK);
1204 /* argument is an pointer to an option with flags */
1208 if (umove(tcp, arg, &val) < 0)
1211 printxval(stream_read_options,
1212 arg & RMODEMASK, "R???");
1213 addflags(stream_read_flags, arg & ~RMODEMASK);
1227 /* argument is a pointer to a decimal integer */
1231 printnum(tcp, arg, "%d");
1234 /* argument is a pointer to a strfdinsert structure */
1235 if (syserror(tcp) || !arg)
1237 if (umove(tcp, arg, &sfi) < 0) {
1241 tprintf(", {ctlbuf=");
1242 printstrbuf(tcp, &sfi.ctlbuf, 1);
1243 tprintf(", databuf=");
1244 printstrbuf(tcp, &sfi.databuf, 1);
1245 tprintf(", flags=");
1246 printflags(msgflags, sfi.flags, "RS_???");
1247 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1251 /* argument is a set of flags */
1253 printflags(stream_write_flags, arg, "SND???");
1255 #endif /* I_SWROPT */
1258 /* argument is an pointer to an option with flags */
1262 if (umove(tcp, arg, &val) < 0)
1265 printflags(stream_write_flags, arg, "SND???");
1268 #endif /* I_GWROPT */
1280 /* argument is a decimal integer */
1281 tprintf(", %d", arg);
1284 /* argument is a pointer to a strrecvfd structure */
1285 if (syserror(tcp) || !arg)
1287 if (umove(tcp, arg, &srf) < 0) {
1291 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1292 (unsigned long) srf.uid, (unsigned long) srf.gid);
1302 if (umove(tcp, arg, &sl) < 0) {
1306 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1307 for (i = 0; i < tcp->u_rval; i++) {
1310 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1318 printxval(stream_atmark_options, arg, "???MARK");
1320 #endif /* I_ATMARK */
1326 #endif /* !LINUX && !FREEBSD */
1328 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */