Make post-fs-data scripts block at most 35 secs

This commit is contained in:
topjohnwu
2020-12-17 16:54:53 -08:00
parent 086059ec30
commit eee7f097e3
5 changed files with 92 additions and 29 deletions

View File

@@ -1,6 +1,3 @@
/* misc.cpp - Store all functions that are unable to be catagorized clearly
*/
#include <sys/types.h>
#include <sys/wait.h>
#include <sys/prctl.h>
@@ -20,17 +17,16 @@
using namespace std;
int fork_dont_care() {
int pid = xfork();
if (pid) {
if (int pid = xfork()) {
waitpid(pid, nullptr, 0);
return pid;
} else if ((pid = xfork())) {
} else if (xfork()) {
exit(0);
}
return 0;
}
int fork_no_zombie() {
int fork_no_orphan() {
int pid = xfork();
if (pid)
return pid;

View File

@@ -67,7 +67,7 @@ int new_daemon_thread(std::function<void()> &&entry);
bool ends_with(const std::string_view &s1, const std::string_view &s2);
int fork_dont_care();
int fork_no_zombie();
int fork_no_orphan();
int strend(const char *s1, const char *s2);
void init_argv0(int argc, char **argv);
void set_nice_name(const char *name);