Skip to content

Commit

Permalink
util.pposix: Ask for shared file descriptor table using rfork() on *B…
Browse files Browse the repository at this point in the history
…SD (fixes #412)
  • Loading branch information
Zash committed May 25, 2016
1 parent 884ef2b commit f6d29ba
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions util-src/pposix.c
Expand Up @@ -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) {
Expand Down

0 comments on commit f6d29ba

Please sign in to comment.