summaryrefslogtreecommitdiffstats
path: root/openbsd-compat/bsd-poll.h
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@dtucker.net>2021-11-18 23:11:37 +1100
committerDarren Tucker <dtucker@dtucker.net>2021-11-18 23:11:37 +1100
commit21dd5a9a3fb35e8299a1fbcf8d506f1f6b752b85 (patch)
tree091ced589ec4131cfaad1851592b28a6ebc4cc5c /openbsd-compat/bsd-poll.h
parentb544ce1ad4afb7ee2b09f714aa63efffc73fa93a (diff)
Add compat implementation of ppoll using pselect.
Diffstat (limited to 'openbsd-compat/bsd-poll.h')
-rw-r--r--openbsd-compat/bsd-poll.h25
1 files changed, 21 insertions, 4 deletions
diff --git a/openbsd-compat/bsd-poll.h b/openbsd-compat/bsd-poll.h
index 8420ca1d..73acd3c1 100644
--- a/openbsd-compat/bsd-poll.h
+++ b/openbsd-compat/bsd-poll.h
@@ -27,18 +27,24 @@
/* OPENBSD ORIGINAL: sys/sys/poll.h */
-#if !defined(HAVE_POLL) && !defined(HAVE_POLL_H)
#ifndef _COMPAT_POLL_H_
#define _COMPAT_POLL_H_
+#include <sys/types.h>
+#ifdef HAVE_POLL_H
+# include <poll.h>
+#endif
+#ifdef HAVE_SYS_POLL_H
+# include <sys/poll.h>
+#endif
+
+#ifndef HAVE_STRUCT_POLLFD_FD
typedef struct pollfd {
int fd;
short events;
short revents;
} pollfd_t;
-typedef unsigned int nfds_t;
-
#define POLLIN 0x0001
#define POLLOUT 0x0004
#define POLLERR 0x0008
@@ -55,7 +61,18 @@ typedef unsigned int nfds_t;
#endif
#define INFTIM (-1) /* not standard */
+#endif /* !HAVE_STRUCT_POLLFD_FD */
+
+#ifndef HAVE_NFDS_T
+typedef unsigned int nfds_t;
+#endif
+#ifndef HAVE_POLL
int poll(struct pollfd *, nfds_t, int);
+#endif
+
+#ifndef HAVE_PPOLL
+int ppoll(struct pollfd *, nfds_t, const struct timespec *, const sigset_t *);
+#endif
+
#endif /* !_COMPAT_POLL_H_ */
-#endif /* !HAVE_POLL_H */