tracetool/syslog: add Rust support

The syslog backend needs the syslog function from libc and the LOG_INFO enum
value; they are re-exported as "::trace::syslog" and "::trace::LOG_INFO"
so that device crates do not all have to add the libc dependency, but
otherwise there is nothing special.

Signed-off-by: Tanish Desai <tanishdesai37@gmail.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-ID: <20250929154938.594389-17-pbonzini@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
This commit is contained in:
Tanish Desai 2025-09-29 17:49:38 +02:00 committed by Stefan Hajnoczi
parent 7dbee12742
commit 1461752f0f
6 changed files with 57 additions and 2 deletions

3
rust/Cargo.lock generated
View file

@ -262,6 +262,9 @@ dependencies = [
[[package]]
name = "trace"
version = "0.1.0"
dependencies = [
"libc",
]
[[package]]
name = "unicode-ident"

View file

@ -12,5 +12,8 @@ license.workspace = true
repository.workspace = true
rust-version.workspace = true
[dependencies]
libc = { workspace = true }
[lints]
workspace = true

View file

@ -3,6 +3,10 @@
//! This crate provides macros that aid in using QEMU's tracepoint
//! functionality.
#[doc(hidden)]
/// Re-exported item to avoid adding libc as a dependency everywhere.
pub use libc::{syslog, LOG_INFO};
#[macro_export]
/// Define the trace-points from the named directory (which should have slashes
/// replaced by underscore characters) as functions in a module called `trace`.