projects
/
prosody.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
884ef2b
)
util.pposix: Ask for shared file descriptor table using rfork() on *BSD (fixes #412)
author
Kim Alvefur
<zash@zash.se>
Wed, 25 May 2016 19:34:34 +0000
(21:34 +0200)
committer
Kim Alvefur
<zash@zash.se>
Wed, 25 May 2016 19:34:34 +0000
(21:34 +0200)
util-src/pposix.c
patch
|
blob
|
history
diff --git
a/util-src/pposix.c
b/util-src/pposix.c
index 1b69852d2a703cacf2619adeffe821ad5ddb3b94..b48465d3a75461bd6a9ee216fbace132d81e647c 100644
(file)
--- a/
util-src/pposix.c
+++ b/
util-src/pposix.c
@@
-49,6
+49,19
@@
#define WITH_MALLINFO
#endif
#define WITH_MALLINFO
#endif
+#if defined(RFPROC) && defined(EV_SET)
+/*
+ * On *BSD, calling fork() is equivalent to rfork(RFPROC | RFFDG).
+ *
+ * RFFDG being set means that the file descriptor table is copied,
+ * otherwise it's shared. We want the later, otherwise libevent gets
+ * messed up.
+ *
+ * See issue #412
+ */
+#define fork() rfork(RFPROC)
+#endif
+
/* Daemonization support */
static int lc_daemonize(lua_State* L) {
/* Daemonization support */
static int lc_daemonize(lua_State* L) {