Set sysinfo's open files limit to 0

This commit is contained in:
Ottatop 2024-01-29 20:46:18 -06:00
parent e2a8f8ebfe
commit 32b8c0dd30
2 changed files with 10 additions and 2 deletions

View file

@ -437,7 +437,7 @@ impl State {
self.loop_handle
.insert_source(grpc_receiver, |msg, _, data| match msg {
Event::Msg(f) => f(&mut data.state),
Event::Closed => tracing::debug!("grpc receiver was closed"),
Event::Closed => tracing::error!("grpc receiver was closed"),
})
.expect("failed to insert grpc_receiver into loop");

View file

@ -86,13 +86,21 @@ async fn main() -> anyhow::Result<()> {
let args = Args::parse();
if Uid::effective().is_root() && !args.allow_root {
println!("You are trying to run Pinnacle as root.\nThis is NOT recommended.\nTo run Pinnacle as root, pass in the --allow-root flag. Again, this is NOT recommended.");
tracing::warn!("You are trying to run Pinnacle as root.");
tracing::warn!("This is NOT recommended.");
tracing::warn!("To run Pinnacle as root, pass in the --allow-root flag.");
tracing::warn!("Again, this is NOT recommended.");
return Ok(());
}
let in_graphical_env =
std::env::var("WAYLAND_DISPLAY").is_ok() || std::env::var("DISPLAY").is_ok();
if !sysinfo::set_open_files_limit(0) {
tracing::warn!("Unable to set `sysinfo`'s open files limit to 0.");
tracing::warn!("You may see LOTS of file descriptors open under Pinnacle.");
}
match (args.backend.winit, args.backend.udev, args.force) {
(false, false, _) => {
if in_graphical_env {