summaryrefslogtreecommitdiff
path: root/usr/src/lib/libbc/inc/include/sys/stropts.h
blob: 20418dc4391eb933049480369b728f5d86ca045d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/*
 * CDDL HEADER START
 *
 * The contents of this file are subject to the terms of the
 * Common Development and Distribution License, Version 1.0 only
 * (the "License").  You may not use this file except in compliance
 * with the License.
 *
 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
 * or http://www.opensolaris.org/os/licensing.
 * See the License for the specific language governing permissions
 * and limitations under the License.
 *
 * When distributing Covered Code, include this CDDL HEADER in each
 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
 * If applicable, add the following below this CDDL HEADER, with the
 * fields enclosed by brackets "[]" replaced with your own identifying
 * information: Portions Copyright [yyyy] [name of copyright owner]
 *
 * CDDL HEADER END
 */
/*
 * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 * Use is subject to license terms.
 */

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

#ifndef _sys_stropts_h
#define	_sys_stropts_h

#pragma ident	"%Z%%M%	%I%	%E% SMI"

/*
 * Read options
 */
#define RNORM	0			/* read msg norm */
#define RMSGD	1			/* read msg discard */
#define RMSGN	2			/* read msg no discard */

/*
 * Flush options
 */

#define FLUSHR	1			/* flush read queue */
#define FLUSHW	2			/* flush write queue */
#define FLUSHRW	3			/* flush both queues */

/*
 * Events for which to be sent SIGPOLL signal
 */
#define S_INPUT		001		/* regular priority msg on read Q */
#define S_HIPRI		002		/* high priority msg on read Q */
#define S_OUTPUT	004		/* write Q no longer full */
#define S_MSG		010		/* signal msg at front of read Q */

/*
 * Flags for recv() and send() syscall arguments
 */
#define RS_HIPRI	1		/* send/recv high priority message */

/*
 * Flags returned as value of recv() syscall
 */
#define MORECTL		1		/* more ctl info is left in message */
#define MOREDATA	2		/* more data is left in message */

#ifndef FMNAMESZ
#define	FMNAMESZ	8
#endif

#include <sys/ioccom.h>

/*
 *  Stream Ioctl defines
 */
#define I_NREAD		_IOR('S',01,int)
#define I_PUSH		_IOWN('S',02,FMNAMESZ+1)
#define I_POP		_IO('S',03)
#define I_LOOK		_IORN('S',04,FMNAMESZ+1)
#define I_FLUSH		_IO('S',05)
#define I_SRDOPT	_IO('S',06)
#define I_GRDOPT	_IOR('S',07,int)
#define I_STR		_IOWR('S',010,struct strioctl)
#define I_SETSIG	_IO('S',011)
#define I_GETSIG	_IOR('S',012,int)
#define I_FIND		_IOWN('S',013,FMNAMESZ+1)
#define I_LINK		_IO('S',014)
#define I_UNLINK	_IO('S',015)
#define I_PEEK		_IOWR('S',017,struct strpeek)
#define I_FDINSERT	_IOW('S',020,struct strfdinsert)
#define I_SENDFD	_IO('S',021)
#define I_RECVFD	_IOR('S',022,struct strrecvfd)
#define I_PLINK		_IO('S',023)
#define I_PUNLINK	_IO('S',024)


/*
 * User level ioctl format for ioctl that go downstream I_STR 
 */
struct strioctl {
	int 	ic_cmd;			/* command */
	int	ic_timout;		/* timeout value */
	int	ic_len;			/* length of data */
	char	*ic_dp;			/* pointer to data */
};


/*
 * Value for timeouts (ioctl, select) that denotes infinity
 */
#define INFTIM		-1


/*
 * Stream buffer structure for send and recv system calls
 */
struct strbuf {
	int	maxlen;			/* no. of bytes in buffer */
	int	len;			/* no. of bytes returned */
	char	*buf;			/* pointer to data */
};


/* 
 * stream I_PEEK ioctl format
 */

struct strpeek {
	struct strbuf ctlbuf;
	struct strbuf databuf;
	long	      flags;
};

/*
 * stream I_FDINSERT ioctl format
 */
struct strfdinsert {
	struct strbuf ctlbuf;
	struct strbuf databuf;
	long	      flags;
	int	      fildes;
	int	      offset;
};


/*
 * receive file descriptor structure
 */
struct strrecvfd {
	int fd;
	unsigned short uid;
	unsigned short gid;
	char fill[8];
};

#endif /* !_sys_stropts_h */