#sys #systemd

sys libsystemd-sys

FFI bindings to libsystemd and libelogind

13 unstable releases (4 breaking)

0.6.0 Sep 7, 2020
0.2.2 Oct 24, 2018
0.2.1 Feb 1, 2018
0.1.0 May 15, 2017
0.0.1 Feb 27, 2015
Download history 758/week @ 2020-05-30 507/week @ 2020-06-06 530/week @ 2020-06-13 589/week @ 2020-06-20 404/week @ 2020-06-27 546/week @ 2020-07-04 454/week @ 2020-07-11 361/week @ 2020-07-18 361/week @ 2020-07-25 297/week @ 2020-08-01 354/week @ 2020-08-08 414/week @ 2020-08-15 557/week @ 2020-08-22 646/week @ 2020-08-29 462/week @ 2020-09-05 532/week @ 2020-09-12

1,937 downloads per month
Used in 15 crates (3 directly)

LGPL-2.1+

62KB
1.5K SLoC

rust-systemd

Documentation Crates.io Clippy Linting Result Build Status

In Cargo.toml:

[dependencies]
systemd = "~0.4"

Or

[dependencies]
systemd = { git = "https://github.com/jmesmon/rust-systemd" }

journal

Journal sending is supported, and systemd::journal::Journal is a (low functionality) wrapper around the read API.

An example of the journal writing api:

#[macro_use] extern crate log;
#[macro_use] extern crate systemd;
use systemd::journal;

fn main() {
   use systemd::journal;
   journal::print(1, &format!("Rust can talk to the journal: {:?}",
                             4));
   journal::send(["CODE_FILE=HI", "CODE_LINE=1213", "CODE_FUNCTION=LIES"]);
   journal::JournalLog::init().unwrap();
   warn!("HI");
   sd_journal_log!(4, "HI {:?}", 2);
}

daemon

The daemon API mostly offers tools for working with raw filehandles passed to the process by systemd on socket activation. Since raw filehandles are not well supported in Rust, it's likely these functions will mostly be helpful in managing program flow; actual socket code will have to use the libc crate.

Dependencies

~31KB