mirror of
https://github.com/containers/youki
synced 2024-06-03 05:16:17 +02:00
add some tracing
Signed-off-by: yihuaf <yihuaf@unkies.org>
This commit is contained in:
parent
545b13da86
commit
c23edc02cc
|
@ -141,9 +141,11 @@ fn check_seccomp(seccomp: &LinuxSeccomp) -> Result<()> {
|
|||
Ok(())
|
||||
}
|
||||
|
||||
#[tracing::instrument(level = "trace", skip(seccomp))]
|
||||
pub fn initialize_seccomp(seccomp: &LinuxSeccomp) -> Result<Option<io::RawFd>> {
|
||||
check_seccomp(seccomp)?;
|
||||
|
||||
tracing::trace!(default_action = ?seccomp.default_action(), errno = ?seccomp.default_errno_ret(), "initializing seccomp");
|
||||
let default_action = translate_action(seccomp.default_action(), seccomp.default_errno_ret())?;
|
||||
let mut ctx =
|
||||
ScmpFilterContext::new_filter(default_action).map_err(|err| SeccompError::NewFilter {
|
||||
|
@ -167,6 +169,7 @@ pub fn initialize_seccomp(seccomp: &LinuxSeccomp) -> Result<Option<io::RawFd>> {
|
|||
|
||||
if let Some(architectures) = seccomp.architectures() {
|
||||
for &arch in architectures {
|
||||
tracing::trace!(?arch, "adding architecture");
|
||||
ctx.add_arch(translate_arch(arch))
|
||||
.map_err(|err| SeccompError::AddArch { source: err, arch })?;
|
||||
}
|
||||
|
@ -228,6 +231,7 @@ pub fn initialize_seccomp(seccomp: &LinuxSeccomp) -> Result<Option<io::RawFd>> {
|
|||
translate_op(arg.op(), arg.value_two()),
|
||||
arg.value(),
|
||||
);
|
||||
tracing::trace!(?name, ?action, ?arg, "add seccomp conditional rule");
|
||||
ctx.add_rule_conditional(action, sc, &[cmp])
|
||||
.map_err(|err| {
|
||||
tracing::error!(
|
||||
|
@ -240,6 +244,7 @@ pub fn initialize_seccomp(seccomp: &LinuxSeccomp) -> Result<Option<io::RawFd>> {
|
|||
}
|
||||
}
|
||||
None => {
|
||||
tracing::trace!(?name, ?action, "add seccomp rule");
|
||||
ctx.add_rule(action, sc).map_err(|err| {
|
||||
tracing::error!(
|
||||
"failed to add seccomp rule: {:?}. Syscall: {name}",
|
||||
|
|
|
@ -70,9 +70,10 @@ pub struct GlobalOpts {
|
|||
// Example in future : '--debug change log level to debug. (default: "warn")'
|
||||
#[clap(long)]
|
||||
pub debug: bool,
|
||||
// Set a consistent behavior like in runc and crun: set log to the last given value
|
||||
/// set the log file to write youki logs to (default is '/dev/stderr')
|
||||
#[clap(short, long, overrides_with("log"))]
|
||||
pub log: Option<PathBuf>,
|
||||
/// set the log format ('text' (default), or 'json') (default: "text")
|
||||
#[clap(long)]
|
||||
pub log_format: Option<String>,
|
||||
/// root directory to store container state
|
||||
|
|
Loading…
Reference in New Issue