diff options
author | Kim Alvefur <zash@zash.se> | 2016-05-25 21:34:34 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2016-05-25 21:34:34 +0200 |
commit | 01a15bfbe296ed254b1daae646f07640e389d70d (patch) | |
tree | e96c8b6b433242e16cec14347b6ea16c9a1fed00 /util-src/pposix.c | |
parent | 478e9b9327fe09be13db51d64c8a175a0902789f (diff) | |
download | prosody-01a15bfbe296ed254b1daae646f07640e389d70d.tar.gz prosody-01a15bfbe296ed254b1daae646f07640e389d70d.zip |
util.pposix: Ask for shared file descriptor table using rfork() on *BSD (fixes #412)
Diffstat (limited to 'util-src/pposix.c')
-rw-r--r-- | util-src/pposix.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/util-src/pposix.c b/util-src/pposix.c index 1b69852d..b48465d3 100644 --- a/util-src/pposix.c +++ b/util-src/pposix.c @@ -49,6 +49,19 @@ #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) { |