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 66ac05acd897c32b652c90b3df01d08220c8a389
Author: Marco Casaroli <[email protected]>
AuthorDate: Fri Oct 23 14:44:04 2026 +0200

    libs/libc/unistd: Make HOST_NAME_MAX a configuration option.
    
    HOST_NAME_MAX was fixed at 32, below the 255 that POSIX requires
    (_POSIX_HOST_NAME_MAX).  A system that needs longer host names could
    not have them.
    
    Add CONFIG_HOST_NAME_MAX, next to CONFIG_NAME_MAX and CONFIG_PATH_MAX,
    with the default 32, so nothing changes unless a configuration sets
    it.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <[email protected]>
---
 include/limits.h         | 2 +-
 libs/libc/unistd/Kconfig | 8 ++++++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/include/limits.h b/include/limits.h
index cbdbcb5c974..fd0922d5a1f 100644
--- a/include/limits.h
+++ b/include/limits.h
@@ -286,7 +286,7 @@
 
 #define IOV_MAX        INT_MAX
 
-#define HOST_NAME_MAX  32
+#define HOST_NAME_MAX  CONFIG_HOST_NAME_MAX
 
 /* ptrdiff_t limits */
 
diff --git a/libs/libc/unistd/Kconfig b/libs/libc/unistd/Kconfig
index be16a529ef5..4ef3cf7886f 100644
--- a/libs/libc/unistd/Kconfig
+++ b/libs/libc/unistd/Kconfig
@@ -111,6 +111,14 @@ config LIBC_HOSTNAME
        ---help---
                A unique name to identify device on the network
 
+config HOST_NAME_MAX
+       int "Maximum size of a host name"
+       default 32
+       ---help---
+               The maximum size of a host name, not including the terminating
+               null (HOST_NAME_MAX in limits.h).  POSIX requires at least 255
+               (_POSIX_HOST_NAME_MAX).
+
 config LIBC_OPEN_MAX
        int "OPEN_MAX for this device"
        default 256

Reply via email to