This is an automated email from the ASF dual-hosted git repository.

xiaoxiang781216 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 4d795e0c34af7740a5f879e779e1aad5ecac7902
Author: jingfei <[email protected]>
AuthorDate: Mon Aug 31 20:56:39 2026 +0800

    libc/unistd: Build truncate() and posix_fallocate() unconditionally.
    
    The build gated these two files on CONFIG_DISABLE_MOUNTPOINTS, which
    is not a real Kconfig symbol (the actual one is singular), so the
    condition never took effect while the sources were separately guarded
    by CONFIG_DISABLE_MOUNTPOINT. Both interfaces only rely on ftruncate,
    not on mountpoint support, so remove the config gating from the build
    files and the source guards and always compile them.
    
    Signed-off-by: jingfei <[email protected]>
    Signed-off-by: ganjing <[email protected]>
---
 libs/libc/unistd/CMakeLists.txt        | 4 +---
 libs/libc/unistd/Make.defs             | 2 --
 libs/libc/unistd/lib_posix_fallocate.c | 4 ----
 libs/libc/unistd/lib_truncate.c        | 4 ----
 4 files changed, 1 insertion(+), 13 deletions(-)

diff --git a/libs/libc/unistd/CMakeLists.txt b/libs/libc/unistd/CMakeLists.txt
index 045d02f2844..98f40fff338 100644
--- a/libs/libc/unistd/CMakeLists.txt
+++ b/libs/libc/unistd/CMakeLists.txt
@@ -120,9 +120,7 @@ if(CONFIG_LIBC_EXECFUNCS)
   list(APPEND SRCS lib_execl.c lib_execle.c lib_execv.c lib_execvp.c)
 endif()
 
-if(NOT CONFIG_DISABLE_MOUNTPOINTS)
-  list(APPEND SRCS lib_truncate.c lib_posix_fallocate.c)
-endif()
+list(APPEND SRCS lib_truncate.c lib_posix_fallocate.c)
 
 if(CONFIG_ARCH_HAVE_VFORK OR CONFIG_ARCH_HAVE_FORK)
   list(APPEND SRCS lib_fork.c)
diff --git a/libs/libc/unistd/Make.defs b/libs/libc/unistd/Make.defs
index 55d5704c30e..73c847e20ef 100644
--- a/libs/libc/unistd/Make.defs
+++ b/libs/libc/unistd/Make.defs
@@ -73,9 +73,7 @@ ifeq ($(CONFIG_LIBC_EXECFUNCS),y)
 CSRCS += lib_execl.c lib_execle.c lib_execv.c lib_execvp.c
 endif
 
-ifneq ($(CONFIG_DISABLE_MOUNTPOINTS),y)
 CSRCS += lib_truncate.c lib_posix_fallocate.c
-endif
 
 ifneq ($(CONFIG_ARCH_HAVE_VFORK)$(CONFIG_ARCH_HAVE_FORK),)
 CSRCS += lib_fork.c
diff --git a/libs/libc/unistd/lib_posix_fallocate.c 
b/libs/libc/unistd/lib_posix_fallocate.c
index 6f50ef37b50..8c2d81385a2 100644
--- a/libs/libc/unistd/lib_posix_fallocate.c
+++ b/libs/libc/unistd/lib_posix_fallocate.c
@@ -30,8 +30,6 @@
 
 #include <sys/stat.h>
 
-#ifndef CONFIG_DISABLE_MOUNTPOINT
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -94,5 +92,3 @@ int posix_fallocate(int fd, off_t offset, off_t len)
 
   return 0;
 }
-
-#endif /* !CONFIG_DISABLE_MOUNTPOINT */
diff --git a/libs/libc/unistd/lib_truncate.c b/libs/libc/unistd/lib_truncate.c
index b328e1246a6..a57e7a89ee9 100644
--- a/libs/libc/unistd/lib_truncate.c
+++ b/libs/libc/unistd/lib_truncate.c
@@ -31,8 +31,6 @@
 #include <errno.h>
 #include <assert.h>
 
-#ifndef CONFIG_DISABLE_MOUNTPOINT
-
 /****************************************************************************
  * Public Functions
  ****************************************************************************/
@@ -117,5 +115,3 @@ int truncate(FAR const char *path, off_t length)
   close(fd);
   return ret;
 }
-
-#endif /* !CONFIG_DISABLE_MOUNTPOINT */

Reply via email to