stropts.h 8.3 KB

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