FreeBSD resource limits and accounting with RCTL / RACCT
This library is still under heavy development, but seems to work so far. No stability guarantees are made.
Rust RCTL / RACCT bindings
Home Page: https://crates.io/crates/rctl
License: BSD 3-Clause "New" or "Revised" License
FreeBSD resource limits and accounting with RCTL / RACCT
This library is still under heavy development, but seems to work so far. No stability guarantees are made.
Please add a repository tag in the Cargo.toml file so people can find the source from crates.io. Also, a doc tag would be nice. But you'll have to host the docs on github pages, since docs.rs doesn't do FreeBSD. I find the cargo-release crate to be useful for uploading docs to github pages.
Example when building sysutils/jail_exporter
on FreeBSD CURRENT:
Compiling rctl v0.1.0
Running `/usr/local/bin/rustc --crate-name rctl /wrkdirs/usr/ports/sysutils/jail_exporter/work/jail_exporter-0.13.0/cargo-crates/rctl-0.1.0/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts --crate-type lib --emit=dep-info,metadata,link -C opt-level=2 -C embed-bitcode=no -C metadata=1d9c7872b2b0120b -C extra-filename=-1d9c7872b2b0120b --out-dir /wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps -L dependency=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps --extern failure=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/libfailure-b508c386bd6196a1.rmeta --extern libc=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/liblibc-0447ead7f695c8b6.rmeta --extern nix=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/libnix-38f2d7df06ea5867.rmeta --extern number_prefix=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/libnumber_prefix-d0c620dbe2da14a0.rmeta --extern sysctl=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/libsysctl-7b5bc4fb65b38547.rmeta --extern users=/wrkdirs/usr/ports/sysutils/jail_exporter/work/target/release/deps/libusers-ce3e061f00df82c1.rmeta --cap-lints allow -C linker=cc -C link-arg=-fstack-protector-strong`
error[E0308]: mismatched types
--> /wrkdirs/usr/ports/sysutils/jail_exporter/work/jail_exporter-0.13.0/cargo-crates/rctl-0.1.0/src/lib.rs:1828:51
|
1828 | if unsafe { api(inbuf.as_ptr(), inputlen, outbuf.as_mut_ptr(), outbuf.len()) } != 0 {
| ^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
|
= note: expected raw pointer `*mut u8`
found raw pointer `*mut i8`
error[E0308]: mismatched types
--> /wrkdirs/usr/ports/sysutils/jail_exporter/work/jail_exporter-0.13.0/cargo-crates/rctl-0.1.0/src/lib.rs:1853:42
|
1853 | break Ok(unsafe { CStr::from_ptr(outbuf.as_ptr() as *mut i8) }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u8`, found `i8`
|
= note: expected raw pointer `*const u8`
found raw pointer `*mut i8`
error: aborting due to 2 previous errors
For more information about this error, try `rustc --explain E0308`.
error: could not compile `rctl`
Now that ogham/rust-users#34 was fixed, which caused #1, it may make sense to revert 24a017c.
This appears to be because FreeBSD 13 is now returning a U8
for the value instead of a Uint
. Looking into the kernel source, this is because the variable changed from an int
to a bool
.
I have a branch with a fix for this and I should have a suitable PR later.
cargo-audit reports that the users crate is unmaintained. Also, it suffers from an unaligned read bug. I suggest switching to Nix instead, which I think has all of the required functionality. Nix also dealt with the same unaligned read, IIRC, and fixed it.
Crate: users
Version: 0.11.0
Warning: unmaintained
Title: `users` crate is unmaintained
Date: 2023-06-01
ID: RUSTSEC-2023-0040
URL: https://rustsec.org/advisories/RUSTSEC-2023-0040
Dependency tree:
users 0.11.0
└── rctl 0.2.1-alpha.0
Crate: users
Version: 0.11.0
Warning: unsound
Title: Unaligned read of `*const *const c_char` pointer
Date: 2023-09-10
ID: RUSTSEC-2023-0059
URL: https://rustsec.org/advisories/RUSTSEC-2023-0059
warning: 2 allowed warnings found
failure is officially deprecated/unmaintained
Details | |
---|---|
Status | unmaintained |
Package | failure |
Version | 0.1.8 |
URL | rust-lang-deprecated/failure#347 |
Date | 2020-05-02 |
The failure
crate is officially end-of-life: it has been marked as deprecated
by the former maintainer, who has announced that there will be no updates or
maintenance work on it going forward.
The following are some suggested actively developed alternatives to switch to:
See advisory page for additional details.
The tests fail every once in a while, because the wrong UID is returned when looking up the nobody
user.
The weird thing is, this only seems to happen in cargo test
, but not when filtering out the exact test that fails: cargo test --lib tests::parse_rule
.
Hi,
The current version of rctl
on crates.io does not support FreeBSD 13. It would be great if a new version of the library could be released to fix this issue since we did add FreeBSD 13 support a while ago.
A new tagged version of libjail at the same time would be good as well.
Thanks, and sorry for prodding for a new version here.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.