diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-07-07 00:00:59 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-07-07 00:00:59 +0200 |
commit | 9e58ff9c5c3bd46a796a20fc6c304cdab489f334 (patch) | |
tree | 3bdef2c8802ee1b1deab9729b4f198fdfb2780f1 /src/util.c | |
parent | fa0f4d8a3a640b235f12e9eb998ce726495622c1 (diff) |
manager: optionally print status updates to console on boot
Diffstat (limited to 'src/util.c')
-rw-r--r-- | src/util.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/util.c b/src/util.c index d1120c60a5..4795dbcc6a 100644 --- a/src/util.c +++ b/src/util.c @@ -2627,6 +2627,30 @@ cpu_set_t* cpu_set_malloc(unsigned *ncpus) { } } +void status_vprintf(const char *format, va_list ap) { + char *s = NULL; + int fd = -1; + + assert(format); + + /* This independent of logging, as status messages are + * optional and go exclusively to the console. */ + + if (vasprintf(&s, format, ap) < 0) + goto finish; + + if ((fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC)) < 0) + goto finish; + + write(fd, s, strlen(s)); + +finish: + free(s); + + if (fd >= 0) + close_nointr_nofail(fd); +} + static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime", |