summary refs log tree commit diff
path: root/src/main.rs
diff options
context:
space:
mode:
authorZach Reizner <zachr@google.com>2017-09-04 15:59:08 -0700
committerchrome-bot <chrome-bot@chromium.org>2017-09-06 14:31:06 -0700
commit1f77a0daa6ee71de17568c34ad924991cb30a3ee (patch)
tree19aa93938c97a2b243aeb58635cc9ee7ac3a39d7 /src/main.rs
parentd0a1fde1c1859a7786c03c0209c83395e89d1184 (diff)
downloadcrosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar.gz
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar.bz2
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar.lz
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar.xz
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.tar.zst
crosvm-1f77a0daa6ee71de17568c34ad924991cb30a3ee.zip
sys_util: use libc's openlog to connect to syslog
By using libc's openlog, we can ensure that the internal state of the
libc syslogger is consistent with the syslog module. Minijail will be
able to print to stderr and the syslog in the same way the logging
macros in crosvm do. The FD the syslog module uses is shared with libc
and via `syslog::get_fds`, jailed processes can inherit the needed FDs
to continue logging.

Now that `sys_log::init()` must be called in single threaded process,
this moves its tests to the list of the serially run ones in
build_test.py.

TEST=./build_test
BUG=None

Change-Id: I8dbc8ebf9d97ef670185259eceac5f6d3d6824ea
Reviewed-on: https://chromium-review.googlesource.com/649951
Commit-Ready: Zach Reizner <zachr@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Jason Clinton <jclinton@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index ee808c9..8f53e1b 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -230,6 +230,13 @@ fn wait_all_children() -> bool {
 }
 
 fn run_config(cfg: Config) -> Result<()> {
+    if cfg.multiprocess {
+        // Printing something to the syslog before entering minijail so that libc's syslogger has a
+        // chance to open files necessary for its operation, like `/etc/localtime`. After jailing,
+        // access to those files will not be possible.
+        info!("crosvm entering multiprocess mode");
+    }
+
     let kernel_image = File::open(cfg.kernel_path.as_path())
         .map_err(|e| Error::OpenKernel(cfg.kernel_path.clone(), e))?;