📄 stropts.h.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta name="generator" content="HTML Tidy, see www.w3.org"><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><link type="text/css" rel="stylesheet" href="style.css"><!-- Generated by The Open Group's rhtm tool v1.2.1 --><!-- Copyright (c) 2001-2003 The Open Group, All Rights Reserved --><title><stropts.h></title></head><body bgcolor="white"><script type="text/javascript" language="JavaScript" src="../jscript/codes.js"></script><basefont size="3"> <a name="<stropts.h>"></a> <a name="tag_13_53"></a><!-- <stropts.h> --> <!--header start--><center><font size="2">The Open Group Base Specifications Issue 6<br>IEEE Std 1003.1, 2003 Edition<br>Copyright © 2001-2003 The IEEE and The Open Group, All Rights reserved.</font></center><!--header end--><hr size="2" noshade><h4><a name="tag_13_53_01"></a>NAME</h4><blockquote>stropts.h - STREAMS interface (<b>STREAMS</b>)</blockquote><h4><a name="tag_13_53_02"></a>SYNOPSIS</h4><blockquote class="synopsis"><div class="box"><tt><sup>[<a href="javascript:open_code('XSR')">XSR</a>]</sup> <img src="../images/opt-start.gif" alt="[Option Start]" border="0"> #include <stropts.h> <img src="../images/opt-end.gif" alt="[Option End]" border="0"></tt></div></blockquote><h4><a name="tag_13_53_03"></a>DESCRIPTION</h4><blockquote><p>The <i><stropts.h></i> header shall define the <b>bandinfo</b> structure that includes at least the following members:</p><pre><tt>unsigned char bi_pri </tt> Priority band. <tt>int bi_flag </tt> Flushing type. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>strpeek</b> structure that includes at least the following members:</p><pre><tt>struct strbuf ctlbuf </tt> The control portion of the message. <tt>struct strbuf databuf </tt> The data portion of the message. <tt>t_uscalar_t flags </tt> RS_HIPRI or 0. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>strbuf</b> structure that includes at least the following members:</p><pre><tt>int maxlen </tt> Maximum buffer length. <tt>int len </tt> Length of data. <tt>char *buf </tt> Pointer to buffer. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>strfdinsert</b> structure that includes at least the followingmembers:</p><pre><tt>struct strbuf ctlbuf </tt> The control portion of the message. <tt>struct strbuf databuf </tt> The data portion of the message. <tt>t_uscalar_t flags </tt> RS_HIPRI or 0. <tt>int fildes </tt> File descriptor of the other STREAM. <tt>int offset </tt> Relative location of the stored value. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>strioctl</b> structure that includes at least the following members:</p><pre><tt>int ic_cmd </tt> <i>ioctl</i>() command. <tt>int ic_timout </tt> Timeout for response. <tt>int ic_len </tt> Length of data. <tt>char *ic_dp </tt> Pointer to buffer. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>strrecvfd</b> structure that includes at least the followingmembers:</p><pre><tt>int fda </tt> Received file descriptor. <tt>uid_t uid </tt> UID of sender. <tt>gid_t gid </tt> GID of sender. <tt></tt></pre><p>The <b>uid_t</b> and <b>gid_t</b> types shall be defined through <b>typedef</b> as described in <a href="sys/types.h.html"><i><sys/types.h></i></a> .</p><p>The <i><stropts.h></i> header shall define the <b>t_scalar_t</b> and <b>t_uscalar_t</b> types, respectively, as signed andunsigned opaque types of equal length of at least 32 bits.</p><p>The <i><stropts.h></i> header shall define the <b>str_list</b> structure that includes at least the following members:</p><pre><tt>int sl_nmods </tt> Number of STREAMS module names. <tt>struct str_mlist *sl_modlist </tt> STREAMS module names. <tt></tt></pre><p>The <i><stropts.h></i> header shall define the <b>str_mlist</b> structure that includes at least the following member:</p><pre><tt>char l_name[FMNAMESZ+1] </tt> A STREAMS module name. <tt></tt></pre><p>At least the following macros shall be defined for use as the <i>request</i> argument to <a href="../functions/ioctl.html"><i>ioctl</i>()</a>:</p><dl compact><dt>I_PUSH</dt><dd>Push a STREAMS module.</dd><dt>I_POP</dt><dd>Pop a STREAMS module.</dd><dt>I_LOOK</dt><dd>Get the top module name.</dd><dt>I_FLUSH</dt><dd>Flush a STREAM.</dd><dt>I_FLUSHBAND</dt><dd>Flush one band of a STREAM.</dd><dt>I_SETSIG</dt><dd>Ask for notification signals.</dd><dt>I_GETSIG</dt><dd>Retrieve current notification signals.</dd><dt>I_FIND</dt><dd>Look for a STREAMS module.</dd><dt>I_PEEK</dt><dd>Peek at the top message on a STREAM.</dd><dt>I_SRDOPT</dt><dd>Set the read mode.</dd><dt>I_GRDOPT</dt><dd>Get the read mode.</dd><dt>I_NREAD</dt><dd>Size the top message.</dd><dt>I_FDINSERT</dt><dd>Send implementation-defined information about another STREAM.</dd><dt>I_STR</dt><dd>Send a STREAMS <a href="../functions/ioctl.html"><i>ioctl</i>()</a>.</dd><dt>I_SWROPT</dt><dd>Set the write mode.</dd><dt>I_GWROPT</dt><dd>Get the write mode.</dd><dt>I_SENDFD</dt><dd>Pass a file descriptor through a STREAMS pipe.</dd><dt>I_RECVFD</dt><dd>Get a file descriptor sent via I_SENDFD.</dd><dt>I_LIST</dt><dd>Get all the module names on a STREAM.</dd><dt>I_ATMARK</dt><dd>Is the top message "marked''?</dd><dt>I_CKBAND</dt><dd>See if any messages exist in a band.</dd><dt>I_GETBAND</dt><dd>Get the band of the top message on a STREAM.</dd><dt>I_CANPUT</dt><dd>Is a band writable?</dd><dt>I_SETCLTIME</dt><dd>Set close time delay.</dd><dt>I_GETCLTIME</dt><dd>Get close time delay.</dd><dt>I_LINK</dt><dd>Connect two STREAMs.</dd><dt>I_UNLINK</dt><dd>Disconnect two STREAMs.</dd><dt>I_PLINK</dt><dd>Persistently connect two STREAMs.</dd><dt>I_PUNLINK</dt><dd>Dismantle a persistent STREAMS link.</dd></dl><p>At least the following macros shall be defined for use with I_LOOK:</p><dl compact><dt>FMNAMESZ</dt><dd>The minimum size in bytes of the buffer referred to by the <i>arg</i> argument.</dd></dl><p>At least the following macros shall be defined for use with I_FLUSH:</p><dl compact><dt>FLUSHR</dt><dd>Flush read queues.</dd><dt>FLUSHW</dt><dd>Flush write queues.</dd><dt>FLUSHRW</dt><dd>Flush read and write queues.</dd></dl><p>At least the following macros shall be defined for use with I_SETSIG:</p><dl compact><dt>S_RDNORM</dt><dd>A normal (priority band set to 0) message has arrived at the head of a STREAM head read queue.</dd><dt>S_RDBAND</dt><dd>A message with a non-zero priority band has arrived at the head of a STREAM head read queue.</dd><dt>S_INPUT</dt><dd>A message, other than a high-priority message, has arrived at the head of a STREAM head read queue.</dd><dt>S_HIPRI</dt><dd>A high-priority message is present on a STREAM head read queue.</dd><dt>S_OUTPUT</dt><dd>The write queue for normal data (priority band 0) just below the STREAM head is no longer full. This notifies the process thatthere is room on the queue for sending (or writing) normal data downstream.</dd><dt>S_WRNORM</dt><dd>Equivalent to S_OUTPUT.</dd><dt>S_WRBAND</dt><dd>The write queue for a non-zero priority band just below the STREAM head is no longer full.</dd><dt>S_MSG</dt><dd>A STREAMS signal message that contains the SIGPOLL signal reaches the front of the STREAM head read queue.</dd><dt>S_ERROR</dt><dd>Notification of an error condition reaches the STREAM head.</dd><dt>S_HANGUP</dt><dd>Notification of a hangup reaches the STREAM head.</dd><dt>S_BANDURG</dt><dd>When used in conjunction with S_RDBAND, SIGURG is generated instead of SIGPOLL when a priority message reaches the front of theSTREAM head read queue.</dd></dl><p>At least the following macros shall be defined for use with I_PEEK:</p><dl compact><dt>RS_HIPRI</dt><dd>Only look for high-priority messages.</dd></dl><p>At least the following macros shall be defined for use with I_SRDOPT:</p><dl compact><dt>RNORM</dt><dd>Byte-STREAM mode, the default.</dd><dt>RMSGD</dt><dd>Message-discard mode.</dd><dt>RMSGN</dt><dd>Message-non-discard mode.</dd><dt>RPROTNORM</dt><dd>Fail <a href="../functions/read.html"><i>read</i>()</a> with [EBADMSG] if a message containing a control part is at the frontof the STREAM head read queue.</dd><dt>RPROTDAT</dt><dd>Deliver the control part of a message as data when a process issues a <a href="../functions/read.html"><i>read</i>()</a>.</dd><dt>RPROTDIS</dt><dd>Discard the control part of a message, delivering any data part, when a process issues a <a href="../functions/read.html"><i>read</i>()</a>.</dd></dl><p>At least the following macros shall be defined for use with I_SWOPT:</p><dl compact><dt>SNDZERO</dt><dd>Send a zero-length message downstream when a <a href="../functions/write.html"><i>write</i>()</a> of 0 bytes occurs.</dd></dl><p>At least the following macros shall be defined for use with I_ATMARK:</p><dl compact><dt>ANYMARK</dt><dd>Check if the message is marked.</dd><dt>LASTMARK</dt><dd>Check if the message is the last one marked on the queue.</dd></dl><p>At least the following macros shall be defined for use with I_UNLINK:</p><dl compact><dt>MUXID_ALL</dt><dd>Unlink all STREAMs linked to the STREAM associated with <i>fildes</i>.</dd></dl><p>The following macros shall be defined for <a href="../functions/getmsg.html"><i>getmsg</i>()</a>, <a href="../functions/getpmsg.html"><i>getpmsg</i>()</a>, <a href="../functions/putmsg.html"><i>putmsg</i>()</a>, and <a href="../functions/putpmsg.html"><i>putpmsg</i>()</a>:</p><dl compact><dt>MSG_ANY</dt><dd>Receive any message.</dd><dt>MSG_BAND</dt><dd>Receive message from specified band.</dd><dt>MSG_HIPRI</dt><dd>Send/receive high-priority message.</dd><dt>MORECTL</dt><dd>More control information is left in message.</dd><dt>MOREDATA</dt><dd>More data is left in message.</dd></dl><p>The <i><stropts.h></i> header may make visible all of the symbols from <a href="../basedefs/unistd.h.html"><i><unistd.h></i></a>.</p><p>The following shall be declared as functions and may also be defined as macros. Function prototypes shall be provided.</p><pre><tt>int isastream(int);int getmsg(int, struct strbuf *restrict, struct strbuf *restrict, int *restrict);int getpmsg(int, struct strbuf *restrict, struct strbuf *restrict, int *restrict, int *restrict);int ioctl(int, int, ... );int putmsg(int, const struct strbuf *, const struct strbuf *, int);int putpmsg(int, const struct strbuf *, const struct strbuf *, int, int);int fattach(int, const char *);int fdetach(const char *);</tt></pre></blockquote><hr><div class="box"><em>The following sections are informative.</em></div><h4><a name="tag_13_53_04"></a>APPLICATION USAGE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_13_53_05"></a>RATIONALE</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_13_53_06"></a>FUTURE DIRECTIONS</h4><blockquote><p>None.</p></blockquote><h4><a name="tag_13_53_07"></a>SEE ALSO</h4><blockquote><p><a href="sys/types.h.html"><i><sys/types.h></i></a> , <a href="unistd.h.html"><i><unistd.h></i></a> , the SystemInterfaces volume of IEEE Std 1003.1-2001, <a href="../functions/close.html"><i>close</i>()</a>, <a href="../functions/fcntl.html"><i>fcntl</i>()</a>, <a href="../functions/getmsg.html"><i>getmsg</i>()</a>, <a href="../functions/ioctl.html"><i>ioctl</i>()</a>, <a href="../functions/open.html"><i>open</i>()</a>, <a href="../functions/pipe.html"><i>pipe</i>()</a>, <a href="../functions/read.html"><i>read</i>()</a>, <a href="../functions/poll.html"><i>poll</i>()</a>, <a href="../functions/putmsg.html"><i>putmsg</i>()</a>, <a href="../functions/signal.html"><i>signal</i>()</a>, <a href="../functions/write.html"><i>write</i>()</a></p></blockquote><h4><a name="tag_13_53_08"></a>CHANGE HISTORY</h4><blockquote><p>First released in Issue 4, Version 2.</p></blockquote><h4><a name="tag_13_53_09"></a>Issue 5</h4><blockquote><p>The <i>flags</i> members of the <b>strpeek</b> and <b>strfdinsert</b> structures are changed from <b>type long</b> to<b>t_uscalar_t</b>.</p></blockquote><h4><a name="tag_13_53_10"></a>Issue 6</h4><blockquote><p>This header is marked as part of the XSI STREAMS Option Group.</p><p>The <b>restrict</b> keyword is added to the prototypes for <a href="../functions/getmsg.html"><i>getmsg</i>()</a> and <a href="../functions/getpmsg.html"><i>getpmsg</i>()</a>.</p></blockquote><div class="box"><em>End of informative text.</em></div><hr><hr size="2" noshade><center><font size="2"><!--footer start-->UNIX ® is a registered Trademark of The Open Group.<br>POSIX ® is a registered Trademark of The IEEE.<br>[ <a href="../mindex.html">Main Index</a> | <a href="../basedefs/contents.html">XBD</a> | <a href="../utilities/contents.html">XCU</a> | <a href="../functions/contents.html">XSH</a> | <a href="../xrat/contents.html">XRAT</a>]</font></center><!--footer end--><hr size="2" noshade></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -