Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Too Many Open Files.
use std::io; #[cfg(unix)] fn raise_file_limit() -> io::Result<()> { use libc::{getrlimit, setrlimit, rlimit, RLIMIT_NOFILE}; unsafe { let mut rlim = rlimit { rlim_cur: 0, rlim_max: 0, }; if getrlimit(RLIMIT_NOFILE, &mut rlim) != 0 { return Err(io::Error::last_os_error()); } rlim.rlim_cur = rlim.rlim_max; if setrlimit(RLIMIT_NOFILE, &rlim) != 0 { return Err(io::Error::last_os_error()); } } Ok(()) }
There are no comments on this comment yet.