Closed phiresky closed 3 years ago
The following works correctly:
std::fs::OpenOptions::new()
.read(false)
.write(true)
.open("/proc/sys/vm/drop_caches")?
.write_all(b"3")?;
Nice catch, thanks!
procfs::sys::vm::drop_caches(procfs::sys::vm::DropCache::All)
fails for me with "Permission denied" (even when running as root as needed). The reason I think is that that file cannot be read (sudo cat /proc/sys/vm/drop_caches
shows the same error), only written to (echo 3 | sudo tee /proc/sys/vm/drop_caches
works).