summaryrefslogtreecommitdiff
path: root/ldpd/ldpe.c
diff options
context:
space:
mode:
authorRenato Westphal <renato@opensourcerouting.org>2017-04-19 16:59:50 -0300
committerRenato Westphal <renato@opensourcerouting.org>2017-06-05 12:23:33 -0300
commitd8292558bde9802b8267deff44dabb87b12b885f (patch)
tree48f4f33c5e0f891a68c4fa408012afb5418aeaac /ldpd/ldpe.c
parent30f35e856608b29c7e4f091c7a22f4a3b4019258 (diff)
ldpd: use synchronous channels for sending log messages
This is necessary to guarantee that all log messages sent from the child processes are received in the parent process right away. Without this patch, when a child process calls fatal() or fatalx(), the log messages don't make it to the parent because the child doesn't have a chance to flush its buffers before exiting. Signed-off-by: Renato Westphal <renato@opensourcerouting.org>
Diffstat (limited to 'ldpd/ldpe.c')
-rw-r--r--ldpd/ldpe.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/ldpd/ldpe.c b/ldpd/ldpe.c
index bd0f9dbd6f..20cc9f7444 100644
--- a/ldpd/ldpe.c
+++ b/ldpd/ldpe.c
@@ -245,6 +245,13 @@ ldpe_imsg_compose_parent(int type, pid_t pid, void *data, uint16_t datalen)
return (imsg_compose_event(iev_main, type, 0, pid, -1, data, datalen));
}
+void
+ldpe_imsg_compose_parent_sync(int type, pid_t pid, void *data, uint16_t datalen)
+{
+ imsg_compose_event(iev_main_sync, type, 0, pid, -1, data, datalen);
+ imsg_flush(&iev_main_sync->ibuf);
+}
+
int
ldpe_imsg_compose_lde(int type, uint32_t peerid, pid_t pid, void *data,
uint16_t datalen)