*/
static void epoll_init_ctx(struct std_event_context *std_ev)
{
+ unsigned v;
+
std_ev->epoll_fd = epoll_create(64);
+
+ /* on exec, don't inherit the fd */
+ v = fcntl(std_ev->epoll_fd, F_GETFD, 0);
+ fcntl(std_ev->epoll_fd, F_SETFD, v | FD_CLOEXEC);
+
std_ev->pid = getpid();
talloc_set_destructor(std_ev, epoll_ctx_destructor);
}
static void epoll_check_reopen(struct std_event_context *std_ev)
{
struct fd_event *fde;
+ unsigned v;
if (std_ev->pid == getpid()) {
return;
DEBUG(0,("Failed to recreate epoll handle after fork\n"));
return;
}
+
+ /* on exec, don't inherit the fd */
+ v = fcntl(std_ev->epoll_fd, F_GETFD, 0);
+ fcntl(std_ev->epoll_fd, F_SETFD, v | FD_CLOEXEC);
+
std_ev->pid = getpid();
for (fde=std_ev->fd_events;fde;fde=fde->next) {
epoll_add_event(std_ev, fde);