|
|
1.1 ! root 1: #ifndef __STROPTS_H__ ! 2: #define __STROPTS_H__ ! 3: ! 4: /* ! 5: * User-level information about STREAMS ioctl ()'s and system calls, derived ! 6: * from the System V manual pages for getmsg (2), putmsg (2) and streamio (7) ! 7: * ! 8: * The actual numeric values for pre-R4 constants have been taken from the ! 9: * iBCS2 specification, pp6-56 through 5-58. ! 10: * ! 11: * Values added in the System V Release 4 edition of STREAMS have numeric ! 12: * values taken from the System V ABI, Intel386 Supplement pp6-70 through ! 13: * 6-75 ! 14: */ ! 15: ! 16: #include <common/ccompat.h> ! 17: #include <sys/types.h> ! 18: #include <sys/conf.h> ! 19: #include <sys/stropts.h> ! 20: #include <sys/poll.h> ! 21: ! 22: ! 23: /* ! 24: * Structure used to indicate size and length of data and control buffers ! 25: * in the getmsg (2) and putmsg (2) system calls. ! 26: */ ! 27: ! 28: struct strbuf { ! 29: int maxlen; /* Maximum buffer length */ ! 30: int len; /* Actual data length */ ! 31: _VOID * buf; /* Points to data buffer */ ! 32: }; ! 33: ! 34: ! 35: /* ! 36: * Flags for getmsg (2)/putmsg (2), defines whether data received/put is ! 37: * in a high-priority or normal-priority STREAMS message. ! 38: */ ! 39: ! 40: #define RS_HIPRI 0x01 ! 41: ! 42: ! 43: /* ! 44: * Flags for getpmsg (2)/putpmsg (2) that control whether a message received ! 45: * or sent is high priority, normal priority, or a member of a priority band. ! 46: */ ! 47: ! 48: #define MSG_HIPRI 0x01 ! 49: #define MSG_ANY 0x02 ! 50: #define MSG_BAND 0x04 ! 51: ! 52: ! 53: /* ! 54: * Return value mask for getmsg (2) and getpmsg (2) that defines whether ! 55: * there is more control or data information in the current message than ! 56: * could be retrieved into the supplied buffers. ! 57: */ ! 58: ! 59: #define MORECTL 1 ! 60: #define MOREDATA 2 ! 61: ! 62: ! 63: /* ! 64: * Function prototypes for system calls. ! 65: */ ! 66: ! 67: __EXTERN_C_BEGIN__ ! 68: ! 69: int getmsg __PROTO ((int fd, struct strbuf * ctlptr, ! 70: struct strbuf * dataptr, int * flagsp)); ! 71: int getpmsg __PROTO ((int fd, struct strbuf * ctlptr, ! 72: struct strbuf * dataptr, int * bandp, ! 73: int * flagsp)); ! 74: int putmsg __PROTO ((int fd, __CONST__ struct strbuf * ctlptr, ! 75: __CONST__ struct strbuf * dataptr, int flags)); ! 76: int putpmsg __PROTO ((int fd, const struct strbuf * ctlptr, ! 77: __CONST__ struct strbuf * dataptr, int band, ! 78: int flags)); ! 79: ! 80: __EXTERN_C_END__ ! 81: ! 82: ! 83: /* ! 84: * Structure used in I_FLUSHBAND to control how priority bands are flushed. ! 85: */ ! 86: ! 87: struct bandinfo { ! 88: unsigned char bi_pri; /* Priority band number */ ! 89: int bi_flag; ! 90: }; ! 91: ! 92: ! 93: /* ! 94: * structure used in I_PEEK ioctl () to retrieve data waiting at the stream ! 95: * head without consuming it. ! 96: */ ! 97: ! 98: struct strpeek { ! 99: struct strbuf ctlbuf; ! 100: struct strbuf databuf; ! 101: long flags; ! 102: }; ! 103: ! 104: ! 105: /* ! 106: * structure used in I_STR ioctl () to send an arbitrary other ioctl () ! 107: * command downstream to a STREAMS module or driver. ! 108: */ ! 109: ! 110: struct strioctl { ! 111: int ic_cmd; /* ioctl () command to send */ ! 112: int ic_timeout; /* seconds to wait for reply */ ! 113: int ic_len; /* length of data to send */ ! 114: char * ic_dp; /* data buffer for send/receive */ ! 115: }; ! 116: ! 117: ! 118: /* ! 119: * structure used in the I_RECVFD ioctl () to retrieve supplementary data ! 120: * about the sent file descriptor. ! 121: */ ! 122: ! 123: struct strrecvfd { ! 124: int fd; /* arriving file descriptor */ ! 125: o_uid_t uid; /* uid of sending stream */ ! 126: o_gid_t gid; /* gid of sending stream */ ! 127: char fill [8]; /* reserved */ ! 128: }; ! 129: ! 130: ! 131: /* ! 132: * Structure used in the I_FDINSERT ioctl () to do whatever the I_FDINSERT ! 133: * ioctl does. ! 134: */ ! 135: ! 136: struct strfdinsert { ! 137: struct strbuf ctlbuf; ! 138: struct strbuf databuf; ! 139: long flags; ! 140: int fildes; ! 141: int offset; ! 142: }; ! 143: ! 144: ! 145: /* ! 146: * information structure used in the I_LIST ioctl () to retrieve the names ! 147: * of all the modules and drivers on a stream. ! 148: */ ! 149: ! 150: struct str_list { ! 151: int sl_nmods; /* number of entries in sl_modlist */ ! 152: struct str_mlist * sl_modlist; /* information array */ ! 153: }; ! 154: ! 155: struct str_mlist { ! 156: char l_name [FMNAMESZ + 1]; ! 157: }; ! 158: ! 159: ! 160: /* ! 161: * ioctl (2) command values for controlling STREAMS drivers and modules ! 162: * directly under STREAMS, as opposed to other ioctl ()'s which are passed ! 163: * to drivers and modules for emulation of old-style device access. ! 164: */ ! 165: ! 166: #define STREAM_I ('S' << 8) ! 167: #define I_NREAD (STREAM_I | 1) /* get message length, count */ ! 168: #define I_PUSH (STREAM_I | 2) /* push named module */ ! 169: #define I_POP (STREAM_I | 3) /* pop topmost module */ ! 170: #define I_LOOK (STREAM_I | 4) /* get topmost module name */ ! 171: #define I_FLUSH (STREAM_I | 5) /* flush read/write side */ ! 172: #define I_SRDOPT (STREAM_I | 6) /* set the stream head read mode */ ! 173: #define I_GRDOPT (STREAM_I | 7) /* get the stream head read mode */ ! 174: #define I_STR (STREAM_I | 8) /* send an ioctl () message downstream */ ! 175: #define I_SETSIG (STREAM_I | 9) /* register for SIGPOLL signal */ ! 176: #define I_GETSIG (STREAM_I | 10) /* return registered event mask */ ! 177: #define I_FIND (STREAM_I | 11) /* locate named module on stream */ ! 178: #define I_LINK (STREAM_I | 12) /* link two streams */ ! 179: #define I_UNLINK (STREAM_I | 13) /* unlink two streams */ ! 180: #define I_RECVFD (STREAM_I | 14) /* receive file descriptor from pipe */ ! 181: #define I_PEEK (STREAM_I | 15) /* examine stream head data */ ! 182: #define I_FDINSERT (STREAM_I | 16) /* NOT SUPPORTED */ ! 183: #define I_SENDFD (STREAM_I | 17) /* send file descriptor to pipe */ ! 184: ! 185: /* Subsequent values are not covered by iBCS2 (defined for R4 STREAMS only) */ ! 186: ! 187: #define I_SWROPT (STREAM_I | 19) /* set stream write mode */ ! 188: #define I_GWROPT (STREAM_I | 20) /* get stream write mode */ ! 189: #define I_LIST (STREAM_I | 21) /* get name of all modules/drivers */ ! 190: #define I_PLINK (STREAM_I | 22) /* create persistent link */ ! 191: #define I_PUNLINK (STREAM_I | 23) /* undo persistent link */ ! 192: #define I_SETEV (STREAM_I | 24) /* ??? */ ! 193: #define I_GETEV (STREAM_I | 25) /* ??? */ ! 194: #define I_STREV (STREAM_I | 26) /* ??? */ ! 195: #define I_UNSTREV (STREAM_I | 27) /* ??? */ ! 196: #define I_FLUSHBAND (STREAM_I | 28) /* flush priority band */ ! 197: #define I_CKBAND (STREAM_I | 29) /* check for existence of priority band */ ! 198: #define I_GETBAND (STREAM_I | 30) /* get band of first message */ ! 199: #define I_ATMARK (STREAM_I | 31) /* is current message marked */ ! 200: #define I_SETCLTIME (STREAM_I | 32) /* set drain timeout for stream */ ! 201: #define I_GETCLTIME (STREAM_I | 33) /* get the curret close timeout */ ! 202: #define I_CANPUT (STREAM_I | 34) /* check if band is writeable */ ! 203: ! 204: ! 205: /* ! 206: * Events that may be requested for in I_SETSIG that can cause a SIGPOLL ! 207: * to be sent to a process. ! 208: */ ! 209: ! 210: #define S_INPUT __POLL_INPUT /* any message other than M_PCPROTO */ ! 211: #define S_HIPRI __POLL_HIPRI /* a high priority message has arrived */ ! 212: #define S_OUTPUT __POLL_OUTPUT /* the write queue is no longer full */ ! 213: #define S_MSG __POLL_008 /* a SIGPOLL signal message has arrived */ ! 214: ! 215: #define S_ERROR __POLL_010 /* an M_ERROR message has arrived */ ! 216: #define S_HANGUP __POLL_020 /* an M_HANGUP message has arrived */ ! 217: #define S_RDNORM __POLL_RDNORM /* a non-priority message has arrived */ ! 218: #define S_WRNORM __POLL_OUTPUT /* alias for S_OUTPUT */ ! 219: #define S_RDBAND __POLL_RDBAND /* a priority band message has arrived */ ! 220: #define S_WRBAND __POLL_WRBAND /* a priority band is writeable */ ! 221: #define S_BANDURG __POLL_BANDURG /* request SIGURG rather than SIGPOLL */ ! 222: ! 223: ! 224: /* ! 225: * Write mode flags that may be specified by I_SWROPT ioctl (). ! 226: */ ! 227: ! 228: #define SNDZERO 1 /* ! 229: * Send a zero-length message when a ! 230: * write of 0 bytes occurs. ! 231: */ ! 232: #define SNDPIPE 2 /* ! 233: * Send a zero-length message down a ! 234: * a STREAMS pipe or FIFO. ! 235: */ ! 236: ! 237: /* ! 238: * Flag values used by the I_ATMARK ioctl () ! 239: */ ! 240: ! 241: #define ANYMARK 0x01 /* check for a marked message */ ! 242: #define LASTMARK 0x02 /* check for only marked message */ ! 243: ! 244: ! 245: #endif /* ! defined (__STROPTS_H__) */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.