MCPcopy Create free account
hub / github.com/ElementsProject/lightning / daemon_setup

Function daemon_setup

common/daemon.c:125–154  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123#endif
124
125void daemon_setup(const char *argv0,
126 void (*backtrace_print)(const char *fmt, ...),
127 void (*backtrace_exit)(void))
128{
129 common_setup(argv0);
130#if BACKTRACE_SUPPORTED
131 bt_print = backtrace_print;
132 bt_exit = backtrace_exit;
133#if DEVELOPER
134 /* Suppresses backtrace (breaks valgrind) */
135 if (!getenv("LIGHTNINGD_DEV_NO_BACKTRACE"))
136 backtrace_state = backtrace_create_state(argv0, 0, NULL, NULL);
137 add_steal_notifiers(NULL);
138#else
139 backtrace_state = backtrace_create_state(argv0, 0, NULL, NULL);
140#endif
141 crashlog_activate();
142#endif
143
144#if DEVELOPER
145 /* This has significant overhead, so we only enable it if told */
146 if (getenv("LIGHTNINGD_DEV_MEMLEAK"))
147 memleak_init();
148#endif
149
150 /* We handle write returning errors! */
151 signal(SIGPIPE, SIG_IGN);
152
153 io_poll_override(daemon_poll);
154}
155
156void daemon_shutdown(void)
157{

Callers 1

subdaemon_setupFunction · 0.70

Calls 4

common_setupFunction · 0.85
add_steal_notifiersFunction · 0.85
crashlog_activateFunction · 0.85
memleak_initFunction · 0.85

Tested by

no test coverage detected