Update.
[glibc.git] / sysdeps / generic / bits / stropts.h
blobed807473c268105f6210a87422fb2a0a04412402
1 /* Copyright (C) 1998, 1999 Free Software Foundation, Inc.
2 This file is part of the GNU C Library.
4 The GNU C Library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public License as
6 published by the Free Software Foundation; either version 2 of the
7 License, or (at your option) any later version.
9 The GNU C Library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
14 You should have received a copy of the GNU Library General Public
15 License along with the GNU C Library; see the file COPYING.LIB. If not,
16 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 Boston, MA 02111-1307, USA. */
19 #ifndef _BITS_STROPTS_H
20 #define _BITS_STROPTS_H 1
22 #include <bits/types.h>
24 /* Macros used as `request' argument to `ioctl'. */
25 #define __SID ('S' << 8)
27 #define I_NREAD (__SID | 1) /* Counts the number of data bytes in the data
28 block in the first message. */
29 #define I_PUSH (__SID | 2) /* Push STREAMS module onto top of the current
30 STREAM, just below the STREAM head. */
31 #define I_POP (__SID | 3) /* Remove STREAMS module from just below the
32 STREAM head. */
33 #define I_LOOK (__SID | 4) /* Retrieve the name of the module just below
34 the STREAM head and place it in a character
35 string. */
36 #define I_FLUSH (__SID | 5) /* Flush all input and/or output. */
37 #define I_SRDOPT (__SID | 6) /* Sets the read mode. */
38 #define I_GRDOPT (__SID | 7) /* Returns the current read mode setting. */
39 #define I_STR (__SID | 8) /* Construct an internal STREAMS `ioctl'
40 message and send that message downstream. */
41 #define I_SETSIG (__SID | 9) /* Inform the STREAM head that the process
42 wants the SIGPOLL signal issued. */
43 #define I_GETSIG (__SID |10) /* Return the events for which the calling
44 process is currently registered to be sent
45 a SIGPOLL signal. */
46 #define I_FIND (__SID |11) /* Compares the names of all modules currently
47 present in the STREAM to the name pointed to
48 by `arg'. */
49 #define I_LINK (__SID |12) /* Connect two STREAMs. */
50 #define I_UNLINK (__SID |13) /* Disconnects the two STREAMs. */
51 #define I_PEEK (__SID |15) /* Allows a process to retrieve the information
52 in the first message on the STREAM head read
53 queue without taking the message off the
54 queue. */
55 #define I_FDINSERT (__SID |16) /* Create a message from the specified
56 buffer(s), adds information about another
57 STREAM, and send the message downstream. */
58 #define I_SENDFD (__SID |17) /* Requests the STREAM associated with `fildes'
59 to send a message, containing a file
60 pointer, to the STREAM head at the other end
61 of a STREAMS pipe. */
62 #define I_RECVFD (__SID |14) /* Non-EFT definition. */
63 #define I_SWROPT (__SID |19) /* Set the write mode. */
64 #define I_GWRSET (__SID |20) /* Return the current write mode setting. */
65 #define I_LIST (__SID |21) /* List all the module names on the STREAM, up
66 to and including the topmost driver name. */
67 #define I_PLINK (__SID |22) /* Connect two STREAMs with a persistent
68 link. */
69 #define I_PUNLINK (__SID |23) /* Disconnect the two STREAMs that were
70 connected with a persistent link. */
71 #define I_FLUSHBAND (__SID |28) /* Flush only band specified. */
72 #define I_CKBAND (__SID |29) /* Check if the message of a given priority
73 band exists on the STREAM head read
74 queue. */
75 #define I_GETBAND (__SID |30) /* Return the priority band of the first
76 message on the STREAM head read queue. */
77 #define I_ATMARK (__SID |31) /* See if the current message on the STREAM
78 head read queue is "marked" by some module
79 downstream. */
80 #define I_SETCLTIME (__SID |32) /* Set the time the STREAM head will delay when
81 a STREAM is closing and there is data on
82 the write queues. */
83 #define I_GETCLTIME (__SID |33) /* Get current value for closing timeout. */
84 #define I_CANPUT (__SID |34) /* Check if a certain band is writable. */
87 /* Used in `I_LOOK' request. */
88 #define FMNAMESZ 8 /* compatibility w/UnixWare/Solaris. */
90 /* Flush options. */
91 #define FLUSHR 0x01 /* Flush read queues. */
92 #define FLUSHW 0x02 /* Flush write queues. */
93 #define FLUSHRW 0x03 /* Flush read and write queues. */
94 #define FLUSHBAND 0x04 /* Flush only specified band. */
96 /* Possible arguments for `I_SETSIG'. */
97 #define S_INPUT 0x0001 /* A message, other than a high-priority
98 message, has arrived. */
99 #define S_HIPRI 0x0002 /* A high-priority message is present. */
100 #define S_OUTPUT 0x0004 /* The write queue for normal data is no longer
101 full. */
102 #define S_MSG 0x0008 /* A STREAMS signal message that contains the
103 SIGPOLL signal reaches the front of the
104 STREAM head read queue. */
105 #define S_ERROR 0x0010 /* Notification of an error condition. */
106 #define S_HANGUP 0x0020 /* Notification of a hangup. */
107 #define S_RDNORM 0x0040 /* A normal message has arrived. */
108 #define S_WRNORM S_OUTPUT
109 #define S_RDBAND 0x0080 /* A message with a non-zero priority has
110 arrived. */
111 #define S_WRBAND 0x0100 /* The write queue for a non-zero priority
112 band is no longer full. */
113 #define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
114 SIGURG is generated instead of SIGPOLL when
115 a priority message reaches the front of the
116 STREAM head read queue. */
118 /* Option for `I_PEEK'. */
119 #define RS_HIPRI 0x01 /* Only look for high-priority messages. */
121 /* Options for `I_SRDOPT'. */
122 #define RNORM 0x0000 /* Byte-STREAM mode, the default. */
123 #define RMSGD 0x0001 /* Message-discard mode. */
124 #define RMSGN 0x0002 /* Message-nondiscard mode. */
125 #define RPROTDAT 0x0004 /* Deliver the control part of a message as
126 data. */
127 #define RPROTDIS 0x0008 /* Discard the control part of a message,
128 delivering any data part. */
129 #define RPROTNORM 0x0010 /* Fail `read' with EBADMSG if a message
130 containing a control part is at the front
131 of the STREAM head read queue. */
132 #define RPROTMASK 0x001C /* The RPROT bits */
134 /* Possible mode for `I_SWROPT'. */
135 #define SNDZERO 0x001 /* Send a zero-length message downstream when a
136 `write' of 0 bytes occurs. */
137 #define SNDPIPE 0x002 /* Send SIGPIPE on write and putmsg if
138 sd_werror is set. */
140 /* Arguments for `I_ATMARK'. */
141 #define ANYMARK 0x01 /* Check if the message is marked. */
142 #define LASTMARK 0x02 /* Check if the message is the last one marked
143 on the queue. */
145 /* Argument for `I_UNLINK'. */
146 #define MUXID_ALL (-1) /* Unlink all STREAMs linked to the STREAM
147 associated with `fildes'. */
150 /* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
151 #define MSG_HIPRI 0x01 /* Send/receive high priority message. */
152 #define MSG_ANY 0x02 /* Receive any message. */
153 #define MSG_BAND 0x04 /* Receive message from specified band. */
155 /* Values returned by getmsg and getpmsg */
156 #define MORECTL 1 /* More control information is left in
157 message. */
158 #define MOREDATA 2 /* More data is left in message. */
161 /* Structure used for the I_FLUSHBAND ioctl on streams. */
162 struct bandinfo
164 unsigned char bi_pri;
165 int bi_flag;
168 struct strbuf
170 int maxlen; /* Maximum buffer length. */
171 int len; /* Length of data. */
172 char *buf; /* Pointer to buffer. */
175 struct strpeek
177 struct strbuf ctlbuf;
178 struct strbuf databuf;
179 __t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
182 struct strfdinsert
184 struct strbuf ctlbuf;
185 struct strbuf databuf;
186 __t_uscalar_t flags; /* UnixWare/Solaris compatibility. */
187 int fildes;
188 int offset;
191 struct strioctl
193 int ic_cmd;
194 int ic_timout;
195 int ic_len;
196 char *ic_dp;
199 struct strrecvfd
201 int fd;
202 __uid_t uid;
203 __gid_t gid;
204 char fill[8]; /* UnixWare/Solaris compatibility */
208 struct str_mlist
210 char l_name[FMNAMESZ + 1];
213 struct str_list
215 int sl_nmods;
216 struct str_mlist *sl_modlist;
219 #endif /* bits/stropts.h */