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" },
484 #ifdef HAVE_STRUCT_T_OPTHDR
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_STRUCT_OPTHDR)
566 print_sock_optmgmt (tcp, addr, len);
567 #elif defined (HAVE_STRUCT_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);
711 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
713 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
714 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
716 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
718 ADDR (conn_res, OPT);
720 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
724 case T_DISCON_REQ: /* disconnect request */
725 GET (T_DISCON_REQ, discon_req);
727 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
731 case T_DATA_REQ: /* data request */
732 GET (T_DATA_REQ, data_req);
734 tprintf ("MORE=%ld", m.data_req.MORE_flag);
738 case T_EXDATA_REQ: /* expedited data req */
739 GET (T_EXDATA_REQ, exdata_req);
741 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
745 case T_INFO_REQ: /* information req */
746 GET (T_INFO_REQ, info_req);
750 case T_BIND_REQ: /* bind request */
752 case O_T_BIND_REQ: /* Ugly xti/tli hack */
754 GET (T_BIND_REQ, bind_req);
755 ADDR (bind_req, ADDR);
757 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
761 case T_UNBIND_REQ: /* unbind request */
762 GET (T_UNBIND_REQ, unbind_req);
765 #ifdef T_UNITDATA_REQ
766 case T_UNITDATA_REQ: /* unitdata requset */
767 GET (T_UNITDATA_REQ, unitdata_req);
768 ADDR (unitdata_req, DEST);
769 ADDR (unitdata_req, OPT);
773 case T_OPTMGMT_REQ: /* manage opt req */
774 GET (T_OPTMGMT_REQ, optmgmt_req);
777 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags);
778 STRUCT (optmgmt_req, OPT, print_optmgmt);
782 case T_ORDREL_REQ: /* orderly rel req */
783 GET (T_ORDREL_REQ, ordrel_req);
787 case T_CONN_IND: /* connect indication */
788 GET (T_CONN_IND, conn_ind);
789 ADDR (conn_ind, SRC);
790 ADDR (conn_ind, OPT);
791 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
795 case T_CONN_CON: /* connect corfirm */
796 GET (T_CONN_CON, conn_con);
797 ADDR (conn_con, RES);
798 ADDR (conn_con, OPT);
802 case T_DISCON_IND: /* discon indication */
803 GET (T_DISCON_IND, discon_ind);
805 tprintf ("DISCON=%ld, SEQ=%ld",
806 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
810 case T_DATA_IND: /* data indication */
811 GET (T_DATA_IND, data_ind);
813 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
817 case T_EXDATA_IND: /* expedited data ind */
818 GET (T_EXDATA_IND, exdata_ind);
820 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
824 case T_INFO_ACK: /* info ack */
825 GET (T_INFO_ACK, info_ack);
827 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
828 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
829 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
830 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
831 m.info_ack.ADDR_size, m.info_ack.OPT_size,
832 m.info_ack.TIDU_size);
833 printxval (service_type, m.info_ack.SERV_type, "T_???");
834 tprintf (", CURRENT=");
835 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
836 tprintf (", PROVIDER=");
837 printflags (provider_flags, m.info_ack.PROVIDER_flag);
841 case T_BIND_ACK: /* bind ack */
842 GET (T_BIND_ACK, bind_ack);
843 ADDR (bind_ack, ADDR);
844 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
848 case T_ERROR_ACK: /* error ack */
849 GET (T_ERROR_ACK, error_ack);
852 printxval (transport_user_options,
853 m.error_ack.ERROR_prim, "TI_???");
855 printxval (tli_errors, m.error_ack.TLI_error, "T???");
856 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
860 case T_OK_ACK: /* ok ack */
861 GET (T_OK_ACK, ok_ack);
863 tprintf ("CORRECT=");
864 printxval (transport_user_options,
865 m.ok_ack.CORRECT_prim, "TI_???");
868 #ifdef T_UNITDATA_IND
869 case T_UNITDATA_IND: /* unitdata ind */
870 GET (T_UNITDATA_IND, unitdata_ind);
871 ADDR (unitdata_ind, SRC);
872 ADDR (unitdata_ind, OPT);
876 case T_UDERROR_IND: /* unitdata error ind */
877 GET (T_UDERROR_IND, uderror_ind);
878 ADDR (uderror_ind, DEST);
879 ADDR (uderror_ind, OPT);
880 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
884 case T_OPTMGMT_ACK: /* manage opt ack */
885 GET (T_OPTMGMT_ACK, optmgmt_ack);
888 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags);
889 STRUCT (optmgmt_ack, OPT, print_optmgmt);
893 case T_ORDREL_IND: /* orderly rel ind */
894 GET (T_ORDREL_IND, ordrel_ind);
898 case T_ADDR_REQ: /* address req */
899 GET (T_ADDR_REQ, addr_req);
903 case T_ADDR_ACK: /* address response */
904 GET (T_ADDR_ACK, addr_ack);
905 ADDR (addr_ack, LOCADDR);
906 ADDR (addr_ack, REMADDR);
912 printstr(tcp, addr, len);
916 if (c >= 0) tprintf ("}");
930 internal_stream_ioctl(tcp, arg)
935 struct ioctlent *iop;
939 struct si_udata udata;
940 #endif /* SI_GETUDATA */
944 if (umove(tcp, arg, &si) < 0) {
950 iop = ioctl_lookup(si.ic_cmd);
952 tprintf(", {ic_cmd=%s", iop->symbol);
953 while ((iop = ioctl_next_match(iop)))
954 tprintf(" or %s", iop->symbol);
956 tprintf(", {ic_cmd=%#x", si.ic_cmd);
957 if (si.ic_timout == INFTIM)
958 tprintf(", ic_timout=INFTIM, ");
960 tprintf(" ic_timout=%d, ", si.ic_timout);
968 #endif /* SI_GETUDATA */
972 tprintf("/* in */ ");
974 tprintf(", /* out */ ");
976 if (in_and_out || entering(tcp))
977 tprintf("ic_len=%d, ic_dp=", si.ic_len);
981 /* in T_BIND_REQ, out T_BIND_ACK */
984 print_transport_message (tcp,
986 si.ic_dp, si.ic_len);
989 print_transport_message (tcp,
991 si.ic_dp, si.ic_len);
997 /* in T_UNBIND_REQ, out T_OK_ACK */
1000 print_transport_message (tcp,
1002 si.ic_dp, si.ic_len);
1005 print_transport_message (tcp,
1007 si.ic_dp, si.ic_len);
1010 #endif /* TI_UNBIND */
1013 /* in T_INFO_REQ, out T_INFO_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_GETINFO */
1029 /* in T_OPTMGMT_REQ, out T_OPTMGMT_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_OPTMGMT */
1048 tprintf("struct si_udata ");
1050 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1053 tprintf("{tidusize=%d, addrsize=%d, ",
1054 udata.tidusize, udata.addrsize);
1055 tprintf("optsize=%d, etsdusize=%d, ",
1056 udata.optsize, udata.etsdusize);
1057 tprintf("servtype=%d, so_state=%d, ",
1058 udata.servtype, udata.so_state);
1059 tprintf("so_options=%d", udata.so_options);
1061 tprintf(", tsdusize=%d", udata.tsdusize);
1066 #endif /* SI_GETUDATA */
1068 printstr(tcp, (long) si.ic_dp, si.ic_len);
1073 if (timod && tcp->u_rval) {
1074 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1075 return RVAL_STR + 1;
1083 stream_ioctl(tcp, code, arg)
1095 struct strfdinsert sfi;
1096 struct strrecvfd srf;
1101 /* I_STR is a special case because the data is read & written. */
1103 return internal_stream_ioctl(tcp, arg);
1111 /* arg is a string */
1113 printpath(tcp, arg);
1116 /* doesn't take an argument */
1119 /* argument is an option */
1121 printxval(stream_flush_options, arg, "FLUSH???");
1125 /* argument is a pointer to a bandinfo struct */
1126 if (umove(tcp, arg, &bi) < 0)
1129 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1130 if (!printflags(stream_flush_options, bi.bi_flag))
1135 #endif /* I_FLUSHBAND */
1137 /* argument is a set of flags */
1139 if (!printflags(stream_setsig_flags, arg))
1143 /* argument is a pointer to a set of flags */
1147 if (umove(tcp, arg, &val) < 0)
1149 else if (!printflags(stream_setsig_flags, val))
1154 /* argument is a pointer to a strpeek structure */
1155 if (syserror(tcp) || !arg)
1157 if (umove(tcp, arg, &sp) < 0) {
1161 tprintf(", {ctlbuf=");
1162 printstrbuf(tcp, &sp.ctlbuf, 1);
1163 tprintf(", databuf=");
1164 printstrbuf(tcp, &sp.databuf, 1);
1165 tprintf(", flags=");
1166 if (!printflags(msgflags, sp.flags))
1171 /* argument is an option with flags */
1173 printxval(stream_read_options, arg & RMODEMASK, "R???");
1174 addflags(stream_read_flags, arg & ~RMODEMASK);
1177 /* argument is an pointer to an option with flags */
1181 if (umove(tcp, arg, &val) < 0)
1184 printxval(stream_read_options,
1185 arg & RMODEMASK, "R???");
1186 addflags(stream_read_flags, arg & ~RMODEMASK);
1200 /* argument is a pointer to a decimal integer */
1204 printnum(tcp, arg, "%d");
1207 /* argument is a pointer to a strfdinsert structure */
1208 if (syserror(tcp) || !arg)
1210 if (umove(tcp, arg, &sfi) < 0) {
1214 tprintf(", {ctlbuf=");
1215 printstrbuf(tcp, &sfi.ctlbuf, 1);
1216 tprintf(", databuf=");
1217 printstrbuf(tcp, &sfi.databuf, 1);
1218 tprintf(", flags=");
1219 if (!printflags(msgflags, sfi.flags))
1221 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1225 /* argument is a set of flags */
1227 if (!printflags(stream_write_flags, arg))
1230 #endif /* I_SWROPT */
1233 /* argument is an pointer to an option with flags */
1237 if (umove(tcp, arg, &val) < 0)
1239 else if (!printflags(stream_write_flags, arg))
1243 #endif /* I_GWROPT */
1255 /* argument is a decimal integer */
1256 tprintf(", %d", arg);
1259 /* argument is a pointer to a strrecvfd structure */
1260 if (syserror(tcp) || !arg)
1262 if (umove(tcp, arg, &srf) < 0) {
1266 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1267 (unsigned long) srf.uid, (unsigned long) srf.gid);
1277 if (umove(tcp, arg, &sl) < 0) {
1281 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1282 for (i = 0; i < tcp->u_rval; i++) {
1285 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1293 printxval(stream_atmark_options, arg, "???MARK");
1295 #endif /* I_ATMARK */
1301 #endif /* !LINUX && !FREEBSD */
1303 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */