stream.c revision d9f816f60457930af27349fac3d23b3b78338036
176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman/*
276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Copyright (c) 1993, 1994, 1995, 1996 Rick Sladkey <jrs@world.std.com>
34dc8a2aec63e4fb5ee2688544c4de323ed5de3efWichert Akkerman * Copyright (c) 1996-1999 Wichert Akkerman <wichert@cistron.nl>
476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * All rights reserved.
576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * Redistribution and use in source and binary forms, with or without
776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * modification, are permitted provided that the following conditions
876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * are met:
976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 1. Redistributions of source code must retain the above copyright
1076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer.
1176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 2. Redistributions in binary form must reproduce the above copyright
1276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    notice, this list of conditions and the following disclaimer in the
1376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    documentation and/or other materials provided with the distribution.
1476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * 3. The name of the author may not be used to endorse or promote products
1576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *    derived from this software without specific prior written permission.
1676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
1776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
1876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
1976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
2176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
2276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
2376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
2476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
2676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *
2876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman *	$Id$
2976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman */
3076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include "defs.h"
3234e014ac7502357e599935c62c18cba564c451beRoland McGrath#include <sys/syscall.h>
3376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
3442080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifdef HAVE_POLL_H
3542080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#include <poll.h>
3642080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif
37245a6ac0e71d7ecdbb776b12b735de58cf5a055bPavel Machek#ifdef HAVE_SYS_POLL_H
3876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/poll.h>
39245a6ac0e71d7ecdbb776b12b735de58cf5a055bPavel Machek#endif
4042080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifdef HAVE_STROPTS_H
4142080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#include <stropts.h>
4242080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif
4342080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifdef HAVE_SYS_CONF_H
4442080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#include <sys/conf.h>
4542080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif
4642080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifdef HAVE_SYS_STREAM_H
4742080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#include <sys/stream.h>
4842080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif
4942080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifdef HAVE_SYS_TIHDR_H
5042080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#include <sys/tihdr.h>
5142080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif
5276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
53561c7995d7524afbf92689593b9ba5f9615d0982Roland McGrath#if defined(HAVE_SYS_STREAM_H) || defined(LINUX) || defined(FREEBSD)
5442080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman
5542080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#ifndef HAVE_STROPTS_H
5676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define RS_HIPRI 1
5776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct strbuf {
5876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman        int     maxlen;                 /* no. of bytes in buffer */
5976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman        int     len;                    /* no. of bytes returned */
6076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman        char    *buf;                   /* pointer to data */
6176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
6276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define MORECTL 1
6376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define MOREDATA 2
6442080d852e2dc0ef3eb507ef561e91cc97cff515Wichert Akkerman#endif /* !HAVE_STROPTS_H */
6576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
6676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef HAVE_SYS_TIUSER_H
6776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/tiuser.h>
6876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/sockmod.h>
6976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#include <sys/timod.h>
7076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* HAVE_SYS_TIUSER_H */
7176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
72bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#ifndef FREEBSD
73d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat msgflags[] = {
7476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RS_HIPRI,	"RS_HIPRI"	},
7576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
7676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
7776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
7876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
7976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void
8076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanprintstrbuf(tcp, sbp, getting)
8176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
8276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct strbuf *sbp;
8376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint getting;
8476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
8576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (sbp->maxlen == -1 && getting)
8676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("{maxlen=-1}");
8776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else {
8876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("{");
8976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (getting)
9076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("maxlen=%d, ", sbp->maxlen);
9176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("len=%d, buf=", sbp->len);
922e2553a534f532a1546ea2b2f3dc3cd2276d020dWichert Akkerman		printstr(tcp, (unsigned long) sbp->buf, sbp->len);
9376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("}");
9476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
9576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
9676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
9776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic void
9876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanprintstrbufarg(tcp, arg, getting)
9976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
10076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint arg;
10176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint getting;
10276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
10376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct strbuf buf;
10476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
10576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (arg == 0)
10676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("NULL");
10776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else if (umove(tcp, arg, &buf) < 0)
10876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("{...}");
10976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	else
11076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstrbuf(tcp, &buf, getting);
11176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	tprintf(", ");
11276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
11376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
11476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
11576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_putmsg(tcp)
11676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
11776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
11876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i;
11976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
12076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
12176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* fd */
12276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%ld, ", tcp->u_arg[0]);
12376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* control and data */
12476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 1; i < 3; i++)
12576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printstrbufarg(tcp, tcp->u_arg[i], 0);
12676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* flags */
12776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(msgflags, tcp->u_arg[3]))
12876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
12976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
13076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
13176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
13276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
13376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
13476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getmsg(tcp)
13576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
13676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
13776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i, flags;
13876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
13976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
14076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* fd */
14176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%lu, ", tcp->u_arg[0]);
14276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
14376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp)) {
14476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %#lx, %#lx",
14576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[1], tcp->u_arg[2], tcp->u_arg[3]);
14676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
14776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
14876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* control and data */
14976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 1; i < 3; i++)
15076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printstrbufarg(tcp, tcp->u_arg[i], 1);
15176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* pointer to flags */
15276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (tcp->u_arg[3] == 0)
15376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("NULL");
15476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (umove(tcp, tcp->u_arg[3], &flags) < 0)
15576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("[?]");
15676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
15776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("[");
15876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			if (!printflags(msgflags, flags))
15976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf("0");
16076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("]");
16176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
16276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* decode return value */
16376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		switch (tcp->u_rval) {
16476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MORECTL:
16576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL";
16676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
16776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MORECTL|MOREDATA:
16876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL|MOREDATA";
16976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
17076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MOREDATA:
17176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL";
17276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
17376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		default:
17476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = NULL;
17576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
17676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
17776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
17876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return RVAL_HEX | RVAL_STR;
17976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
18076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
18134e014ac7502357e599935c62c18cba564c451beRoland McGrath#if defined SYS_putpmsg || defined SYS_getpmsg
182d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat pmsgflags[] = {
183d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#ifdef MSG_HIPRI
18476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ MSG_HIPRI,	"MSG_HIPRI"	},
185d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#endif
186d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#ifdef MSG_AND
18776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ MSG_ANY,	"MSG_ANY"	},
188d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#endif
189d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#ifdef MSG_BAND
19076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ MSG_BAND,	"MSG_BAND"	},
191d856b99aff36012d1c8bc72012d0ede414e17971Wichert Akkerman#endif
19276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
19376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
19434e014ac7502357e599935c62c18cba564c451beRoland McGrath#endif
19576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
19634e014ac7502357e599935c62c18cba564c451beRoland McGrath#ifdef SYS_putpmsg
19776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
19876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_putpmsg(tcp)
19976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
20076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
20176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i;
20276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
20376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
20476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* fd */
20576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%ld, ", tcp->u_arg[0]);
20676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* control and data */
20776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 1; i < 3; i++)
20876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printstrbufarg(tcp, tcp->u_arg[i], 0);
20976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* band */
21076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%ld, ", tcp->u_arg[3]);
21176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* flags */
21276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(pmsgflags, tcp->u_arg[4]))
21376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
21476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
21576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
21676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
21734e014ac7502357e599935c62c18cba564c451beRoland McGrath#endif /* SYS_putpmsg */
21876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
21934e014ac7502357e599935c62c18cba564c451beRoland McGrath#ifdef SYS_getpmsg
22076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
22176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_getpmsg(tcp)
22276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
22376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
22476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i, flags;
22576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
22676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
22776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* fd */
22876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("%lu, ", tcp->u_arg[0]);
22976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	} else {
23076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp)) {
23176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %#lx, %#lx, %#lx", tcp->u_arg[1],
23276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[2], tcp->u_arg[3], tcp->u_arg[4]);
23376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
23476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
23576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* control and data */
23676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 1; i < 3; i++)
23776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printstrbufarg(tcp, tcp->u_arg[i], 1);
23876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* pointer to band */
23976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, tcp->u_arg[3], "%d");
240906dade0ddcd670302fe8ce4e00b9a449b61999fWichert Akkerman		tprintf(", ");
24176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* pointer to flags */
24276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (tcp->u_arg[4] == 0)
24376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("NULL");
24476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (umove(tcp, tcp->u_arg[4], &flags) < 0)
24576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("[?]");
24676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
24776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("[");
24876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			if (!printflags(pmsgflags, flags))
24976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf("0");
25076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("]");
25176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
25276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* decode return value */
25376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		switch (tcp->u_rval) {
25476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MORECTL:
25576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL";
25676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
25776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MORECTL|MOREDATA:
25876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL|MOREDATA";
25976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
26076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		case MOREDATA:
26176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = "MORECTL";
26276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
26376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		default:
26476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tcp->auxstr = NULL;
26576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
26676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
26776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
26876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return RVAL_HEX | RVAL_STR;
26976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
27034e014ac7502357e599935c62c18cba564c451beRoland McGrath#endif /* SYS_getpmsg */
27176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
272bf79f2e16b090ffe59cd1e1820935680a2da7b78Wichert Akkerman#endif /* !FREEBSD */
27376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
27476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
275faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman#ifdef HAVE_SYS_POLL_H
276faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman
277d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat pollflags[] = {
278245a6ac0e71d7ecdbb776b12b735de58cf5a055bPavel Machek#ifdef POLLIN
27976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLIN,	"POLLIN"	},
28076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLPRI,	"POLLPRI"	},
28176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLOUT,	"POLLOUT"	},
28276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef POLLRDNORM
28376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLRDNORM,	"POLLRDNORM"	},
28476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
28576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef POLLWRNORM
28676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLWRNORM,	"POLLWRNORM"	},
28776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
28876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef POLLRDBAND
28976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLRDBAND,	"POLLRDBAND"	},
29076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
29176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef POLLWRBAND
29276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLWRBAND,	"POLLWRBAND"	},
29376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
29476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLERR,	"POLLERR"	},
29576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLHUP,	"POLLHUP"	},
29676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ POLLNVAL,	"POLLNVAL"	},
297245a6ac0e71d7ecdbb776b12b735de58cf5a055bPavel Machek#endif
29876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
29976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
30076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
30176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
30276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermansys_poll(tcp)
30376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
30476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
30576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct pollfd *pollp;
30676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
30776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (exiting(tcp)) {
30876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		int i;
30976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		int nfds = tcp->u_arg[1];
31076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
31176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (nfds <= 0) {
31276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %d, %ld\n",
31376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[0], nfds, tcp->u_arg[2]);
31476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
31576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
31676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		pollp = (struct pollfd *) malloc(nfds * sizeof(*pollp));
31776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (pollp == NULL) {
31876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			fprintf(stderr, "sys_poll: no memory\n");
31976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx, %d, %ld",
32076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tcp->u_arg[0], nfds, tcp->u_arg[2]);
32176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
32276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
32376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umoven(tcp, tcp->u_arg[0],
32476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			   (nfds * sizeof(*pollp)), (char *) pollp) < 0) {
32576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%#lx", tcp->u_arg[0]);
32676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
32776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
32876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("[");
32976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			for (i = 0; i < nfds; i++) {
33076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				if (i)
33176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					tprintf(", ");
33276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				if (pollp[i].fd < 0) {
33376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					tprintf("{fd=%d}", pollp[i].fd);
33476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					continue;
33576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				}
33676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf("{fd=%d, events=", pollp[i].fd);
33776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				if (!printflags(pollflags, pollp[i].events))
33876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					tprintf("0");
33976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				if (!syserror(tcp) && pollp[i].revents) {
34076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					tprintf(", revents=");
34176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman					if (!printflags(pollflags,
34276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman							pollp[i].revents))
34376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman						tprintf("0");
34476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				}
34576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf("}");
34676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			}
34776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("]");
34876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
34976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", %d, ", nfds);
35076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef INFTIM
35176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (tcp->u_arg[2] == INFTIM)
35276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("INFTIM");
35376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
35476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
35576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("%ld", tcp->u_arg[2]);
35676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		free(pollp);
35776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
35876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 0;
35976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
36076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
361faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman#else /* !HAVE_SYS_POLL_H */
362faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkermanint
363faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkermansys_poll(tcp)
364faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkermanstruct tcb *tcp;
365faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman{
366faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman    	return 0;
367faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman}
368faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman#endif
369faf722234dc8af97776f94fdda7e100fb60650a2Wichert Akkerman
370561c7995d7524afbf92689593b9ba5f9615d0982Roland McGrath#if !defined(LINUX) && !defined(FREEBSD)
37176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
372d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_flush_options[] = {
37376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ FLUSHR,	"FLUSHR"	},
37476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ FLUSHW,	"FLUSHW"	},
37576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ FLUSHRW,	"FLUSHRW"	},
37676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef FLUSHBAND
37776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ FLUSHBAND,	"FLUSHBAND"	},
37876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
37976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
38076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
38176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
382d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_setsig_flags[] = {
38376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_INPUT,	"S_INPUT"	},
38476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_HIPRI,	"S_HIPRI"	},
38576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_OUTPUT,	"S_OUTPUT"	},
38676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_MSG,	"S_MSG"		},
38776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_ERROR
38876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_ERROR,	"S_ERROR"	},
38976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_HANGUP
39176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_HANGUP,	"S_HANGUP"	},
39276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_RDNORM
39476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_RDNORM,	"S_RDNORM"	},
39576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_WRNORM
39776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_WRNORM,	"S_WRNORM"	},
39876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
39976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_RDBAND
40076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_RDBAND,	"S_RDBAND"	},
40176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_WRBAND
40376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_WRBAND,	"S_WRBAND"	},
40476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef S_BANDURG
40676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ S_BANDURG,	"S_BANDURG"	},
40776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
40876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
40976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
41076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
411d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_read_options[] = {
41276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RNORM,	"RNORM"		},
41376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RMSGD,	"RMSGD"		},
41476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RMSGN,	"RMSGN"		},
41576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
41676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
41776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
418d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_read_flags[] = {
41976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef RPROTDAT
42076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RPROTDAT,	"RPROTDAT"	},
42176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
42276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef RPROTDIS
42376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RPROTDIS,	"RPROTDIS"	},
42476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
42576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef RPROTNORM
42676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ RPROTNORM,	"RPROTNORM"	},
42776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
42876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
42976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
43076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
43176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifndef RMODEMASK
43276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#define RMODEMASK (~0)
43376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
43476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
43576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_SWROPT
436d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_write_flags[] = {
43776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ SNDZERO,	"SNDZERO"	},
43876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ SNDPIPE,	"SNDPIPE"	},
43976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
44076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
44176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_SWROPT */
44276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
44376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_ATMARK
444d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat stream_atmark_options[] = {
44576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ ANYMARK,	"ANYMARK"	},
44676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ LASTMARK,	"LASTMARK"	},
44776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
44876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
44976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_ATMARK */
45076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
45176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TI_BIND
452d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat transport_user_options[] = {
45376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_CONN_REQ,	"T_CONN_REQ"	},
45476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_CONN_RES,	"T_CONN_RES"	},
45576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_DISCON_REQ,	"T_DISCON_REQ"	},
45676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_DATA_REQ,	"T_DATA_REQ"	},
45776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_EXDATA_REQ,	"T_EXDATA_REQ"	},
45876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_INFO_REQ,	"T_INFO_REQ"	},
45976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_BIND_REQ,	"T_BIND_REQ"	},
46076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_UNBIND_REQ,	"T_UNBIND_REQ"	},
46176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_UNITDATA_REQ,"T_UNITDATA_REQ"},
46276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_OPTMGMT_REQ,"T_OPTMGMT_REQ"	},
46376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ T_ORDREL_REQ,	"T_ORDREL_REQ"	},
46476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
46576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
46676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
467d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat transport_user_flags [] = {
46838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		"0"		},
46938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_MORE,	"T_MORE"	},
47038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_EXPEDITED,	"T_EXPEDITED"	},
47138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_NEGOTIATE,	"T_NEGOTIATE"	},
47238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_CHECK,	"T_CHECK"	},
47338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_DEFAULT,	"T_DEFAULT"	},
47438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_SUCCESS,	"T_SUCCESS"	},
47538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_FAILURE,	"T_FAILURE"	},
47638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_CURRENT,	"T_CURRENT"	},
47738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_PARTSUCCESS,"T_PARTSUCCESS"	},
47838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_READONLY,	"T_READONLY"	},
47938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_NOTSUPPORT,	"T_NOTSUPPORT"	},
48076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	{ 0,		NULL		},
48176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman};
48238ae88d332acd9f86a30d58158e306d795d98977John Hughes
48338ae88d332acd9f86a30d58158e306d795d98977John Hughes
4846d2b34971b33d379c89c36c5ad1b0c6d5d12c453Roland McGrath#ifdef HAVE_STRUCT_T_OPTHDR
48538ae88d332acd9f86a30d58158e306d795d98977John Hughes
486d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat xti_level [] = {
48738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_GENERIC,	"XTI_GENERIC"	},
48838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
48938ae88d332acd9f86a30d58158e306d795d98977John Hughes};
49038ae88d332acd9f86a30d58158e306d795d98977John Hughes
491d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat xti_generic [] = {
49238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_DEBUG,	"XTI_DEBUG"	},
49338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_LINGER,	"XTI_LINGER"	},
49438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_RCVBUF,	"XTI_RCVBUF"	},
49538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_RCVLOWAT,	"XTI_RCVLOWAT"	},
49638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_SNDBUF,	"XTI_SNDBUF"	},
49738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XTI_SNDLOWAT,	"XTI_SNDLOWAT"	},
49838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
49938ae88d332acd9f86a30d58158e306d795d98977John Hughes};
50038ae88d332acd9f86a30d58158e306d795d98977John Hughes
50138ae88d332acd9f86a30d58158e306d795d98977John Hughes
50238ae88d332acd9f86a30d58158e306d795d98977John Hughes
50338ae88d332acd9f86a30d58158e306d795d98977John Hughesvoid
50438ae88d332acd9f86a30d58158e306d795d98977John Hughesprint_xti_optmgmt (tcp, addr, len)
50538ae88d332acd9f86a30d58158e306d795d98977John Hughesstruct tcb *tcp;
50638ae88d332acd9f86a30d58158e306d795d98977John Hugheslong addr;
50738ae88d332acd9f86a30d58158e306d795d98977John Hughesint len;
50838ae88d332acd9f86a30d58158e306d795d98977John Hughes{
50938ae88d332acd9f86a30d58158e306d795d98977John Hughes	int c = 0;
51038ae88d332acd9f86a30d58158e306d795d98977John Hughes	struct t_opthdr hdr;
51138ae88d332acd9f86a30d58158e306d795d98977John Hughes
5122c4e3a8061130493bd196564f096b677c5528fc1John Hughes	while (len >= (int) sizeof hdr) {
51338ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (umove(tcp, addr, &hdr) < 0) break;
51438ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (c++) {
51538ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf (", ");
51638ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
51738ae88d332acd9f86a30d58158e306d795d98977John Hughes		else if (len > hdr.len + sizeof hdr) {
51838ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf ("[");
51938ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
52038ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("{level=");
52138ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (xti_level, hdr.level, "???");
52238ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", name=");
52338ae88d332acd9f86a30d58158e306d795d98977John Hughes		switch (hdr.level) {
52438ae88d332acd9f86a30d58158e306d795d98977John Hughes		    case XTI_GENERIC:
52538ae88d332acd9f86a30d58158e306d795d98977John Hughes			printxval (xti_generic, hdr.name, "XTI_???");
52638ae88d332acd9f86a30d58158e306d795d98977John Hughes			break;
52738ae88d332acd9f86a30d58158e306d795d98977John Hughes		    default:
52838ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf ("%ld", hdr.name);
52938ae88d332acd9f86a30d58158e306d795d98977John Hughes			break;
53038ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
53138ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", status=");
53238ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (transport_user_flags,  hdr.status, "T_???");
53338ae88d332acd9f86a30d58158e306d795d98977John Hughes		addr += sizeof hdr;
53438ae88d332acd9f86a30d58158e306d795d98977John Hughes		len -= sizeof hdr;
53538ae88d332acd9f86a30d58158e306d795d98977John Hughes		if ((hdr.len -= sizeof hdr) > 0) {
53638ae88d332acd9f86a30d58158e306d795d98977John Hughes			if (hdr.len > len) break;
53738ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf (", val=");
53838ae88d332acd9f86a30d58158e306d795d98977John Hughes			if (len == sizeof (int))
53938ae88d332acd9f86a30d58158e306d795d98977John Hughes				printnum (tcp, addr, "%d");
54038ae88d332acd9f86a30d58158e306d795d98977John Hughes			else
54138ae88d332acd9f86a30d58158e306d795d98977John Hughes				printstr (tcp, addr, hdr.len);
54238ae88d332acd9f86a30d58158e306d795d98977John Hughes			addr += hdr.len;
54338ae88d332acd9f86a30d58158e306d795d98977John Hughes			len -= hdr.len;
54438ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
54538ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("}");
54638ae88d332acd9f86a30d58158e306d795d98977John Hughes	}
54738ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (len > 0) {
54838ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (c++) tprintf (", ");
54938ae88d332acd9f86a30d58158e306d795d98977John Hughes		printstr (tcp, addr, len);
55038ae88d332acd9f86a30d58158e306d795d98977John Hughes	}
55138ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (c > 1) tprintf ("]");
55238ae88d332acd9f86a30d58158e306d795d98977John Hughes}
55338ae88d332acd9f86a30d58158e306d795d98977John Hughes
55438ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
55538ae88d332acd9f86a30d58158e306d795d98977John Hughes
55638ae88d332acd9f86a30d58158e306d795d98977John Hughes
55738ae88d332acd9f86a30d58158e306d795d98977John Hughesstatic void
55838ae88d332acd9f86a30d58158e306d795d98977John Hughesprint_optmgmt (tcp, addr, len)
55938ae88d332acd9f86a30d58158e306d795d98977John Hughesstruct tcb *tcp;
56038ae88d332acd9f86a30d58158e306d795d98977John Hugheslong addr;
56138ae88d332acd9f86a30d58158e306d795d98977John Hughesint len;
56238ae88d332acd9f86a30d58158e306d795d98977John Hughes{
56334e014ac7502357e599935c62c18cba564c451beRoland McGrath	/* We don't know how to tell if TLI (socket) or XTI
56438ae88d332acd9f86a30d58158e306d795d98977John Hughes	   optmgmt is being used yet, assume TLI. */
5656d2b34971b33d379c89c36c5ad1b0c6d5d12c453Roland McGrath#if defined (HAVE_STRUCT_OPTHDR)
56638ae88d332acd9f86a30d58158e306d795d98977John Hughes	print_sock_optmgmt (tcp, addr, len);
5676d2b34971b33d379c89c36c5ad1b0c6d5d12c453Roland McGrath#elif defined (HAVE_STRUCT_T_OPTHDR)
56838ae88d332acd9f86a30d58158e306d795d98977John Hughes	print_xti_optmgmt (tcp, addr, len);
56938ae88d332acd9f86a30d58158e306d795d98977John Hughes#else
57038ae88d332acd9f86a30d58158e306d795d98977John Hughes	printstr (tcp, addr, len);
57138ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
57238ae88d332acd9f86a30d58158e306d795d98977John Hughes}
57338ae88d332acd9f86a30d58158e306d795d98977John Hughes
57438ae88d332acd9f86a30d58158e306d795d98977John Hughes
57538ae88d332acd9f86a30d58158e306d795d98977John Hughes
57638ae88d332acd9f86a30d58158e306d795d98977John Hughes
577d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat service_type [] = {
57838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_COTS,	"T_COTS"	},
57938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_COTS_ORD,	"T_COTS_ORD"	},
58038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ T_CLTS,	"T_CLTS"	},
58138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
58238ae88d332acd9f86a30d58158e306d795d98977John Hughes};
58338ae88d332acd9f86a30d58158e306d795d98977John Hughes
584d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat ts_state [] = {
58538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_UNBND,	"TS_UNBND"	},
58638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_BREQ,	"TS_WACK_BREQ"	},
58738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_UREQ,	"TS_WACK_UREQ"	},
58838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_IDLE,	"TS_IDLE"	},
58938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_OPTREQ,"TS_WACK_OPTREQ"},
59038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_CREQ,	"TS_WACK_CREQ"	},
59138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WCON_CREQ,	"TS_WCON_CREQ"	},
59238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WRES_CIND,	"TS_WRES_CIND"	},
59338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_CRES,	"TS_WACK_CRES"	},
59438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_DATA_XFER,	"TS_DATA_XFER"	},
59538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WIND_ORDREL,"TS_WIND_ORDREL"},
59638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WREQ_ORDREL,"TS_WREQ_ORDREL"},
59738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_DREQ6,"TS_WACK_DREQ6"	},
59838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_DREQ7,"TS_WACK_DREQ7"	},
59938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_DREQ9,"TS_WACK_DREQ9"	},
60038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_DREQ10,"TS_WACK_DREQ10"},
60138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TS_WACK_DREQ11,"TS_WACK_DREQ11"},
60238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
60338ae88d332acd9f86a30d58158e306d795d98977John Hughes};
60438ae88d332acd9f86a30d58158e306d795d98977John Hughes
605d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat provider_flags [] = {
60638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		"0"		},
60738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ SENDZERO,	"SENDZERO"	},
60838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ EXPINLINE,	"EXPINLINE"	},
60938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ XPG4_1,	"XPG4_1"	},
61038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
61138ae88d332acd9f86a30d58158e306d795d98977John Hughes};
61238ae88d332acd9f86a30d58158e306d795d98977John Hughes
61338ae88d332acd9f86a30d58158e306d795d98977John Hughes
614d9f816f60457930af27349fac3d23b3b78338036Roland McGrathstatic const struct xlat tli_errors [] = {
61538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADADDR,	"TBADADDR"	},
61638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADOPT,	"TBADOPT"	},
61738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TACCES,	"TACCES"	},
61838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADF,	"TBADF"		},
61938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNOADDR,	"TNOADDR"	},
62038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TOUTSTATE,	"TOUTSTATE"	},
62138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADSEQ,	"TBADSEQ"	},
62238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TSYSERR,	"TSYSERR"	},
62338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TLOOK,	"TLOOK"		},
62438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADDATA,	"TBADDATA"	},
62538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBUFOVFLW,	"TBUFOVFLW"	},
62638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TFLOW,	"TFLOW"		},
62738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNODATA,	"TNODATA"	},
62838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNODIS,	"TNODIS"	},
62938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNOUDERR,	"TNOUDERR"	},
63038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADFLAG,	"TBADFLAG"	},
63138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNOREL,	"TNOREL"	},
63238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNOTSUPPORT,	"TNOTSUPPORT"	},
63338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TSTATECHNG,	"TSTATECHNG"	},
63438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TNOSTRUCTYPE,	"TNOSTRUCTYPE"	},
63538ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADNAME,	"TBADNAME"	},
63638ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TBADQLEN,	"TBADQLEN"	},
63738ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TADDRBUSY,	"TADDRBUSY"	},
63838ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TINDOUT,	"TINDOUT"	},
63938ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TPROVMISMATCH,"TPROVMISMATCH"	},
64038ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TRESQLEN,	"TRESQLEN"	},
64138ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TRESADDR,	"TRESADDR"	},
64238ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TQFULL,	"TQFULL"	},
64338ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ TPROTO,	"TPROTO"	},
64438ae88d332acd9f86a30d58158e306d795d98977John Hughes	{ 0,		NULL		},
64538ae88d332acd9f86a30d58158e306d795d98977John Hughes};
64638ae88d332acd9f86a30d58158e306d795d98977John Hughes
64738ae88d332acd9f86a30d58158e306d795d98977John Hughes
64838ae88d332acd9f86a30d58158e306d795d98977John Hughesstatic int
64938ae88d332acd9f86a30d58158e306d795d98977John Hughesprint_transport_message (tcp, expect, addr, len)
65038ae88d332acd9f86a30d58158e306d795d98977John Hughesstruct tcb *tcp;
65138ae88d332acd9f86a30d58158e306d795d98977John Hughesint expect;
65238ae88d332acd9f86a30d58158e306d795d98977John Hugheslong addr;
65338ae88d332acd9f86a30d58158e306d795d98977John Hughesint len;
65438ae88d332acd9f86a30d58158e306d795d98977John Hughes{
65538ae88d332acd9f86a30d58158e306d795d98977John Hughes	union T_primitives m;
65638ae88d332acd9f86a30d58158e306d795d98977John Hughes	int c = 0;
65738ae88d332acd9f86a30d58158e306d795d98977John Hughes
65838ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (len < sizeof m.type) goto dump;
65938ae88d332acd9f86a30d58158e306d795d98977John Hughes
66038ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (umove (tcp, addr, &m.type) < 0) goto dump;
66138ae88d332acd9f86a30d58158e306d795d98977John Hughes
66238ae88d332acd9f86a30d58158e306d795d98977John Hughes#define GET(type, struct)	\
66338ae88d332acd9f86a30d58158e306d795d98977John Hughes	do {							\
66438ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (len < sizeof m.struct) goto dump;		\
66538ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (umove (tcp, addr, &m.struct) < 0) goto dump;\
66638ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("{");					\
66738ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (expect != type) {				\
66838ae88d332acd9f86a30d58158e306d795d98977John Hughes			++c;					\
66938ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf (#type);			\
67038ae88d332acd9f86a30d58158e306d795d98977John Hughes		}						\
67138ae88d332acd9f86a30d58158e306d795d98977John Hughes	}							\
67238ae88d332acd9f86a30d58158e306d795d98977John Hughes	while (0)
67338ae88d332acd9f86a30d58158e306d795d98977John Hughes
67438ae88d332acd9f86a30d58158e306d795d98977John Hughes#define COMMA() \
67534e014ac7502357e599935c62c18cba564c451beRoland McGrath	do { if (c++) tprintf (", "); } while (0)
67634e014ac7502357e599935c62c18cba564c451beRoland McGrath
67738ae88d332acd9f86a30d58158e306d795d98977John Hughes
67838ae88d332acd9f86a30d58158e306d795d98977John Hughes#define STRUCT(struct, elem, print)					\
67938ae88d332acd9f86a30d58158e306d795d98977John Hughes	do {								\
68038ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();						\
68138ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (m.struct.elem##_length < 0 ||			\
68238ae88d332acd9f86a30d58158e306d795d98977John Hughes		    m.struct.elem##_offset < sizeof m.struct ||		\
68338ae88d332acd9f86a30d58158e306d795d98977John Hughes		    m.struct.elem##_offset + m.struct.elem##_length > len) \
68438ae88d332acd9f86a30d58158e306d795d98977John Hughes		{							\
68538ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf (#elem "_length=%ld, " #elem "_offset=%ld",\
68638ae88d332acd9f86a30d58158e306d795d98977John Hughes				m.struct.elem##_length,			\
68738ae88d332acd9f86a30d58158e306d795d98977John Hughes				m.struct.elem##_offset);		\
68838ae88d332acd9f86a30d58158e306d795d98977John Hughes		}							\
68938ae88d332acd9f86a30d58158e306d795d98977John Hughes		else {							\
69038ae88d332acd9f86a30d58158e306d795d98977John Hughes			tprintf (#elem "=");				\
69138ae88d332acd9f86a30d58158e306d795d98977John Hughes			print (tcp,					\
69238ae88d332acd9f86a30d58158e306d795d98977John Hughes				 addr + m.struct.elem##_offset,		\
69338ae88d332acd9f86a30d58158e306d795d98977John Hughes				 m.struct.elem##_length);		\
69438ae88d332acd9f86a30d58158e306d795d98977John Hughes		}							\
69538ae88d332acd9f86a30d58158e306d795d98977John Hughes	}								\
69638ae88d332acd9f86a30d58158e306d795d98977John Hughes	while (0)
69738ae88d332acd9f86a30d58158e306d795d98977John Hughes
69838ae88d332acd9f86a30d58158e306d795d98977John Hughes#define ADDR(struct, elem) STRUCT (struct, elem, printstr)
69934e014ac7502357e599935c62c18cba564c451beRoland McGrath
70038ae88d332acd9f86a30d58158e306d795d98977John Hughes	switch (m.type) {
70138ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_CONN_REQ
70238ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_CONN_REQ:	/* connect request   */
70338ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_CONN_REQ, conn_req);
70438ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_req, DEST);
70538ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_req, OPT);
70638ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
70738ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
70838ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_CONN_RES
70938ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_CONN_RES:	/* connect response   */
71038ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_CONN_RES, conn_res);
71138dc6bb84fefe9e310177afe09cf37f88a2abb67Roland McGrath#ifdef HAVE_STRUCT_T_CONN_RES_QUEUE_PTR
71238ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
71338ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("QUEUE=%p", m.conn_res.QUEUE_ptr);
71438dc6bb84fefe9e310177afe09cf37f88a2abb67Roland McGrath#elif defined HAVE_STRUCT_T_CONN_RES_ACCEPTOR_ID
71538dc6bb84fefe9e310177afe09cf37f88a2abb67Roland McGrath		COMMA ();
7167686eee1d72e1d150f696890fd24ea9fa41383beRoland McGrath		tprintf ("ACCEPTOR=%#lx", m.conn_res.ACCEPTOR_id);
71738dc6bb84fefe9e310177afe09cf37f88a2abb67Roland McGrath#endif
71838ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_res, OPT);
71938ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
72038ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("SEQ=%ld", m.conn_res.SEQ_number);
72138ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
72238ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
72338ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_DISCON_REQ
72438ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_DISCON_REQ:	/* disconnect request */
72538ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_DISCON_REQ, discon_req);
72638ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
72738ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("SEQ=%ld", m.discon_req.SEQ_number);
72838ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
72938ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
73038ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_DATA_REQ
73138ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_DATA_REQ:	/* data request       */
73238ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_DATA_REQ, data_req);
73338ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
73438ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MORE=%ld", m.data_req.MORE_flag);
73538ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
73638ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
73738ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_EXDATA_REQ
73838ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_EXDATA_REQ:	/* expedited data req */
73938ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_EXDATA_REQ, exdata_req);
74038ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
74138ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MORE=%ld", m.exdata_req.MORE_flag);
74238ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
74338ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
74438ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_INFO_REQ
74538ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_INFO_REQ:	/* information req    */
74638ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_INFO_REQ, info_req);
74738ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
74838ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
74938ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_BIND_REQ
75038ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_BIND_REQ:	/* bind request       */
75138ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef O_T_BIND_REQ
75238ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case O_T_BIND_REQ:	/* Ugly xti/tli hack */
75338ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
75438ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_BIND_REQ, bind_req);
75538ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (bind_req, ADDR);
75638ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
75738ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("CONIND=%ld", m.bind_req.CONIND_number);
75838ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
75938ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
76038ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_UNBIND_REQ
76138ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_UNBIND_REQ:	/* unbind request     */
76238ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_UNBIND_REQ, unbind_req);
76338ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
76438ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
76538ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_UNITDATA_REQ
76638ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_UNITDATA_REQ:	/* unitdata requset   */
76738ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_UNITDATA_REQ, unitdata_req);
76838ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (unitdata_req, DEST);
76938ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (unitdata_req, OPT);
77038ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
77138ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
77238ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_OPTMGMT_REQ
77338ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_OPTMGMT_REQ:	/* manage opt req     */
77438ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_OPTMGMT_REQ, optmgmt_req);
77538ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
77638ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MGMT=");
77738ae88d332acd9f86a30d58158e306d795d98977John Hughes		printflags (transport_user_flags, m.optmgmt_req.MGMT_flags);
77838ae88d332acd9f86a30d58158e306d795d98977John Hughes		STRUCT (optmgmt_req, OPT, print_optmgmt);
77938ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
78038ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
78138ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_ORDREL_REQ
78238ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_ORDREL_REQ:	/* orderly rel req    */
78338ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_ORDREL_REQ, ordrel_req);
78438ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
78538ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
78638ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_CONN_IND
78738ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_CONN_IND:	/* connect indication */
78838ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_CONN_IND, conn_ind);
78938ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_ind, SRC);
79038ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_ind, OPT);
79138ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", SEQ=%ld", m.conn_ind.SEQ_number);
79238ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
79338ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
79438ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_CONN_CON
79538ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_CONN_CON:	/* connect corfirm    */
79638ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_CONN_CON, conn_con);
79738ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_con, RES);
79838ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (conn_con, OPT);
79938ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
80038ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
80138ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_DISCON_IND
80238ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_DISCON_IND:	/* discon indication  */
80338ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_DISCON_IND, discon_ind);
80438ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
80538ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("DISCON=%ld, SEQ=%ld",
80638ae88d332acd9f86a30d58158e306d795d98977John Hughes			 m.discon_ind.DISCON_reason, m.discon_ind.SEQ_number);
80738ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
80838ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
80938ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_DATA_IND
81038ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_DATA_IND:	/* data indication    */
81138ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_DATA_IND, data_ind);
81238ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
81338ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MORE=%ld", m.data_ind.MORE_flag);
81438ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
81538ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
81638ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_EXDATA_IND
81738ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_EXDATA_IND:	/* expedited data ind */
81838ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_EXDATA_IND, exdata_ind);
81938ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
82038ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MORE=%ld", m.exdata_ind.MORE_flag);
82138ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
82238ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
82338ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_INFO_ACK
82438ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_INFO_ACK:	/* info ack           */
82538ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_INFO_ACK, info_ack);
82638ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
82738ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("TSDU=%ld, ETSDU=%ld, CDATA=%ld, DDATA=%ld, "
82838ae88d332acd9f86a30d58158e306d795d98977John Hughes			 "ADDR=%ld, OPT=%ld, TIDU=%ld, SERV=",
82938ae88d332acd9f86a30d58158e306d795d98977John Hughes			 m.info_ack.TSDU_size, m.info_ack.ETSDU_size,
83038ae88d332acd9f86a30d58158e306d795d98977John Hughes			 m.info_ack.CDATA_size, m.info_ack.DDATA_size,
83138ae88d332acd9f86a30d58158e306d795d98977John Hughes			 m.info_ack.ADDR_size, m.info_ack.OPT_size,
83238ae88d332acd9f86a30d58158e306d795d98977John Hughes			 m.info_ack.TIDU_size);
83338ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (service_type, m.info_ack.SERV_type, "T_???");
83438ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", CURRENT=");
83538ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (ts_state, m.info_ack.CURRENT_state, "TS_???");
83638ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", PROVIDER=");
83738ae88d332acd9f86a30d58158e306d795d98977John Hughes		printflags (provider_flags, m.info_ack.PROVIDER_flag);
83838ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
83938ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
84038ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_BIND_ACK
84138ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_BIND_ACK:	/* bind ack           */
84238ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_BIND_ACK, bind_ack);
84338ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (bind_ack, ADDR);
84438ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", CONIND=%ld", m.bind_ack.CONIND_number);
84538ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
84638ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
84738ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_ERROR_ACK
84838ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_ERROR_ACK:	/* error ack          */
84938ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_ERROR_ACK, error_ack);
85038ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
85138ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("ERROR=");
85238ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (transport_user_options,
85338ae88d332acd9f86a30d58158e306d795d98977John Hughes			   m.error_ack.ERROR_prim, "TI_???");
85438ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", TLI=");
85538ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (tli_errors, m.error_ack.TLI_error, "T???");
85638ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("UNIX=%s", strerror (m.error_ack.UNIX_error));
85738ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
85838ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
85938ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_OK_ACK
86038ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_OK_ACK:	/* ok ack             */
86138ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_OK_ACK, ok_ack);
86238ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
86338ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("CORRECT=");
86438ae88d332acd9f86a30d58158e306d795d98977John Hughes		printxval (transport_user_options,
86538ae88d332acd9f86a30d58158e306d795d98977John Hughes			   m.ok_ack.CORRECT_prim, "TI_???");
86638ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
86738ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
86838ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_UNITDATA_IND
86938ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_UNITDATA_IND:	/* unitdata ind       */
87038ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_UNITDATA_IND, unitdata_ind);
87138ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (unitdata_ind, SRC);
87238ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (unitdata_ind, OPT);
87338ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
87438ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
87538ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_UDERROR_IND
87638ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_UDERROR_IND:	/* unitdata error ind */
87738ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_UDERROR_IND, uderror_ind);
87838ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (uderror_ind, DEST);
87938ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (uderror_ind, OPT);
88038ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf (", ERROR=%ld", m.uderror_ind.ERROR_type);
88138ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
88238ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
88338ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_OPTMGMT_ACK
88438ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_OPTMGMT_ACK:	/* manage opt ack     */
88538ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_OPTMGMT_ACK, optmgmt_ack);
88638ae88d332acd9f86a30d58158e306d795d98977John Hughes		COMMA ();
88738ae88d332acd9f86a30d58158e306d795d98977John Hughes		tprintf ("MGMT=");
88838ae88d332acd9f86a30d58158e306d795d98977John Hughes		printflags (transport_user_flags, m.optmgmt_ack.MGMT_flags);
88938ae88d332acd9f86a30d58158e306d795d98977John Hughes		STRUCT (optmgmt_ack, OPT, print_optmgmt);
89038ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
89138ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
89238ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_ORDREL_IND
89338ae88d332acd9f86a30d58158e306d795d98977John Hughes	case T_ORDREL_IND:	/* orderly rel ind    */
89438ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_ORDREL_IND, ordrel_ind);
89538ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
89638ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
89738ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_ADDR_REQ
89838ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_ADDR_REQ:	/* address req        */
89938ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_ADDR_REQ, addr_req);
90038ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
90138ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
90238ae88d332acd9f86a30d58158e306d795d98977John Hughes#ifdef T_ADDR_ACK
90338ae88d332acd9f86a30d58158e306d795d98977John Hughes	    case T_ADDR_ACK:	/* address response   */
90438ae88d332acd9f86a30d58158e306d795d98977John Hughes		GET (T_ADDR_ACK, addr_ack);
90538ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (addr_ack, LOCADDR);
90638ae88d332acd9f86a30d58158e306d795d98977John Hughes		ADDR (addr_ack, REMADDR);
90738ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
90838ae88d332acd9f86a30d58158e306d795d98977John Hughes#endif
90938ae88d332acd9f86a30d58158e306d795d98977John Hughes	    default:
91038ae88d332acd9f86a30d58158e306d795d98977John Hughes	    dump:
91138ae88d332acd9f86a30d58158e306d795d98977John Hughes		c = -1;
91238ae88d332acd9f86a30d58158e306d795d98977John Hughes		printstr(tcp, addr, len);
91338ae88d332acd9f86a30d58158e306d795d98977John Hughes		break;
91438ae88d332acd9f86a30d58158e306d795d98977John Hughes	}
91538ae88d332acd9f86a30d58158e306d795d98977John Hughes
91638ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (c >= 0) tprintf ("}");
91738ae88d332acd9f86a30d58158e306d795d98977John Hughes
91838ae88d332acd9f86a30d58158e306d795d98977John Hughes#undef ADDR
91938ae88d332acd9f86a30d58158e306d795d98977John Hughes#undef COMMA
92038ae88d332acd9f86a30d58158e306d795d98977John Hughes#undef STRUCT
92134e014ac7502357e599935c62c18cba564c451beRoland McGrath
92238ae88d332acd9f86a30d58158e306d795d98977John Hughes	return 0;
92338ae88d332acd9f86a30d58158e306d795d98977John Hughes}
92438ae88d332acd9f86a30d58158e306d795d98977John Hughes
92538ae88d332acd9f86a30d58158e306d795d98977John Hughes
92676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TI_BIND */
92776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
92838ae88d332acd9f86a30d58158e306d795d98977John Hughes
92976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstatic int
93076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermaninternal_stream_ioctl(tcp, arg)
93176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
93276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint arg;
93376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
93476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct strioctl si;
9351c04b0b000a93eef43fb2633a082d3f18da69f47Roland McGrath	struct ioctlent *iop;
93676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int in_and_out;
93738ae88d332acd9f86a30d58158e306d795d98977John Hughes	int timod = 0;
93876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SI_GETUDATA
93976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct si_udata udata;
94076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SI_GETUDATA */
94176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
94276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (!arg)
94376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 0;
94476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (umove(tcp, arg, &si) < 0) {
94576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (entering(tcp))
94676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
94776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
94876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
94976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp)) {
9502843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath		iop = ioctl_lookup(si.ic_cmd);
9512843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath		if (iop) {
9522843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath			tprintf(", {ic_cmd=%s", iop->symbol);
9532843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath			while ((iop = ioctl_next_match(iop)))
9542843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath				tprintf(" or %s", iop->symbol);
9552843a4e1d2fca851be6e47e7ff2413b45903ac9aRoland McGrath		} else
95676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {ic_cmd=%#x", si.ic_cmd);
95776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (si.ic_timout == INFTIM)
95876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", ic_timout=INFTIM, ");
95976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
96076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(" ic_timout=%d, ", si.ic_timout);
96176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
96276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	in_and_out = 1;
96376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	switch (si.ic_cmd) {
96476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SI_GETUDATA
96576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case SI_GETUDATA:
96676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		in_and_out = 0;
96776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
96876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SI_GETUDATA */
96976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
97076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (in_and_out) {
97176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (entering(tcp))
97276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("/* in */ ");
97376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else
97476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", /* out */ ");
97576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
97676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (in_and_out || entering(tcp))
97776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("ic_len=%d, ic_dp=", si.ic_len);
97876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	switch (si.ic_cmd) {
97976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TI_BIND
98076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TI_BIND:
98176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* in T_BIND_REQ, out T_BIND_ACK */
98238ae88d332acd9f86a30d58158e306d795d98977John Hughes		++timod;
98376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (entering(tcp)) {
98438ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
98538ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_BIND_REQ,
98638ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
98776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
98876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
98938ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
99038ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_BIND_ACK,
99138ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
99276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
99376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
99476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TI_BIND */
99576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TI_UNBIND
99676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TI_UNBIND:
99776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* in T_UNBIND_REQ, out T_OK_ACK */
99838ae88d332acd9f86a30d58158e306d795d98977John Hughes		++timod;
99938ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (entering(tcp)) {
100038ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
100138ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_UNBIND_REQ,
100238ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
100338ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
100438ae88d332acd9f86a30d58158e306d795d98977John Hughes		else {
100538ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
100638ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_OK_ACK,
100738ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
100838ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
100976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
101076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TI_UNBIND */
101176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TI_GETINFO
101276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TI_GETINFO:
101376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* in T_INFO_REQ, out T_INFO_ACK */
101438ae88d332acd9f86a30d58158e306d795d98977John Hughes		++timod;
101538ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (entering(tcp)) {
101638ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
101738ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_INFO_REQ,
101838ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
101938ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
102038ae88d332acd9f86a30d58158e306d795d98977John Hughes		else {
102138ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
102238ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_INFO_ACK,
102338ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
102438ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
102576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
102676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TI_GETINFO */
102776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef TI_OPTMGMT
102876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case TI_OPTMGMT:
102976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* in T_OPTMGMT_REQ, out T_OPTMGMT_ACK */
103038ae88d332acd9f86a30d58158e306d795d98977John Hughes		++timod;
103138ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (entering(tcp)) {
103238ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
103338ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_OPTMGMT_REQ,
103438ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
103538ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
103638ae88d332acd9f86a30d58158e306d795d98977John Hughes		else {
103738ae88d332acd9f86a30d58158e306d795d98977John Hughes			print_transport_message (tcp,
103838ae88d332acd9f86a30d58158e306d795d98977John Hughes						 T_OPTMGMT_ACK,
103938ae88d332acd9f86a30d58158e306d795d98977John Hughes						 si.ic_dp, si.ic_len);
104038ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
104176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
104276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* TI_OPTMGMT */
104376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef SI_GETUDATA
104476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case SI_GETUDATA:
104576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (entering(tcp))
104676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			break;
104776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if 0
104876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("struct si_udata ");
104976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
105076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, (int) si.ic_dp, &udata) < 0)
105176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("{...}");
105276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
105376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("{tidusize=%d, addrsize=%d, ",
105476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				udata.tidusize, udata.addrsize);
105576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("optsize=%d, etsdusize=%d, ",
105676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				udata.optsize, udata.etsdusize);
105776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("servtype=%d, so_state=%d, ",
105876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				udata.servtype, udata.so_state);
105976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("so_options=%d", udata.so_options);
106076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#if 0
106176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", tsdusize=%d", udata.tsdusize);
106276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
106376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("}");
106476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
106576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
106676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* SI_GETUDATA */
106776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	default:
106810a88d09ebe283d0dd2ba5deccfe50dc20ea5821Michal Ludvig		printstr(tcp, (long) si.ic_dp, si.ic_len);
106976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		break;
107076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
107138ae88d332acd9f86a30d58158e306d795d98977John Hughes	if (exiting(tcp)) {
107276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("}");
107338ae88d332acd9f86a30d58158e306d795d98977John Hughes		if (timod && tcp->u_rval) {
107438ae88d332acd9f86a30d58158e306d795d98977John Hughes			tcp->auxstr = xlookup (tli_errors, tcp->u_rval);
107538ae88d332acd9f86a30d58158e306d795d98977John Hughes			return RVAL_STR + 1;
107638ae88d332acd9f86a30d58158e306d795d98977John Hughes		}
107738ae88d332acd9f86a30d58158e306d795d98977John Hughes	}
107834e014ac7502357e599935c62c18cba564c451beRoland McGrath
107976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	return 1;
108076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
108176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
108276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint
108376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstream_ioctl(tcp, code, arg)
108476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanstruct tcb *tcp;
108576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkermanint code, arg;
108676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman{
108776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_LIST
108876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int i;
108976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
109076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	int val;
109176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_FLUSHBAND
109276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct bandinfo bi;
109376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
109476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct strpeek sp;
109576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct strfdinsert sfi;
109676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct strrecvfd srf;
109776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_LIST
109876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	struct str_list sl;
109976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
110076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
110176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	/* I_STR is a special case because the data is read & written. */
110276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (code == I_STR)
110376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return internal_stream_ioctl(tcp, arg);
110476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	if (entering(tcp))
110576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 0;
110676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
110776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	switch (code) {
110876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_PUSH:
110976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_LOOK:
111076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_FIND:
111176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* arg is a string */
111276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
111376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printpath(tcp, arg);
111476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
111576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_POP:
111676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* doesn't take an argument */
111776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
111876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_FLUSH:
111976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is an option */
112076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
112176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(stream_flush_options, arg, "FLUSH???");
112276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
112376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_FLUSHBAND
112476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_FLUSHBAND:
112576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a bandinfo struct */
112676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &bi) < 0)
112776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
112876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
112976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {bi_pri=%d, bi_flag=", bi.bi_pri);
113076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			if (!printflags(stream_flush_options, bi.bi_flag))
113176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf("0");
113276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("}");
113376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
113476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
113576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_FLUSHBAND */
113676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_SETSIG:
113776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a set of flags */
113876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
113976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(stream_setsig_flags, arg))
114076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
114176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
114276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_GETSIG:
114376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a set of flags */
114476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
114576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
114676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", [");
114776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &val) < 0)
114876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("?");
114976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (!printflags(stream_setsig_flags, val))
115076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
115176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("]");
115276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
115376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_PEEK:
115476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a strpeek structure */
115576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp) || !arg)
115676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
115776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &sp) < 0) {
115876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
115976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
116076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
116176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {ctlbuf=");
116276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstrbuf(tcp, &sp.ctlbuf, 1);
116376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", databuf=");
116476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstrbuf(tcp, &sp.databuf, 1);
1165fd15cb31adf1c38c2b5524253a50e5646c7b08ceJohn Hughes		tprintf(", flags=");
116676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(msgflags, sp.flags))
116776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
1168fd15cb31adf1c38c2b5524253a50e5646c7b08ceJohn Hughes		tprintf("}");
116976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
117076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_SRDOPT:
117176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is an option with flags */
117276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
117376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(stream_read_options, arg & RMODEMASK, "R???");
117476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		addflags(stream_read_flags, arg & ~RMODEMASK);
117576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
117676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_GRDOPT:
117776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is an pointer to an option with flags */
117876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
117976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
118076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", [");
118176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &val) < 0)
118276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("?");
118376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else {
118476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printxval(stream_read_options,
118576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				  arg & RMODEMASK, "R???");
118676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			addflags(stream_read_flags, arg & ~RMODEMASK);
118776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
118876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("]");
118976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
119076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_NREAD:
119176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_GETBAND
119276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_GETBAND:
119376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
119476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_SETCLTIME
119576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_SETCLTIME:
119676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
119776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_GETCLTIME
119876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_GETCLTIME:
119976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
120076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a decimal integer */
120176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
120276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
120376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
120476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printnum(tcp, arg, "%d");
120576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
120676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_FDINSERT:
120776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a strfdinsert structure */
120876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp) || !arg)
120976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
121076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &sfi) < 0) {
121176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
121276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
121376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
121476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {ctlbuf=");
121576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstrbuf(tcp, &sfi.ctlbuf, 1);
121676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", databuf=");
121776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printstrbuf(tcp, &sfi.databuf, 1);
1218fd15cb31adf1c38c2b5524253a50e5646c7b08ceJohn Hughes		tprintf(", flags=");
121976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(msgflags, sfi.flags))
122076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
122176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", filedes=%d, offset=%d}", sfi.fildes, sfi.offset);
122276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
122376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_SWROPT
122476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_SWROPT:
122576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a set of flags */
122676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
122776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (!printflags(stream_write_flags, arg))
122876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
122976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
123076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_SWROPT */
123176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_GWROPT
123276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_GWROPT:
123376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is an pointer to an option with flags */
123476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
123576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
123676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", [");
123776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &val) < 0)
123876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("?");
123976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		else if (!printflags(stream_write_flags, arg))
124076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf("0");
124176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("]");
124276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
124376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_GWROPT */
124476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_SENDFD:
124576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_CKBAND
124676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_CKBAND:
124776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
124876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_CANPUT
124976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_CANPUT:
125076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif
125176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_LINK:
125276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_UNLINK:
125376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_PLINK:
125476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_PUNLINK:
125576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a decimal integer */
125676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", %d", arg);
125776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
125876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_RECVFD:
125976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		/* argument is a pointer to a strrecvfd structure */
126076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp) || !arg)
126176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
126276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &srf) < 0) {
126376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
126476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
126576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
126676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {fd=%d, uid=%lu, gid=%lu}", srf.fd,
126776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			(unsigned long) srf.uid, (unsigned long) srf.gid);
126876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
126976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_LIST
127076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_LIST:
127176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (syserror(tcp))
127276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 0;
127376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (arg == 0) {
127476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", NULL");
127576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
127676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
127776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		if (umove(tcp, arg, &sl) < 0) {
127876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			tprintf(", {...}");
127976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			return 1;
128076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
128176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", {sl_nmods=%d, sl_modlist=[", sl.sl_nmods);
128276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		for (i = 0; i < tcp->u_rval; i++) {
128376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			if (i)
128476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman				tprintf(", ");
128576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman			printpath(tcp, (int) sl.sl_modlist[i].l_name);
128676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		}
128776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf("]}");
128876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
128976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_LIST */
129076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#ifdef I_ATMARK
129176baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	case I_ATMARK:
129276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		tprintf(", ");
129376baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		printxval(stream_atmark_options, arg, "???MARK");
129476baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 1;
129576baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman#endif /* I_ATMARK */
129676baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	default:
129776baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman		return 0;
129876baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman	}
129976baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman}
130076baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
1301561c7995d7524afbf92689593b9ba5f9615d0982Roland McGrath#endif /* !LINUX && !FREEBSD */
130276baf7c9f6dd61a15524ad43c1b690c252cf5b7Wichert Akkerman
1303561c7995d7524afbf92689593b9ba5f9615d0982Roland McGrath#endif /* HAVE_SYS_STREAM_H || LINUX || FREEBSD */
1304