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 const 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, long pts)
304 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???");
347 tprintf(" %#lx", start);
348 tprintf(", %d, ", nfds);
351 static char outstr[1024];
358 if (tcp->u_rval == 0) {
359 tcp->auxstr = "Timeout";
363 nfds = tcp->u_arg[1];
364 size = sizeof(fds) * nfds;
365 start = tcp->u_arg[0];
367 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
370 abbrev_end = start + max_strlen * sizeof(fds);
371 if (abbrev_end < start)
380 for (cur = start; cur < end; cur += sizeof(fds)) {
381 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
383 if (cumlen < sizeof(outstr))
395 if (cumlen < sizeof(outstr))
396 strcat(outstr, ", ");
398 if (cur >= abbrev_end) {
400 if (cumlen < sizeof(outstr))
401 strcat(outstr, "...");
404 sprintf(str, "{fd=%d, revents=", fds.fd);
405 flagstr=sprintflags("", pollflags, fds.revents);
406 cumlen += strlen(str) + strlen(flagstr) + 1;
407 if (cumlen < sizeof(outstr)) {
409 strcat(outstr, flagstr);
416 if (cumlen && ++cumlen < sizeof(outstr))
422 sprintf(str, "%sleft ", cumlen ? ", " : "");
423 sprint_timespec(str + strlen(str), tcp, pts);
424 if ((cumlen += strlen(str)) < sizeof(outstr))
431 tcp->auxstr = outstr;
437 sys_poll(struct tcb *tcp)
439 int rc = decode_poll(tcp, 0);
442 if (tcp->u_arg[2] == INFTIM)
446 tprintf("%ld", tcp->u_arg[2]);
453 sys_ppoll(struct tcb *tcp)
455 int rc = decode_poll(tcp, tcp->u_arg[2]);
457 print_timespec(tcp, tcp->u_arg[2]);
459 print_sigset(tcp, tcp->u_arg[3], 0);
460 tprintf(", %lu", tcp->u_arg[4]);
466 #else /* !HAVE_SYS_POLL_H */
475 #if !defined(LINUX) && !defined(FREEBSD)
477 static const struct xlat stream_flush_options[] = {
478 { FLUSHR, "FLUSHR" },
479 { FLUSHW, "FLUSHW" },
480 { FLUSHRW, "FLUSHRW" },
482 { FLUSHBAND, "FLUSHBAND" },
487 static const struct xlat stream_setsig_flags[] = {
488 { S_INPUT, "S_INPUT" },
489 { S_HIPRI, "S_HIPRI" },
490 { S_OUTPUT, "S_OUTPUT" },
493 { S_ERROR, "S_ERROR" },
496 { S_HANGUP, "S_HANGUP" },
499 { S_RDNORM, "S_RDNORM" },
502 { S_WRNORM, "S_WRNORM" },
505 { S_RDBAND, "S_RDBAND" },
508 { S_WRBAND, "S_WRBAND" },
511 { S_BANDURG, "S_BANDURG" },
516 static const struct xlat stream_read_options[] = {
523 static const struct xlat stream_read_flags[] = {
525 { RPROTDAT, "RPROTDAT" },
528 { RPROTDIS, "RPROTDIS" },
531 { RPROTNORM, "RPROTNORM" },
537 #define RMODEMASK (~0)
541 static const struct xlat stream_write_flags[] = {
542 { SNDZERO, "SNDZERO" },
543 { SNDPIPE, "SNDPIPE" },
546 #endif /* I_SWROPT */
549 static const struct xlat stream_atmark_options[] = {
550 { ANYMARK, "ANYMARK" },
551 { LASTMARK, "LASTMARK" },
554 #endif /* I_ATMARK */
557 static const struct xlat transport_user_options[] = {
558 { T_CONN_REQ, "T_CONN_REQ" },
559 { T_CONN_RES, "T_CONN_RES" },
560 { T_DISCON_REQ, "T_DISCON_REQ" },
561 { T_DATA_REQ, "T_DATA_REQ" },
562 { T_EXDATA_REQ, "T_EXDATA_REQ" },
563 { T_INFO_REQ, "T_INFO_REQ" },
564 { T_BIND_REQ, "T_BIND_REQ" },
565 { T_UNBIND_REQ, "T_UNBIND_REQ" },
566 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
567 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
568 { T_ORDREL_REQ, "T_ORDREL_REQ" },
572 static const struct xlat transport_user_flags [] = {
574 { T_MORE, "T_MORE" },
575 { T_EXPEDITED, "T_EXPEDITED" },
576 { T_NEGOTIATE, "T_NEGOTIATE" },
577 { T_CHECK, "T_CHECK" },
578 { T_DEFAULT, "T_DEFAULT" },
579 { T_SUCCESS, "T_SUCCESS" },
580 { T_FAILURE, "T_FAILURE" },
581 { T_CURRENT, "T_CURRENT" },
582 { T_PARTSUCCESS,"T_PARTSUCCESS" },
583 { T_READONLY, "T_READONLY" },
584 { T_NOTSUPPORT, "T_NOTSUPPORT" },
589 #ifdef HAVE_STRUCT_T_OPTHDR
591 static const struct xlat xti_level [] = {
592 { XTI_GENERIC, "XTI_GENERIC" },
596 static const struct xlat xti_generic [] = {
597 { XTI_DEBUG, "XTI_DEBUG" },
598 { XTI_LINGER, "XTI_LINGER" },
599 { XTI_RCVBUF, "XTI_RCVBUF" },
600 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
601 { XTI_SNDBUF, "XTI_SNDBUF" },
602 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
609 print_xti_optmgmt (tcp, addr, len)
617 while (len >= (int) sizeof hdr) {
618 if (umove(tcp, addr, &hdr) < 0) break;
622 else if (len > hdr.len + sizeof hdr) {
626 printxval (xti_level, hdr.level, "???");
630 printxval (xti_generic, hdr.name, "XTI_???");
633 tprintf ("%ld", hdr.name);
636 tprintf (", status=");
637 printxval (transport_user_flags, hdr.status, "T_???");
640 if ((hdr.len -= sizeof hdr) > 0) {
641 if (hdr.len > len) break;
643 if (len == sizeof (int))
644 printnum (tcp, addr, "%d");
646 printstr (tcp, addr, hdr.len);
653 if (c++) tprintf (", ");
654 printstr (tcp, addr, len);
656 if (c > 1) tprintf ("]");
663 print_optmgmt (tcp, addr, len)
668 /* We don't know how to tell if TLI (socket) or XTI
669 optmgmt is being used yet, assume TLI. */
670 #if defined (HAVE_STRUCT_OPTHDR)
671 print_sock_optmgmt (tcp, addr, len);
672 #elif defined (HAVE_STRUCT_T_OPTHDR)
673 print_xti_optmgmt (tcp, addr, len);
675 printstr (tcp, addr, len);
682 static const struct xlat service_type [] = {
683 { T_COTS, "T_COTS" },
684 { T_COTS_ORD, "T_COTS_ORD" },
685 { T_CLTS, "T_CLTS" },
689 static const struct xlat ts_state [] = {
690 { TS_UNBND, "TS_UNBND" },
691 { TS_WACK_BREQ, "TS_WACK_BREQ" },
692 { TS_WACK_UREQ, "TS_WACK_UREQ" },
693 { TS_IDLE, "TS_IDLE" },
694 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
695 { TS_WACK_CREQ, "TS_WACK_CREQ" },
696 { TS_WCON_CREQ, "TS_WCON_CREQ" },
697 { TS_WRES_CIND, "TS_WRES_CIND" },
698 { TS_WACK_CRES, "TS_WACK_CRES" },
699 { TS_DATA_XFER, "TS_DATA_XFER" },
700 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
701 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
702 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
703 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
704 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
705 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
706 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
710 static const struct xlat provider_flags [] = {
712 { SENDZERO, "SENDZERO" },
713 { EXPINLINE, "EXPINLINE" },
714 { XPG4_1, "XPG4_1" },
719 static const struct xlat tli_errors [] = {
720 { TBADADDR, "TBADADDR" },
721 { TBADOPT, "TBADOPT" },
722 { TACCES, "TACCES" },
724 { TNOADDR, "TNOADDR" },
725 { TOUTSTATE, "TOUTSTATE" },
726 { TBADSEQ, "TBADSEQ" },
727 { TSYSERR, "TSYSERR" },
729 { TBADDATA, "TBADDATA" },
730 { TBUFOVFLW, "TBUFOVFLW" },
732 { TNODATA, "TNODATA" },
733 { TNODIS, "TNODIS" },
734 { TNOUDERR, "TNOUDERR" },
735 { TBADFLAG, "TBADFLAG" },
736 { TNOREL, "TNOREL" },
737 { TNOTSUPPORT, "TNOTSUPPORT" },
738 { TSTATECHNG, "TSTATECHNG" },
739 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
740 { TBADNAME, "TBADNAME" },
741 { TBADQLEN, "TBADQLEN" },
742 { TADDRBUSY, "TADDRBUSY" },
743 { TINDOUT, "TINDOUT" },
744 { TPROVMISMATCH,"TPROVMISMATCH" },
745 { TRESQLEN, "TRESQLEN" },
746 { TRESADDR, "TRESADDR" },
747 { TQFULL, "TQFULL" },
748 { TPROTO, "TPROTO" },
754 print_transport_message (tcp, expect, addr, len)
760 union T_primitives m;
763 if (len < sizeof m.type) goto dump;
765 if (umove (tcp, addr, &m.type) < 0) goto dump;
767 #define GET(type, struct) \
769 if (len < sizeof m.struct) goto dump; \
770 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
772 if (expect != type) { \
780 do { if (c++) tprintf (", "); } while (0)
783 #define STRUCT(struct, elem, print) \
786 if (m.struct.elem##_length < 0 || \
787 m.struct.elem##_offset < sizeof m.struct || \
788 m.struct.elem##_offset + m.struct.elem##_length > len) \
790 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
791 m.struct.elem##_length, \
792 m.struct.elem##_offset); \
795 tprintf (#elem "="); \
797 addr + m.struct.elem##_offset, \
798 m.struct.elem##_length); \
803 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
807 case T_CONN_REQ: /* connect request */
808 GET (T_CONN_REQ, conn_req);
809 ADDR (conn_req, DEST);
810 ADDR (conn_req, OPT);
814 case T_CONN_RES: /* connect response */
815 GET (T_CONN_RES, conn_res);
816 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
818 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
819 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
821 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
823 ADDR (conn_res, OPT);
825 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
829 case T_DISCON_REQ: /* disconnect request */
830 GET (T_DISCON_REQ, discon_req);
832 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
836 case T_DATA_REQ: /* data request */
837 GET (T_DATA_REQ, data_req);
839 tprintf ("MORE=%ld", m.data_req.MORE_flag);
843 case T_EXDATA_REQ: /* expedited data req */
844 GET (T_EXDATA_REQ, exdata_req);
846 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
850 case T_INFO_REQ: /* information req */
851 GET (T_INFO_REQ, info_req);
855 case T_BIND_REQ: /* bind request */
857 case O_T_BIND_REQ: /* Ugly xti/tli hack */
859 GET (T_BIND_REQ, bind_req);
860 ADDR (bind_req, ADDR);
862 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
866 case T_UNBIND_REQ: /* unbind request */
867 GET (T_UNBIND_REQ, unbind_req);
870 #ifdef T_UNITDATA_REQ
871 case T_UNITDATA_REQ: /* unitdata requset */
872 GET (T_UNITDATA_REQ, unitdata_req);
873 ADDR (unitdata_req, DEST);
874 ADDR (unitdata_req, OPT);
878 case T_OPTMGMT_REQ: /* manage opt req */
879 GET (T_OPTMGMT_REQ, optmgmt_req);
882 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
884 STRUCT (optmgmt_req, OPT, print_optmgmt);
888 case T_ORDREL_REQ: /* orderly rel req */
889 GET (T_ORDREL_REQ, ordrel_req);
893 case T_CONN_IND: /* connect indication */
894 GET (T_CONN_IND, conn_ind);
895 ADDR (conn_ind, SRC);
896 ADDR (conn_ind, OPT);
897 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
901 case T_CONN_CON: /* connect corfirm */
902 GET (T_CONN_CON, conn_con);
903 ADDR (conn_con, RES);
904 ADDR (conn_con, OPT);
908 case T_DISCON_IND: /* discon indication */
909 GET (T_DISCON_IND, discon_ind);
911 tprintf ("DISCON=%ld, SEQ=%ld",
912 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
916 case T_DATA_IND: /* data indication */
917 GET (T_DATA_IND, data_ind);
919 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
923 case T_EXDATA_IND: /* expedited data ind */
924 GET (T_EXDATA_IND, exdata_ind);
926 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
930 case T_INFO_ACK: /* info ack */
931 GET (T_INFO_ACK, info_ack);
933 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
934 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
935 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
936 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
937 m.info_ack.ADDR_size, m.info_ack.OPT_size,
938 m.info_ack.TIDU_size);
939 printxval (service_type, m.info_ack.SERV_type, "T_???");
940 tprintf (", CURRENT=");
941 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
942 tprintf (", PROVIDER=");
943 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
947 case T_BIND_ACK: /* bind ack */
948 GET (T_BIND_ACK, bind_ack);
949 ADDR (bind_ack, ADDR);
950 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
954 case T_ERROR_ACK: /* error ack */
955 GET (T_ERROR_ACK, error_ack);
958 printxval (transport_user_options,
959 m.error_ack.ERROR_prim, "TI_???");
961 printxval (tli_errors, m.error_ack.TLI_error, "T???");
962 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
966 case T_OK_ACK: /* ok ack */
967 GET (T_OK_ACK, ok_ack);
969 tprintf ("CORRECT=");
970 printxval (transport_user_options,
971 m.ok_ack.CORRECT_prim, "TI_???");
974 #ifdef T_UNITDATA_IND
975 case T_UNITDATA_IND: /* unitdata ind */
976 GET (T_UNITDATA_IND, unitdata_ind);
977 ADDR (unitdata_ind, SRC);
978 ADDR (unitdata_ind, OPT);
982 case T_UDERROR_IND: /* unitdata error ind */
983 GET (T_UDERROR_IND, uderror_ind);
984 ADDR (uderror_ind, DEST);
985 ADDR (uderror_ind, OPT);
986 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
990 case T_OPTMGMT_ACK: /* manage opt ack */
991 GET (T_OPTMGMT_ACK, optmgmt_ack);
994 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
996 STRUCT (optmgmt_ack, OPT, print_optmgmt);
1000 case T_ORDREL_IND: /* orderly rel ind */
1001 GET (T_ORDREL_IND, ordrel_ind);
1005 case T_ADDR_REQ: /* address req */
1006 GET (T_ADDR_REQ, addr_req);
1010 case T_ADDR_ACK: /* address response */
1011 GET (T_ADDR_ACK, addr_ack);
1012 ADDR (addr_ack, LOCADDR);
1013 ADDR (addr_ack, REMADDR);
1019 printstr(tcp, addr, len);
1023 if (c >= 0) tprintf ("}");
1033 #endif /* TI_BIND */
1036 static int internal_stream_ioctl(struct tcb *tcp, int arg)
1039 struct ioctlent *iop;
1043 struct si_udata udata;
1044 #endif /* SI_GETUDATA */
1048 if (umove(tcp, arg, &si) < 0) {
1053 if (entering(tcp)) {
1054 iop = ioctl_lookup(si.ic_cmd);
1056 tprintf(", {ic_cmd=%s", iop->symbol);
1057 while ((iop = ioctl_next_match(iop)))
1058 tprintf(" or %s", iop->symbol);
1060 tprintf(", {ic_cmd=%#x", si.ic_cmd);
1061 if (si.ic_timout == INFTIM)
1062 tprintf(", ic_timout=INFTIM, ");
1064 tprintf(" ic_timout=%d, ", si.ic_timout);
1067 switch (si.ic_cmd) {
1072 #endif /* SI_GETUDATA */
1076 tprintf("/* in */ ");
1078 tprintf(", /* out */ ");
1080 if (in_and_out || entering(tcp))
1081 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1082 switch (si.ic_cmd) {
1085 /* in T_BIND_REQ, out T_BIND_ACK */
1087 if (entering(tcp)) {
1088 print_transport_message (tcp,
1090 si.ic_dp, si.ic_len);
1093 print_transport_message (tcp,
1095 si.ic_dp, si.ic_len);
1098 #endif /* TI_BIND */
1101 /* in T_UNBIND_REQ, out T_OK_ACK */
1103 if (entering(tcp)) {
1104 print_transport_message (tcp,
1106 si.ic_dp, si.ic_len);
1109 print_transport_message (tcp,
1111 si.ic_dp, si.ic_len);
1114 #endif /* TI_UNBIND */
1117 /* in T_INFO_REQ, out T_INFO_ACK */
1119 if (entering(tcp)) {
1120 print_transport_message (tcp,
1122 si.ic_dp, si.ic_len);
1125 print_transport_message (tcp,
1127 si.ic_dp, si.ic_len);
1130 #endif /* TI_GETINFO */
1133 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1135 if (entering(tcp)) {
1136 print_transport_message (tcp,
1138 si.ic_dp, si.ic_len);
1141 print_transport_message (tcp,
1143 si.ic_dp, si.ic_len);
1146 #endif /* TI_OPTMGMT */
1151 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1154 tprintf("{tidusize=%d, addrsize=%d, ",
1155 udata.tidusize, udata.addrsize);
1156 tprintf("optsize=%d, etsdusize=%d, ",
1157 udata.optsize, udata.etsdusize);
1158 tprintf("servtype=%d, so_state=%d, ",
1159 udata.servtype, udata.so_state);
1160 tprintf("so_options=%d", udata.so_options);
1164 #endif /* SI_GETUDATA */
1166 printstr(tcp, (long) si.ic_dp, si.ic_len);
1171 if (timod && tcp->u_rval && !syserror(tcp)) {
1172 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1173 return RVAL_STR + 1;
1181 stream_ioctl(tcp, code, arg)
1193 struct strfdinsert sfi;
1194 struct strrecvfd srf;
1199 /* I_STR is a special case because the data is read & written. */
1201 return internal_stream_ioctl(tcp, arg);
1209 /* arg is a string */
1211 printpath(tcp, arg);
1214 /* doesn't take an argument */
1217 /* argument is an option */
1219 printxval(stream_flush_options, arg, "FLUSH???");
1223 /* argument is a pointer to a bandinfo struct */
1224 if (umove(tcp, arg, &bi) < 0)
1227 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1228 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1232 #endif /* I_FLUSHBAND */
1234 /* argument is a set of flags */
1236 printflags(stream_setsig_flags, arg, "S_???");
1239 /* argument is a pointer to a set of flags */
1243 if (umove(tcp, arg, &val) < 0)
1246 printflags(stream_setsig_flags, val, "S_???");
1250 /* argument is a pointer to a strpeek structure */
1251 if (syserror(tcp) || !arg)
1253 if (umove(tcp, arg, &sp) < 0) {
1257 tprintf(", {ctlbuf=");
1258 printstrbuf(tcp, &sp.ctlbuf, 1);
1259 tprintf(", databuf=");
1260 printstrbuf(tcp, &sp.databuf, 1);
1261 tprintf(", flags=");
1262 printflags(msgflags, sp.flags, "RS_???");
1266 /* argument is an option with flags */
1268 printxval(stream_read_options, arg & RMODEMASK, "R???");
1269 addflags(stream_read_flags, arg & ~RMODEMASK);
1272 /* argument is an pointer to an option with flags */
1276 if (umove(tcp, arg, &val) < 0)
1279 printxval(stream_read_options,
1280 arg & RMODEMASK, "R???");
1281 addflags(stream_read_flags, arg & ~RMODEMASK);
1295 /* argument is a pointer to a decimal integer */
1299 printnum(tcp, arg, "%d");
1302 /* argument is a pointer to a strfdinsert structure */
1303 if (syserror(tcp) || !arg)
1305 if (umove(tcp, arg, &sfi) < 0) {
1309 tprintf(", {ctlbuf=");
1310 printstrbuf(tcp, &sfi.ctlbuf, 1);
1311 tprintf(", databuf=");
1312 printstrbuf(tcp, &sfi.databuf, 1);
1313 tprintf(", flags=");
1314 printflags(msgflags, sfi.flags, "RS_???");
1315 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1319 /* argument is a set of flags */
1321 printflags(stream_write_flags, arg, "SND???");
1323 #endif /* I_SWROPT */
1326 /* argument is an pointer to an option with flags */
1330 if (umove(tcp, arg, &val) < 0)
1333 printflags(stream_write_flags, arg, "SND???");
1336 #endif /* I_GWROPT */
1348 /* argument is a decimal integer */
1349 tprintf(", %d", arg);
1352 /* argument is a pointer to a strrecvfd structure */
1353 if (syserror(tcp) || !arg)
1355 if (umove(tcp, arg, &srf) < 0) {
1359 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1360 (unsigned long) srf.uid, (unsigned long) srf.gid);
1370 if (umove(tcp, arg, &sl) < 0) {
1374 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1375 for (i = 0; i < tcp->u_rval; i++) {
1378 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1386 printxval(stream_atmark_options, arg, "???MARK");
1388 #endif /* I_ATMARK */
1394 #endif /* !LINUX && !FREEBSD */
1396 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */