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(struct tcb *tcp, struct strbuf *sbp, int getting)
82 if (sbp->maxlen == -1 && getting)
83 tprintf("{maxlen=-1}");
87 tprintf("maxlen=%d, ", sbp->maxlen);
88 tprintf("len=%d, buf=", sbp->len);
89 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
95 printstrbufarg(struct tcb *tcp, int arg, int getting)
101 else if (umove(tcp, arg, &buf) < 0)
104 printstrbuf(tcp, &buf, getting);
109 sys_putmsg(struct tcb *tcp)
115 tprintf("%ld, ", tcp->u_arg[0]);
116 /* control and data */
117 for (i = 1; i < 3; i++)
118 printstrbufarg(tcp, tcp->u_arg[i], 0);
120 printflags(msgflags, tcp->u_arg[3], "RS_???");
125 #if defined(SPARC) || defined(SPARC64) || defined(SUNOS4) || defined(SVR4)
127 sys_getmsg(struct tcb *tcp)
133 tprintf("%lu, ", tcp->u_arg[0]);
136 tprintf("%#lx, %#lx, %#lx",
137 tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
140 /* control and data */
141 for (i = 1; i < 3; i++)
142 printstrbufarg(tcp, tcp->u_arg[i], 1);
143 /* pointer to flags */
144 if (tcp->u_arg[3] == 0)
146 else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
150 printflags(msgflags, flags, "RS_???");
153 /* decode return value */
154 switch (tcp->u_rval) {
156 tcp->auxstr = "MORECTL";
158 case MORECTL|MOREDATA:
159 tcp->auxstr = "MORECTL|MOREDATA";
162 tcp->auxstr = "MORECTL";
169 return RVAL_HEX | RVAL_STR;
171 #endif /* SPARC || SPARC64 || SUNOS4 || SVR4 */
173 #if defined SYS_putpmsg || defined SYS_getpmsg
174 static const struct xlat pmsgflags[] = {
176 { MSG_HIPRI, "MSG_HIPRI" },
179 { MSG_ANY, "MSG_ANY" },
182 { MSG_BAND, "MSG_BAND" },
190 sys_putpmsg(struct tcb *tcp)
196 tprintf("%ld, ", tcp->u_arg[0]);
197 /* control and data */
198 for (i = 1; i < 3; i++)
199 printstrbufarg(tcp, tcp->u_arg[i], 0);
201 tprintf("%ld, ", tcp->u_arg[3]);
203 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
207 #endif /* SYS_putpmsg */
211 sys_getpmsg(struct tcb *tcp)
217 tprintf("%lu, ", tcp->u_arg[0]);
220 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
221 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
224 /* control and data */
225 for (i = 1; i < 3; i++)
226 printstrbufarg(tcp, tcp->u_arg[i], 1);
227 /* pointer to band */
228 printnum(tcp, tcp->u_arg[3], "%d");
230 /* pointer to flags */
231 if (tcp->u_arg[4] == 0)
233 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
237 printflags(pmsgflags, flags, "MSG_???");
240 /* decode return value */
241 switch (tcp->u_rval) {
243 tcp->auxstr = "MORECTL";
245 case MORECTL|MOREDATA:
246 tcp->auxstr = "MORECTL|MOREDATA";
249 tcp->auxstr = "MORECTL";
256 return RVAL_HEX | RVAL_STR;
258 #endif /* SYS_getpmsg */
260 #endif /* !FREEBSD */
263 #ifdef HAVE_SYS_POLL_H
265 static const struct xlat pollflags[] = {
267 { POLLIN, "POLLIN" },
268 { POLLPRI, "POLLPRI" },
269 { POLLOUT, "POLLOUT" },
271 { POLLRDNORM, "POLLRDNORM" },
274 { POLLWRNORM, "POLLWRNORM" },
277 { POLLRDBAND, "POLLRDBAND" },
280 { POLLWRBAND, "POLLWRBAND" },
282 { POLLERR, "POLLERR" },
283 { POLLHUP, "POLLHUP" },
284 { POLLNVAL, "POLLNVAL" },
290 decode_poll(struct tcb *tcp, long pts)
294 unsigned long size, start, cur, end, abbrev_end;
298 nfds = tcp->u_arg[1];
299 size = sizeof(fds) * nfds;
300 start = tcp->u_arg[0];
302 if (nfds == 0 || size / sizeof(fds) != nfds || end < start) {
303 tprintf("%#lx, %d, ",
304 tcp->u_arg[0], nfds);
308 abbrev_end = start + max_strlen * sizeof(fds);
309 if (abbrev_end < start)
315 for (cur = start; cur < end; cur += sizeof(fds)) {
318 if (cur >= abbrev_end) {
322 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
328 tprintf("{fd=%d}", fds.fd);
332 printfd(tcp, fds.fd);
333 tprintf(", events=");
334 printflags(pollflags, fds.events, "POLL???");
339 tprintf(" %#lx", start);
340 tprintf(", %d, ", nfds);
343 static char outstr[1024];
350 if (tcp->u_rval == 0) {
351 tcp->auxstr = "Timeout";
355 nfds = tcp->u_arg[1];
356 size = sizeof(fds) * nfds;
357 start = tcp->u_arg[0];
359 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
362 abbrev_end = start + max_strlen * sizeof(fds);
363 if (abbrev_end < start)
372 for (cur = start; cur < end; cur += sizeof(fds)) {
373 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
375 if (cumlen < sizeof(outstr))
387 if (cumlen < sizeof(outstr))
388 strcat(outstr, ", ");
390 if (cur >= abbrev_end) {
392 if (cumlen < sizeof(outstr))
393 strcat(outstr, "...");
396 sprintf(str, "{fd=%d, revents=", fds.fd);
397 flagstr = sprintflags("", pollflags, fds.revents);
398 cumlen += strlen(str) + strlen(flagstr) + 1;
399 if (cumlen < sizeof(outstr)) {
401 strcat(outstr, flagstr);
408 if (cumlen && ++cumlen < sizeof(outstr))
414 sprintf(str, "%sleft ", cumlen ? ", " : "");
415 sprint_timespec(str + strlen(str), tcp, pts);
416 if ((cumlen += strlen(str)) < sizeof(outstr))
423 tcp->auxstr = outstr;
429 sys_poll(struct tcb *tcp)
431 int rc = decode_poll(tcp, 0);
434 if (tcp->u_arg[2] == INFTIM)
438 tprintf("%ld", tcp->u_arg[2]);
445 sys_ppoll(struct tcb *tcp)
447 int rc = decode_poll(tcp, tcp->u_arg[2]);
449 print_timespec(tcp, tcp->u_arg[2]);
451 print_sigset(tcp, tcp->u_arg[3], 0);
452 tprintf(", %lu", tcp->u_arg[4]);
458 #else /* !HAVE_SYS_POLL_H */
460 sys_poll(struct tcb *tcp)
466 #if !defined(LINUX) && !defined(FREEBSD)
468 static const struct xlat stream_flush_options[] = {
469 { FLUSHR, "FLUSHR" },
470 { FLUSHW, "FLUSHW" },
471 { FLUSHRW, "FLUSHRW" },
473 { FLUSHBAND, "FLUSHBAND" },
478 static const struct xlat stream_setsig_flags[] = {
479 { S_INPUT, "S_INPUT" },
480 { S_HIPRI, "S_HIPRI" },
481 { S_OUTPUT, "S_OUTPUT" },
484 { S_ERROR, "S_ERROR" },
487 { S_HANGUP, "S_HANGUP" },
490 { S_RDNORM, "S_RDNORM" },
493 { S_WRNORM, "S_WRNORM" },
496 { S_RDBAND, "S_RDBAND" },
499 { S_WRBAND, "S_WRBAND" },
502 { S_BANDURG, "S_BANDURG" },
507 static const struct xlat stream_read_options[] = {
514 static const struct xlat stream_read_flags[] = {
516 { RPROTDAT, "RPROTDAT" },
519 { RPROTDIS, "RPROTDIS" },
522 { RPROTNORM, "RPROTNORM" },
528 #define RMODEMASK (~0)
532 static const struct xlat stream_write_flags[] = {
533 { SNDZERO, "SNDZERO" },
534 { SNDPIPE, "SNDPIPE" },
537 #endif /* I_SWROPT */
540 static const struct xlat stream_atmark_options[] = {
541 { ANYMARK, "ANYMARK" },
542 { LASTMARK, "LASTMARK" },
545 #endif /* I_ATMARK */
548 static const struct xlat transport_user_options[] = {
549 { T_CONN_REQ, "T_CONN_REQ" },
550 { T_CONN_RES, "T_CONN_RES" },
551 { T_DISCON_REQ, "T_DISCON_REQ" },
552 { T_DATA_REQ, "T_DATA_REQ" },
553 { T_EXDATA_REQ, "T_EXDATA_REQ" },
554 { T_INFO_REQ, "T_INFO_REQ" },
555 { T_BIND_REQ, "T_BIND_REQ" },
556 { T_UNBIND_REQ, "T_UNBIND_REQ" },
557 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
558 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
559 { T_ORDREL_REQ, "T_ORDREL_REQ" },
563 static const struct xlat transport_user_flags[] = {
565 { T_MORE, "T_MORE" },
566 { T_EXPEDITED, "T_EXPEDITED" },
567 { T_NEGOTIATE, "T_NEGOTIATE" },
568 { T_CHECK, "T_CHECK" },
569 { T_DEFAULT, "T_DEFAULT" },
570 { T_SUCCESS, "T_SUCCESS" },
571 { T_FAILURE, "T_FAILURE" },
572 { T_CURRENT, "T_CURRENT" },
573 { T_PARTSUCCESS,"T_PARTSUCCESS" },
574 { T_READONLY, "T_READONLY" },
575 { T_NOTSUPPORT, "T_NOTSUPPORT" },
580 #ifdef HAVE_STRUCT_T_OPTHDR
582 static const struct xlat xti_level[] = {
583 { XTI_GENERIC, "XTI_GENERIC" },
587 static const struct xlat xti_generic[] = {
588 { XTI_DEBUG, "XTI_DEBUG" },
589 { XTI_LINGER, "XTI_LINGER" },
590 { XTI_RCVBUF, "XTI_RCVBUF" },
591 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
592 { XTI_SNDBUF, "XTI_SNDBUF" },
593 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
600 print_xti_optmgmt(struct tcb *tcp, long addr, int len)
605 while (len >= (int) sizeof hdr) {
606 if (umove(tcp, addr, &hdr) < 0) break;
610 else if (len > hdr.len + sizeof hdr) {
614 printxval(xti_level, hdr.level, "???");
618 printxval(xti_generic, hdr.name, "XTI_???");
621 tprintf("%ld", hdr.name);
624 tprintf(", status=");
625 printxval(transport_user_flags, hdr.status, "T_???");
628 if ((hdr.len -= sizeof hdr) > 0) {
629 if (hdr.len > len) break;
631 if (len == sizeof(int))
632 printnum(tcp, addr, "%d");
634 printstr(tcp, addr, hdr.len);
641 if (c++) tprintf(", ");
642 printstr(tcp, addr, len);
644 if (c > 1) tprintf("]");
651 print_optmgmt(struct tcb *tcp, long addr, int len)
653 /* We don't know how to tell if TLI (socket) or XTI
654 optmgmt is being used yet, assume TLI. */
655 #if defined (HAVE_STRUCT_OPTHDR)
656 print_sock_optmgmt(tcp, addr, len);
657 #elif defined (HAVE_STRUCT_T_OPTHDR)
658 print_xti_optmgmt(tcp, addr, len);
660 printstr(tcp, addr, len);
667 static const struct xlat service_type[] = {
668 { T_COTS, "T_COTS" },
669 { T_COTS_ORD, "T_COTS_ORD" },
670 { T_CLTS, "T_CLTS" },
674 static const struct xlat ts_state[] = {
675 { TS_UNBND, "TS_UNBND" },
676 { TS_WACK_BREQ, "TS_WACK_BREQ" },
677 { TS_WACK_UREQ, "TS_WACK_UREQ" },
678 { TS_IDLE, "TS_IDLE" },
679 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
680 { TS_WACK_CREQ, "TS_WACK_CREQ" },
681 { TS_WCON_CREQ, "TS_WCON_CREQ" },
682 { TS_WRES_CIND, "TS_WRES_CIND" },
683 { TS_WACK_CRES, "TS_WACK_CRES" },
684 { TS_DATA_XFER, "TS_DATA_XFER" },
685 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
686 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
687 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
688 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
689 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
690 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
691 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
695 static const struct xlat provider_flags[] = {
697 { SENDZERO, "SENDZERO" },
698 { EXPINLINE, "EXPINLINE" },
699 { XPG4_1, "XPG4_1" },
704 static const struct xlat tli_errors[] = {
705 { TBADADDR, "TBADADDR" },
706 { TBADOPT, "TBADOPT" },
707 { TACCES, "TACCES" },
709 { TNOADDR, "TNOADDR" },
710 { TOUTSTATE, "TOUTSTATE" },
711 { TBADSEQ, "TBADSEQ" },
712 { TSYSERR, "TSYSERR" },
714 { TBADDATA, "TBADDATA" },
715 { TBUFOVFLW, "TBUFOVFLW" },
717 { TNODATA, "TNODATA" },
718 { TNODIS, "TNODIS" },
719 { TNOUDERR, "TNOUDERR" },
720 { TBADFLAG, "TBADFLAG" },
721 { TNOREL, "TNOREL" },
722 { TNOTSUPPORT, "TNOTSUPPORT" },
723 { TSTATECHNG, "TSTATECHNG" },
724 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
725 { TBADNAME, "TBADNAME" },
726 { TBADQLEN, "TBADQLEN" },
727 { TADDRBUSY, "TADDRBUSY" },
728 { TINDOUT, "TINDOUT" },
729 { TPROVMISMATCH,"TPROVMISMATCH" },
730 { TRESQLEN, "TRESQLEN" },
731 { TRESADDR, "TRESADDR" },
732 { TQFULL, "TQFULL" },
733 { TPROTO, "TPROTO" },
739 print_transport_message(struct tcb *tcp, int expect, long addr, int len)
741 union T_primitives m;
744 if (len < sizeof m.type) goto dump;
746 if (umove(tcp, addr, &m.type) < 0) goto dump;
748 #define GET(type, struct) \
750 if (len < sizeof m.struct) goto dump; \
751 if (umove(tcp, addr, &m.struct) < 0) goto dump;\
753 if (expect != type) { \
761 do { if (c++) tprintf(", "); } while (0)
764 #define STRUCT(struct, elem, print) \
767 if (m.struct.elem##_length < 0 || \
768 m.struct.elem##_offset < sizeof m.struct || \
769 m.struct.elem##_offset + m.struct.elem##_length > len) \
771 tprintf(#elem "_length=%ld, " #elem "_offset=%ld",\
772 m.struct.elem##_length, \
773 m.struct.elem##_offset); \
776 tprintf(#elem "="); \
778 addr + m.struct.elem##_offset, \
779 m.struct.elem##_length); \
784 #define ADDR(struct, elem) STRUCT(struct, elem, printstr)
788 case T_CONN_REQ: /* connect request */
789 GET(T_CONN_REQ, conn_req);
790 ADDR(conn_req, DEST);
795 case T_CONN_RES: /* connect response */
796 GET(T_CONN_RES, conn_res);
797 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
799 tprintf("QUEUE=%p", m.conn_res.QUEUE_ptr);
800 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
802 tprintf("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
806 tprintf("SEQ=%ld", m.conn_res.SEQ_number);
810 case T_DISCON_REQ: /* disconnect request */
811 GET(T_DISCON_REQ, discon_req);
813 tprintf("SEQ=%ld", m.discon_req.SEQ_number);
817 case T_DATA_REQ: /* data request */
818 GET(T_DATA_REQ, data_req);
820 tprintf("MORE=%ld", m.data_req.MORE_flag);
824 case T_EXDATA_REQ: /* expedited data req */
825 GET(T_EXDATA_REQ, exdata_req);
827 tprintf("MORE=%ld", m.exdata_req.MORE_flag);
831 case T_INFO_REQ: /* information req */
832 GET(T_INFO_REQ, info_req);
836 case T_BIND_REQ: /* bind request */
838 case O_T_BIND_REQ: /* Ugly xti/tli hack */
840 GET(T_BIND_REQ, bind_req);
841 ADDR(bind_req, ADDR);
843 tprintf("CONIND=%ld", m.bind_req.CONIND_number);
847 case T_UNBIND_REQ: /* unbind request */
848 GET(T_UNBIND_REQ, unbind_req);
851 #ifdef T_UNITDATA_REQ
852 case T_UNITDATA_REQ: /* unitdata requset */
853 GET(T_UNITDATA_REQ, unitdata_req);
854 ADDR(unitdata_req, DEST);
855 ADDR(unitdata_req, OPT);
859 case T_OPTMGMT_REQ: /* manage opt req */
860 GET(T_OPTMGMT_REQ, optmgmt_req);
863 printflags(transport_user_flags, m.optmgmt_req.MGMT_flags,
865 STRUCT(optmgmt_req, OPT, print_optmgmt);
869 case T_ORDREL_REQ: /* orderly rel req */
870 GET(T_ORDREL_REQ, ordrel_req);
874 case T_CONN_IND: /* connect indication */
875 GET(T_CONN_IND, conn_ind);
878 tprintf(", SEQ=%ld", m.conn_ind.SEQ_number);
882 case T_CONN_CON: /* connect corfirm */
883 GET(T_CONN_CON, conn_con);
889 case T_DISCON_IND: /* discon indication */
890 GET(T_DISCON_IND, discon_ind);
892 tprintf("DISCON=%ld, SEQ=%ld",
893 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
897 case T_DATA_IND: /* data indication */
898 GET(T_DATA_IND, data_ind);
900 tprintf("MORE=%ld", m.data_ind.MORE_flag);
904 case T_EXDATA_IND: /* expedited data ind */
905 GET(T_EXDATA_IND, exdata_ind);
907 tprintf("MORE=%ld", m.exdata_ind.MORE_flag);
911 case T_INFO_ACK: /* info ack */
912 GET(T_INFO_ACK, info_ack);
914 tprintf("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
915 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
916 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
917 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
918 m.info_ack.ADDR_size, m.info_ack.OPT_size,
919 m.info_ack.TIDU_size);
920 printxval(service_type, m.info_ack.SERV_type, "T_???");
921 tprintf(", CURRENT=");
922 printxval(ts_state, m.info_ack.CURRENT_state, "TS_???");
923 tprintf(", PROVIDER=");
924 printflags(provider_flags, m.info_ack.PROVIDER_flag, "???");
928 case T_BIND_ACK: /* bind ack */
929 GET(T_BIND_ACK, bind_ack);
930 ADDR(bind_ack, ADDR);
931 tprintf(", CONIND=%ld", m.bind_ack.CONIND_number);
935 case T_ERROR_ACK: /* error ack */
936 GET(T_ERROR_ACK, error_ack);
939 printxval(transport_user_options,
940 m.error_ack.ERROR_prim, "TI_???");
942 printxval(tli_errors, m.error_ack.TLI_error, "T???");
943 tprintf("UNIX=%s", strerror(m.error_ack.UNIX_error));
947 case T_OK_ACK: /* ok ack */
948 GET(T_OK_ACK, ok_ack);
951 printxval(transport_user_options,
952 m.ok_ack.CORRECT_prim, "TI_???");
955 #ifdef T_UNITDATA_IND
956 case T_UNITDATA_IND: /* unitdata ind */
957 GET(T_UNITDATA_IND, unitdata_ind);
958 ADDR(unitdata_ind, SRC);
959 ADDR(unitdata_ind, OPT);
963 case T_UDERROR_IND: /* unitdata error ind */
964 GET(T_UDERROR_IND, uderror_ind);
965 ADDR(uderror_ind, DEST);
966 ADDR(uderror_ind, OPT);
967 tprintf(", ERROR=%ld", m.uderror_ind.ERROR_type);
971 case T_OPTMGMT_ACK: /* manage opt ack */
972 GET(T_OPTMGMT_ACK, optmgmt_ack);
975 printflags(transport_user_flags, m.optmgmt_ack.MGMT_flags,
977 STRUCT(optmgmt_ack, OPT, print_optmgmt);
981 case T_ORDREL_IND: /* orderly rel ind */
982 GET(T_ORDREL_IND, ordrel_ind);
986 case T_ADDR_REQ: /* address req */
987 GET(T_ADDR_REQ, addr_req);
991 case T_ADDR_ACK: /* address response */
992 GET(T_ADDR_ACK, addr_ack);
993 ADDR(addr_ack, LOCADDR);
994 ADDR(addr_ack, REMADDR);
1000 printstr(tcp, addr, len);
1004 if (c >= 0) tprintf("}");
1014 #endif /* TI_BIND */
1017 static int internal_stream_ioctl(struct tcb *tcp, int arg)
1020 struct ioctlent *iop;
1024 struct si_udata udata;
1025 #endif /* SI_GETUDATA */
1029 if (umove(tcp, arg, &si) < 0) {
1034 if (entering(tcp)) {
1035 iop = ioctl_lookup(si.ic_cmd);
1037 tprintf(", {ic_cmd=%s", iop->symbol);
1038 while ((iop = ioctl_next_match(iop)))
1039 tprintf(" or %s", iop->symbol);
1041 tprintf(", {ic_cmd=%#x", si.ic_cmd);
1042 if (si.ic_timout == INFTIM)
1043 tprintf(", ic_timout=INFTIM, ");
1045 tprintf(" ic_timout=%d, ", si.ic_timout);
1048 switch (si.ic_cmd) {
1053 #endif /* SI_GETUDATA */
1057 tprintf("/* in */ ");
1059 tprintf(", /* out */ ");
1061 if (in_and_out || entering(tcp))
1062 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1063 switch (si.ic_cmd) {
1066 /* in T_BIND_REQ, out T_BIND_ACK */
1068 if (entering(tcp)) {
1069 print_transport_message(tcp,
1071 si.ic_dp, si.ic_len);
1074 print_transport_message(tcp,
1076 si.ic_dp, si.ic_len);
1079 #endif /* TI_BIND */
1082 /* in T_UNBIND_REQ, out T_OK_ACK */
1084 if (entering(tcp)) {
1085 print_transport_message(tcp,
1087 si.ic_dp, si.ic_len);
1090 print_transport_message(tcp,
1092 si.ic_dp, si.ic_len);
1095 #endif /* TI_UNBIND */
1098 /* in T_INFO_REQ, out T_INFO_ACK */
1100 if (entering(tcp)) {
1101 print_transport_message(tcp,
1103 si.ic_dp, si.ic_len);
1106 print_transport_message(tcp,
1108 si.ic_dp, si.ic_len);
1111 #endif /* TI_GETINFO */
1114 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1116 if (entering(tcp)) {
1117 print_transport_message(tcp,
1119 si.ic_dp, si.ic_len);
1122 print_transport_message(tcp,
1124 si.ic_dp, si.ic_len);
1127 #endif /* TI_OPTMGMT */
1132 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1135 tprintf("{tidusize=%d, addrsize=%d, ",
1136 udata.tidusize, udata.addrsize);
1137 tprintf("optsize=%d, etsdusize=%d, ",
1138 udata.optsize, udata.etsdusize);
1139 tprintf("servtype=%d, so_state=%d, ",
1140 udata.servtype, udata.so_state);
1141 tprintf("so_options=%d", udata.so_options);
1145 #endif /* SI_GETUDATA */
1147 printstr(tcp, (long) si.ic_dp, si.ic_len);
1152 if (timod && tcp->u_rval && !syserror(tcp)) {
1153 tcp->auxstr = xlookup(tli_errors, tcp->u_rval);
1154 return RVAL_STR + 1;
1162 stream_ioctl(struct tcb *tcp, int code, int arg)
1172 struct strfdinsert sfi;
1173 struct strrecvfd srf;
1178 /* I_STR is a special case because the data is read & written. */
1180 return internal_stream_ioctl(tcp, arg);
1188 /* arg is a string */
1190 printpath(tcp, arg);
1193 /* doesn't take an argument */
1196 /* argument is an option */
1198 printxval(stream_flush_options, arg, "FLUSH???");
1202 /* argument is a pointer to a bandinfo struct */
1203 if (umove(tcp, arg, &bi) < 0)
1206 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1207 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1211 #endif /* I_FLUSHBAND */
1213 /* argument is a set of flags */
1215 printflags(stream_setsig_flags, arg, "S_???");
1218 /* argument is a pointer to a set of flags */
1222 if (umove(tcp, arg, &val) < 0)
1225 printflags(stream_setsig_flags, val, "S_???");
1229 /* argument is a pointer to a strpeek structure */
1230 if (syserror(tcp) || !arg)
1232 if (umove(tcp, arg, &sp) < 0) {
1236 tprintf(", {ctlbuf=");
1237 printstrbuf(tcp, &sp.ctlbuf, 1);
1238 tprintf(", databuf=");
1239 printstrbuf(tcp, &sp.databuf, 1);
1240 tprintf(", flags=");
1241 printflags(msgflags, sp.flags, "RS_???");
1245 /* argument is an option with flags */
1247 printxval(stream_read_options, arg & RMODEMASK, "R???");
1248 addflags(stream_read_flags, arg & ~RMODEMASK);
1251 /* argument is an pointer to an option with flags */
1255 if (umove(tcp, arg, &val) < 0)
1258 printxval(stream_read_options,
1259 arg & RMODEMASK, "R???");
1260 addflags(stream_read_flags, arg & ~RMODEMASK);
1274 /* argument is a pointer to a decimal integer */
1278 printnum(tcp, arg, "%d");
1281 /* argument is a pointer to a strfdinsert structure */
1282 if (syserror(tcp) || !arg)
1284 if (umove(tcp, arg, &sfi) < 0) {
1288 tprintf(", {ctlbuf=");
1289 printstrbuf(tcp, &sfi.ctlbuf, 1);
1290 tprintf(", databuf=");
1291 printstrbuf(tcp, &sfi.databuf, 1);
1292 tprintf(", flags=");
1293 printflags(msgflags, sfi.flags, "RS_???");
1294 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1298 /* argument is a set of flags */
1300 printflags(stream_write_flags, arg, "SND???");
1302 #endif /* I_SWROPT */
1305 /* argument is an pointer to an option with flags */
1309 if (umove(tcp, arg, &val) < 0)
1312 printflags(stream_write_flags, arg, "SND???");
1315 #endif /* I_GWROPT */
1327 /* argument is a decimal integer */
1328 tprintf(", %d", arg);
1331 /* argument is a pointer to a strrecvfd structure */
1332 if (syserror(tcp) || !arg)
1334 if (umove(tcp, arg, &srf) < 0) {
1338 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1339 (unsigned long) srf.uid, (unsigned long) srf.gid);
1349 if (umove(tcp, arg, &sl) < 0) {
1353 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1354 for (i = 0; i < tcp->u_rval; i++) {
1357 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1365 printxval(stream_atmark_options, arg, "???MARK");
1367 #endif /* I_ATMARK */
1373 #endif /* !LINUX && !FREEBSD */
1375 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */