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_???");
132 #if defined(SPARC) || defined(SPARC64) || defined(SUNOS4) || defined(SVR4)
141 tprintf("%lu, ", tcp->u_arg[0]);
144 tprintf("%#lx, %#lx, %#lx",
145 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
148 /* control and data */
149 for (i = 1; i < 3; i++)
150 printstrbufarg(tcp, tcp->u_arg[i], 1);
151 /* pointer to flags */
152 if (tcp->u_arg[3] == 0)
154 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
158 printflags(msgflags, flags, "RS_???");
161 /* decode return value */
162 switch (tcp->u_rval) {
164 tcp->auxstr = "MORECTL";
166 case MORECTL|MOREDATA:
167 tcp->auxstr = "MORECTL|MOREDATA";
170 tcp->auxstr = "MORECTL";
177 return RVAL_HEX | RVAL_STR;
179 #endif /* SPARC || SPARC64 || SUNOS4 || SVR4 */
181 #if defined SYS_putpmsg || defined SYS_getpmsg
182 static const struct xlat pmsgflags[] = {
184 { MSG_HIPRI, "MSG_HIPRI" },
187 { MSG_ANY, "MSG_ANY" },
190 { MSG_BAND, "MSG_BAND" },
205 tprintf("%ld, ", tcp->u_arg[0]);
206 /* control and data */
207 for (i = 1; i < 3; i++)
208 printstrbufarg(tcp, tcp->u_arg[i], 0);
210 tprintf("%ld, ", tcp->u_arg[3]);
212 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
216 #endif /* SYS_putpmsg */
227 tprintf("%lu, ", tcp->u_arg[0]);
230 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
231 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
234 /* control and data */
235 for (i = 1; i < 3; i++)
236 printstrbufarg(tcp, tcp->u_arg[i], 1);
237 /* pointer to band */
238 printnum(tcp, tcp->u_arg[3], "%d");
240 /* pointer to flags */
241 if (tcp->u_arg[4] == 0)
243 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
247 printflags(pmsgflags, flags, "MSG_???");
250 /* decode return value */
251 switch (tcp->u_rval) {
253 tcp->auxstr = "MORECTL";
255 case MORECTL|MOREDATA:
256 tcp->auxstr = "MORECTL|MOREDATA";
259 tcp->auxstr = "MORECTL";
266 return RVAL_HEX | RVAL_STR;
268 #endif /* SYS_getpmsg */
270 #endif /* !FREEBSD */
273 #ifdef HAVE_SYS_POLL_H
275 static const struct xlat pollflags[] = {
277 { POLLIN, "POLLIN" },
278 { POLLPRI, "POLLPRI" },
279 { POLLOUT, "POLLOUT" },
281 { POLLRDNORM, "POLLRDNORM" },
284 { POLLWRNORM, "POLLWRNORM" },
287 { POLLRDBAND, "POLLRDBAND" },
290 { POLLWRBAND, "POLLWRBAND" },
292 { POLLERR, "POLLERR" },
293 { POLLHUP, "POLLHUP" },
294 { POLLNVAL, "POLLNVAL" },
300 decode_poll(struct tcb *tcp)
304 unsigned long size, start, cur, end, abbrev_end;
310 nfds = tcp->u_arg[1];
311 size = sizeof(fds) * nfds;
312 start = tcp->u_arg[0];
314 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
315 tprintf("%#lx, %d, ",
316 tcp->u_arg[0], nfds);
320 abbrev_end = start + max_strlen * sizeof(fds);
321 if (abbrev_end < start)
327 for (cur = start; cur < end; cur += sizeof(fds)) {
330 if (cur >= abbrev_end) {
334 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
340 tprintf("{fd=%d}", fds.fd);
343 tprintf("{fd=%d, events=", fds.fd);
344 printflags(pollflags, fds.events, "POLL???");
345 if (!syserror(tcp) && fds.revents) {
346 tprintf(", revents=");
347 printflags(pollflags, fds.revents, "POLL???");
353 tprintf(" %#lx", start);
354 tprintf(", %d, ", nfds);
359 sys_poll(struct tcb *tcp)
361 int rc = decode_poll(tcp);
364 if (tcp->u_arg[2] == INFTIM)
368 tprintf("%ld", tcp->u_arg[2]);
375 sys_ppoll(struct tcb *tcp)
377 int rc = decode_poll(tcp);
380 if (umove(tcp, tcp->u_arg[2], &ts) == 0)
381 tprintf("{%lu, %lu}, ", ts.tv_sec, ts.tv_nsec);
384 print_sigset(tcp, tcp->u_arg[3], 0);
385 tprintf(", %lu", tcp->u_arg[4]);
391 #else /* !HAVE_SYS_POLL_H */
400 #if !defined(LINUX) && !defined(FREEBSD)
402 static const struct xlat stream_flush_options[] = {
403 { FLUSHR, "FLUSHR" },
404 { FLUSHW, "FLUSHW" },
405 { FLUSHRW, "FLUSHRW" },
407 { FLUSHBAND, "FLUSHBAND" },
412 static const struct xlat stream_setsig_flags[] = {
413 { S_INPUT, "S_INPUT" },
414 { S_HIPRI, "S_HIPRI" },
415 { S_OUTPUT, "S_OUTPUT" },
418 { S_ERROR, "S_ERROR" },
421 { S_HANGUP, "S_HANGUP" },
424 { S_RDNORM, "S_RDNORM" },
427 { S_WRNORM, "S_WRNORM" },
430 { S_RDBAND, "S_RDBAND" },
433 { S_WRBAND, "S_WRBAND" },
436 { S_BANDURG, "S_BANDURG" },
441 static const struct xlat stream_read_options[] = {
448 static const struct xlat stream_read_flags[] = {
450 { RPROTDAT, "RPROTDAT" },
453 { RPROTDIS, "RPROTDIS" },
456 { RPROTNORM, "RPROTNORM" },
462 #define RMODEMASK (~0)
466 static const struct xlat stream_write_flags[] = {
467 { SNDZERO, "SNDZERO" },
468 { SNDPIPE, "SNDPIPE" },
471 #endif /* I_SWROPT */
474 static const struct xlat stream_atmark_options[] = {
475 { ANYMARK, "ANYMARK" },
476 { LASTMARK, "LASTMARK" },
479 #endif /* I_ATMARK */
482 static const struct xlat transport_user_options[] = {
483 { T_CONN_REQ, "T_CONN_REQ" },
484 { T_CONN_RES, "T_CONN_RES" },
485 { T_DISCON_REQ, "T_DISCON_REQ" },
486 { T_DATA_REQ, "T_DATA_REQ" },
487 { T_EXDATA_REQ, "T_EXDATA_REQ" },
488 { T_INFO_REQ, "T_INFO_REQ" },
489 { T_BIND_REQ, "T_BIND_REQ" },
490 { T_UNBIND_REQ, "T_UNBIND_REQ" },
491 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
492 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
493 { T_ORDREL_REQ, "T_ORDREL_REQ" },
497 static const struct xlat transport_user_flags [] = {
499 { T_MORE, "T_MORE" },
500 { T_EXPEDITED, "T_EXPEDITED" },
501 { T_NEGOTIATE, "T_NEGOTIATE" },
502 { T_CHECK, "T_CHECK" },
503 { T_DEFAULT, "T_DEFAULT" },
504 { T_SUCCESS, "T_SUCCESS" },
505 { T_FAILURE, "T_FAILURE" },
506 { T_CURRENT, "T_CURRENT" },
507 { T_PARTSUCCESS,"T_PARTSUCCESS" },
508 { T_READONLY, "T_READONLY" },
509 { T_NOTSUPPORT, "T_NOTSUPPORT" },
514 #ifdef HAVE_STRUCT_T_OPTHDR
516 static const struct xlat xti_level [] = {
517 { XTI_GENERIC, "XTI_GENERIC" },
521 static const struct xlat xti_generic [] = {
522 { XTI_DEBUG, "XTI_DEBUG" },
523 { XTI_LINGER, "XTI_LINGER" },
524 { XTI_RCVBUF, "XTI_RCVBUF" },
525 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
526 { XTI_SNDBUF, "XTI_SNDBUF" },
527 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
534 print_xti_optmgmt (tcp, addr, len)
542 while (len >= (int) sizeof hdr) {
543 if (umove(tcp, addr, &hdr) < 0) break;
547 else if (len > hdr.len + sizeof hdr) {
551 printxval (xti_level, hdr.level, "???");
555 printxval (xti_generic, hdr.name, "XTI_???");
558 tprintf ("%ld", hdr.name);
561 tprintf (", status=");
562 printxval (transport_user_flags, hdr.status, "T_???");
565 if ((hdr.len -= sizeof hdr) > 0) {
566 if (hdr.len > len) break;
568 if (len == sizeof (int))
569 printnum (tcp, addr, "%d");
571 printstr (tcp, addr, hdr.len);
578 if (c++) tprintf (", ");
579 printstr (tcp, addr, len);
581 if (c > 1) tprintf ("]");
588 print_optmgmt (tcp, addr, len)
593 /* We don't know how to tell if TLI (socket) or XTI
594 optmgmt is being used yet, assume TLI. */
595 #if defined (HAVE_STRUCT_OPTHDR)
596 print_sock_optmgmt (tcp, addr, len);
597 #elif defined (HAVE_STRUCT_T_OPTHDR)
598 print_xti_optmgmt (tcp, addr, len);
600 printstr (tcp, addr, len);
607 static const struct xlat service_type [] = {
608 { T_COTS, "T_COTS" },
609 { T_COTS_ORD, "T_COTS_ORD" },
610 { T_CLTS, "T_CLTS" },
614 static const struct xlat ts_state [] = {
615 { TS_UNBND, "TS_UNBND" },
616 { TS_WACK_BREQ, "TS_WACK_BREQ" },
617 { TS_WACK_UREQ, "TS_WACK_UREQ" },
618 { TS_IDLE, "TS_IDLE" },
619 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
620 { TS_WACK_CREQ, "TS_WACK_CREQ" },
621 { TS_WCON_CREQ, "TS_WCON_CREQ" },
622 { TS_WRES_CIND, "TS_WRES_CIND" },
623 { TS_WACK_CRES, "TS_WACK_CRES" },
624 { TS_DATA_XFER, "TS_DATA_XFER" },
625 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
626 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
627 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
628 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
629 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
630 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
631 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
635 static const struct xlat provider_flags [] = {
637 { SENDZERO, "SENDZERO" },
638 { EXPINLINE, "EXPINLINE" },
639 { XPG4_1, "XPG4_1" },
644 static const struct xlat tli_errors [] = {
645 { TBADADDR, "TBADADDR" },
646 { TBADOPT, "TBADOPT" },
647 { TACCES, "TACCES" },
649 { TNOADDR, "TNOADDR" },
650 { TOUTSTATE, "TOUTSTATE" },
651 { TBADSEQ, "TBADSEQ" },
652 { TSYSERR, "TSYSERR" },
654 { TBADDATA, "TBADDATA" },
655 { TBUFOVFLW, "TBUFOVFLW" },
657 { TNODATA, "TNODATA" },
658 { TNODIS, "TNODIS" },
659 { TNOUDERR, "TNOUDERR" },
660 { TBADFLAG, "TBADFLAG" },
661 { TNOREL, "TNOREL" },
662 { TNOTSUPPORT, "TNOTSUPPORT" },
663 { TSTATECHNG, "TSTATECHNG" },
664 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
665 { TBADNAME, "TBADNAME" },
666 { TBADQLEN, "TBADQLEN" },
667 { TADDRBUSY, "TADDRBUSY" },
668 { TINDOUT, "TINDOUT" },
669 { TPROVMISMATCH,"TPROVMISMATCH" },
670 { TRESQLEN, "TRESQLEN" },
671 { TRESADDR, "TRESADDR" },
672 { TQFULL, "TQFULL" },
673 { TPROTO, "TPROTO" },
679 print_transport_message (tcp, expect, addr, len)
685 union T_primitives m;
688 if (len < sizeof m.type) goto dump;
690 if (umove (tcp, addr, &m.type) < 0) goto dump;
692 #define GET(type, struct) \
694 if (len < sizeof m.struct) goto dump; \
695 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
697 if (expect != type) { \
705 do { if (c++) tprintf (", "); } while (0)
708 #define STRUCT(struct, elem, print) \
711 if (m.struct.elem##_length < 0 || \
712 m.struct.elem##_offset < sizeof m.struct || \
713 m.struct.elem##_offset + m.struct.elem##_length > len) \
715 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
716 m.struct.elem##_length, \
717 m.struct.elem##_offset); \
720 tprintf (#elem "="); \
722 addr + m.struct.elem##_offset, \
723 m.struct.elem##_length); \
728 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
732 case T_CONN_REQ: /* connect request */
733 GET (T_CONN_REQ, conn_req);
734 ADDR (conn_req, DEST);
735 ADDR (conn_req, OPT);
739 case T_CONN_RES: /* connect response */
740 GET (T_CONN_RES, conn_res);
741 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
743 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
744 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
746 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
748 ADDR (conn_res, OPT);
750 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
754 case T_DISCON_REQ: /* disconnect request */
755 GET (T_DISCON_REQ, discon_req);
757 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
761 case T_DATA_REQ: /* data request */
762 GET (T_DATA_REQ, data_req);
764 tprintf ("MORE=%ld", m.data_req.MORE_flag);
768 case T_EXDATA_REQ: /* expedited data req */
769 GET (T_EXDATA_REQ, exdata_req);
771 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
775 case T_INFO_REQ: /* information req */
776 GET (T_INFO_REQ, info_req);
780 case T_BIND_REQ: /* bind request */
782 case O_T_BIND_REQ: /* Ugly xti/tli hack */
784 GET (T_BIND_REQ, bind_req);
785 ADDR (bind_req, ADDR);
787 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
791 case T_UNBIND_REQ: /* unbind request */
792 GET (T_UNBIND_REQ, unbind_req);
795 #ifdef T_UNITDATA_REQ
796 case T_UNITDATA_REQ: /* unitdata requset */
797 GET (T_UNITDATA_REQ, unitdata_req);
798 ADDR (unitdata_req, DEST);
799 ADDR (unitdata_req, OPT);
803 case T_OPTMGMT_REQ: /* manage opt req */
804 GET (T_OPTMGMT_REQ, optmgmt_req);
807 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
809 STRUCT (optmgmt_req, OPT, print_optmgmt);
813 case T_ORDREL_REQ: /* orderly rel req */
814 GET (T_ORDREL_REQ, ordrel_req);
818 case T_CONN_IND: /* connect indication */
819 GET (T_CONN_IND, conn_ind);
820 ADDR (conn_ind, SRC);
821 ADDR (conn_ind, OPT);
822 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
826 case T_CONN_CON: /* connect corfirm */
827 GET (T_CONN_CON, conn_con);
828 ADDR (conn_con, RES);
829 ADDR (conn_con, OPT);
833 case T_DISCON_IND: /* discon indication */
834 GET (T_DISCON_IND, discon_ind);
836 tprintf ("DISCON=%ld, SEQ=%ld",
837 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
841 case T_DATA_IND: /* data indication */
842 GET (T_DATA_IND, data_ind);
844 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
848 case T_EXDATA_IND: /* expedited data ind */
849 GET (T_EXDATA_IND, exdata_ind);
851 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
855 case T_INFO_ACK: /* info ack */
856 GET (T_INFO_ACK, info_ack);
858 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
859 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
860 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
861 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
862 m.info_ack.ADDR_size, m.info_ack.OPT_size,
863 m.info_ack.TIDU_size);
864 printxval (service_type, m.info_ack.SERV_type, "T_???");
865 tprintf (", CURRENT=");
866 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
867 tprintf (", PROVIDER=");
868 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
872 case T_BIND_ACK: /* bind ack */
873 GET (T_BIND_ACK, bind_ack);
874 ADDR (bind_ack, ADDR);
875 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
879 case T_ERROR_ACK: /* error ack */
880 GET (T_ERROR_ACK, error_ack);
883 printxval (transport_user_options,
884 m.error_ack.ERROR_prim, "TI_???");
886 printxval (tli_errors, m.error_ack.TLI_error, "T???");
887 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
891 case T_OK_ACK: /* ok ack */
892 GET (T_OK_ACK, ok_ack);
894 tprintf ("CORRECT=");
895 printxval (transport_user_options,
896 m.ok_ack.CORRECT_prim, "TI_???");
899 #ifdef T_UNITDATA_IND
900 case T_UNITDATA_IND: /* unitdata ind */
901 GET (T_UNITDATA_IND, unitdata_ind);
902 ADDR (unitdata_ind, SRC);
903 ADDR (unitdata_ind, OPT);
907 case T_UDERROR_IND: /* unitdata error ind */
908 GET (T_UDERROR_IND, uderror_ind);
909 ADDR (uderror_ind, DEST);
910 ADDR (uderror_ind, OPT);
911 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
915 case T_OPTMGMT_ACK: /* manage opt ack */
916 GET (T_OPTMGMT_ACK, optmgmt_ack);
919 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
921 STRUCT (optmgmt_ack, OPT, print_optmgmt);
925 case T_ORDREL_IND: /* orderly rel ind */
926 GET (T_ORDREL_IND, ordrel_ind);
930 case T_ADDR_REQ: /* address req */
931 GET (T_ADDR_REQ, addr_req);
935 case T_ADDR_ACK: /* address response */
936 GET (T_ADDR_ACK, addr_ack);
937 ADDR (addr_ack, LOCADDR);
938 ADDR (addr_ack, REMADDR);
944 printstr(tcp, addr, len);
948 if (c >= 0) tprintf ("}");
962 internal_stream_ioctl(tcp, arg)
967 struct ioctlent *iop;
971 struct si_udata udata;
972 #endif /* SI_GETUDATA */
976 if (umove(tcp, arg, &si) < 0) {
982 iop = ioctl_lookup(si.ic_cmd);
984 tprintf(", {ic_cmd=%s", iop->symbol);
985 while ((iop = ioctl_next_match(iop)))
986 tprintf(" or %s", iop->symbol);
988 tprintf(", {ic_cmd=%#x", si.ic_cmd);
989 if (si.ic_timout == INFTIM)
990 tprintf(", ic_timout=INFTIM, ");
992 tprintf(" ic_timout=%d, ", si.ic_timout);
1000 #endif /* SI_GETUDATA */
1004 tprintf("/* in */ ");
1006 tprintf(", /* out */ ");
1008 if (in_and_out || entering(tcp))
1009 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1010 switch (si.ic_cmd) {
1013 /* in T_BIND_REQ, out T_BIND_ACK */
1015 if (entering(tcp)) {
1016 print_transport_message (tcp,
1018 si.ic_dp, si.ic_len);
1021 print_transport_message (tcp,
1023 si.ic_dp, si.ic_len);
1026 #endif /* TI_BIND */
1029 /* in T_UNBIND_REQ, out T_OK_ACK */
1031 if (entering(tcp)) {
1032 print_transport_message (tcp,
1034 si.ic_dp, si.ic_len);
1037 print_transport_message (tcp,
1039 si.ic_dp, si.ic_len);
1042 #endif /* TI_UNBIND */
1045 /* in T_INFO_REQ, out T_INFO_ACK */
1047 if (entering(tcp)) {
1048 print_transport_message (tcp,
1050 si.ic_dp, si.ic_len);
1053 print_transport_message (tcp,
1055 si.ic_dp, si.ic_len);
1058 #endif /* TI_GETINFO */
1061 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1063 if (entering(tcp)) {
1064 print_transport_message (tcp,
1066 si.ic_dp, si.ic_len);
1069 print_transport_message (tcp,
1071 si.ic_dp, si.ic_len);
1074 #endif /* TI_OPTMGMT */
1080 tprintf("struct si_udata ");
1082 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1085 tprintf("{tidusize=%d, addrsize=%d, ",
1086 udata.tidusize, udata.addrsize);
1087 tprintf("optsize=%d, etsdusize=%d, ",
1088 udata.optsize, udata.etsdusize);
1089 tprintf("servtype=%d, so_state=%d, ",
1090 udata.servtype, udata.so_state);
1091 tprintf("so_options=%d", udata.so_options);
1093 tprintf(", tsdusize=%d", udata.tsdusize);
1098 #endif /* SI_GETUDATA */
1100 printstr(tcp, (long) si.ic_dp, si.ic_len);
1105 if (timod && tcp->u_rval) {
1106 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1107 return RVAL_STR + 1;
1115 stream_ioctl(tcp, code, arg)
1127 struct strfdinsert sfi;
1128 struct strrecvfd srf;
1133 /* I_STR is a special case because the data is read & written. */
1135 return internal_stream_ioctl(tcp, arg);
1143 /* arg is a string */
1145 printpath(tcp, arg);
1148 /* doesn't take an argument */
1151 /* argument is an option */
1153 printxval(stream_flush_options, arg, "FLUSH???");
1157 /* argument is a pointer to a bandinfo struct */
1158 if (umove(tcp, arg, &bi) < 0)
1161 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1162 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1166 #endif /* I_FLUSHBAND */
1168 /* argument is a set of flags */
1170 printflags(stream_setsig_flags, arg, "S_???");
1173 /* argument is a pointer to a set of flags */
1177 if (umove(tcp, arg, &val) < 0)
1180 printflags(stream_setsig_flags, val, "S_???");
1184 /* argument is a pointer to a strpeek structure */
1185 if (syserror(tcp) || !arg)
1187 if (umove(tcp, arg, &sp) < 0) {
1191 tprintf(", {ctlbuf=");
1192 printstrbuf(tcp, &sp.ctlbuf, 1);
1193 tprintf(", databuf=");
1194 printstrbuf(tcp, &sp.databuf, 1);
1195 tprintf(", flags=");
1196 printflags(msgflags, sp.flags, "RS_???");
1200 /* argument is an option with flags */
1202 printxval(stream_read_options, arg & RMODEMASK, "R???");
1203 addflags(stream_read_flags, arg & ~RMODEMASK);
1206 /* argument is an pointer to an option with flags */
1210 if (umove(tcp, arg, &val) < 0)
1213 printxval(stream_read_options,
1214 arg & RMODEMASK, "R???");
1215 addflags(stream_read_flags, arg & ~RMODEMASK);
1229 /* argument is a pointer to a decimal integer */
1233 printnum(tcp, arg, "%d");
1236 /* argument is a pointer to a strfdinsert structure */
1237 if (syserror(tcp) || !arg)
1239 if (umove(tcp, arg, &sfi) < 0) {
1243 tprintf(", {ctlbuf=");
1244 printstrbuf(tcp, &sfi.ctlbuf, 1);
1245 tprintf(", databuf=");
1246 printstrbuf(tcp, &sfi.databuf, 1);
1247 tprintf(", flags=");
1248 printflags(msgflags, sfi.flags, "RS_???");
1249 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1253 /* argument is a set of flags */
1255 printflags(stream_write_flags, arg, "SND???");
1257 #endif /* I_SWROPT */
1260 /* argument is an pointer to an option with flags */
1264 if (umove(tcp, arg, &val) < 0)
1267 printflags(stream_write_flags, arg, "SND???");
1270 #endif /* I_GWROPT */
1282 /* argument is a decimal integer */
1283 tprintf(", %d", arg);
1286 /* argument is a pointer to a strrecvfd structure */
1287 if (syserror(tcp) || !arg)
1289 if (umove(tcp, arg, &srf) < 0) {
1293 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1294 (unsigned long) srf.uid, (unsigned long) srf.gid);
1304 if (umove(tcp, arg, &sl) < 0) {
1308 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1309 for (i = 0; i < tcp->u_rval; i++) {
1312 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1320 printxval(stream_atmark_options, arg, "???MARK");
1322 #endif /* I_ATMARK */
1328 #endif /* !LINUX && !FREEBSD */
1330 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */