From 32b8c0dd309c01fc84a618d9f1490c9d12db1482 Mon Sep 17 00:00:00 2001 From: Ottatop Date: Mon, 29 Jan 2024 20:46:18 -0600 Subject: [PATCH] Set `sysinfo`'s open files limit to 0 --- src/config.rs | 2 +- src/main.rs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/config.rs b/src/config.rs index 06683d7..cceb124 100644 --- a/src/config.rs +++ b/src/config.rs @@ -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"); diff --git a/src/main.rs b/src/main.rs index c690d90..7623c91 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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 {