extern initcall_t __madinit[], __madexit[];
-void common_initialize(void)
+static void common_shutdown(void)
+{
+ for (int i = -1; __madexit[i]; i--) {
+ (*__madexit[i])();
+ }
+}
+
+static void __attribute__((__constructor__,__used__))
+common_initialize(void)
{
if (atexit(common_shutdown)) {
fputs("Cannot hook my atexit function, quitting !\n", stderr);
}
}
-void common_shutdown(void)
-{
- for (int i = -1; __madexit[i]; i--) {
- (*__madexit[i])();
- }
-}
extern sig_atomic_t sighup;
void common_sighandler(int sig);
-void common_initialize(void);
-void common_shutdown(void);
/* daemon.c */
int tcp_listen_nonblock(const struct sockaddr *addr, socklen_t len);