+typedef int (*initcall_t)(void);
+typedef void (*exitcall_t)(void);
+
+#define __init __attribute__((__used__,__section__(".mad.init")))
+#define __exit __attribute__((__used__,__section__(".mad.exit")))
+
+#define module_init(fn) static __init initcall_t __init_##fn = fn;
+#define module_exit(fn) static __exit exitcall_t __exit_##fn = fn;
+
+extern sig_atomic_t sigint;
+extern sig_atomic_t sighup;
+
+void common_sighandler(int sig);
+
+int tcp_bind(const struct sockaddr *addr, socklen_t len);
+int tcp_listen(const struct sockaddr *addr, socklen_t len);
+int tcp_listen_nonblock(const struct sockaddr *addr, socklen_t len);
+int accept_nonblock(int fd);
+int xwrite(int fd, const char *s, size_t l);
+
+int daemon_detach(void);
+int drop_privileges(const char *user, const char *group);
+
+int pidfile_open(const char *name);
+int pidfile_refresh(void);
+