Closed ls-1801 closed 8 months ago
the page you are prob? referring to https://nanos.org/thebook lists it under 'unsupported' although it's a bit hard to read and should be cleaned up for readability purposes, no it's not supported right now but I don't see a reason why we couldn't add it
Oh, you are right, I just ctrl+f for memfd_create and totally missed the not-supported header.
I assume it wouldn't be a particularly high priority for anyone except me, so I will just tinker around a bit. Thank you for your quick response!
https://github.com/nanovms/nanos/pull/2005 adds support for the memfd_create syscall. This syscall is implemented in a klib named "shmem" (which depends on another klib named "tmpfs"), so in order to be able to use this functionality, the unikernel image must contain the shmem and tmpfs klibs, as in the following snippet of the Ops configuration file: "Klibs": ["shmem", "tmpfs"]
.
Regarding the example code in the description of this issue, please note that the compiler may reorder instructions, which can make the assert()
fail if the value of data[capacity]
is read before writing the value of data[0]
. In order to avoid this, a volatile variable can be used instead of data
(see for example the code in test/runtime/shmem.c in the above PR).
Hey very cool thank you I will try that!
I am running into issues, where I want to port a ring buffer implementation that uses mmap under the hood to a unikernel.
Here is a minimal working example:
The trace reveals that memfd_create is not a (supported) syscall?
Yet the Nanos Website lists
memfd_create
as a supported syscall. Ifmemfd_create
is not supported, are there workarounds, maybe touching the page table manually?