Bring poll.h up to conformance with POSIX.1-2001 by adding some

visibility conditionals, adding the nfds_t type, and changing the
poll() prototype a little.  Update the manual to match.
This commit is contained in:
Mike Barcroft 2002-07-08 16:37:35 +00:00
parent 7ed0457457
commit f71e6a5243
2 changed files with 13 additions and 12 deletions

View File

@ -28,7 +28,7 @@
.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.Dd September 7, 1996
.Dd July 8, 2002
.Dt POLL 2
.Os
.Sh NAME
@ -37,10 +37,9 @@
.Sh LIBRARY
.Lb libc
.Sh SYNOPSIS
.In sys/types.h
.In poll.h
.Ft int
.Fn poll "struct pollfd *fds" "unsigned int nfds" "int timeout"
.Fn poll "struct pollfd fds[]" "nfds_t nfds" "int timeout"
.Sh DESCRIPTION
.Fn Poll
examines a set of file descriptors to see if some of them are ready for

View File

@ -31,10 +31,14 @@
#ifndef _SYS_POLL_H_
#define _SYS_POLL_H_
#include <sys/cdefs.h>
/*
* This file is intended to be compatible with the traditional poll.h.
*/
typedef unsigned int nfds_t;
/*
* This structure is passed as an array to poll(2).
*/
@ -63,7 +67,9 @@ struct pollfd {
#define POLLWRBAND 0x0100 /* OOB/Urgent data can be written */
/* General FreeBSD extension (currently only supported for sockets): */
#if __BSD_VISIBLE
#define POLLINIGNEOF 0x2000 /* like POLLIN, except ignore EOF */
#endif
/*
* These events are set if they occur regardless of whether they were
@ -73,6 +79,8 @@ struct pollfd {
#define POLLHUP 0x0010 /* file descriptor was "hung up" */
#define POLLNVAL 0x0020 /* requested events "invalid" */
#if __BSD_VISIBLE
#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\
POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
@ -83,18 +91,12 @@ struct pollfd {
*/
#define INFTIM (-1)
#endif
#ifndef _KERNEL
#include <sys/cdefs.h>
__BEGIN_DECLS
/*
* XXX logically, poll() should be declared in <poll.h>, but SVR4 at
* least has it here in <sys/poll.h>.
* XXX poll() has "unsigned long" nfds on SVR4, not unsigned as on the
* other BSDs.
*/
int poll(struct pollfd *_pfd, unsigned int _nfds, int _timeout);
int poll(struct pollfd _pfd[], nfds_t _nfds, int _timeout);
__END_DECLS
#endif /* !_KERNEL */