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.
36 #ifdef HAVE_SYS_POLL_H
42 #ifdef HAVE_SYS_CONF_H
45 #ifdef HAVE_SYS_STREAM_H
46 #include <sys/stream.h>
48 #ifdef HAVE_SYS_TIHDR_H
49 #include <sys/tihdr.h>
52 #if defined(HAVE_SYS_STREAM_H) || defined(linux) || defined(FREEBSD)
54 #ifndef HAVE_STROPTS_H
57 int maxlen; /* no. of bytes in buffer */
58 int len; /* no. of bytes returned */
59 char *buf; /* pointer to data */
63 #endif /* !HAVE_STROPTS_H */
65 #ifdef HAVE_SYS_TIUSER_H
66 #include <sys/tiuser.h>
67 #include <sys/sockmod.h>
68 #include <sys/timod.h>
69 #endif /* HAVE_SYS_TIUSER_H */
72 static struct xlat msgflags[] = {
73 { RS_HIPRI, "RS_HIPRI" },
79 printstrbuf(tcp, sbp, getting)
84 if (sbp->maxlen == -1 && getting)
85 tprintf("{maxlen=-1}");
89 tprintf("maxlen=%d, ", sbp->maxlen);
90 tprintf("len=%d, buf=", sbp->len);
91 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
97 printstrbufarg(tcp, arg, getting)
106 else if (umove(tcp, arg, &buf) < 0)
109 printstrbuf(tcp, &buf, getting);
121 tprintf("%ld, ", tcp->u_arg[0]);
122 /* control and data */
123 for (i = 1; i < 3; i++)
124 printstrbufarg(tcp, tcp->u_arg[i], 0);
126 if (!printflags(msgflags, tcp->u_arg[3]))
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 if (!printflags(msgflags, flags))
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;
182 static struct xlat pmsgflags[] = {
184 { MSG_HIPRI, "MSG_HIPRI" },
187 { MSG_ANY, "MSG_ANY" },
190 { 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 if (!printflags(pmsgflags, tcp->u_arg[4]))
224 tprintf("%lu, ", tcp->u_arg[0]);
227 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
228 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
231 /* control and data */
232 for (i = 1; i < 3; i++)
233 printstrbufarg(tcp, tcp->u_arg[i], 1);
234 /* pointer to band */
235 printnum(tcp, tcp->u_arg[3], "%d");
237 /* pointer to flags */
238 if (tcp->u_arg[4] == 0)
240 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
244 if (!printflags(pmsgflags, flags))
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;
267 #endif /* HAVE_PUTPMSG */
268 #endif /* !FREEBSD */
271 #ifdef HAVE_SYS_POLL_H
273 static 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" },
301 struct pollfd *pollp;
305 int nfds = tcp->u_arg[1];
308 tprintf("%#lx, %d, %ld\n",
309 tcp->u_arg[0], nfds, tcp->u_arg[2]);
312 pollp = (struct pollfd *) malloc(nfds * sizeof(*pollp));
314 fprintf(stderr, "sys_poll: no memory\n");
315 tprintf("%#lx, %d, %ld",
316 tcp->u_arg[0], nfds, tcp->u_arg[2]);
319 if (umoven(tcp, tcp->u_arg[0],
320 (nfds * sizeof(*pollp)), (char *) pollp) < 0) {
321 tprintf("%#lx", tcp->u_arg[0]);
325 for (i = 0; i < nfds; i++) {
328 if (pollp[i].fd < 0) {
329 tprintf("{fd=%d}", pollp[i].fd);
332 tprintf("{fd=%d, events=", pollp[i].fd);
333 if (!printflags(pollflags, pollp[i].events))
335 if (!syserror(tcp) && pollp[i].revents) {
336 tprintf(", revents=");
337 if (!printflags(pollflags,
345 tprintf(", %d, ", nfds);
347 if (tcp->u_arg[2] == INFTIM)
351 tprintf("%ld", tcp->u_arg[2]);
357 #else /* !HAVE_SYS_POLL_H */
366 #if !defined(linux) && !defined(FREEBSD)
368 static struct xlat stream_flush_options[] = {
369 { FLUSHR, "FLUSHR" },
370 { FLUSHW, "FLUSHW" },
371 { FLUSHRW, "FLUSHRW" },
373 { FLUSHBAND, "FLUSHBAND" },
378 static struct xlat stream_setsig_flags[] = {
379 { S_INPUT, "S_INPUT" },
380 { S_HIPRI, "S_HIPRI" },
381 { S_OUTPUT, "S_OUTPUT" },
384 { S_ERROR, "S_ERROR" },
387 { S_HANGUP, "S_HANGUP" },
390 { S_RDNORM, "S_RDNORM" },
393 { S_WRNORM, "S_WRNORM" },
396 { S_RDBAND, "S_RDBAND" },
399 { S_WRBAND, "S_WRBAND" },
402 { S_BANDURG, "S_BANDURG" },
407 static struct xlat stream_read_options[] = {
414 static struct xlat stream_read_flags[] = {
416 { RPROTDAT, "RPROTDAT" },
419 { RPROTDIS, "RPROTDIS" },
422 { RPROTNORM, "RPROTNORM" },
428 #define RMODEMASK (~0)
432 static struct xlat stream_write_flags[] = {
433 { SNDZERO, "SNDZERO" },
434 { SNDPIPE, "SNDPIPE" },
437 #endif /* I_SWROPT */
440 static struct xlat stream_atmark_options[] = {
441 { ANYMARK, "ANYMARK" },
442 { LASTMARK, "LASTMARK" },
445 #endif /* I_ATMARK */
448 static struct xlat transport_user_options[] = {
449 { T_CONN_REQ, "T_CONN_REQ" },
450 { T_CONN_RES, "T_CONN_RES" },
451 { T_DISCON_REQ, "T_DISCON_REQ" },
452 { T_DATA_REQ, "T_DATA_REQ" },
453 { T_EXDATA_REQ, "T_EXDATA_REQ" },
454 { T_INFO_REQ, "T_INFO_REQ" },
455 { T_BIND_REQ, "T_BIND_REQ" },
456 { T_UNBIND_REQ, "T_UNBIND_REQ" },
457 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
458 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
459 { T_ORDREL_REQ, "T_ORDREL_REQ" },
463 static struct xlat transport_user_flags [] = {
465 { T_MORE, "T_MORE" },
466 { T_EXPEDITED, "T_EXPEDITED" },
467 { T_NEGOTIATE, "T_NEGOTIATE" },
468 { T_CHECK, "T_CHECK" },
469 { T_DEFAULT, "T_DEFAULT" },
470 { T_SUCCESS, "T_SUCCESS" },
471 { T_FAILURE, "T_FAILURE" },
472 { T_CURRENT, "T_CURRENT" },
473 { T_PARTSUCCESS,"T_PARTSUCCESS" },
474 { T_READONLY, "T_READONLY" },
475 { T_NOTSUPPORT, "T_NOTSUPPORT" },
482 static struct xlat xti_level [] = {
483 { XTI_GENERIC, "XTI_GENERIC" },
487 static struct xlat xti_generic [] = {
488 { XTI_DEBUG, "XTI_DEBUG" },
489 { XTI_LINGER, "XTI_LINGER" },
490 { XTI_RCVBUF, "XTI_RCVBUF" },
491 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
492 { XTI_SNDBUF, "XTI_SNDBUF" },
493 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
500 print_xti_optmgmt (tcp, addr, len)
508 while (len >= (int) sizeof hdr) {
509 if (umove(tcp, addr, &hdr) < 0) break;
513 else if (len > hdr.len + sizeof hdr) {
517 printxval (xti_level, hdr.level, "???");
521 printxval (xti_generic, hdr.name, "XTI_???");
524 tprintf ("%ld", hdr.name);
527 tprintf (", status=");
528 printxval (transport_user_flags, hdr.status, "T_???");
531 if ((hdr.len -= sizeof hdr) > 0) {
532 if (hdr.len > len) break;
534 if (len == sizeof (int))
535 printnum (tcp, addr, "%d");
537 printstr (tcp, addr, hdr.len);
544 if (c++) tprintf (", ");
545 printstr (tcp, addr, len);
547 if (c > 1) tprintf ("]");
554 print_optmgmt (tcp, addr, len)
559 /* We don't know how to tell if TLI (socket) or XTI
560 optmgmt is being used yet, assume TLI. */
561 #if defined (HAVE_OPTHDR)
562 print_sock_optmgmt (tcp, addr, len);
563 #elif defined (HAVE_T_OPTHDR)
564 print_xti_optmgmt (tcp, addr, len);
566 printstr (tcp, addr, len);
573 static struct xlat service_type [] = {
574 { T_COTS, "T_COTS" },
575 { T_COTS_ORD, "T_COTS_ORD" },
576 { T_CLTS, "T_CLTS" },
580 static struct xlat ts_state [] = {
581 { TS_UNBND, "TS_UNBND" },
582 { TS_WACK_BREQ, "TS_WACK_BREQ" },
583 { TS_WACK_UREQ, "TS_WACK_UREQ" },
584 { TS_IDLE, "TS_IDLE" },
585 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
586 { TS_WACK_CREQ, "TS_WACK_CREQ" },
587 { TS_WCON_CREQ, "TS_WCON_CREQ" },
588 { TS_WRES_CIND, "TS_WRES_CIND" },
589 { TS_WACK_CRES, "TS_WACK_CRES" },
590 { TS_DATA_XFER, "TS_DATA_XFER" },
591 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
592 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
593 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
594 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
595 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
596 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
597 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
601 static struct xlat provider_flags [] = {
603 { SENDZERO, "SENDZERO" },
604 { EXPINLINE, "EXPINLINE" },
605 { XPG4_1, "XPG4_1" },
610 static struct xlat tli_errors [] = {
611 { TBADADDR, "TBADADDR" },
612 { TBADOPT, "TBADOPT" },
613 { TACCES, "TACCES" },
615 { TNOADDR, "TNOADDR" },
616 { TOUTSTATE, "TOUTSTATE" },
617 { TBADSEQ, "TBADSEQ" },
618 { TSYSERR, "TSYSERR" },
620 { TBADDATA, "TBADDATA" },
621 { TBUFOVFLW, "TBUFOVFLW" },
623 { TNODATA, "TNODATA" },
624 { TNODIS, "TNODIS" },
625 { TNOUDERR, "TNOUDERR" },
626 { TBADFLAG, "TBADFLAG" },
627 { TNOREL, "TNOREL" },
628 { TNOTSUPPORT, "TNOTSUPPORT" },
629 { TSTATECHNG, "TSTATECHNG" },
630 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
631 { TBADNAME, "TBADNAME" },
632 { TBADQLEN, "TBADQLEN" },
633 { TADDRBUSY, "TADDRBUSY" },
634 { TINDOUT, "TINDOUT" },
635 { TPROVMISMATCH,"TPROVMISMATCH" },
636 { TRESQLEN, "TRESQLEN" },
637 { TRESADDR, "TRESADDR" },
638 { TQFULL, "TQFULL" },
639 { TPROTO, "TPROTO" },
645 print_transport_message (tcp, expect, addr, len)
651 union T_primitives m;
654 if (len < sizeof m.type) goto dump;
656 if (umove (tcp, addr, &m.type) < 0) goto dump;
658 #define GET(type, struct) \
660 if (len < sizeof m.struct) goto dump; \
661 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
663 if (expect != type) { \
671 do { if (c++) tprintf (", "); } while (0)
674 #define STRUCT(struct, elem, print) \
677 if (m.struct.elem##_length < 0 || \
678 m.struct.elem##_offset < sizeof m.struct || \
679 m.struct.elem##_offset + m.struct.elem##_length > len) \
681 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
682 m.struct.elem##_length, \
683 m.struct.elem##_offset); \
686 tprintf (#elem "="); \
688 addr + m.struct.elem##_offset, \
689 m.struct.elem##_length); \
694 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
698 case T_CONN_REQ: /* connect request */
699 GET (T_CONN_REQ, conn_req);
700 ADDR (conn_req, DEST);
701 ADDR (conn_req, OPT);
705 case T_CONN_RES: /* connect response */
706 GET (T_CONN_RES, conn_res);
708 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
709 ADDR (conn_res, OPT);
711 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
715 case T_DISCON_REQ: /* disconnect request */
716 GET (T_DISCON_REQ, discon_req);
718 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
722 case T_DATA_REQ: /* data request */
723 GET (T_DATA_REQ, data_req);
725 tprintf ("MORE=%ld", m.data_req.MORE_flag);
729 case T_EXDATA_REQ: /* expedited data req */
730 GET (T_EXDATA_REQ, exdata_req);
732 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
736 case T_INFO_REQ: /* information req */
737 GET (T_INFO_REQ, info_req);
741 case T_BIND_REQ: /* bind request */
743 case O_T_BIND_REQ: /* Ugly xti/tli hack */
745 GET (T_BIND_REQ, bind_req);
746 ADDR (bind_req, ADDR);
748 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
752 case T_UNBIND_REQ: /* unbind request */
753 GET (T_UNBIND_REQ, unbind_req);
756 #ifdef T_UNITDATA_REQ
757 case T_UNITDATA_REQ: /* unitdata requset */
758 GET (T_UNITDATA_REQ, unitdata_req);
759 ADDR (unitdata_req, DEST);
760 ADDR (unitdata_req, OPT);
764 case T_OPTMGMT_REQ: /* manage opt req */
765 GET (T_OPTMGMT_REQ, optmgmt_req);
768 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags);
769 STRUCT (optmgmt_req, OPT, print_optmgmt);
773 case T_ORDREL_REQ: /* orderly rel req */
774 GET (T_ORDREL_REQ, ordrel_req);
778 case T_CONN_IND: /* connect indication */
779 GET (T_CONN_IND, conn_ind);
780 ADDR (conn_ind, SRC);
781 ADDR (conn_ind, OPT);
782 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
786 case T_CONN_CON: /* connect corfirm */
787 GET (T_CONN_CON, conn_con);
788 ADDR (conn_con, RES);
789 ADDR (conn_con, OPT);
793 case T_DISCON_IND: /* discon indication */
794 GET (T_DISCON_IND, discon_ind);
796 tprintf ("DISCON=%ld, SEQ=%ld",
797 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
801 case T_DATA_IND: /* data indication */
802 GET (T_DATA_IND, data_ind);
804 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
808 case T_EXDATA_IND: /* expedited data ind */
809 GET (T_EXDATA_IND, exdata_ind);
811 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
815 case T_INFO_ACK: /* info ack */
816 GET (T_INFO_ACK, info_ack);
818 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
819 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
820 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
821 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
822 m.info_ack.ADDR_size, m.info_ack.OPT_size,
823 m.info_ack.TIDU_size);
824 printxval (service_type, m.info_ack.SERV_type, "T_???");
825 tprintf (", CURRENT=");
826 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
827 tprintf (", PROVIDER=");
828 printflags (provider_flags, m.info_ack.PROVIDER_flag);
832 case T_BIND_ACK: /* bind ack */
833 GET (T_BIND_ACK, bind_ack);
834 ADDR (bind_ack, ADDR);
835 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
839 case T_ERROR_ACK: /* error ack */
840 GET (T_ERROR_ACK, error_ack);
843 printxval (transport_user_options,
844 m.error_ack.ERROR_prim, "TI_???");
846 printxval (tli_errors, m.error_ack.TLI_error, "T???");
847 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
851 case T_OK_ACK: /* ok ack */
852 GET (T_OK_ACK, ok_ack);
854 tprintf ("CORRECT=");
855 printxval (transport_user_options,
856 m.ok_ack.CORRECT_prim, "TI_???");
859 #ifdef T_UNITDATA_IND
860 case T_UNITDATA_IND: /* unitdata ind */
861 GET (T_UNITDATA_IND, unitdata_ind);
862 ADDR (unitdata_ind, SRC);
863 ADDR (unitdata_ind, OPT);
867 case T_UDERROR_IND: /* unitdata error ind */
868 GET (T_UDERROR_IND, uderror_ind);
869 ADDR (uderror_ind, DEST);
870 ADDR (uderror_ind, OPT);
871 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
875 case T_OPTMGMT_ACK: /* manage opt ack */
876 GET (T_OPTMGMT_ACK, optmgmt_ack);
879 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags);
880 STRUCT (optmgmt_ack, OPT, print_optmgmt);
884 case T_ORDREL_IND: /* orderly rel ind */
885 GET (T_ORDREL_IND, ordrel_ind);
889 case T_ADDR_REQ: /* address req */
890 GET (T_ADDR_REQ, addr_req);
894 case T_ADDR_ACK: /* address response */
895 GET (T_ADDR_ACK, addr_ack);
896 ADDR (addr_ack, LOCADDR);
897 ADDR (addr_ack, REMADDR);
903 printstr(tcp, addr, len);
907 if (c >= 0) tprintf ("}");
921 internal_stream_ioctl(tcp, arg)
930 struct si_udata udata;
931 #endif /* SI_GETUDATA */
935 if (umove(tcp, arg, &si) < 0) {
941 name = ioctl_lookup(si.ic_cmd);
943 tprintf(", {ic_cmd=%s", name);
945 tprintf(", {ic_cmd=%#x", si.ic_cmd);
946 if (si.ic_timout == INFTIM)
947 tprintf(", ic_timout=INFTIM, ");
949 tprintf(" ic_timout=%d, ", si.ic_timout);
957 #endif /* SI_GETUDATA */
961 tprintf("/* in */ ");
963 tprintf(", /* out */ ");
965 if (in_and_out || entering(tcp))
966 tprintf("ic_len=%d, ic_dp=", si.ic_len);
970 /* in T_BIND_REQ, out T_BIND_ACK */
973 print_transport_message (tcp,
975 si.ic_dp, si.ic_len);
978 print_transport_message (tcp,
980 si.ic_dp, si.ic_len);
986 /* in T_UNBIND_REQ, out T_OK_ACK */
989 print_transport_message (tcp,
991 si.ic_dp, si.ic_len);
994 print_transport_message (tcp,
996 si.ic_dp, si.ic_len);
999 #endif /* TI_UNBIND */
1002 /* in T_INFO_REQ, out T_INFO_ACK */
1004 if (entering(tcp)) {
1005 print_transport_message (tcp,
1007 si.ic_dp, si.ic_len);
1010 print_transport_message (tcp,
1012 si.ic_dp, si.ic_len);
1015 #endif /* TI_GETINFO */
1018 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1020 if (entering(tcp)) {
1021 print_transport_message (tcp,
1023 si.ic_dp, si.ic_len);
1026 print_transport_message (tcp,
1028 si.ic_dp, si.ic_len);
1031 #endif /* TI_OPTMGMT */
1037 tprintf("struct si_udata ");
1039 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1042 tprintf("{tidusize=%d, addrsize=%d, ",
1043 udata.tidusize, udata.addrsize);
1044 tprintf("optsize=%d, etsdusize=%d, ",
1045 udata.optsize, udata.etsdusize);
1046 tprintf("servtype=%d, so_state=%d, ",
1047 udata.servtype, udata.so_state);
1048 tprintf("so_options=%d", udata.so_options);
1050 tprintf(", tsdusize=%d", udata.tsdusize);
1055 #endif /* SI_GETUDATA */
1057 printstr(tcp, (int) si.ic_dp, si.ic_len);
1062 if (timod && tcp->u_rval) {
1063 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1064 return RVAL_STR + 1;
1072 stream_ioctl(tcp, code, arg)
1084 struct strfdinsert sfi;
1085 struct strrecvfd srf;
1090 /* I_STR is a special case because the data is read & written. */
1092 return internal_stream_ioctl(tcp, arg);
1100 /* arg is a string */
1102 printpath(tcp, arg);
1105 /* doesn't take an argument */
1108 /* argument is an option */
1110 printxval(stream_flush_options, arg, "FLUSH???");
1114 /* argument is a pointer to a bandinfo struct */
1115 if (umove(tcp, arg, &bi) < 0)
1118 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1119 if (!printflags(stream_flush_options, bi.bi_flag))
1124 #endif /* I_FLUSHBAND */
1126 /* argument is a set of flags */
1128 if (!printflags(stream_setsig_flags, arg))
1132 /* argument is a pointer to a set of flags */
1136 if (umove(tcp, arg, &val) < 0)
1138 else if (!printflags(stream_setsig_flags, val))
1143 /* argument is a pointer to a strpeek structure */
1144 if (syserror(tcp) || !arg)
1146 if (umove(tcp, arg, &sp) < 0) {
1150 tprintf(", {ctlbuf=");
1151 printstrbuf(tcp, &sp.ctlbuf, 1);
1152 tprintf(", databuf=");
1153 printstrbuf(tcp, &sp.databuf, 1);
1154 tprintf(", flags=");
1155 if (!printflags(msgflags, sp.flags))
1160 /* argument is an option with flags */
1162 printxval(stream_read_options, arg & RMODEMASK, "R???");
1163 addflags(stream_read_flags, arg & ~RMODEMASK);
1166 /* argument is an pointer to an option with flags */
1170 if (umove(tcp, arg, &val) < 0)
1173 printxval(stream_read_options,
1174 arg & RMODEMASK, "R???");
1175 addflags(stream_read_flags, arg & ~RMODEMASK);
1189 /* argument is a pointer to a decimal integer */
1193 printnum(tcp, arg, "%d");
1196 /* argument is a pointer to a strfdinsert structure */
1197 if (syserror(tcp) || !arg)
1199 if (umove(tcp, arg, &sfi) < 0) {
1203 tprintf(", {ctlbuf=");
1204 printstrbuf(tcp, &sfi.ctlbuf, 1);
1205 tprintf(", databuf=");
1206 printstrbuf(tcp, &sfi.databuf, 1);
1207 tprintf(", flags=");
1208 if (!printflags(msgflags, sfi.flags))
1210 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1214 /* argument is a set of flags */
1216 if (!printflags(stream_write_flags, arg))
1219 #endif /* I_SWROPT */
1222 /* argument is an pointer to an option with flags */
1226 if (umove(tcp, arg, &val) < 0)
1228 else if (!printflags(stream_write_flags, arg))
1232 #endif /* I_GWROPT */
1244 /* argument is a decimal integer */
1245 tprintf(", %d", arg);
1248 /* argument is a pointer to a strrecvfd structure */
1249 if (syserror(tcp) || !arg)
1251 if (umove(tcp, arg, &srf) < 0) {
1255 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1256 (unsigned long) srf.uid, (unsigned long) srf.gid);
1266 if (umove(tcp, arg, &sl) < 0) {
1270 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1271 for (i = 0; i < tcp->u_rval; i++) {
1274 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1282 printxval(stream_atmark_options, arg, "???MARK");
1284 #endif /* I_ATMARK */
1290 #endif /* !linux && !FREEBSD */
1292 #endif /* HAVE_SYS_STREAM_H || linux || FREEBSD */