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 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 if (!printflags(msgflags, tcp->u_arg[3]))
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 if (!printflags(msgflags, flags))
162 /* decode return value */
163 switch (tcp->u_rval) {
165 tcp->auxstr = "MORECTL";
167 case MORECTL|MOREDATA:
168 tcp->auxstr = "MORECTL|MOREDATA";
171 tcp->auxstr = "MORECTL";
178 return RVAL_HEX | RVAL_STR;
181 #if defined SYS_putpmsg || defined SYS_getpmsg
182 static 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 if (!printflags(pmsgflags, tcp->u_arg[4]))
217 #endif /* SYS_putpmsg */
228 tprintf("%lu, ", tcp->u_arg[0]);
231 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
232 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
235 /* control and data */
236 for (i = 1; i < 3; i++)
237 printstrbufarg(tcp, tcp->u_arg[i], 1);
238 /* pointer to band */
239 printnum(tcp, tcp->u_arg[3], "%d");
241 /* pointer to flags */
242 if (tcp->u_arg[4] == 0)
244 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
248 if (!printflags(pmsgflags, flags))
252 /* decode return value */
253 switch (tcp->u_rval) {
255 tcp->auxstr = "MORECTL";
257 case MORECTL|MOREDATA:
258 tcp->auxstr = "MORECTL|MOREDATA";
261 tcp->auxstr = "MORECTL";
268 return RVAL_HEX | RVAL_STR;
270 #endif /* SYS_getpmsg */
272 #endif /* !FREEBSD */
275 #ifdef HAVE_SYS_POLL_H
277 static struct xlat pollflags[] = {
279 { POLLIN, "POLLIN" },
280 { POLLPRI, "POLLPRI" },
281 { POLLOUT, "POLLOUT" },
283 { POLLRDNORM, "POLLRDNORM" },
286 { POLLWRNORM, "POLLWRNORM" },
289 { POLLRDBAND, "POLLRDBAND" },
292 { POLLWRBAND, "POLLWRBAND" },
294 { POLLERR, "POLLERR" },
295 { POLLHUP, "POLLHUP" },
296 { POLLNVAL, "POLLNVAL" },
305 struct pollfd *pollp;
309 int nfds = tcp->u_arg[1];
312 tprintf("%#lx, %d, %ld\n",
313 tcp->u_arg[0], nfds, tcp->u_arg[2]);
316 pollp = (struct pollfd *) malloc(nfds * sizeof(*pollp));
318 fprintf(stderr, "sys_poll: no memory\n");
319 tprintf("%#lx, %d, %ld",
320 tcp->u_arg[0], nfds, tcp->u_arg[2]);
323 if (umoven(tcp, tcp->u_arg[0],
324 (nfds * sizeof(*pollp)), (char *) pollp) < 0) {
325 tprintf("%#lx", tcp->u_arg[0]);
329 for (i = 0; i < nfds; i++) {
332 if (pollp[i].fd < 0) {
333 tprintf("{fd=%d}", pollp[i].fd);
336 tprintf("{fd=%d, events=", pollp[i].fd);
337 if (!printflags(pollflags, pollp[i].events))
339 if (!syserror(tcp) && pollp[i].revents) {
340 tprintf(", revents=");
341 if (!printflags(pollflags,
349 tprintf(", %d, ", nfds);
351 if (tcp->u_arg[2] == INFTIM)
355 tprintf("%ld", tcp->u_arg[2]);
361 #else /* !HAVE_SYS_POLL_H */
370 #if !defined(linux) && !defined(FREEBSD)
372 static struct xlat stream_flush_options[] = {
373 { FLUSHR, "FLUSHR" },
374 { FLUSHW, "FLUSHW" },
375 { FLUSHRW, "FLUSHRW" },
377 { FLUSHBAND, "FLUSHBAND" },
382 static struct xlat stream_setsig_flags[] = {
383 { S_INPUT, "S_INPUT" },
384 { S_HIPRI, "S_HIPRI" },
385 { S_OUTPUT, "S_OUTPUT" },
388 { S_ERROR, "S_ERROR" },
391 { S_HANGUP, "S_HANGUP" },
394 { S_RDNORM, "S_RDNORM" },
397 { S_WRNORM, "S_WRNORM" },
400 { S_RDBAND, "S_RDBAND" },
403 { S_WRBAND, "S_WRBAND" },
406 { S_BANDURG, "S_BANDURG" },
411 static struct xlat stream_read_options[] = {
418 static struct xlat stream_read_flags[] = {
420 { RPROTDAT, "RPROTDAT" },
423 { RPROTDIS, "RPROTDIS" },
426 { RPROTNORM, "RPROTNORM" },
432 #define RMODEMASK (~0)
436 static struct xlat stream_write_flags[] = {
437 { SNDZERO, "SNDZERO" },
438 { SNDPIPE, "SNDPIPE" },
441 #endif /* I_SWROPT */
444 static struct xlat stream_atmark_options[] = {
445 { ANYMARK, "ANYMARK" },
446 { LASTMARK, "LASTMARK" },
449 #endif /* I_ATMARK */
452 static struct xlat transport_user_options[] = {
453 { T_CONN_REQ, "T_CONN_REQ" },
454 { T_CONN_RES, "T_CONN_RES" },
455 { T_DISCON_REQ, "T_DISCON_REQ" },
456 { T_DATA_REQ, "T_DATA_REQ" },
457 { T_EXDATA_REQ, "T_EXDATA_REQ" },
458 { T_INFO_REQ, "T_INFO_REQ" },
459 { T_BIND_REQ, "T_BIND_REQ" },
460 { T_UNBIND_REQ, "T_UNBIND_REQ" },
461 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
462 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
463 { T_ORDREL_REQ, "T_ORDREL_REQ" },
467 static struct xlat transport_user_flags [] = {
469 { T_MORE, "T_MORE" },
470 { T_EXPEDITED, "T_EXPEDITED" },
471 { T_NEGOTIATE, "T_NEGOTIATE" },
472 { T_CHECK, "T_CHECK" },
473 { T_DEFAULT, "T_DEFAULT" },
474 { T_SUCCESS, "T_SUCCESS" },
475 { T_FAILURE, "T_FAILURE" },
476 { T_CURRENT, "T_CURRENT" },
477 { T_PARTSUCCESS,"T_PARTSUCCESS" },
478 { T_READONLY, "T_READONLY" },
479 { T_NOTSUPPORT, "T_NOTSUPPORT" },
486 static struct xlat xti_level [] = {
487 { XTI_GENERIC, "XTI_GENERIC" },
491 static struct xlat xti_generic [] = {
492 { XTI_DEBUG, "XTI_DEBUG" },
493 { XTI_LINGER, "XTI_LINGER" },
494 { XTI_RCVBUF, "XTI_RCVBUF" },
495 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
496 { XTI_SNDBUF, "XTI_SNDBUF" },
497 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
504 print_xti_optmgmt (tcp, addr, len)
512 while (len >= (int) sizeof hdr) {
513 if (umove(tcp, addr, &hdr) < 0) break;
517 else if (len > hdr.len + sizeof hdr) {
521 printxval (xti_level, hdr.level, "???");
525 printxval (xti_generic, hdr.name, "XTI_???");
528 tprintf ("%ld", hdr.name);
531 tprintf (", status=");
532 printxval (transport_user_flags, hdr.status, "T_???");
535 if ((hdr.len -= sizeof hdr) > 0) {
536 if (hdr.len > len) break;
538 if (len == sizeof (int))
539 printnum (tcp, addr, "%d");
541 printstr (tcp, addr, hdr.len);
548 if (c++) tprintf (", ");
549 printstr (tcp, addr, len);
551 if (c > 1) tprintf ("]");
558 print_optmgmt (tcp, addr, len)
563 /* We don't know how to tell if TLI (socket) or XTI
564 optmgmt is being used yet, assume TLI. */
565 #if defined (HAVE_OPTHDR)
566 print_sock_optmgmt (tcp, addr, len);
567 #elif defined (HAVE_T_OPTHDR)
568 print_xti_optmgmt (tcp, addr, len);
570 printstr (tcp, addr, len);
577 static struct xlat service_type [] = {
578 { T_COTS, "T_COTS" },
579 { T_COTS_ORD, "T_COTS_ORD" },
580 { T_CLTS, "T_CLTS" },
584 static struct xlat ts_state [] = {
585 { TS_UNBND, "TS_UNBND" },
586 { TS_WACK_BREQ, "TS_WACK_BREQ" },
587 { TS_WACK_UREQ, "TS_WACK_UREQ" },
588 { TS_IDLE, "TS_IDLE" },
589 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
590 { TS_WACK_CREQ, "TS_WACK_CREQ" },
591 { TS_WCON_CREQ, "TS_WCON_CREQ" },
592 { TS_WRES_CIND, "TS_WRES_CIND" },
593 { TS_WACK_CRES, "TS_WACK_CRES" },
594 { TS_DATA_XFER, "TS_DATA_XFER" },
595 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
596 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
597 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
598 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
599 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
600 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
601 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
605 static struct xlat provider_flags [] = {
607 { SENDZERO, "SENDZERO" },
608 { EXPINLINE, "EXPINLINE" },
609 { XPG4_1, "XPG4_1" },
614 static struct xlat tli_errors [] = {
615 { TBADADDR, "TBADADDR" },
616 { TBADOPT, "TBADOPT" },
617 { TACCES, "TACCES" },
619 { TNOADDR, "TNOADDR" },
620 { TOUTSTATE, "TOUTSTATE" },
621 { TBADSEQ, "TBADSEQ" },
622 { TSYSERR, "TSYSERR" },
624 { TBADDATA, "TBADDATA" },
625 { TBUFOVFLW, "TBUFOVFLW" },
627 { TNODATA, "TNODATA" },
628 { TNODIS, "TNODIS" },
629 { TNOUDERR, "TNOUDERR" },
630 { TBADFLAG, "TBADFLAG" },
631 { TNOREL, "TNOREL" },
632 { TNOTSUPPORT, "TNOTSUPPORT" },
633 { TSTATECHNG, "TSTATECHNG" },
634 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
635 { TBADNAME, "TBADNAME" },
636 { TBADQLEN, "TBADQLEN" },
637 { TADDRBUSY, "TADDRBUSY" },
638 { TINDOUT, "TINDOUT" },
639 { TPROVMISMATCH,"TPROVMISMATCH" },
640 { TRESQLEN, "TRESQLEN" },
641 { TRESADDR, "TRESADDR" },
642 { TQFULL, "TQFULL" },
643 { TPROTO, "TPROTO" },
649 print_transport_message (tcp, expect, addr, len)
655 union T_primitives m;
658 if (len < sizeof m.type) goto dump;
660 if (umove (tcp, addr, &m.type) < 0) goto dump;
662 #define GET(type, struct) \
664 if (len < sizeof m.struct) goto dump; \
665 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
667 if (expect != type) { \
675 do { if (c++) tprintf (", "); } while (0)
678 #define STRUCT(struct, elem, print) \
681 if (m.struct.elem##_length < 0 || \
682 m.struct.elem##_offset < sizeof m.struct || \
683 m.struct.elem##_offset + m.struct.elem##_length > len) \
685 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
686 m.struct.elem##_length, \
687 m.struct.elem##_offset); \
690 tprintf (#elem "="); \
692 addr + m.struct.elem##_offset, \
693 m.struct.elem##_length); \
698 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
702 case T_CONN_REQ: /* connect request */
703 GET (T_CONN_REQ, conn_req);
704 ADDR (conn_req, DEST);
705 ADDR (conn_req, OPT);
709 case T_CONN_RES: /* connect response */
710 GET (T_CONN_RES, conn_res);
712 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
713 ADDR (conn_res, OPT);
715 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
719 case T_DISCON_REQ: /* disconnect request */
720 GET (T_DISCON_REQ, discon_req);
722 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
726 case T_DATA_REQ: /* data request */
727 GET (T_DATA_REQ, data_req);
729 tprintf ("MORE=%ld", m.data_req.MORE_flag);
733 case T_EXDATA_REQ: /* expedited data req */
734 GET (T_EXDATA_REQ, exdata_req);
736 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
740 case T_INFO_REQ: /* information req */
741 GET (T_INFO_REQ, info_req);
745 case T_BIND_REQ: /* bind request */
747 case O_T_BIND_REQ: /* Ugly xti/tli hack */
749 GET (T_BIND_REQ, bind_req);
750 ADDR (bind_req, ADDR);
752 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
756 case T_UNBIND_REQ: /* unbind request */
757 GET (T_UNBIND_REQ, unbind_req);
760 #ifdef T_UNITDATA_REQ
761 case T_UNITDATA_REQ: /* unitdata requset */
762 GET (T_UNITDATA_REQ, unitdata_req);
763 ADDR (unitdata_req, DEST);
764 ADDR (unitdata_req, OPT);
768 case T_OPTMGMT_REQ: /* manage opt req */
769 GET (T_OPTMGMT_REQ, optmgmt_req);
772 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags);
773 STRUCT (optmgmt_req, OPT, print_optmgmt);
777 case T_ORDREL_REQ: /* orderly rel req */
778 GET (T_ORDREL_REQ, ordrel_req);
782 case T_CONN_IND: /* connect indication */
783 GET (T_CONN_IND, conn_ind);
784 ADDR (conn_ind, SRC);
785 ADDR (conn_ind, OPT);
786 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
790 case T_CONN_CON: /* connect corfirm */
791 GET (T_CONN_CON, conn_con);
792 ADDR (conn_con, RES);
793 ADDR (conn_con, OPT);
797 case T_DISCON_IND: /* discon indication */
798 GET (T_DISCON_IND, discon_ind);
800 tprintf ("DISCON=%ld, SEQ=%ld",
801 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
805 case T_DATA_IND: /* data indication */
806 GET (T_DATA_IND, data_ind);
808 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
812 case T_EXDATA_IND: /* expedited data ind */
813 GET (T_EXDATA_IND, exdata_ind);
815 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
819 case T_INFO_ACK: /* info ack */
820 GET (T_INFO_ACK, info_ack);
822 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
823 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
824 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
825 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
826 m.info_ack.ADDR_size, m.info_ack.OPT_size,
827 m.info_ack.TIDU_size);
828 printxval (service_type, m.info_ack.SERV_type, "T_???");
829 tprintf (", CURRENT=");
830 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
831 tprintf (", PROVIDER=");
832 printflags (provider_flags, m.info_ack.PROVIDER_flag);
836 case T_BIND_ACK: /* bind ack */
837 GET (T_BIND_ACK, bind_ack);
838 ADDR (bind_ack, ADDR);
839 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
843 case T_ERROR_ACK: /* error ack */
844 GET (T_ERROR_ACK, error_ack);
847 printxval (transport_user_options,
848 m.error_ack.ERROR_prim, "TI_???");
850 printxval (tli_errors, m.error_ack.TLI_error, "T???");
851 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
855 case T_OK_ACK: /* ok ack */
856 GET (T_OK_ACK, ok_ack);
858 tprintf ("CORRECT=");
859 printxval (transport_user_options,
860 m.ok_ack.CORRECT_prim, "TI_???");
863 #ifdef T_UNITDATA_IND
864 case T_UNITDATA_IND: /* unitdata ind */
865 GET (T_UNITDATA_IND, unitdata_ind);
866 ADDR (unitdata_ind, SRC);
867 ADDR (unitdata_ind, OPT);
871 case T_UDERROR_IND: /* unitdata error ind */
872 GET (T_UDERROR_IND, uderror_ind);
873 ADDR (uderror_ind, DEST);
874 ADDR (uderror_ind, OPT);
875 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
879 case T_OPTMGMT_ACK: /* manage opt ack */
880 GET (T_OPTMGMT_ACK, optmgmt_ack);
883 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags);
884 STRUCT (optmgmt_ack, OPT, print_optmgmt);
888 case T_ORDREL_IND: /* orderly rel ind */
889 GET (T_ORDREL_IND, ordrel_ind);
893 case T_ADDR_REQ: /* address req */
894 GET (T_ADDR_REQ, addr_req);
898 case T_ADDR_ACK: /* address response */
899 GET (T_ADDR_ACK, addr_ack);
900 ADDR (addr_ack, LOCADDR);
901 ADDR (addr_ack, REMADDR);
907 printstr(tcp, addr, len);
911 if (c >= 0) tprintf ("}");
925 internal_stream_ioctl(tcp, arg)
934 struct si_udata udata;
935 #endif /* SI_GETUDATA */
939 if (umove(tcp, arg, &si) < 0) {
945 name = ioctl_lookup(si.ic_cmd);
947 tprintf(", {ic_cmd=%s", name);
949 tprintf(", {ic_cmd=%#x", si.ic_cmd);
950 if (si.ic_timout == INFTIM)
951 tprintf(", ic_timout=INFTIM, ");
953 tprintf(" ic_timout=%d, ", si.ic_timout);
961 #endif /* SI_GETUDATA */
965 tprintf("/* in */ ");
967 tprintf(", /* out */ ");
969 if (in_and_out || entering(tcp))
970 tprintf("ic_len=%d, ic_dp=", si.ic_len);
974 /* in T_BIND_REQ, out T_BIND_ACK */
977 print_transport_message (tcp,
979 si.ic_dp, si.ic_len);
982 print_transport_message (tcp,
984 si.ic_dp, si.ic_len);
990 /* in T_UNBIND_REQ, out T_OK_ACK */
993 print_transport_message (tcp,
995 si.ic_dp, si.ic_len);
998 print_transport_message (tcp,
1000 si.ic_dp, si.ic_len);
1003 #endif /* TI_UNBIND */
1006 /* in T_INFO_REQ, out T_INFO_ACK */
1008 if (entering(tcp)) {
1009 print_transport_message (tcp,
1011 si.ic_dp, si.ic_len);
1014 print_transport_message (tcp,
1016 si.ic_dp, si.ic_len);
1019 #endif /* TI_GETINFO */
1022 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1024 if (entering(tcp)) {
1025 print_transport_message (tcp,
1027 si.ic_dp, si.ic_len);
1030 print_transport_message (tcp,
1032 si.ic_dp, si.ic_len);
1035 #endif /* TI_OPTMGMT */
1041 tprintf("struct si_udata ");
1043 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1046 tprintf("{tidusize=%d, addrsize=%d, ",
1047 udata.tidusize, udata.addrsize);
1048 tprintf("optsize=%d, etsdusize=%d, ",
1049 udata.optsize, udata.etsdusize);
1050 tprintf("servtype=%d, so_state=%d, ",
1051 udata.servtype, udata.so_state);
1052 tprintf("so_options=%d", udata.so_options);
1054 tprintf(", tsdusize=%d", udata.tsdusize);
1059 #endif /* SI_GETUDATA */
1061 printstr(tcp, (long) si.ic_dp, si.ic_len);
1066 if (timod && tcp->u_rval) {
1067 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1068 return RVAL_STR + 1;
1076 stream_ioctl(tcp, code, arg)
1088 struct strfdinsert sfi;
1089 struct strrecvfd srf;
1094 /* I_STR is a special case because the data is read & written. */
1096 return internal_stream_ioctl(tcp, arg);
1104 /* arg is a string */
1106 printpath(tcp, arg);
1109 /* doesn't take an argument */
1112 /* argument is an option */
1114 printxval(stream_flush_options, arg, "FLUSH???");
1118 /* argument is a pointer to a bandinfo struct */
1119 if (umove(tcp, arg, &bi) < 0)
1122 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1123 if (!printflags(stream_flush_options, bi.bi_flag))
1128 #endif /* I_FLUSHBAND */
1130 /* argument is a set of flags */
1132 if (!printflags(stream_setsig_flags, arg))
1136 /* argument is a pointer to a set of flags */
1140 if (umove(tcp, arg, &val) < 0)
1142 else if (!printflags(stream_setsig_flags, val))
1147 /* argument is a pointer to a strpeek structure */
1148 if (syserror(tcp) || !arg)
1150 if (umove(tcp, arg, &sp) < 0) {
1154 tprintf(", {ctlbuf=");
1155 printstrbuf(tcp, &sp.ctlbuf, 1);
1156 tprintf(", databuf=");
1157 printstrbuf(tcp, &sp.databuf, 1);
1158 tprintf(", flags=");
1159 if (!printflags(msgflags, sp.flags))
1164 /* argument is an option with flags */
1166 printxval(stream_read_options, arg & RMODEMASK, "R???");
1167 addflags(stream_read_flags, arg & ~RMODEMASK);
1170 /* argument is an pointer to an option with flags */
1174 if (umove(tcp, arg, &val) < 0)
1177 printxval(stream_read_options,
1178 arg & RMODEMASK, "R???");
1179 addflags(stream_read_flags, arg & ~RMODEMASK);
1193 /* argument is a pointer to a decimal integer */
1197 printnum(tcp, arg, "%d");
1200 /* argument is a pointer to a strfdinsert structure */
1201 if (syserror(tcp) || !arg)
1203 if (umove(tcp, arg, &sfi) < 0) {
1207 tprintf(", {ctlbuf=");
1208 printstrbuf(tcp, &sfi.ctlbuf, 1);
1209 tprintf(", databuf=");
1210 printstrbuf(tcp, &sfi.databuf, 1);
1211 tprintf(", flags=");
1212 if (!printflags(msgflags, sfi.flags))
1214 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1218 /* argument is a set of flags */
1220 if (!printflags(stream_write_flags, arg))
1223 #endif /* I_SWROPT */
1226 /* argument is an pointer to an option with flags */
1230 if (umove(tcp, arg, &val) < 0)
1232 else if (!printflags(stream_write_flags, arg))
1236 #endif /* I_GWROPT */
1248 /* argument is a decimal integer */
1249 tprintf(", %d", arg);
1252 /* argument is a pointer to a strrecvfd structure */
1253 if (syserror(tcp) || !arg)
1255 if (umove(tcp, arg, &srf) < 0) {
1259 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1260 (unsigned long) srf.uid, (unsigned long) srf.gid);
1270 if (umove(tcp, arg, &sl) < 0) {
1274 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1275 for (i = 0; i < tcp->u_rval; i++) {
1278 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1286 printxval(stream_atmark_options, arg, "???MARK");
1288 #endif /* I_ATMARK */
1294 #endif /* !linux && !FREEBSD */
1296 #endif /* HAVE_SYS_STREAM_H || linux || FREEBSD */