summaryrefslogtreecommitdiffstats
path: root/osdep-darwin.c
diff options
context:
space:
mode:
authorNicholas Marriott <nicholas.marriott@gmail.com>2010-12-30 20:41:08 +0000
committerNicholas Marriott <nicholas.marriott@gmail.com>2010-12-30 20:41:08 +0000
commit436f3b357ee6a960621c319b7904aeed1cccead4 (patch)
treed5ef34bc8cc43d81c3582645b61724ca2200df47 /osdep-darwin.c
parentba89a048edeebb34f03a46b5ecc789655f7d223d (diff)
epoll on Linux is broken with /dev/null so it needs to be disabled.
Instead of adding another BROKEN_* define, move event_init into osdep-*.c.
Diffstat (limited to 'osdep-darwin.c')
-rw-r--r--osdep-darwin.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/osdep-darwin.c b/osdep-darwin.c
index dfa49a48..0d63e7fc 100644
--- a/osdep-darwin.c
+++ b/osdep-darwin.c
@@ -1,4 +1,4 @@
-/* $Id: osdep-darwin.c,v 1.11 2009-05-04 17:58:27 nicm Exp $ */
+/* $Id: osdep-darwin.c,v 1.12 2010-12-30 20:41:07 nicm Exp $ */
/*
* Copyright (c) 2009 Joshua Elsasser <josh@elsasser.org>
@@ -19,11 +19,13 @@
#include <sys/types.h>
#include <sys/sysctl.h>
+#include <event.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
-char *osdep_get_name(int, char *);
+char *osdep_get_name(int, char *);
+struct event_base *osdep_event_init(void);
#define unused __attribute__ ((unused))
@@ -31,7 +33,7 @@ char *
osdep_get_name(int fd, unused char *tty)
{
int mib[4] = { CTL_KERN, KERN_PROC, KERN_PROC_PID, 0 };
- size_t size;
+ size_t size;
struct kinfo_proc kp;
if ((mib[3] = tcgetpgrp(fd)) == -1)
@@ -45,3 +47,15 @@ osdep_get_name(int fd, unused char *tty)
return (strdup(kp.kp_proc.p_comm));
}
+
+struct event_base *
+osdep_event_init(void)
+{
+ /*
+ * On OS X, kqueue and poll are both completely broken and don't
+ * work on anything except socket file descriptors (yes, really).
+ */
+ setenv("EVENT_NOKQUEUE", "1", 1);
+ setenv("EVENT_NOPOLL", "1", 1);
+ return (event_init());
+}