There are other ways to do this that don't involve tmpfs or write() - see <a href="https://github.com/dimkr/papaw" rel="nofollow">https://github.com/dimkr/papaw</a> and <a href="https://github.com/dimkr/Mirai-Source-Code" rel="nofollow">https://github.com/dimkr/Mirai-Source-Code</a>
Given that Linux now has both file descriptors, and process memory-page ranges, pointing to anonymous allocated memory regions, are they interchangeable?<p>What I mean is:<p>- to go from a memfd to anonymous memory, you can call mmap(2) on the fd<p>- to go from anonymous memory to a memfd, you...?
And when would you want to do that ? Really curious as I fail to see a usecase where the same goal could not be achieve otherwise. But there must be some otherwise the API would not have been introduced i guess.
Oh yeah, I've once discovered this method myself. With execveat() one can even avoid going through procfs.<p>It doesn't work worth shbang-based scripts, though; that just returns ENOENT. Makes sense, I suppose.
A bit off-topic, but their perl code is buggy. fork() returns <i>undef</i> on error, not -1.<p>And you can use '$FH->autoflush(1)' instead of the eye-watering 'select((select($FH), $|=1)[0])'