⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 selectlib.html

📁 Vxworks API操作系统和驱动程序设计API。压缩的HTML文件
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<html><head><!-- /vobs/wpwr/docs/vxworks/ref/selectLib.html - generated by refgen from selectLib.c --> <title> selectLib </title></head><body bgcolor="#FFFFFF"> <hr><a name="top"></a><p align=right><a href="libIndex.htm"><i>VxWorks API Reference :  OS Libraries</i></a></p></blockquote><h1>selectLib</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>selectLib</strong> - UNIX BSD 4.3 select library </p></blockquote><h4>ROUTINES</h4><blockquote><p><p><b><a href="./selectLib.html#selectInit">selectInit</a>(&nbsp;)</b>  -  initialize the select facility<br><b><a href="./selectLib.html#select">select</a>(&nbsp;)</b>  -  pend on a set of file descriptors<br><b><a href="./selectLib.html#selWakeup">selWakeup</a>(&nbsp;)</b>  -  wake up a task pended in <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b><br><b><a href="./selectLib.html#selWakeupAll">selWakeupAll</a>(&nbsp;)</b>  -  wake up all tasks in a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selNodeAdd">selNodeAdd</a>(&nbsp;)</b>  -  add a wake-up node to a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selNodeDelete">selNodeDelete</a>(&nbsp;)</b>  -  find and delete a node from a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selWakeupListInit">selWakeupListInit</a>(&nbsp;)</b>  -  initialize a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selWakeupListTerm">selWakeupListTerm</a>(&nbsp;)</b>  -  terminate a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selWakeupListLen">selWakeupListLen</a>(&nbsp;)</b>  -  get the number of nodes in a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up list<br><b><a href="./selectLib.html#selWakeupType">selWakeupType</a>(&nbsp;)</b>  -  get the type of a <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> wake-up node<br><p></blockquote><h4>DESCRIPTION</h4><blockquote><p>This library provides a BSD 4.3 compatible <i>select</i> facility to waitfor activity on a set of file descriptors.  <b><a href="./selectLib.html#top">selectLib</a></b> provides a mechanismthat gives a driver the ability to detect pended tasks that are awaitingactivity on the driver's device.  This allows a driver's interrupt serviceroutine to wake up such tasks directly, eliminating the need for polling.<p>Applications can use <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> with pipes and serial devices, in additionto sockets.  Also, <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> examines <i>write</i> file descriptors in additionto <i>read</i> file descriptors; however, exception file descriptors remainunsupported.<p>Typically, application developers need concern themselves only with the<b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> call.  However, driver developers should become familiar with theother routines that may be used with <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b>, if they wish to support the<b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> mechanism.<p>The select facility is included in a system when VxWorks is configuredwith the <b>INCLUDE_SELECT</b> component.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>selectLib.h</b><p></blockquote><h4>SEE ALSO</h4><blockquote><p><p><i>VxWorks Programmer's Guide: I/O System </i><hr><a name="selectInit"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>selectInit(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>selectInit(&nbsp;)</strong> - initialize the select facility</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void selectInit    (    int numFiles              /* maximum number of open files */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine initializes the UNIX BSD 4.3 select facility.  It should becalled only once, and typically is called from the root task, <b><a href="./usrConfig.html#usrRoot">usrRoot</a>(&nbsp;)</b>,in <b>usrConfig.c</b>.  It installs a task create hook such that a select contextis initialized for each task.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A<p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./selectLib.html#top">selectLib</a></b><hr><a name="select"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>select(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>select(&nbsp;)</strong> - pend on a set of file descriptors</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>int select    (    int              width,      /* number of bits to examine from 0 */    fd_set *         pReadFds,   /* read fds */    fd_set *         pWriteFds,  /* write fds */    fd_set *         pExceptFds, /* exception fds (unsupported) */    struct timeval * pTimeOut    /* max time to wait, NULL = forever */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine permits a task to pend until one of a set of file descriptorsbecomes ready.  Three parameters -- <i>pReadFds</i>, <i>pWriteFds</i>, and<i>pExceptFds</i> -- point to file descriptor sets in which each bitcorresponds to a particular file descriptor.   Bits set in the read filedescriptor set (<i>pReadFds</i>) will cause <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> to pend until data isavailable on any of the corresponding file descriptors, while bits set inthe write file descriptor set (<i>pWriteFds</i>) will cause <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> to penduntil any of the corresponding file descriptors become writable.  (The<i>pExceptFds</i> parameter is currently unused, but is provided for UNIX callcompatibility.)<p>The following macros are available for setting the appropriate bitsin the file descriptor set structure:<pre>    FD_SET(fd, &amp;fdset)    FD_CLR(fd, &amp;fdset)    FD_ZERO(&amp;fdset)</pre>If either <i>pReadFds</i> or <i>pWriteFds</i> is NULL, they are ignored.  The<i>width</i> parameter defines how many bits will be examined in the filedescriptor sets, and should be set to either the maximum file descriptorvalue in use plus one, or simply to <b>FD_SETSIZE</b>.  When <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> returns, it zeros out the file descriptor sets, and sets only the bits that correspond to file descriptors that are ready.  The <b>FD_ISSET</b> macro may be used to determine which bits are set.<p>If <i>pTimeOut</i> is NULL, <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> will block indefinitely.  If <i>pTimeOut</i> isnot NULL, but points to a <b>timeval</b> structure with an effective time ofzero, the file descriptors in the file descriptor sets will be polled andthe results returned immediately.  If the effective time value is greaterthan zero, <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> will return after the specified time has elapsed, evenif none of the file descriptors are ready.<p>Applications can use <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> with pipes and serial devices, in additionto sockets.  Also, <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> now examines write file descriptors inaddition to read file descriptors; however, exception file descriptorsremain unsupported.<p>The value for the maximum number of file descriptors configured in thesystem (<b>NUM_FILES</b>) should be less than or equal to the value of <b>FD_SETSIZE</b> (2048).<p>Driver developers should consult the <i>VxWorks Programmer's Guide: I/O System </i>for details on writing drivers that will use <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p><p>The number of file descriptors with activity, 0 if timed out, orERROR if an error occurred when the driver's <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b> routinewas invoked via <b><a href="./ioLib.html#ioctl">ioctl</a>(&nbsp;)</b>.<p></blockquote><h4>ERRNOS</h4><blockquote><p>Possible errnos generated by this routine include:<dl><dt><b>S_selectLib_NO_SELECT_SUPPORT_IN_DRIVER</b><dd>A driver associated with one or more fds does not support <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b>.<dt><b>S_selectLib_NO_SELECT_CONTEXT</b><dd>The task's select context was not initialized at task creation time.<dt><b>S_selectLib_WIDTH_OUT_OF_RANGE</b><dd>The width parameter is greater than the maximum possible fd.</dl><p></blockquote><h4>SEE ALSO</h4><blockquote><p><b><a href="./selectLib.html#top">selectLib</a></b>, <i>VxWorks Programmer's Guide: I/O System</i><hr><a name="selWakeup"></a><p align=right><a href="rtnIndex.htm"><i>OS Libraries :  Routines</i></a></p></blockquote><h1>selWakeup(&nbsp;)</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote>  <p><strong>selWakeup(&nbsp;)</strong> - wake up a task pended in <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b></p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void selWakeup    (    SEL_WAKEUP_NODE * pWakeupNode /* node to wake up */    )</pre></blockquote><h4>DESCRIPTION</h4><blockquote><p>This routine wakes up a task pended in <b><a href="./selectLib.html#select">select</a>(&nbsp;)</b>.  Once a driver's

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -