You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by "acassis (via GitHub)" <gi...@apache.org> on 2023/06/12 19:27:48 UTC
[GitHub] [nuttx] acassis commented on a diff in pull request #9513: libc: Prefer to implement memfd on top of shm
acassis commented on code in PR #9513:
URL: https://github.com/apache/nuttx/pull/9513#discussion_r1227140152
##########
libs/libc/misc/lib_memfd.c:
##########
@@ -45,7 +45,9 @@
int memfd_create(FAR const char *name, unsigned int flags)
{
-#ifdef CONFIG_FS_TMPFS
+#if defined(CONFIG_FS_SHMFS)
+ return shm_open(name, O_RDWR | flags, 0660);
+#elif defined(CONFIG_FS_TMPFS)
Review Comment:
@xiaoxiang781216 since this patch open the possibility to use memfd with TMPFS only or with SHMFS, it introduced a hidden feature. Users will not know about it because there is not Documentation/ and there is not Kconfig entry to select it correctly.
So users could face an issue when trying to use memfd_create() in protected and kernel modes without knowing there is a solution (enabling CONFIG_FS_SHMFS).
So, maybe we could create an entry and make it enabled by default in Kconfig (I don't like to introduce a new Kconfig entry, but in this case it will be helpful)
```
config LIB_MEMFD
default y
depends on FS_TMPFS
select FS_SHMFS if !CONFIG_BUILD_FLAT
```
What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org