home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 15 / 15.iso / s / s053 / 9.ddi / usr / include / sys / stropts.h < prev    next >
Encoding:
C/C++ Source or Header  |  1990-12-08  |  9.4 KB  |  390 lines

  1. /*    Copyright (c) 1990 UNIX System Laboratories, Inc.    */
  2. /*    Copyright (c) 1984, 1986, 1987, 1988, 1989, 1990 AT&T    */
  3. /*      All Rights Reserved      */
  4.  
  5. /*    THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF         */
  6. /*    UNIX System Laboratories, Inc.                         */
  7. /*    The copyright notice above does not evidence any       */
  8. /*    actual or intended publication of such source code.    */
  9.  
  10. #ifndef _SYS_STROPTS_H
  11. #define _SYS_STROPTS_H
  12.  
  13. #ident    "@(#)/usr/include/sys/stropts.h.sl 1.1 4.0 12/08/90 38225 AT&T-USL"
  14.  
  15. /*
  16.  * For sys/evecb.h
  17.  */
  18. #include <sys/types.h>
  19.  
  20. /*
  21.  * For FMNAMESZ define.
  22.  */
  23. #include <sys/conf.h>
  24.  
  25. /*
  26.  * For struct ecb (source compatibility).
  27.  */
  28. #include <sys/evecb.h>
  29.  
  30. /*
  31.  * Write options.
  32.  */
  33. #define SNDZERO        0x001        /* send a zero length message */
  34. #define SNDPIPE        0x002        /* send SIGPIPE on write and */
  35.                     /* putmsg if sd_werror is set */
  36.  
  37. /*
  38.  * Read options
  39.  */
  40.  
  41. #define RNORM        0x000        /* read msg norm */
  42. #define RMSGD        0x001        /* read msg discard */
  43. #define RMSGN        0x002        /* read msg no discard */
  44.  
  45. #define RMODEMASK    0x003        /* all above bits */
  46.  
  47. /*
  48.  * These next three read options are added for the sake of
  49.  * user-level transparency.  RPROTDAT will cause the stream head
  50.  * to treat the contents of M_PROTO and M_PCPROTO message blocks
  51.  * as data.  RPROTDIS will prevent the stream head from failing
  52.  * a read with EBADMSG if an M_PROTO or M_PCPROTO message is on
  53.  * the front of the stream head read queue.  Rather, the protocol
  54.  * blocks will be silently discarded and the data associated with
  55.  * the message (in linked M_DATA blocks), if any, will be delivered
  56.  * to the user.  RPROTNORM sets the default behavior, where read
  57.  * will fail with EBADMSG if an M_PROTO or M_PCPROTO are at the
  58.  * stream head.
  59.  */
  60. #define RPROTDAT    0x004        /* read protocol messages as data */
  61. #define RPROTDIS    0x008        /* discard protocol messages, but */
  62.                     /* read data portion */
  63. #define RPROTNORM    0x010
  64.  
  65. #define RPROTMASK    0x01c        /* all RPROT bits */
  66.  
  67. /*
  68.  * Flush options
  69.  */
  70.  
  71. #define FLUSHR        0x01        /* flush read queue */
  72. #define FLUSHW        0x02        /* flush write queue */
  73. #define FLUSHRW        0x03        /* flush both queues */
  74. #define FLUSHBAND    0x04        /* flush only band specified */
  75.                     /* in next byte */
  76.  
  77. /*
  78.  * Events for which to be sent SIGPOLL signal and for which events
  79.  * can be posted by the I_SETEV ioctl.
  80.  */
  81. #define S_INPUT        0x0001        /* any msg but hipri on read Q */
  82. #define S_HIPRI        0x0002        /* high priority msg on read Q */
  83. #define S_OUTPUT    0x0004        /* write Q no longer full */
  84. #define S_MSG        0x0008        /* signal msg at front of read Q */
  85. #define    S_ERROR        0x0010        /* error msg arrived at stream head */
  86. #define    S_HANGUP    0x0020        /* hangup msg arrived at stream head */
  87. #define S_RDNORM    0x0040        /* normal msg on read Q */
  88. #define S_WRNORM    S_OUTPUT
  89. #define    S_RDBAND    0x0080        /* out of band msg on read Q */
  90. #define S_WRBAND    0x0100        /* can write out of band */
  91. #define S_BANDURG    0x0200        /* modifier to S_RDBAND, to generate */
  92.                     /* SIGURG instead of SIGPOLL */
  93.  
  94. /*
  95.  * Flags for getmsg() and putmsg() syscall arguments.
  96.  * "RS" stands for recv/send.  The system calls were originally called
  97.  * recv() and send(), but were renamed to avoid confusion with the BSD
  98.  * calls of the same name.  A value of zero will cause getmsg() to return
  99.  * the first message on the stream head read queue and putmsg() to send
  100.  * a normal priority message.
  101.  */
  102. #define RS_HIPRI    0x01        /* send/recv high priority message */
  103.  
  104. /*
  105.  * Flags for getpmsg() and putpmsg() syscall arguments.
  106.  */
  107.  
  108. /*
  109.  * These are settable by the user and will be set on return
  110.  * to indicate the priority of message received.
  111.  */
  112. #define MSG_HIPRI    0x01        /* send/recv high priority message */
  113. #define MSG_ANY        0x02        /* recv any messages */
  114. #define MSG_BAND    0x04        /* recv messages from specified band */
  115.  
  116. /*
  117.  * Flags returned as value of getmsg() and getpmsg() syscall.
  118.  */
  119. #define MORECTL        1        /* more ctl info is left in message */
  120. #define MOREDATA    2        /* more data is left in message */
  121.  
  122. /*
  123.  * Define to indicate that all multiplexors beneath a stream should
  124.  * be unlinked.
  125.  */
  126. #define MUXID_ALL    (-1)
  127.  
  128. /*
  129.  * Flag definitions for the I_ATMARK ioctl.
  130.  */
  131. #define ANYMARK        0x01
  132. #define LASTMARK    0x02
  133.  
  134. /*
  135.  *  Stream Ioctl defines
  136.  */
  137. #define    STR        ('S'<<8)
  138. /* (STR|000) in use */
  139. #define I_NREAD        (STR|01)
  140. #define I_PUSH        (STR|02)
  141. #define I_POP        (STR|03)
  142. #define I_LOOK        (STR|04)
  143. #define I_FLUSH        (STR|05)
  144. #define I_SRDOPT    (STR|06)
  145. #define I_GRDOPT    (STR|07)
  146. #define I_STR        (STR|010)
  147. #define I_SETSIG    (STR|011)
  148. #define I_GETSIG    (STR|012)
  149. #define I_FIND        (STR|013)
  150. #define I_LINK        (STR|014)
  151. #define I_UNLINK    (STR|015)
  152. /* (STR|016) in use */
  153. #define I_PEEK        (STR|017)
  154. #define I_FDINSERT    (STR|020)
  155. #define I_SENDFD    (STR|021)
  156. #if defined(_KERNEL)
  157.  
  158. #define I_RECVFD    (STR|022)
  159. #define I_E_RECVFD    (STR|016)
  160.  
  161. #elif !defined(_STYPES)    /* user level definition */
  162.  
  163. #define I_RECVFD    (STR|016)    /* maps to kernel I_E_RECVFD */
  164.  
  165. #else
  166.  
  167. #define I_RECVFD    (STR|022)    /* non-EFT definition */
  168.  
  169. #endif /* defined(_KERNEL) */
  170.  
  171. #define I_SWROPT    (STR|023)
  172. #define I_GWROPT    (STR|024)
  173. #define I_LIST        (STR|025)
  174. #define I_PLINK        (STR|026)
  175. #define I_PUNLINK    (STR|027)
  176. #define I_SETEV        (STR|030)
  177. #define I_GETEV        (STR|031)
  178. #define I_STREV        (STR|032)
  179. #define I_UNSTREV    (STR|033)
  180. #define I_FLUSHBAND    (STR|034)
  181. #define I_CKBAND    (STR|035)
  182. #define I_GETBAND    (STR|036)
  183. #define I_ATMARK    (STR|037)
  184. #define I_SETCLTIME    (STR|040)
  185. #define I_GETCLTIME    (STR|041)
  186. #define I_CANPUT    (STR|042)
  187.  
  188.                         /* Same ioctl as O_MODESWITCH */
  189. #define    X_STR            ('S'<<8)    /* SCO XENIX Streams ioctl's */
  190. #define    X_I_BASE        (X_STR|0200)
  191. #define    X_I_NREAD        (X_STR|0201)
  192. #define    X_I_PUSH        (X_STR|0202)
  193. #define    X_I_POP            (X_STR|0203)
  194. #define    X_I_LOOK        (X_STR|0204)
  195. #define    X_I_FLUSH        (X_STR|0205)
  196. #define    X_I_SRDOPT        (X_STR|0206)
  197. #define    X_I_GRDOPT        (X_STR|0207)
  198. #define    X_I_STR            (X_STR|0210)
  199. #define    X_I_SETSIG        (X_STR|0211)
  200. #define    X_I_GETSIG        (X_STR|0212)
  201. #define    X_I_FIND        (X_STR|0213)
  202. #define    X_I_LINK        (X_STR|0214)
  203. #define    X_I_UNLINK        (X_STR|0215)
  204. #define    X_I_PEEK        (X_STR|0217)
  205. #define    X_I_FDINSERT        (X_STR|0220)
  206. #define    X_I_SENDFD        (X_STR|0221)
  207. #define    X_I_RECVFD        (X_STR|0222)
  208.  
  209. /*
  210.  * User level ioctl format for ioctls that go downstream (I_STR)
  211.  */
  212. struct strioctl {
  213.     int     ic_cmd;            /* command */
  214.     int    ic_timout;        /* timeout value */
  215.     int    ic_len;            /* length of data */
  216.     char    *ic_dp;            /* pointer to data */
  217. };
  218.  
  219. /*
  220.  * Value for timeouts (ioctl, select) that denotes infinity
  221.  */
  222. #define INFTIM        -1
  223.  
  224. /*
  225.  * Stream buffer structure for putmsg and getmsg system calls
  226.  */
  227. struct strbuf {
  228.     int    maxlen;            /* no. of bytes in buffer */
  229.     int    len;            /* no. of bytes returned */
  230.     char    *buf;            /* pointer to data */
  231. };
  232.  
  233. /* 
  234.  * Stream I_PEEK ioctl format
  235.  */
  236. struct strpeek {
  237.     struct strbuf ctlbuf;
  238.     struct strbuf databuf;
  239.     long          flags;
  240. };
  241.  
  242. /*
  243.  * Stream I_FDINSERT ioctl format
  244.  */
  245. struct strfdinsert {
  246.     struct strbuf ctlbuf;
  247.     struct strbuf databuf;
  248.     long          flags;
  249.     int          fildes;
  250.     int          offset;
  251. };
  252.  
  253. /*
  254.  * Receive file descriptor structure
  255.  */
  256.  
  257. #if defined(_KERNEL)
  258.  
  259. struct o_strrecvfd {    /* SVR3 syscall structure */
  260.     union {
  261.         struct file *fp;
  262.         int fd;
  263.     } f;
  264.     o_uid_t uid;        /* always ushort */
  265.     o_gid_t gid;
  266.     char fill[8];
  267. };
  268.  
  269. /* Although EFT is enabled in the kernel we kept the following definition
  270. ** to support an EFT application on a 4.0 non-EFT system.
  271. */
  272.  
  273. struct e_strrecvfd {    /* SVR4 expanded syscall interface structure */
  274.     union {
  275.         struct file *fp;
  276.         int fd;
  277.     } f;
  278.     uid_t uid;        /* always long */
  279.     gid_t gid;
  280.     char fill[8];
  281. };
  282.  
  283. struct strrecvfd {    /* Kernel structure dependent on EFT definition */
  284.     union {
  285.         struct file *fp;
  286.         int fd;
  287.     } f;
  288. #if !defined(_STYPES)
  289.     uid_t uid;
  290.     gid_t gid;
  291. #else
  292.     o_uid_t uid;
  293.     o_gid_t gid;
  294. #endif
  295.     char fill[8];
  296. };
  297.  
  298. #elif !defined(_STYPES)     /* EFT user definition */
  299.  
  300. struct strrecvfd {
  301.     int fd;
  302.     uid_t uid;
  303.     gid_t gid;
  304.     char fill[8];
  305. };
  306.  
  307. #else
  308.  
  309. /*
  310.  * User compatibility mode. EOVERFLOW returned 
  311.  * when uid/gid exceeds ushort limit.
  312.  */
  313. struct strrecvfd {
  314.     int fd;
  315.     o_uid_t uid;
  316.     o_gid_t gid;
  317.     char fill[8];
  318. };
  319.  
  320. #endif    /* defined(_KERNEL) */
  321.  
  322. /*
  323.  * For I_LIST ioctl.
  324.  */
  325. struct str_mlist {
  326.     char l_name[FMNAMESZ+1];
  327. };
  328.  
  329. struct str_list {
  330.     int sl_nmods;
  331.     struct str_mlist *sl_modlist;
  332. };
  333.  
  334. /*
  335.  * For I_STREV and I_UNSTREV ioctls: requesting
  336.  * ET_DRIVER-type events from STREAMS modules and
  337.  * drivers.
  338.  */
  339. struct str_event {
  340.     long        ste_event;    /* the event (module-specific) */
  341.     ecb_t        ste_ecb;    /* event control block */
  342.     long        ste_evflags;    /* same as ev_flags */
  343.     struct strbuf    ste_buf;    /* module-specific data */
  344. };
  345.  
  346. /*
  347.  * For I_SETEV ioctls: requesting ET_STREAM-type
  348.  * events from the stream head.
  349.  */
  350. typedef struct str_sev {
  351.     int    se_mask;    /* generate events for above S_XXX conditions */
  352.     ecb_t    se_ecb;        /* the event control block */
  353.     unchar    se_band;    /* band requested (ignored if does not apply) */
  354. } str_sev_t;
  355.  
  356. /*
  357.  * For I_GETEV ioctls: retrieve the events for
  358.  * which stream head is generating events.
  359.  */
  360. typedef struct str_gev {
  361.     int        ge_flags;    /* see below */
  362.     str_sev_t    *ge_sep;    /* ptr to array of str_sev structs */
  363.     int        ge_ses;        /* number of elements in ge_sep array */
  364. } str_gev_t;
  365.  
  366.  
  367. /*
  368.  * Flags for ge_flags field.
  369.  */
  370. #define    GEF_PROC    0x0001    /* Get information only about    */
  371.                 /* this process' requests.    */
  372.                 /* Otherwise, all I_SETEV's for    */
  373.                 /* the stream head will be    */
  374.                 /* returned.            */
  375. #define    GEF_MORE    0x0002    /* Set on return if there were    */
  376.                 /* more I_SETEVs to return than    */
  377.                 /* would fit into the ge_sep    */
  378.                 /* array the caller provided.    */
  379.  
  380. /*
  381.  * For I_FLUSHBAND ioctl.  Describes the priority
  382.  * band for which the operation applies.
  383.  */
  384. struct bandinfo {
  385.     unsigned char    bi_pri;
  386.     int        bi_flag;
  387. };
  388.  
  389. #endif    /* _SYS_STROPTS_H */
  390.