Git Product home page Git Product logo

rctl's Introduction

rctl

FreeBSD resource limits and accounting with RCTL / RACCT

Build Status Code Coverage Crates.io GitHub last commit Gitter Libraries.io for releases Crates.io Crates.io FOSSA Status

Is it any good?

Yes.

Can I use it?

This library is still under heavy development, but seems to work so far. No stability guarantees are made.

License

FOSSA Status

rctl's People

Contributors

dependabot-preview[bot] avatar dependabot-support avatar fabianfreyer avatar fossabot avatar igalic avatar phyber avatar pkubaj avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rctl's Issues

Needs repository link in Cargo.toml

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.

Fails to build on arm / ppc architectures

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`

FreeBSD 13 breaks the RACCT check

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.

`users` crate is unmaintained

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

RUSTSEC-2020-0036: failure is officially deprecated/unmaintained

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.

Spurious test failures: user lookups not stable

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.

Released version on crates.io does not support FreeBSD 13

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.