+# call this if you fork() from child
+# Note: we already call this for workers, so it is only required
+# if you fork inside a simple daemon (max_workers == 0).
+sub after_fork_cleanup {
+ my ($self) = @_;
+
+ &$close_daemon_lock($self);
+
+ PVE::INotify::inotify_close();
+
+ for my $sig (qw(CHLD HUP INT TERM QUIT)) {
+ $SIG{$sig} = 'DEFAULT'; # restore default handler
+ # AnyEvent signals only works if $SIG{XX} is
+ # undefined (perl event loop)
+ delete $SIG{$sig}; # so that we can handle events with AnyEvent
+ }
+}
+