#ifdef CONFIG_LINUX
#include <sys/prctl.h>
+#include "qemu/async-teardown.h"
#endif
/*
case QEMU_OPTION_daemonize:
daemonize = 1;
break;
+#if defined(CONFIG_LINUX)
+ case QEMU_OPTION_asyncteardown:
+ init_async_teardown();
+ break;
+#endif
default:
return -1;
}
pid_t pid;
int fds[2];
- if (pipe(fds) == -1) {
+ if (!g_unix_open_pipe(fds, FD_CLOEXEC, NULL)) {
exit(1);
}
close(fds[0]);
daemon_pipe = fds[1];
- qemu_set_cloexec(daemon_pipe);
setsid();
error_report("not able to chdir to /: %s", strerror(errno));
exit(1);
}
- TFR(fd = qemu_open_old("/dev/null", O_RDWR));
+ fd = RETRY_ON_EINTR(qemu_open_old("/dev/null", O_RDWR));
if (fd == -1) {
exit(1);
}