📄 selectlib.html
字号:
<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.html"><i>VxWorks Reference Manual : 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><i><a href="./selectLib.html#selectInit">selectInit</a></i>( )</b> - initialize the select facility<br><b><i><a href="./selectLib.html#select">select</a></i>( )</b> - pend on a set of file descriptors<br><b><i><a href="./selectLib.html#selWakeup">selWakeup</a></i>( )</b> - wake up a task pended in <b><i><a href="./selectLib.html#select">select</a></i>( )</b><br><b><i><a href="./selectLib.html#selWakeupAll">selWakeupAll</a></i>( )</b> - wake up all tasks in a <b><i><a href="./selectLib.html#select">select</a></i>( )</b> wake-up list<br><b><i><a href="./selectLib.html#selNodeAdd">selNodeAdd</a></i>( )</b> - add a wake-up node to a <b><i><a href="./selectLib.html#select">select</a></i>( )</b> wake-up list<br><b><i><a href="./selectLib.html#selNodeDelete">selNodeDelete</a></i>( )</b> - find and delete a node from a <b><i><a href="./selectLib.html#select">select</a></i>( )</b> wake-up list<br><b><i><a href="./selectLib.html#selWakeupListInit">selWakeupListInit</a></i>( )</b> - initialize a <b><i><a href="./selectLib.html#select">select</a></i>( )</b> wake-up list<br><b><i><a href="./selectLib.html#selWakeupListLen">selWakeupListLen</a></i>( )</b> - get the number of nodes in a <b><i><a href="./selectLib.html#select">select</a></i>( )</b> wake-up list<br><b><i><a href="./selectLib.html#selWakeupType">selWakeupType</a></i>( )</b> - get the type of a <b><i><a href="./selectLib.html#select">select</a></i>( )</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.The maximum number of file descriptors supported is 256.<p>Applications can use <b><i><a href="./selectLib.html#select">select</a></i>( )</b> with pipes and serial devices, in additionto sockets. Also, <b><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</b> call. However, driver developers should become familiar with theother routines that may be used with <b><i><a href="./selectLib.html#select">select</a></i>( )</b>, if they wish to support the<b><i><a href="./selectLib.html#select">select</a></i>( )</b> mechanism.<p></blockquote><h4>INCLUDE FILES</h4><blockquote><p><b>selectLib.h</b><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="selectInit"></a><p align=right><a href="rtnIndex.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>selectInit</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>selectInit</i>( )</strong> - initialize the select facility</p></blockquote><h4>SYNOPSIS</h4><blockquote><p><pre>void selectInit (void)</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><i><a href="./usrConfig.html#usrRoot">usrRoot</a></i>( )</b>,in <b>usrConfig.c</b>. It installs a task delete hook that cleans up after atask if the task is deleted while pended in <b><i><a href="./selectLib.html#select">select</a></i>( )</b>.<p></blockquote><h4>RETURNS</h4><blockquote><p>N/A</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.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>select</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>select</i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</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, &fdset) FD_CLR(fd, &fdset) FD_ZERO(&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><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</b> will return after the specified time has elapsed, evenif none of the file descriptors are ready.<p>Applications can use <b><i><a href="./selectLib.html#select">select</a></i>( )</b> with pipes and serial devices, in additionto sockets. Also, <b><i><a href="./selectLib.html#select">select</a></i>( )</b> now examines write file descriptors inaddition to read file descriptors; however, exception file descriptorsremain unsupported.<p>Driver developers should consult the <i>VxWorks Programmer's Guide: I/O System </i>for details on writing drivers that will use <b><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</b> routinewas invoked via <b><i><a href="./ioLib.html#ioctl">ioctl</a></i>( )</b>.<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.html"><i>Libraries : Routines</i></a></p></blockquote><h1><i>selWakeup</i>( )</h1> <blockquote></a></blockquote><h4>NAME</h4><blockquote> <p><strong><i>selWakeup</i>( )</strong> - wake up a task pended in <b><i><a href="./selectLib.html#select">select</a></i>( )</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><i><a href="./selectLib.html#select">select</a></i>( )</b>. Once a driver'sFIOSELECT function installs a wake-up node in a device's wake-up list(using <b><i><a href="./selectLib.html#selNodeAdd">selNodeAdd</a></i>( )</b>) and checks to make sure the device is ready, this
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -