1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-30 01:15:52 +00:00
freebsd-ports/sysutils/mcelog/files/patch-eventloop.c
Chris Rees fd2c7f38fa Update to 1.0pre3
PR:		ports/171866
Submitted by:	koitsu
2012-09-25 19:30:36 +00:00

47 lines
1.0 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");