mirror of
https://github.com/pinnacle-comp/pinnacle.git
synced 2024-12-25 09:59:21 +01:00
Set sysinfo
's open files limit to 0
This commit is contained in:
parent
e2a8f8ebfe
commit
32b8c0dd30
2 changed files with 10 additions and 2 deletions
|
@ -437,7 +437,7 @@ impl State {
|
||||||
self.loop_handle
|
self.loop_handle
|
||||||
.insert_source(grpc_receiver, |msg, _, data| match msg {
|
.insert_source(grpc_receiver, |msg, _, data| match msg {
|
||||||
Event::Msg(f) => f(&mut data.state),
|
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");
|
.expect("failed to insert grpc_receiver into loop");
|
||||||
|
|
||||||
|
|
10
src/main.rs
10
src/main.rs
|
@ -86,13 +86,21 @@ async fn main() -> anyhow::Result<()> {
|
||||||
let args = Args::parse();
|
let args = Args::parse();
|
||||||
|
|
||||||
if Uid::effective().is_root() && !args.allow_root {
|
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(());
|
return Ok(());
|
||||||
}
|
}
|
||||||
|
|
||||||
let in_graphical_env =
|
let in_graphical_env =
|
||||||
std::env::var("WAYLAND_DISPLAY").is_ok() || std::env::var("DISPLAY").is_ok();
|
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) {
|
match (args.backend.winit, args.backend.udev, args.force) {
|
||||||
(false, false, _) => {
|
(false, false, _) => {
|
||||||
if in_graphical_env {
|
if in_graphical_env {
|
||||||
|
|
Loading…
Reference in a new issue