chiark / gitweb /
log: make sure generators never log into the journal to avoid activation deadlocks
authorLennart Poettering <lennart@poettering.net>
Tue, 22 May 2012 20:00:37 +0000 (22:00 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 22 May 2012 20:00:37 +0000 (22:00 +0200)
This makes all generators log to kmsg by default.

src/cryptsetup/cryptsetup-generator.c
src/fstab-generator/fstab-generator.c
src/getty-generator/getty-generator.c
src/journal/journald.c
src/rc-local-generator/rc-local-generator.c
src/shared/log.c
src/shared/log.h
src/system-update-generator/system-update-generator.c

index c0b1cf0..7eb122d 100644 (file)
@@ -249,7 +249,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 39af18a..86cbc45 100644 (file)
@@ -503,7 +503,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 13dca7d..b2e4f52 100644 (file)
@@ -104,7 +104,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index 232457a..c429896 100644 (file)
@@ -2774,7 +2774,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_KMSG);
+        log_set_target(LOG_TARGET_SAFE);
         log_set_facility(LOG_SYSLOG);
         log_parse_environment();
         log_open();
index a5987f9..1464c8e 100644 (file)
@@ -91,7 +91,7 @@ int main(int argc, char *argv[]) {
                 return EXIT_FAILURE;
         }
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();
 
index da53098..6a10dc4 100644 (file)
@@ -240,7 +240,7 @@ int log_open(void) {
                 return 0;
         }
 
-        if (log_target != LOG_TARGET_AUTO ||
+        if ((log_target != LOG_TARGET_AUTO && log_target != LOG_TARGET_SAFE) ||
             getpid() == 1 ||
             isatty(STDERR_FILENO) <= 0) {
 
@@ -266,6 +266,7 @@ int log_open(void) {
                 }
 
                 if (log_target == LOG_TARGET_AUTO ||
+                    log_target == LOG_TARGET_SAFE ||
                     log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                     log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                     log_target == LOG_TARGET_KMSG) {
@@ -547,6 +548,7 @@ static int log_dispatch(
 
                 if (k <= 0 &&
                     (log_target == LOG_TARGET_AUTO ||
+                     log_target == LOG_TARGET_SAFE ||
                      log_target == LOG_TARGET_SYSLOG_OR_KMSG ||
                      log_target == LOG_TARGET_JOURNAL_OR_KMSG ||
                      log_target == LOG_TARGET_KMSG)) {
@@ -744,6 +746,7 @@ static const char *const log_target_table[] = {
         [LOG_TARGET_SYSLOG] = "syslog",
         [LOG_TARGET_SYSLOG_OR_KMSG] = "syslog-or-kmsg",
         [LOG_TARGET_AUTO] = "auto",
+        [LOG_TARGET_SAFE] = "safe",
         [LOG_TARGET_NULL] = "null"
 };
 
index b2f5f2a..59d4c00 100644 (file)
@@ -36,6 +36,7 @@ typedef enum LogTarget{
         LOG_TARGET_SYSLOG,
         LOG_TARGET_SYSLOG_OR_KMSG,
         LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
+        LOG_TARGET_SAFE, /* console if stderr is tty, KMSG otherwise */
         LOG_TARGET_NULL,
         _LOG_TARGET_MAX,
         _LOG_TARGET_INVALID = -1
index 30fdbc3..f4e8daf 100644 (file)
@@ -74,7 +74,7 @@ int main(int argc, char *argv[]) {
         if (argc > 1)
                 arg_dest = argv[1];
 
-        log_set_target(LOG_TARGET_AUTO);
+        log_set_target(LOG_TARGET_SAFE);
         log_parse_environment();
         log_open();