| 1 | #ifndef _system_select_h
|
|---|
| 2 | #define _system_select_h
|
|---|
| 3 | /*
|
|---|
| 4 | Unix SMB/CIFS implementation.
|
|---|
| 5 |
|
|---|
| 6 | select system include wrappers
|
|---|
| 7 |
|
|---|
| 8 | Copyright (C) Andrew Tridgell 2004
|
|---|
| 9 |
|
|---|
| 10 | ** NOTE! The following LGPL license applies to the replace
|
|---|
| 11 | ** library. This does NOT imply that all of Samba is released
|
|---|
| 12 | ** under the LGPL
|
|---|
| 13 |
|
|---|
| 14 | This library is free software; you can redistribute it and/or
|
|---|
| 15 | modify it under the terms of the GNU Lesser General Public
|
|---|
| 16 | License as published by the Free Software Foundation; either
|
|---|
| 17 | version 3 of the License, or (at your option) any later version.
|
|---|
| 18 |
|
|---|
| 19 | This library is distributed in the hope that it will be useful,
|
|---|
| 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 22 | Lesser General Public License for more details.
|
|---|
| 23 |
|
|---|
| 24 | You should have received a copy of the GNU Lesser General Public
|
|---|
| 25 | License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|---|
| 26 |
|
|---|
| 27 | */
|
|---|
| 28 |
|
|---|
| 29 | #ifdef HAVE_SYS_SELECT_H
|
|---|
| 30 | #include <sys/select.h>
|
|---|
| 31 | #endif
|
|---|
| 32 |
|
|---|
| 33 | #ifdef HAVE_SYS_EPOLL_H
|
|---|
| 34 | #include <sys/epoll.h>
|
|---|
| 35 | #endif
|
|---|
| 36 |
|
|---|
| 37 | #ifndef SELECT_CAST
|
|---|
| 38 | #define SELECT_CAST
|
|---|
| 39 | #endif
|
|---|
| 40 |
|
|---|
| 41 | #ifdef HAVE_POLL
|
|---|
| 42 |
|
|---|
| 43 | #include <poll.h>
|
|---|
| 44 |
|
|---|
| 45 | #else
|
|---|
| 46 |
|
|---|
| 47 | /* Type used for the number of file descriptors. */
|
|---|
| 48 | typedef unsigned long int nfds_t;
|
|---|
| 49 |
|
|---|
| 50 | /* Data structure describing a polling request. */
|
|---|
| 51 | struct pollfd
|
|---|
| 52 | {
|
|---|
| 53 | int fd; /* File descriptor to poll. */
|
|---|
| 54 | short int events; /* Types of events poller cares about. */
|
|---|
| 55 | short int revents; /* Types of events that actually occurred. */
|
|---|
| 56 | };
|
|---|
| 57 |
|
|---|
| 58 | /* Event types that can be polled for. These bits may be set in `events'
|
|---|
| 59 | to indicate the interesting event types; they will appear in `revents'
|
|---|
| 60 | to indicate the status of the file descriptor. */
|
|---|
| 61 | #define POLLIN 0x001 /* There is data to read. */
|
|---|
| 62 | #define POLLPRI 0x002 /* There is urgent data to read. */
|
|---|
| 63 | #define POLLOUT 0x004 /* Writing now will not block. */
|
|---|
| 64 | #define POLLRDNORM 0x040 /* Normal data may be read. */
|
|---|
| 65 | #define POLLRDBAND 0x080 /* Priority data may be read. */
|
|---|
| 66 | #define POLLWRNORM 0x100 /* Writing now will not block. */
|
|---|
| 67 | #define POLLWRBAND 0x200 /* Priority data may be written. */
|
|---|
| 68 | #define POLLERR 0x008 /* Error condition. */
|
|---|
| 69 | #define POLLHUP 0x010 /* Hung up. */
|
|---|
| 70 | #define POLLNVAL 0x020 /* Invalid polling request. */
|
|---|
| 71 |
|
|---|
| 72 | /* define is in "replace.h" */
|
|---|
| 73 | int rep_poll(struct pollfd *fds, nfds_t nfds, int timeout);
|
|---|
| 74 |
|
|---|
| 75 | #endif
|
|---|
| 76 |
|
|---|
| 77 | #endif
|
|---|