MCPcopy Create free account
hub / github.com/PostHog/duckgres / duckgres_crashhandler_install

Function duckgres_crashhandler_install

internal/crashhandler/handler.c:112–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

110}
111
112__attribute__((constructor)) static void duckgres_crashhandler_install(void) {
113 struct sigaction sa;
114 memset(&sa, 0, sizeof(sa));
115 sa.sa_sigaction = duckgres_crash_handler;
116 // SA_ONSTACK: the Go runtime forwards signals while running on the
117 // per-thread alternate signal stack; the handler must be willing to run
118 // there.
119 sa.sa_flags = SA_SIGINFO | SA_ONSTACK;
120 sigemptyset(&sa.sa_mask);
121
122 const int sigs[] = {SIGSEGV, SIGBUS, SIGILL, SIGFPE, SIGABRT};
123 for (size_t i = 0; i < sizeof(sigs) / sizeof(sigs[0]); i++) {
124 sigaction(sigs[i], &sa, NULL);
125 }
126 g_installed = true;
127}
128
129bool duckgres_crashhandler_installed(void) { return g_installed; }

Callers

nothing calls this directly

Calls 1

sigactionClass · 0.85

Tested by

no test coverage detected