MongoDB  2.7.0
socket_poll.h
1 
17 #pragma once
18 
19 #ifndef _WIN32
20 # include <sys/poll.h>
21 #else
22 # if defined(NTDDI_VERSION) && ( !defined(NTDDI_VISTA) || ( NTDDI_VERSION < NTDDI_VISTA ) )
23  // These are only defined in winsock2.h on newer windows but we need them everywhere.
24 # define POLLRDNORM 0x0100
25 # define POLLRDBAND 0x0200
26 # define POLLIN (POLLRDNORM | POLLRDBAND)
27 # define POLLPRI 0x0400
28 
29 # define POLLWRNORM 0x0010
30 # define POLLOUT (POLLWRNORM)
31 # define POLLWRBAND 0x0020
32 
33 # define POLLERR 0x0001
34 # define POLLHUP 0x0002
35 # define POLLNVAL 0x0004
36 
37  struct pollfd {
38  SOCKET fd;
39  SHORT events;
40  SHORT revents;
41  };
42 # endif // old windows
43 #endif // ndef _WIN32
44 
45 namespace mongo {
46  bool isPollSupported();
47  int socketPoll(pollfd* fdarray, unsigned long nfds, int timeout);
48 }