MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / SetupSignals

Function SetupSignals

Source/Tools/FEXServer/Main.cpp:82–102  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80void ActionIgnore(int sig, siginfo_t* info, void* context) {}
81
82void SetupSignals() {
83 // Setup our signal handlers now so we can capture some events
84 struct sigaction act {};
85 act.sa_sigaction = ActionHandler;
86 act.sa_flags = SA_SIGINFO;
87
88 // SIGTERM if something is trying to terminate us
89 sigaction(SIGTERM, &act, nullptr);
90 // SIGINT if something is trying to terminate us
91 sigaction(SIGINT, &act, nullptr);
92
93 // SIGUSR1 just to interrupt syscalls
94 act.sa_sigaction = ActionIgnore;
95 sigaction(SIGUSR1, &act, nullptr);
96
97 // Ignore SIGPIPE, we will be checking for pipe closure which could send this signal
98 signal(SIGPIPE, SIG_IGN);
99 // Reset SIGCHLD which is likely SIG_IGN if FEXInterpreter started the server.
100 // We now wait for child processes with waitpid, newer libfuse also requires SIGCHLD to not be ignored by child processes.
101 signal(SIGCHLD, SIG_DFL);
102}
103
104/**
105 * @brief Deparents itself by forking and terminating the parent process.

Callers 1

mainFunction · 0.85

Calls 1

sigactionClass · 0.70

Tested by

no test coverage detected