On Fri, Aug 27, 2021, 08:52 Nishant Nayan <nayan.nishant2...@gmail.com> wrote:
> I have just started to learn journald and in its main function (in > journald.c) I encountered a function call "log_set_prohibit_ipc(true);" > In systemd source, I can see the declaration in src/basic/log.h:/* > > If turned on, then we'll never use IPC-based logging, * i.e. never log to > syslog or the journal. We'll only * log to stderr, the console or kmsg > */void log_set_prohibit_ipc(bool b); > > I did not get this because Journald not writing to journal itself by > default is strange, isn't it? > What is the reason behind it? > My understanding is that the point isn't to prevent logging to journal, but to prevent logging *through IPC* specifically, i.e. make sure journald doesn't try to create loopback connections to its own sockets. The journald daemon is single-threaded, so if it tries to connect to itself, it'll deadlock. But also if journald wants to log a critical error (e.g. running out of space or something like that), then it can't really *rely* on journal still working... Afaik, messages written to kmsg will be imported back into the journal anyway, but that happens asynchronously so it's fine. >