#if 0 /// UNNEEDED by elogind
static bool upgrade_syslog_to_journal = false;
#endif // 0
+static bool always_reopen_console = false;
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
if (console_fd >= 0)
return 0;
- if (getpid() == 1) {
+ if (always_reopen_console) {
console_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (console_fd < 0)
return console_fd;
}
#endif // 0
-static int log_dispatch(
+int log_dispatch_internal(
int level,
int error,
const char *file,
if (_likely_(LOG_PRI(level) > log_max_level))
return -error;
- return log_dispatch(level, error, file, line, func, NULL, NULL, NULL, NULL, buffer);
+ return log_dispatch_internal(level, error, file, line, func, NULL, NULL, NULL, NULL, buffer);
}
int log_internalv(
vsnprintf(buffer, sizeof(buffer), format, ap);
- return log_dispatch(level, error, file, line, func, NULL, NULL, NULL, NULL, buffer);
+ return log_dispatch_internal(level, error, file, line, func, NULL, NULL, NULL, NULL, buffer);
}
int log_internal(
vsnprintf(b, l, format, ap);
- return log_dispatch(level, error, file, line, func, object_field, object, extra_field, extra, buffer);
+ return log_dispatch_internal(level, error, file, line, func,
+ object_field, object, extra_field, extra, buffer);
}
int log_object_internal(
log_abort_msg = buffer;
- log_dispatch(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer);
+ log_dispatch_internal(level, 0, file, line, func, NULL, NULL, NULL, NULL, buffer);
}
noreturn void log_assert_failed(const char *text, const char *file, int line, const char *func) {
if (!found)
return -error;
- return log_dispatch(level, error, file, line, func, NULL, NULL, NULL, NULL, buf + 8);
+ return log_dispatch_internal(level, error, file, line, func, NULL, NULL, NULL, NULL, buf + 8);
}
int log_set_target_from_string(const char *e) {
return log_struct_internal(
level, error,
file, line, func,
- LOG_MESSAGE_ID(SD_MESSAGE_INVALID_CONFIGURATION),
+ "MESSAGE_ID=" SD_MESSAGE_INVALID_CONFIGURATION_STR,
"CONFIG_FILE=%s", config_file,
"CONFIG_LINE=%u", config_line,
LOG_MESSAGE("%s:%u: %s", config_file, config_line, buffer),
unit_fmt, unit,
NULL);
}
+
+#if 0 /// UNNEEDED by elogind
+void log_set_always_reopen_console(bool b) {
+ always_reopen_console = b;
+}
+#endif // 0