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 543e090d75055a0faf1d35a8fcf0be31ce876330
Author: yukangzhi <[email protected]>
AuthorDate: Thu Jul 30 18:02:41 2026 +0800

    libc/limits: increase LINK_MAX to 128 and fix pathconf
    
    Increase LINK_MAX from _POSIX_LINK_MAX (8) to 128 to allow
    directories to have a reasonable number of subdirectories while
    still enforcing a hard link limit.
    
    Also fix pathconf(_PC_LINK_MAX) to return the actual LINK_MAX
    value instead of the minimum _POSIX_LINK_MAX.
    
    Signed-off-by: yukangzhi <[email protected]>
---
 include/limits.h                | 2 +-
 libs/libc/unistd/lib_pathconf.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/limits.h b/include/limits.h
index 4e8bd5599e4..59357fe83f3 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -208,7 +208,7 @@
 #define ARG_MAX        _POSIX_ARG_MAX
 #define CHILD_MAX      _POSIX_CHILD_MAX
 #define LINE_MAX       _POSIX2_LINE_MAX
-#define LINK_MAX       _POSIX_LINK_MAX
+#define LINK_MAX       128
 #define MAX_CANON      _POSIX_MAX_CANON
 #define MAX_INPUT      _POSIX_MAX_INPUT
 #define NAME_MAX       _POSIX_NAME_MAX
diff --git a/libs/libc/unistd/lib_pathconf.c b/libs/libc/unistd/lib_pathconf.c
index d5630f8953a..e6ccd45f521 100644
--- a/libs/libc/unistd/lib_pathconf.c
+++ b/libs/libc/unistd/lib_pathconf.c
@@ -122,7 +122,7 @@ long fpathconf(int fildes, int name)
         return PATH_MAX;
 
       case _PC_LINK_MAX:
-        return _POSIX_LINK_MAX;
+        return LINK_MAX;
 
       case _PC_NAME_MAX:
         return _POSIX_NAME_MAX;

Reply via email to