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