Update.
[glibc.git] / bits / stropts.h
blob026df21a486597afe8ecb6e71f4bc21b56a9fa9d
1 /* Copyright (C) 1998 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 I_PUSH 1 /* Push STREAMS module onto top of the current
26 STREAM, just below the STREAM head. */
27 #define I_POP 2 /* Remove STREAMS module from just below the
28 STREAM head. */
29 #define I_LOOK 3 /* Retrieve the name of the module just below
30 the STREAM head and place it in a character
31 string. */
32 #define I_FLUSH 4 /* Flush all input and/or output. */
33 #define I_FLUSHBAND 5 /* Flush only band specified. */
34 #define I_SETSIG 6 /* Inform the STREAM head that the process
35 wants the SIGPOLL signal issued. */
36 #define I_GETSIG 7 /* Return the events for which the calling
37 process is currently registered to be sent
38 a SIGPOLL signal. */
39 #define I_FIND 8 /* Compares the names of all modules currently
40 present in the STREAM to the name pointed to
41 by `arg'. */
42 #define I_PEEK 9 /* Allows a process to retrieve the information
43 in the first message on the STREAM head read
44 queue without taking the message off the
45 queue. */
46 #define I_SRDOPT 10 /* Sets the read mode. */
47 #define I_GRDOPT 11 /* Returns the current read mode setting. */
48 #define I_NREAD 12 /* Counts the number of data bytes in the data
49 block in the first message. */
50 #define I_FDINSERT 13 /* Create a message from the specified
51 buffer(s), adds information about another
52 STREAM, and send the message downstream. */
53 #define I_STR 14 /* Construct an internal STREAMS `ioctl'
54 message and send that message downstream. */
55 #define I_SWROPT 15 /* Set the write mode. */
56 #define I_GWRSET 16 /* Return the current write mode setting. */
57 #define I_SENDFD 17 /* Requests the STREAM associated with `fildes'
58 to send a message, containing a file
59 pointer, to the STREAM head at the other end
60 of a STREAMS pipe. */
61 #define I_RECVFD 18 /* Retrieve the file descriptor associated with
62 the message sent by an I_SENDFD `ioctl'
63 over a STREAMS pipe. */
64 #define I_LIST 19 /* List all the module names on the STREAM, up
65 to and including the topmost driver name. */
66 #define I_ATMARK 20 /* See if the current message on the STREAM
67 head read queue is "marked" by some module
68 downstream. */
69 #define I_CKBAND 21 /* Check if the message of a given priority
70 band exists on the STREAM head read
71 queue. */
72 #define I_GETBAND 22 /* Return the priority band of the first
73 message on the STREAM head read queue. */
74 #define I_CANPUT 23 /* Check if a certain band is writable. */
75 #define I_SETCLTIME 24 /* Set the time the STREAM head will delay when
76 a STREAM is closing and there is data on
77 the write queues. */
78 #define I_LINK 25 /* Connect two STREAMs. */
79 #define I_UNLINK 26 /* Disconnects the two STREAMs. */
80 #define I_PLINK 27 /* Connect two STREAMs with a persistent
81 link. */
82 #define I_PUNLINK 28 /* Disconnect the two STREAMs that were
83 connected with a persistent link. */
86 /* Used in `I_LOOK' request. */
87 #define FMNAMESZ 255
89 /* Flush options. */
90 #define FLUSHR 1 /* Flush read queues. */
91 #define FLUSHW 2 /* Flush write queues. */
92 #define FLUSHRW 3 /* Flush read and write queues. */
94 /* Possible arguments for `I_SETSIG'. */
95 #define S_RDNORM 0x0001 /* A normal message has arrived. */
96 #define S_RDBAND 0x0002 /* A message with a non-zero priority has
97 arrived. */
98 #define S_INPUT 0x0004 /* A message, other than a high-priority
99 message, has arrived. */
100 #define S_HIPRI 0x0008 /* A high-priority message is present. */
101 #define S_OUTPUT 0x0010 /* The write queue for normal data is no longer
102 full. */
103 #define S_WRNORM S_OUTPUT
104 #define S_WRBAND 0x0020 /* The write queue for a non-zero priority
105 band is no longer full. */
106 #define S_MSG 0x0040 /* A STREAMS signal message that contains the
107 SIGPOLL signal reaches the front of the
108 STREAM head read queue. */
109 #define S_ERROR 0x0080 /* Notification of an error condition. */
110 #define S_HANGUP 0x0100 /* Notification of a hangup. */
111 #define S_BANDURG 0x0200 /* When used in conjunction with S_RDBAND,
112 SIGURG is generated instead of SIGPOLL when
113 a priority message reaches the front of the
114 STREAM head read queue. */
116 /* Option for `I_PEEK'. */
117 #define RS_HIPRI 1 /* Only look for high-priority messages. */
119 /* Options for `I_SRDOPT'. */
120 #define RDNORM 1 /* Byte-STREAM mode, the default. */
121 #define RMSGD 2 /* Message-discard mode. */
122 #define RMSGN 3 /* Message-nondiscard mode. */
123 #define RPROTNORM 4 /* Fail `read' with EBADMSG if a message
124 containing a control part is at the front
125 of the STREAM head read queue. */
126 #define RPROTDAT 5 /* Deliver the control part of a message as
127 data. */
128 #define RPROTDIS 6 /* Discard the control part of a message,
129 delivering any data part. */
131 /* Possible mode for `I_SWROPT'. */
132 #define SNDZERO 1 /* Send a zero-length message downstream when a
133 `write' of 0 bytes occurs. */
135 /* Arguments for `I_ATMARK'. */
136 #define ANYMARK 1 /* Check if the message is marked. */
137 #define LASTMARK 2 /* Check if the message is the last one marked
138 on the queue. */
140 /* Argument for `I_UNLINK'. */
141 #define MUXID_ALL 1 /* Unlink all STREAMs linked to the STREAM
142 associated with `fildes'. */
145 /* Macros for `getmsg', `getpmsg', `putmsg' and `putpmsg'. */
146 #define MSG_ANY 1 /* Receive any message. */
147 #define MSG_BAND 2 /* Receive message from specified band. */
148 #define MSG_HIPRI 3 /* Send/receive high priority message. */
149 #define MORECTL 4 /* More control information is left in
150 message. */
151 #define MOREDATA 5 /* More data is left in message. */
154 /* Structure used for the I_FLUSHBAND ioctl on streams. */
155 struct bandinfo
157 unsigned char bi_pri;
158 int bi_flag;
161 struct strbuf
163 int maxlen; /* Maximum buffer length. */
164 int len; /* Length of data. */
165 char *buf; /* Pointer to buffer. */
168 struct strpeek
170 struct strbuf ctlbuf;
171 struct strbuf databuf;
172 __t_uscalar_t flags;
175 struct strfdinsert
177 struct strbuf ctlbuf;
178 struct strbuf databuf;
179 __t_uscalar_t flags;
180 int fildes;
181 int offset;
184 struct strioctl
186 int ic_cmd;
187 int ic_timout;
188 int ic_len;
189 char *ic_dp;
192 struct strrecvfd
194 int fd;
195 __uid_t uid;
196 __gid_t gid;
200 struct str_mlist
202 char l_name[FMNAMESZ + 1];
205 struct str_list
207 int sl_nmods;
208 struct str_mlist *sl_modlist;
211 #endif /* bits/stropts.h */