sipxtacklib
Version 3.3
Main Page
Related Pages
Classes
Files
File List
File Members
include
resparse
poll.h
Go to the documentation of this file.
1
/*-
2
* Copyright (c) 1997 Peter Wemm <peter@freebsd.org>
3
* All rights reserved.
4
*
5
* Redistribution and use in source and binary forms, with or without
6
* modification, are permitted provided that the following conditions
7
* are met:
8
* 1. Redistributions of source code must retain the above copyright
9
* notice, this list of conditions and the following disclaimer.
10
* 2. Redistributions in binary form must reproduce the above copyright
11
* notice, this list of conditions and the following disclaimer in the
12
* documentation and/or other materials provided with the distribution.
13
* 3. The name of the author may not be used to endorse or promote products
14
* derived from this software without specific prior written permission.
15
*
16
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
17
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
20
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26
* SUCH DAMAGE.
27
*
28
*
29
*/
30
31
#ifndef _SYS_POLL_H_
32
#define _SYS_POLL_H_
33
34
#ifdef __cplusplus
35
extern
"C"
{
36
#endif
37
38
/*
39
* This file is intended to be compatible with the traditional poll.h.
40
*/
41
42
// In Visual Studio 2008, winsock2.h defines all of these already
43
#if defined(_MSC_VER) && (_MSC_VER < 1400)
44
/*
45
* This structure is passed as an array to poll(2).
46
*/
47
struct
pollfd {
48
int
fd;
/* which file descriptor to poll */
49
short
events;
/* events we are interested in */
50
short
revents;
/* events found on return */
51
};
52
53
/*
54
* Requestable events. If poll(2) finds any of these set, they are
55
* copied to revents on return.
56
* XXX Note that FreeBSD doesn't make much distinction between POLLPRI
57
* and POLLRDBAND since none of the file types have distinct priority
58
* bands - and only some have an urgent "mode".
59
* XXX Note POLLIN isn't really supported in true SVSV terms. Under SYSV
60
* POLLIN includes all of normal, band and urgent data. Most poll handlers
61
* on FreeBSD only treat it as "normal" data.
62
*/
63
#define POLLIN 0x0001
/* any readable data available */
64
#define POLLPRI 0x0002
/* OOB/Urgent readable data */
65
#define POLLOUT 0x0004
/* file descriptor is writeable */
66
#define POLLRDNORM 0x0040
/* non-OOB/URG data available */
67
#define POLLWRNORM POLLOUT
/* no write type differentiation */
68
#define POLLRDBAND 0x0080
/* OOB/Urgent readable data */
69
#define POLLWRBAND 0x0100
/* OOB/Urgent data can be written */
70
71
/*
72
* These events are set if they occur regardless of whether they were
73
* requested.
74
*/
75
#define POLLERR 0x0008
/* some poll error occurred */
76
#define POLLHUP 0x0010
/* file descriptor was "hung up" */
77
#define POLLNVAL 0x0020
/* requested events "invalid" */
78
#endif
79
80
#define POLLSTANDARD (POLLIN|POLLPRI|POLLOUT|POLLRDNORM|POLLRDBAND|\
81
POLLWRBAND|POLLERR|POLLHUP|POLLNVAL)
82
83
/*
84
* FreeBSD extensions: polling on a regular file might return one
85
* of these events (currently only supported on UFS).
86
*/
87
#define POLLEXTEND 0x0200
/* file may have been extended */
88
#define POLLATTRIB 0x0400
/* file attributes may have changed */
89
#define POLLNLINK 0x0800
/* (un)link/rename may have happened */
90
#define POLLWRITE 0x1000
/* file's contents may have changed */
91
92
/*
93
* Request that poll() wait forever.
94
* XXX in SYSV, this is defined in stropts.h, which is not included
95
* by poll.h.
96
*/
97
#define INFTIM (-1)
98
99
#ifndef KERNEL
100
101
/* #include <sys/cdefs.h> */
102
103
/*
104
* XXX logically, poll() should be declared in <poll.h>, but SVR4 at
105
* least has it here in <sys/poll.h>.
106
* XXX poll() has "unsigned long" nfds on SVR4, not unsigned as on the
107
* other BSDs.
108
*/
109
int
poll
(
struct
pollfd *_pfd,
unsigned
_nfds,
int
_timeout);
110
111
#endif
/* !KERNEL */
112
113
#ifdef __cplusplus
114
}
115
#endif
116
117
#endif
/* !_SYS_POLL_H_ */
poll
int poll(struct pollfd *_pfd, unsigned _nfds, int _timeout)
sipXtackLib home page