xref: /titanic_52/usr/src/lib/libbc/inc/include/sys/stropts.h (revision bdfc6d18da790deeec2e0eb09c625902defe2498)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*	from S5R3 sys/stropts.h 10.7	*/
23 
24 #pragma ident	"%Z%%M%	%I%	%E% SMI"
25 
26 /*	Copyright (c) 1984 AT&T	*/
27 /*	  All Rights Reserved  	*/
28 
29 
30 #ifndef _sys_stropts_h
31 #define _sys_stropts_h
32 
33 /*
34  * Read options
35  */
36 #define RNORM	0			/* read msg norm */
37 #define RMSGD	1			/* read msg discard */
38 #define RMSGN	2			/* read msg no discard */
39 
40 /*
41  * Flush options
42  */
43 
44 #define FLUSHR	1			/* flush read queue */
45 #define FLUSHW	2			/* flush write queue */
46 #define FLUSHRW	3			/* flush both queues */
47 
48 /*
49  * Events for which to be sent SIGPOLL signal
50  */
51 #define S_INPUT		001		/* regular priority msg on read Q */
52 #define S_HIPRI		002		/* high priority msg on read Q */
53 #define S_OUTPUT	004		/* write Q no longer full */
54 #define S_MSG		010		/* signal msg at front of read Q */
55 
56 /*
57  * Flags for recv() and send() syscall arguments
58  */
59 #define RS_HIPRI	1		/* send/recv high priority message */
60 
61 /*
62  * Flags returned as value of recv() syscall
63  */
64 #define MORECTL		1		/* more ctl info is left in message */
65 #define MOREDATA	2		/* more data is left in message */
66 
67 #ifndef FMNAMESZ
68 #define	FMNAMESZ	8
69 #endif
70 
71 #include <sys/ioccom.h>
72 
73 /*
74  *  Stream Ioctl defines
75  */
76 #define I_NREAD		_IOR(S,01,int)
77 #define I_PUSH		_IOWN(S,02,FMNAMESZ+1)
78 #define I_POP		_IO(S,03)
79 #define I_LOOK		_IORN(S,04,FMNAMESZ+1)
80 #define I_FLUSH		_IO(S,05)
81 #define I_SRDOPT	_IO(S,06)
82 #define I_GRDOPT	_IOR(S,07,int)
83 #define I_STR		_IOWR(S,010,struct strioctl)
84 #define I_SETSIG	_IO(S,011)
85 #define I_GETSIG	_IOR(S,012,int)
86 #define I_FIND		_IOWN(S,013,FMNAMESZ+1)
87 #define I_LINK		_IO(S,014)
88 #define I_UNLINK	_IO(S,015)
89 #define I_PEEK		_IOWR(S,017,struct strpeek)
90 #define I_FDINSERT	_IOW(S,020,struct strfdinsert)
91 #define I_SENDFD	_IO(S,021)
92 #define I_RECVFD	_IOR(S,022,struct strrecvfd)
93 #define I_PLINK		_IO(S,023)
94 #define I_PUNLINK	_IO(S,024)
95 
96 
97 /*
98  * User level ioctl format for ioctl that go downstream I_STR
99  */
100 struct strioctl {
101 	int 	ic_cmd;			/* command */
102 	int	ic_timout;		/* timeout value */
103 	int	ic_len;			/* length of data */
104 	char	*ic_dp;			/* pointer to data */
105 };
106 
107 
108 /*
109  * Value for timeouts (ioctl, select) that denotes infinity
110  */
111 #define INFTIM		-1
112 
113 
114 /*
115  * Stream buffer structure for send and recv system calls
116  */
117 struct strbuf {
118 	int	maxlen;			/* no. of bytes in buffer */
119 	int	len;			/* no. of bytes returned */
120 	char	*buf;			/* pointer to data */
121 };
122 
123 
124 /*
125  * stream I_PEEK ioctl format
126  */
127 
128 struct strpeek {
129 	struct strbuf ctlbuf;
130 	struct strbuf databuf;
131 	long	      flags;
132 };
133 
134 /*
135  * stream I_FDINSERT ioctl format
136  */
137 struct strfdinsert {
138 	struct strbuf ctlbuf;
139 	struct strbuf databuf;
140 	long	      flags;
141 	int	      fildes;
142 	int	      offset;
143 };
144 
145 
146 /*
147  * receive file descriptor structure
148  */
149 struct strrecvfd {
150 #ifdef KERNEL
151 	union {
152 		struct file *fp;
153 		int fd;
154 	} f;
155 #else
156 	int fd;
157 #endif
158 	unsigned short uid;
159 	unsigned short gid;
160 	char fill[8];
161 };
162 
163 #endif /*!_sys_stropts_h*/
164