opnsense-ports/sysutils/mcelog/files/patch-eventloop.c
Franco Fichtner 8cb1a96ede ports: pull in a snapshot of the FreeBSD ports tree
Taken from:	https://github.com/freebsd/freebsd-ports.git
Commit id:	5070672073b68be364139bc6b3a89100bd17d331
2014-11-09 14:03:21 +01:00

46 lines
1 KiB
C

--- eventloop.c.orig 2010-01-20 18:36:52.000000000 -0800
+++ eventloop.c 2012-09-22 02:25:13.281116126 -0700
@@ -38,7 +38,9 @@
static struct pollfd pollfds[MAX_POLLFD];
static struct pollcb pollcbs[MAX_POLLFD];
+#ifdef __Linux__
static sigset_t event_sigs;
+#endif
static int closeonexec(int fd)
{
@@ -97,6 +99,7 @@
}
/* Run signal handler only directly after event loop */
+#ifdef __Linux__
int event_signal(int sig)
{
static int first = 1;
@@ -126,17 +129,25 @@
static int (*ppoll_vec)(struct pollfd *, nfds_t, const struct timespec
*, const sigset_t *);
+#endif
void eventloop(void)
{
+#ifdef __Linux__
#if __GLIBC__ == 2 && __GLIBC_MINOR__ >= 5 || __GLIBC__ > 2
ppoll_vec = ppoll;
#endif
if (!ppoll_vec)
ppoll_vec = ppoll_fallback;
+#endif
for (;;) {
+#ifdef __Linux__
int n = ppoll_vec(pollfds, max_pollfd, NULL, &event_sigs);
+#endif
+#ifdef __FreeBSD__
+ int n = poll(pollfds, max_pollfd, -1);
+#endif
if (n <= 0) {
if (n < 0 && errno != EINTR)
SYSERRprintf("poll error");