aboutsummaryrefslogtreecommitdiff
path: root/log.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-23 12:05:54 +0000
committerOmar Polo <op@omarpolo.com>2021-02-23 13:44:20 +0100
commit376a540764c3778330b4f744031bcdb5c6e73647 (patch)
tree6759a0394fab046aa8e125eb7a3de1bf6fefbb19 /log.c
parentaa627c91fcd7b6d56b9a9864fa89f8fa615ff0d2 (diff)
move log_init & vars to gmid.c, retain logger_main in log.c
this is to let the regression suite compile
Diffstat (limited to 'log.c')
-rw-r--r--log.c35
1 files changed, 3 insertions, 32 deletions
diff --git a/log.c b/log.c
index 6bb84f1..19b72b9 100644
--- a/log.c
+++ b/log.c
@@ -28,12 +28,9 @@
#include <string.h>
#include <syslog.h>
-static struct imsgbuf parent_ibuf, child_ibuf;
static struct event inlog;
-static int logfd;
static void handle_log(int, short, void*);
-static int logger_main(int, struct imsgbuf*);
void
fatal(const char *fmt, ...)
@@ -74,9 +71,9 @@ should_log(int priority)
static inline void
send_log(const char *msg, size_t len)
{
- imsg_compose(&parent_ibuf, 0, 0, 0, -1, msg, len);
+ imsg_compose(&logpibuf, 0, 0, 0, -1, msg, len);
/* XXX: use event_once() */
- imsg_flush(&parent_ibuf);
+ imsg_flush(&logpibuf);
}
static inline void
@@ -267,7 +264,7 @@ handle_log(int fd, short ev, void *d)
}
}
-static int
+int
logger_main(int fd, struct imsgbuf *ibuf)
{
event_init();
@@ -284,29 +281,3 @@ logger_main(int fd, struct imsgbuf *ibuf)
return 0;
}
-
-void
-logger_init(void)
-{
- int p[2];
-
- if (socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC, p) == -1)
- err(1, "socketpair");
-
- switch (fork()) {
- case -1:
- err(1, "fork");
- case 0:
- logfd = p[1];
- close(p[0]);
- setproctitle("logger");
- imsg_init(&child_ibuf, p[1]);
- drop_priv();
- _exit(logger_main(p[1], &child_ibuf));
- default:
- logfd = p[0];
- close(p[1]);
- imsg_init(&parent_ibuf, p[0]);
- return;
- }
-}