Added file sealing for making `-exec/{}` better (esp. for memfile mode.)
Fixed `errors` being shit.
Removed `memfile-preallocate` from `mode-memfile` feature: It is unneeded.
Fortune for collect's current commit: Middle blessing − 中吉
TODO: Should `-exec{} {}` be valid? That is, should we allow the use of `fexecve()` instead of `execve()` in the special case where the command itself of a positional exec is the positional replacement string? This may be useful, but also dangerous and perhaps not possible with a memfd or with a pipe. We"d also need to `ioctl()` set to permissions to RX instead of RO, and any subsequent instances of the replacement string *should probably* be `dup()`"d file-descriptors with -X permission set. Note for later. For now, a warning is ommitted if this is present, explaining to the user that executing the input is not (yet??) supported.
Fortune for collect's current commit: Future small blessing − 末小吉
args::parse_from: Added warning messages as `cold, inline(never)` functions for apparent mis-uses or arguments or possible user mistakes when feature "logging" is enabled; they are no-op `cold, inline(always)` functions when feature "logging" is disabled. They are stored in a function-private module `warnings`.
Fortune for collect's current commit: Half blessing − 半吉
Motivation for this addition is that often shells will run processes in a pipeline in parallel, regardless of if they have any input yet. This leads to a lot of messy `ifne` useage that is unneeded with this option. It also allows for greater efficiency in memfd mode as the process passed the /proc fd can be spawned before the copy to stdout (TODO: behaviour of this still undefined.) and the `memfd_create()` fd can be used instead of tweaking stdout to be used.
This essentially functions the same way as shell process substitution but with an actually complete file; it waits for all input to be collected *before* spawning the process. This can be useful for interactive programs like gpg, which often are not fond of waiting for input and want it all immediately. Programs that map files into memory can also not like being passed pipe fds, in memfd mode, this shouldn"t be a problem, the fd should be shareable immediately with the correct `ioctl()` call (or perhaps even without.)
Fortune for collect's current commit: Small blessing − 小吉
memfile::hp: Switched from `fallocate()` to `ftruncate()`: This system-call actually does allow the size to be set, as long as it is a multiple of the huge-page size used to create it.
memfile:: Added `RawFile::truncate_size()`: Set size using `ftruncate()` instead of `fallocate()`: This difference matters a lot with hugetlbfs-backed FDs.
Fortune for collect's current commit: Blessing − 吉
The branch is merged anyway, just in case any of the extra code used in it can be extracted later.
Fortune for collect's current commit: Future small blessing − 末小吉
This branch will be merged but the `hugetlb` feature flag will be removed.
This matter is now closed.
Fortune for collect's current commit: Future blessing − 末吉
Added (default) feature-flag for `hugetlb`: Will use `memfile::hp` for `memfile` enabled feature.
Added tests for both checked and unchecked `Mask` creation.
Added feature `hugepage-checked-masks`: Use checked `Mask` creation in `get_masks{,_in}()`. Only useful for debugging or for ensuring no invalid values slip past mask creation. Disabled by default and offers not much of an improvement other than a bit more safety (integer arithmatic checking).
Fortune for collect's current commit: Half curse − 半凶
The above is all either `const fn` or checked, and can be bitwise OR"d together, producing a higher `Mask`, or bitwise OR"d with an arbitrary `c_uint` to produce a valid mask for `memfd_create()` (in the latter case, the OR with MFD_HUGETLB is unneeded, as `Mask` applies this itself.)
Fortune for collect's current commit: Blessing − 吉
TODO: This will be a seperate comptime feature: `hugetlb`: Extend `memfile` with the ability to allocate apporpirately sized huge-pages when input size is known to extend into them.
Fortune for collect's current commit: Blessing − 吉