summaryrefslogtreecommitdiffhomepage
path: root/src/mypoll.h
blob: 87360156edebb1146e1abfdf3d600caf8d63de7d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef MYPOLL_H
#define MYPOLL_H

#include "config.h"

#ifdef HAVE_POLL_H
#define SELECT_OR_POLL "poll"

#include <poll.h>
typedef struct pollfd pollfd_struct;

#define MYPOLL_READ POLLIN
#define MYPOLL_WRITE POLLOUT

#else

#define SELECT_OR_POLL "select"
#include <sys/select.h>
typedef struct mypollfd {
	int   fd;
	short events;
	short revents;
} pollfd_struct;

#define MYPOLL_READ (1<<1)
#define MYPOLL_WRITE (1<<2)
#endif

int mypoll(pollfd_struct* fds, int nfds, int timeout);

#endif