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);
342 printfd(tcp, fds.fd);
343 tprintf(", events=");
344 printflags(pollflags, fds.events, "POLL???");
349 tprintf(" %#lx", start);
350 tprintf(", %d, ", nfds);
353 static char outstr[1024];
360 if (tcp->u_rval == 0) {
361 tcp->auxstr = "Timeout";
365 nfds = tcp->u_arg[1];
366 size = sizeof(fds) * nfds;
367 start = tcp->u_arg[0];
369 if (nfds == 0 || size / sizeof(fds) != nfds || end < start)
372 abbrev_end = start + max_strlen * sizeof(fds);
373 if (abbrev_end < start)
382 for (cur = start; cur < end; cur += sizeof(fds)) {
383 if (umoven(tcp, cur, sizeof fds, (char *) &fds) < 0) {
385 if (cumlen < sizeof(outstr))
397 if (cumlen < sizeof(outstr))
398 strcat(outstr, ", ");
400 if (cur >= abbrev_end) {
402 if (cumlen < sizeof(outstr))
403 strcat(outstr, "...");
406 sprintf(str, "{fd=%d, revents=", fds.fd);
407 flagstr=sprintflags("", pollflags, fds.revents);
408 cumlen += strlen(str) + strlen(flagstr) + 1;
409 if (cumlen < sizeof(outstr)) {
411 strcat(outstr, flagstr);
418 if (cumlen && ++cumlen < sizeof(outstr))
424 sprintf(str, "%sleft ", cumlen ? ", " : "");
425 sprint_timespec(str + strlen(str), tcp, pts);
426 if ((cumlen += strlen(str)) < sizeof(outstr))
433 tcp->auxstr = outstr;
439 sys_poll(struct tcb *tcp)
441 int rc = decode_poll(tcp, 0);
444 if (tcp->u_arg[2] == INFTIM)
448 tprintf("%ld", tcp->u_arg[2]);
455 sys_ppoll(struct tcb *tcp)
457 int rc = decode_poll(tcp, tcp->u_arg[2]);
459 print_timespec(tcp, tcp->u_arg[2]);
461 print_sigset(tcp, tcp->u_arg[3], 0);
462 tprintf(", %lu", tcp->u_arg[4]);
468 #else /* !HAVE_SYS_POLL_H */
477 #if !defined(LINUX) && !defined(FREEBSD)
479 static const struct xlat stream_flush_options[] = {
480 { FLUSHR, "FLUSHR" },
481 { FLUSHW, "FLUSHW" },
482 { FLUSHRW, "FLUSHRW" },
484 { FLUSHBAND, "FLUSHBAND" },
489 static const struct xlat stream_setsig_flags[] = {
490 { S_INPUT, "S_INPUT" },
491 { S_HIPRI, "S_HIPRI" },
492 { S_OUTPUT, "S_OUTPUT" },
495 { S_ERROR, "S_ERROR" },
498 { S_HANGUP, "S_HANGUP" },
501 { S_RDNORM, "S_RDNORM" },
504 { S_WRNORM, "S_WRNORM" },
507 { S_RDBAND, "S_RDBAND" },
510 { S_WRBAND, "S_WRBAND" },
513 { S_BANDURG, "S_BANDURG" },
518 static const struct xlat stream_read_options[] = {
525 static const struct xlat stream_read_flags[] = {
527 { RPROTDAT, "RPROTDAT" },
530 { RPROTDIS, "RPROTDIS" },
533 { RPROTNORM, "RPROTNORM" },
539 #define RMODEMASK (~0)
543 static const struct xlat stream_write_flags[] = {
544 { SNDZERO, "SNDZERO" },
545 { SNDPIPE, "SNDPIPE" },
548 #endif /* I_SWROPT */
551 static const struct xlat stream_atmark_options[] = {
552 { ANYMARK, "ANYMARK" },
553 { LASTMARK, "LASTMARK" },
556 #endif /* I_ATMARK */
559 static const struct xlat transport_user_options[] = {
560 { T_CONN_REQ, "T_CONN_REQ" },
561 { T_CONN_RES, "T_CONN_RES" },
562 { T_DISCON_REQ, "T_DISCON_REQ" },
563 { T_DATA_REQ, "T_DATA_REQ" },
564 { T_EXDATA_REQ, "T_EXDATA_REQ" },
565 { T_INFO_REQ, "T_INFO_REQ" },
566 { T_BIND_REQ, "T_BIND_REQ" },
567 { T_UNBIND_REQ, "T_UNBIND_REQ" },
568 { T_UNITDATA_REQ,"T_UNITDATA_REQ"},
569 { T_OPTMGMT_REQ,"T_OPTMGMT_REQ" },
570 { T_ORDREL_REQ, "T_ORDREL_REQ" },
574 static const struct xlat transport_user_flags [] = {
576 { T_MORE, "T_MORE" },
577 { T_EXPEDITED, "T_EXPEDITED" },
578 { T_NEGOTIATE, "T_NEGOTIATE" },
579 { T_CHECK, "T_CHECK" },
580 { T_DEFAULT, "T_DEFAULT" },
581 { T_SUCCESS, "T_SUCCESS" },
582 { T_FAILURE, "T_FAILURE" },
583 { T_CURRENT, "T_CURRENT" },
584 { T_PARTSUCCESS,"T_PARTSUCCESS" },
585 { T_READONLY, "T_READONLY" },
586 { T_NOTSUPPORT, "T_NOTSUPPORT" },
591 #ifdef HAVE_STRUCT_T_OPTHDR
593 static const struct xlat xti_level [] = {
594 { XTI_GENERIC, "XTI_GENERIC" },
598 static const struct xlat xti_generic [] = {
599 { XTI_DEBUG, "XTI_DEBUG" },
600 { XTI_LINGER, "XTI_LINGER" },
601 { XTI_RCVBUF, "XTI_RCVBUF" },
602 { XTI_RCVLOWAT, "XTI_RCVLOWAT" },
603 { XTI_SNDBUF, "XTI_SNDBUF" },
604 { XTI_SNDLOWAT, "XTI_SNDLOWAT" },
611 print_xti_optmgmt (tcp, addr, len)
619 while (len >= (int) sizeof hdr) {
620 if (umove(tcp, addr, &hdr) < 0) break;
624 else if (len > hdr.len + sizeof hdr) {
628 printxval (xti_level, hdr.level, "???");
632 printxval (xti_generic, hdr.name, "XTI_???");
635 tprintf ("%ld", hdr.name);
638 tprintf (", status=");
639 printxval (transport_user_flags, hdr.status, "T_???");
642 if ((hdr.len -= sizeof hdr) > 0) {
643 if (hdr.len > len) break;
645 if (len == sizeof (int))
646 printnum (tcp, addr, "%d");
648 printstr (tcp, addr, hdr.len);
655 if (c++) tprintf (", ");
656 printstr (tcp, addr, len);
658 if (c > 1) tprintf ("]");
665 print_optmgmt (tcp, addr, len)
670 /* We don't know how to tell if TLI (socket) or XTI
671 optmgmt is being used yet, assume TLI. */
672 #if defined (HAVE_STRUCT_OPTHDR)
673 print_sock_optmgmt (tcp, addr, len);
674 #elif defined (HAVE_STRUCT_T_OPTHDR)
675 print_xti_optmgmt (tcp, addr, len);
677 printstr (tcp, addr, len);
684 static const struct xlat service_type [] = {
685 { T_COTS, "T_COTS" },
686 { T_COTS_ORD, "T_COTS_ORD" },
687 { T_CLTS, "T_CLTS" },
691 static const struct xlat ts_state [] = {
692 { TS_UNBND, "TS_UNBND" },
693 { TS_WACK_BREQ, "TS_WACK_BREQ" },
694 { TS_WACK_UREQ, "TS_WACK_UREQ" },
695 { TS_IDLE, "TS_IDLE" },
696 { TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
697 { TS_WACK_CREQ, "TS_WACK_CREQ" },
698 { TS_WCON_CREQ, "TS_WCON_CREQ" },
699 { TS_WRES_CIND, "TS_WRES_CIND" },
700 { TS_WACK_CRES, "TS_WACK_CRES" },
701 { TS_DATA_XFER, "TS_DATA_XFER" },
702 { TS_WIND_ORDREL,"TS_WIND_ORDREL"},
703 { TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
704 { TS_WACK_DREQ6,"TS_WACK_DREQ6" },
705 { TS_WACK_DREQ7,"TS_WACK_DREQ7" },
706 { TS_WACK_DREQ9,"TS_WACK_DREQ9" },
707 { TS_WACK_DREQ10,"TS_WACK_DREQ10"},
708 { TS_WACK_DREQ11,"TS_WACK_DREQ11"},
712 static const struct xlat provider_flags [] = {
714 { SENDZERO, "SENDZERO" },
715 { EXPINLINE, "EXPINLINE" },
716 { XPG4_1, "XPG4_1" },
721 static const struct xlat tli_errors [] = {
722 { TBADADDR, "TBADADDR" },
723 { TBADOPT, "TBADOPT" },
724 { TACCES, "TACCES" },
726 { TNOADDR, "TNOADDR" },
727 { TOUTSTATE, "TOUTSTATE" },
728 { TBADSEQ, "TBADSEQ" },
729 { TSYSERR, "TSYSERR" },
731 { TBADDATA, "TBADDATA" },
732 { TBUFOVFLW, "TBUFOVFLW" },
734 { TNODATA, "TNODATA" },
735 { TNODIS, "TNODIS" },
736 { TNOUDERR, "TNOUDERR" },
737 { TBADFLAG, "TBADFLAG" },
738 { TNOREL, "TNOREL" },
739 { TNOTSUPPORT, "TNOTSUPPORT" },
740 { TSTATECHNG, "TSTATECHNG" },
741 { TNOSTRUCTYPE, "TNOSTRUCTYPE" },
742 { TBADNAME, "TBADNAME" },
743 { TBADQLEN, "TBADQLEN" },
744 { TADDRBUSY, "TADDRBUSY" },
745 { TINDOUT, "TINDOUT" },
746 { TPROVMISMATCH,"TPROVMISMATCH" },
747 { TRESQLEN, "TRESQLEN" },
748 { TRESADDR, "TRESADDR" },
749 { TQFULL, "TQFULL" },
750 { TPROTO, "TPROTO" },
756 print_transport_message (tcp, expect, addr, len)
762 union T_primitives m;
765 if (len < sizeof m.type) goto dump;
767 if (umove (tcp, addr, &m.type) < 0) goto dump;
769 #define GET(type, struct) \
771 if (len < sizeof m.struct) goto dump; \
772 if (umove (tcp, addr, &m.struct) < 0) goto dump;\
774 if (expect != type) { \
782 do { if (c++) tprintf (", "); } while (0)
785 #define STRUCT(struct, elem, print) \
788 if (m.struct.elem##_length < 0 || \
789 m.struct.elem##_offset < sizeof m.struct || \
790 m.struct.elem##_offset + m.struct.elem##_length > len) \
792 tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
793 m.struct.elem##_length, \
794 m.struct.elem##_offset); \
797 tprintf (#elem "="); \
799 addr + m.struct.elem##_offset, \
800 m.struct.elem##_length); \
805 #define ADDR(struct, elem) STRUCT (struct, elem, printstr)
809 case T_CONN_REQ: /* connect request */
810 GET (T_CONN_REQ, conn_req);
811 ADDR (conn_req, DEST);
812 ADDR (conn_req, OPT);
816 case T_CONN_RES: /* connect response */
817 GET (T_CONN_RES, conn_res);
818 #ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
820 tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
821 #elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
823 tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
825 ADDR (conn_res, OPT);
827 tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
831 case T_DISCON_REQ: /* disconnect request */
832 GET (T_DISCON_REQ, discon_req);
834 tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
838 case T_DATA_REQ: /* data request */
839 GET (T_DATA_REQ, data_req);
841 tprintf ("MORE=%ld", m.data_req.MORE_flag);
845 case T_EXDATA_REQ: /* expedited data req */
846 GET (T_EXDATA_REQ, exdata_req);
848 tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
852 case T_INFO_REQ: /* information req */
853 GET (T_INFO_REQ, info_req);
857 case T_BIND_REQ: /* bind request */
859 case O_T_BIND_REQ: /* Ugly xti/tli hack */
861 GET (T_BIND_REQ, bind_req);
862 ADDR (bind_req, ADDR);
864 tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
868 case T_UNBIND_REQ: /* unbind request */
869 GET (T_UNBIND_REQ, unbind_req);
872 #ifdef T_UNITDATA_REQ
873 case T_UNITDATA_REQ: /* unitdata requset */
874 GET (T_UNITDATA_REQ, unitdata_req);
875 ADDR (unitdata_req, DEST);
876 ADDR (unitdata_req, OPT);
880 case T_OPTMGMT_REQ: /* manage opt req */
881 GET (T_OPTMGMT_REQ, optmgmt_req);
884 printflags (transport_user_flags, m.optmgmt_req.MGMT_flags,
886 STRUCT (optmgmt_req, OPT, print_optmgmt);
890 case T_ORDREL_REQ: /* orderly rel req */
891 GET (T_ORDREL_REQ, ordrel_req);
895 case T_CONN_IND: /* connect indication */
896 GET (T_CONN_IND, conn_ind);
897 ADDR (conn_ind, SRC);
898 ADDR (conn_ind, OPT);
899 tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
903 case T_CONN_CON: /* connect corfirm */
904 GET (T_CONN_CON, conn_con);
905 ADDR (conn_con, RES);
906 ADDR (conn_con, OPT);
910 case T_DISCON_IND: /* discon indication */
911 GET (T_DISCON_IND, discon_ind);
913 tprintf ("DISCON=%ld, SEQ=%ld",
914 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
918 case T_DATA_IND: /* data indication */
919 GET (T_DATA_IND, data_ind);
921 tprintf ("MORE=%ld", m.data_ind.MORE_flag);
925 case T_EXDATA_IND: /* expedited data ind */
926 GET (T_EXDATA_IND, exdata_ind);
928 tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
932 case T_INFO_ACK: /* info ack */
933 GET (T_INFO_ACK, info_ack);
935 tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
936 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
937 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
938 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
939 m.info_ack.ADDR_size, m.info_ack.OPT_size,
940 m.info_ack.TIDU_size);
941 printxval (service_type, m.info_ack.SERV_type, "T_???");
942 tprintf (", CURRENT=");
943 printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
944 tprintf (", PROVIDER=");
945 printflags (provider_flags, m.info_ack.PROVIDER_flag, "???");
949 case T_BIND_ACK: /* bind ack */
950 GET (T_BIND_ACK, bind_ack);
951 ADDR (bind_ack, ADDR);
952 tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
956 case T_ERROR_ACK: /* error ack */
957 GET (T_ERROR_ACK, error_ack);
960 printxval (transport_user_options,
961 m.error_ack.ERROR_prim, "TI_???");
963 printxval (tli_errors, m.error_ack.TLI_error, "T???");
964 tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
968 case T_OK_ACK: /* ok ack */
969 GET (T_OK_ACK, ok_ack);
971 tprintf ("CORRECT=");
972 printxval (transport_user_options,
973 m.ok_ack.CORRECT_prim, "TI_???");
976 #ifdef T_UNITDATA_IND
977 case T_UNITDATA_IND: /* unitdata ind */
978 GET (T_UNITDATA_IND, unitdata_ind);
979 ADDR (unitdata_ind, SRC);
980 ADDR (unitdata_ind, OPT);
984 case T_UDERROR_IND: /* unitdata error ind */
985 GET (T_UDERROR_IND, uderror_ind);
986 ADDR (uderror_ind, DEST);
987 ADDR (uderror_ind, OPT);
988 tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
992 case T_OPTMGMT_ACK: /* manage opt ack */
993 GET (T_OPTMGMT_ACK, optmgmt_ack);
996 printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags,
998 STRUCT (optmgmt_ack, OPT, print_optmgmt);
1002 case T_ORDREL_IND: /* orderly rel ind */
1003 GET (T_ORDREL_IND, ordrel_ind);
1007 case T_ADDR_REQ: /* address req */
1008 GET (T_ADDR_REQ, addr_req);
1012 case T_ADDR_ACK: /* address response */
1013 GET (T_ADDR_ACK, addr_ack);
1014 ADDR (addr_ack, LOCADDR);
1015 ADDR (addr_ack, REMADDR);
1021 printstr(tcp, addr, len);
1025 if (c >= 0) tprintf ("}");
1035 #endif /* TI_BIND */
1038 static int internal_stream_ioctl(struct tcb *tcp, int arg)
1041 struct ioctlent *iop;
1045 struct si_udata udata;
1046 #endif /* SI_GETUDATA */
1050 if (umove(tcp, arg, &si) < 0) {
1055 if (entering(tcp)) {
1056 iop = ioctl_lookup(si.ic_cmd);
1058 tprintf(", {ic_cmd=%s", iop->symbol);
1059 while ((iop = ioctl_next_match(iop)))
1060 tprintf(" or %s", iop->symbol);
1062 tprintf(", {ic_cmd=%#x", si.ic_cmd);
1063 if (si.ic_timout == INFTIM)
1064 tprintf(", ic_timout=INFTIM, ");
1066 tprintf(" ic_timout=%d, ", si.ic_timout);
1069 switch (si.ic_cmd) {
1074 #endif /* SI_GETUDATA */
1078 tprintf("/* in */ ");
1080 tprintf(", /* out */ ");
1082 if (in_and_out || entering(tcp))
1083 tprintf("ic_len=%d, ic_dp=", si.ic_len);
1084 switch (si.ic_cmd) {
1087 /* in T_BIND_REQ, out T_BIND_ACK */
1089 if (entering(tcp)) {
1090 print_transport_message (tcp,
1092 si.ic_dp, si.ic_len);
1095 print_transport_message (tcp,
1097 si.ic_dp, si.ic_len);
1100 #endif /* TI_BIND */
1103 /* in T_UNBIND_REQ, out T_OK_ACK */
1105 if (entering(tcp)) {
1106 print_transport_message (tcp,
1108 si.ic_dp, si.ic_len);
1111 print_transport_message (tcp,
1113 si.ic_dp, si.ic_len);
1116 #endif /* TI_UNBIND */
1119 /* in T_INFO_REQ, out T_INFO_ACK */
1121 if (entering(tcp)) {
1122 print_transport_message (tcp,
1124 si.ic_dp, si.ic_len);
1127 print_transport_message (tcp,
1129 si.ic_dp, si.ic_len);
1132 #endif /* TI_GETINFO */
1135 /* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
1137 if (entering(tcp)) {
1138 print_transport_message (tcp,
1140 si.ic_dp, si.ic_len);
1143 print_transport_message (tcp,
1145 si.ic_dp, si.ic_len);
1148 #endif /* TI_OPTMGMT */
1153 if (umove(tcp, (int) si.ic_dp, &udata) < 0)
1156 tprintf("{tidusize=%d, addrsize=%d, ",
1157 udata.tidusize, udata.addrsize);
1158 tprintf("optsize=%d, etsdusize=%d, ",
1159 udata.optsize, udata.etsdusize);
1160 tprintf("servtype=%d, so_state=%d, ",
1161 udata.servtype, udata.so_state);
1162 tprintf("so_options=%d", udata.so_options);
1166 #endif /* SI_GETUDATA */
1168 printstr(tcp, (long) si.ic_dp, si.ic_len);
1173 if (timod && tcp->u_rval && !syserror(tcp)) {
1174 tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
1175 return RVAL_STR + 1;
1183 stream_ioctl(tcp, code, arg)
1195 struct strfdinsert sfi;
1196 struct strrecvfd srf;
1201 /* I_STR is a special case because the data is read & written. */
1203 return internal_stream_ioctl(tcp, arg);
1211 /* arg is a string */
1213 printpath(tcp, arg);
1216 /* doesn't take an argument */
1219 /* argument is an option */
1221 printxval(stream_flush_options, arg, "FLUSH???");
1225 /* argument is a pointer to a bandinfo struct */
1226 if (umove(tcp, arg, &bi) < 0)
1229 tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
1230 printflags(stream_flush_options, bi.bi_flag, "FLUSH???");
1234 #endif /* I_FLUSHBAND */
1236 /* argument is a set of flags */
1238 printflags(stream_setsig_flags, arg, "S_???");
1241 /* argument is a pointer to a set of flags */
1245 if (umove(tcp, arg, &val) < 0)
1248 printflags(stream_setsig_flags, val, "S_???");
1252 /* argument is a pointer to a strpeek structure */
1253 if (syserror(tcp) || !arg)
1255 if (umove(tcp, arg, &sp) < 0) {
1259 tprintf(", {ctlbuf=");
1260 printstrbuf(tcp, &sp.ctlbuf, 1);
1261 tprintf(", databuf=");
1262 printstrbuf(tcp, &sp.databuf, 1);
1263 tprintf(", flags=");
1264 printflags(msgflags, sp.flags, "RS_???");
1268 /* argument is an option with flags */
1270 printxval(stream_read_options, arg & RMODEMASK, "R???");
1271 addflags(stream_read_flags, arg & ~RMODEMASK);
1274 /* argument is an pointer to an option with flags */
1278 if (umove(tcp, arg, &val) < 0)
1281 printxval(stream_read_options,
1282 arg & RMODEMASK, "R???");
1283 addflags(stream_read_flags, arg & ~RMODEMASK);
1297 /* argument is a pointer to a decimal integer */
1301 printnum(tcp, arg, "%d");
1304 /* argument is a pointer to a strfdinsert structure */
1305 if (syserror(tcp) || !arg)
1307 if (umove(tcp, arg, &sfi) < 0) {
1311 tprintf(", {ctlbuf=");
1312 printstrbuf(tcp, &sfi.ctlbuf, 1);
1313 tprintf(", databuf=");
1314 printstrbuf(tcp, &sfi.databuf, 1);
1315 tprintf(", flags=");
1316 printflags(msgflags, sfi.flags, "RS_???");
1317 tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
1321 /* argument is a set of flags */
1323 printflags(stream_write_flags, arg, "SND???");
1325 #endif /* I_SWROPT */
1328 /* argument is an pointer to an option with flags */
1332 if (umove(tcp, arg, &val) < 0)
1335 printflags(stream_write_flags, arg, "SND???");
1338 #endif /* I_GWROPT */
1350 /* argument is a decimal integer */
1351 tprintf(", %d", arg);
1354 /* argument is a pointer to a strrecvfd structure */
1355 if (syserror(tcp) || !arg)
1357 if (umove(tcp, arg, &srf) < 0) {
1361 tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
1362 (unsigned long) srf.uid, (unsigned long) srf.gid);
1372 if (umove(tcp, arg, &sl) < 0) {
1376 tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
1377 for (i = 0; i < tcp->u_rval; i++) {
1380 printpath(tcp, (int) sl.sl_modlist[i].l_name);
1388 printxval(stream_atmark_options, arg, "???MARK");
1390 #endif /* I_ATMARK */
1396 #endif /* !LINUX && !FREEBSD */
1398 #endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */