swhkd icon indicating copy to clipboard operation
swhkd copied to clipboard

tests: create memory backed file in ram to do the file tests

Open EdenQwQ opened this issue 3 years ago • 2 comments

This can be done with fnctl, memfd_create or other libc syscalls

EdenQwQ avatar Jun 02 '22 11:06 EdenQwQ

Is that really necessary?

Both the Filesystem Hierarchy Standard and POSIX mandate that /tmp exists. I think that on most Linux distributions, it is also a tmpfs mount where everything is kept in memory (or swap if needed). While I could not find any documentation stating that /tmp must be a tmpfs mount, I think it is rather safe to assume it is.

To be safer, we could use a dedicated temporary file crate (e.g. https://github.com/Stebalien/tempfile) which uses specific system calls internally to create temporary files.

ajanon avatar Oct 07 '22 08:10 ajanon

Is that really necessary?

Not really, just a nice-to-have.

Both the Filesystem Hierarchy Standard and POSIX mandate that /tmp exists. I think that on most Linux distributions, it is also a tmpfs mount where everything is kept in memory (or swap if needed). While I could not find any documentation stating that /tmp must be a tmpfs mount, I think it is rather safe to assume it is.

To be safer, we could use a dedicated temporary file crate (e.g. https://github.com/Stebalien/tempfile) which uses specific system calls internally to create temporary files.

Shinyzenith avatar Oct 07 '22 09:10 Shinyzenith