Surge/netlib: Rust-based power manager and netlink library


#1

Hi all!
I’m currently working on a pet project that should have a similar functionality to acpid, the power manager. I have previously written a project somewhat like this in C but the goal for that was mainly educational and strictly focused on Python integration. I have decided to do things differently in Rust: I’ve created a core netlink socket library to handle generic netlink events and then use this library in the power manager to specifically handle ACPI events.

While this project is mainly for me, if anyone would like to contribute, here are my goals for the power manager:

  • minimal interface and low level access to ACPI events much like acpid
  • ability to load C-like shared library symbols to execute user defined callbacks in compiled languages like Rust and C
  • ability to fork and exec scripts to enable Python and Bash scripts
  • addition of timer threads to enable timed events, something that seems to be lacking in many minimal power managers
  • optional boxed functions to link to in compiled language callbacks for more extensive power management

and for the netlink library:

  • Built on low level but idiomatic Rust interface to netlink
  • Keep the design as close to C socket calls as possible while providing type safety and the necessary abstractions that come with it
  • Also provide a higher level interface for less involved netlink events, most notably a generic incremental parser for netlink packets

The current progress on both of these projects lives here.

I welcome contributions, suggestions, and ideas. While the code is still a bit rough around the edges (my open source projects of course have to wait for Not Work Hours ™), I have a proof of concept for the netlink library low level API and for loading callbacks from C-like libraries on events (thanks to the Rust libloading library which I feel is definitely worth mentioning).

Thanks and hope to bump into you on Github!