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.
31 /* Who has STREAMS syscalls?
32 * Linux hasn't. Solaris has (had?).
33 * Just in case I miss something, retain in for Sparc...
35 #if (defined SPARC || defined SPARC64) \
36 && (defined SYS_putpmsg || defined SYS_getpmsg)
38 # ifdef HAVE_STROPTS_H
42 int maxlen; /* no. of bytes in buffer */
43 int len; /* no. of bytes returned */
44 const char *buf; /* pointer to data */
51 printstrbuf(struct tcb *tcp, struct strbuf *sbp, int getting)
53 if (sbp->maxlen == -1 && getting)
54 tprints("{maxlen=-1}");
58 tprintf("maxlen=%d, ", sbp->maxlen);
59 tprintf("len=%d, buf=", sbp->len);
60 printstr(tcp, (unsigned long) sbp->buf, sbp->len);
66 printstrbufarg(struct tcb *tcp, long arg, int getting)
72 else if (umove(tcp, arg, &buf) < 0)
75 printstrbuf(tcp, &buf, getting);
79 # include "xlat/pmsgflags.h"
87 tprintf("%ld, ", tcp->u_arg[0]);
88 /* control and data */
89 for (i = 1; i < 3; i++)
90 printstrbufarg(tcp, tcp->u_arg[i], 0);
92 tprintf("%ld, ", tcp->u_arg[3]);
94 printflags(pmsgflags, tcp->u_arg[4], "MSG_???");
106 tprintf("%lu, ", tcp->u_arg[0]);
109 tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
110 tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
113 /* control and data */
114 for (i = 1; i < 3; i++)
115 printstrbufarg(tcp, tcp->u_arg[i], 1);
116 /* pointer to band */
117 printnum_int(tcp, tcp->u_arg[3], "%d");
119 /* pointer to flags */
120 if (tcp->u_arg[4] == 0)
122 else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
126 printflags(pmsgflags, flags, "MSG_???");
129 /* decode return value */
130 switch (tcp->u_rval) {
132 tcp->auxstr = "MORECTL";
134 case MORECTL|MOREDATA:
135 tcp->auxstr = "MORECTL|MOREDATA";
138 tcp->auxstr = "MORECTL";
145 return RVAL_HEX | RVAL_STR;
148 #endif /* STREAMS syscalls support */