Fixed -exec{}: dup()"d file descriptor was being closed before the process could access it. Fixed -exec (hack ver.): Ditto.Avril2023-03-02 16:42:18 +0000
Made -exec (stdin ver) work via piping hack (XXX: We need to find how to pass file directly.) (TODO: -exec{} still doesn"t work: `No such file or directory` error when accessing /dev/fd/{fd} *and* /proc/{pid}/{fd}?? Idk why...Avril2023-03-02 08:50:51 +0000
Chenged return type of `spawn_from_sync()` to be an iterator of `Result<Option<i32>>` so the caller can decide what to do if the child terminates without an exit code. Also changed to `eyre::Result<>` to report the specific failure and child process" index.Avril2023-03-01 06:37:53 +0000
Prepared or replacing return type from directly normal operation `Options` to `enum Mode`, which will facilitate returning a `--help` or other special mode case. We can use `impl From<Options> for Mode` and work with this to make the migration of return types easier.Avril2022-08-13 00:31:51 +0100
args: Added visitor-pattern argument parsing. Fixed bug in `try_parse_for!()` which `continue`d on the wrong branch. Improved specific and general error messages regarding arguments. Parsing for `-exec/{}` works! A correct `Options` struct is produced, edge-and error- cases are handled correctly with informative messages (TODO: Implement `--help`.)Avril2022-08-13 00:21:10 +0100
main: Added `parse_args()`: Parses args, converts error to eyre::Report, and adds section for suggestion (TODO: Implement `--help`) and section on which args existed.Avril2022-08-12 21:58:25 +0100
args: Added `parse_args()`: Attempt to parse the program args into `Options` struct. Added `ArgParseError`, error describing why parsing arguments failed. Added `EXEC_MODE_STRING_TERMINATOR` the terminator used when deciding when to stop parsing an arglist for `-exec/{}`. Added `program_name()`, returns the current executable"s name as a UTF8 string, if the executable"s name was not a UTF8 string, then it is lossily converted to one and invalid characters are replaced.Avril2022-08-11 23:18:37 +0100
Added fmt::Display impl for ExecMode that quotes/escapes command or args if needed uses the `POSITIONAL_ARG_STRING` for positional arguments.Avril2022-08-11 22:39:06 +0100
Attempted to add new feature flag: `memfile-size-output`: Which will pre- or post- set the size of `stdout` to the correct buffer size, allowing consumers of `collect`"s stdout pipe to know the size just like a file. However, `ftruncate()` always fails on stdout. Before re-enabling the feature, we must find out how to set the size of a pipe, if/when you even can, and what syscall(s) you need to do it with.Avril2022-05-22 23:21:33 +0100
TODO: Find out how to set the length of stdout if possible, so that the consumer of `collect` in a pipeline need only use one syscall splice() to read all the collected data at once, like a file.Avril2022-05-21 04:26:21 +0100
memfile::hp: Changed `get_masks()` to return an iterator of `SizedMask` instead of just `Mask` to retain the size of the huge-page itself in bytes (for `ftruncate()` calls, and `mmap()` calls.)
hugetlb
Avril2022-05-21 04:11:28 +0100
Using huge-pages for this is folly from the start: For one, we never actually map the fallocate()"d memory. And two... hugetlbfs does not support write()s in any way, splice()s, send_file()s... It only supports read(), and mmap() (its primary use-case...); which isn"t relevant for us.Avril2022-05-21 03:20:04 +0100
It seems creating HUGETLB memory files either just doesn"t work or changes their behaviour so that any (or at least, small arbitrary) writing or fallocate()ing to them fails... Read up on MFD_HUGETLB more then re-do a test like `memfd_create_wrapper()` to find out why... and if it depends on the MAP_HUGE_ mask, and if so, find one that works... (We know when masks are invalid, since the error message is different. The masks collected via `get_masks()` *are* valid for this system, they just prevent the fd from being any way useful.)Avril2022-05-20 19:37:56 +0100
memfile::hp: Added `PartialEq` impl for `c_int` (checks `MAP_HUGE` from `.raw()`), and `c_uint` (checks `memfd_create()` useable constant from `.mask()`.)Avril2022-05-18 17:33:01 +0100
memfile::hp: `find_size_bytes()` fixed and tested; should change function to return `eyre::Result<usize>` instead of `Option<usize>` considering how many different failure-paths exist.Avril2022-05-12 21:55:04 +0100
memfile::hp: Added `Mask`: Converts bytes into a suitable `MAP_HUGE_` constant via its `.raw()` method, and a suitable flag for `memfd_create()` via its `.mask()` method.Avril2022-05-11 00:27:59 +0100
memfile: Added `RawFile::try_link_from()`: Analogue to `try_link_to()`. Instrumented and added panicking versions of both functions. Added `clone_from()` impl that uses `try_link_from()` (i.e. `dup2()`)Avril2022-05-02 00:25:43 +0100
Started: `memfile::hp`: `MFD_HUGETLB` can be used when a size is known to exceed into the boundary of a hugepage. Currently in the process of writing function to collect all possible hugepage sizes and generate the correct flag masks for `memfd_create(, MFD_HUGETLB | ...)` for each one; and the smallest one that contains the known size can be used for the `memfd_create()` call (if the size fits any at all.)Avril2022-04-30 22:46:01 +0100
Added TODOs for specific bugs (and impl related ideas for how to go about preventing/warning in the event of `mode-memfd` system OOM) ; moved some RawFd-related functions into a submoduleAvril2022-04-28 21:53:08 +0100