You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by xi...@apache.org on 2026/10/09 12:07:39 UTC

(nuttx) branch master updated (7942d18fd57 -> dcc3b7b384f)

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

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


    from 7942d18fd57 sched/task: Do not log a missing or unloadable program as an exec error.
     new 314348cafe7 libs/libc/time: Add tzset() for builds without time zones.
     new dcc3b7b384f libs/libc/locale: Add getlocalename_l().

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 include/locale.h                                   |  1 +
 include/time.h                                     |  2 --
 libs/libc/locale/CMakeLists.txt                    |  3 +-
 libs/libc/locale/Make.defs                         |  2 +-
 .../lib_getlocalename_l.c}                         | 35 ++++++++++++----------
 libs/libc/time/CMakeLists.txt                      |  2 +-
 libs/libc/time/Make.defs                           |  2 +-
 libs/libc/time/{lib_gethrtime.c => lib_tzset.c}    | 21 +++++--------
 8 files changed, 32 insertions(+), 36 deletions(-)
 copy libs/libc/{sched/sched_getprioritymax.c => locale/lib_getlocalename_l.c} (69%)
 copy libs/libc/time/{lib_gethrtime.c => lib_tzset.c} (82%)


(nuttx) 01/02: libs/libc/time: Add tzset() for builds without time zones.

Posted by xi...@apache.org.
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 314348cafe721723a470b06b2bba341650be7e34
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Thu Oct 8 22:01:33 2026 +0200

    libs/libc/time: Add tzset() for builds without time zones.
    
    POSIX requires tzset(), but NuttX declared and defined it only with
    CONFIG_LIBC_LOCALTIME, so programs that call it do not build without
    that option.  Without CONFIG_LIBC_LOCALTIME there are no time zones and
    local time is UTC, so tzset() has nothing to do.
    
    Declare tzset() always, and add an empty one for builds without
    CONFIG_LIBC_LOCALTIME.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 include/time.h                |  2 --
 libs/libc/time/CMakeLists.txt |  2 +-
 libs/libc/time/Make.defs      |  2 +-
 libs/libc/time/lib_tzset.c    | 46 +++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 48 insertions(+), 4 deletions(-)

diff --git a/include/time.h b/include/time.h
index 19e03bec5b6..0ff75587ed5 100644
--- a/include/time.h
+++ b/include/time.h
@@ -237,9 +237,7 @@ int clock_nanosleep(clockid_t clockid, int flags,
                     FAR struct timespec *rmtp);
 int nanosleep(FAR const struct timespec *rqtp, FAR struct timespec *rmtp);
 
-#ifdef CONFIG_LIBC_LOCALTIME
 void tzset(void);
-#endif
 
 #undef EXTERN
 #if defined(__cplusplus)
diff --git a/libs/libc/time/CMakeLists.txt b/libs/libc/time/CMakeLists.txt
index cd577ece293..d7807de764f 100644
--- a/libs/libc/time/CMakeLists.txt
+++ b/libs/libc/time/CMakeLists.txt
@@ -41,7 +41,7 @@ set(SRCS
 if(CONFIG_LIBC_LOCALTIME)
   list(APPEND SRCS lib_localtime.c)
 else()
-  list(APPEND SRCS lib_timegm.c lib_gmtime.c lib_gmtimer.c)
+  list(APPEND SRCS lib_timegm.c lib_gmtime.c lib_gmtimer.c lib_tzset.c)
 endif()
 
 if(CONFIG_ALLOW_MIT_COMPONENTS)
diff --git a/libs/libc/time/Make.defs b/libs/libc/time/Make.defs
index 22a0856da28..71883b25aa5 100644
--- a/libs/libc/time/Make.defs
+++ b/libs/libc/time/Make.defs
@@ -31,7 +31,7 @@ CSRCS += lib_gethrtime.c
 ifdef CONFIG_LIBC_LOCALTIME
 CSRCS += lib_localtime.c
 else
-CSRCS += lib_timegm.c lib_gmtime.c lib_gmtimer.c
+CSRCS += lib_timegm.c lib_gmtime.c lib_gmtimer.c lib_tzset.c
 endif
 
 ifdef CONFIG_ALLOW_MIT_COMPONENTS
diff --git a/libs/libc/time/lib_tzset.c b/libs/libc/time/lib_tzset.c
new file mode 100644
index 00000000000..00f829111ee
--- /dev/null
+++ b/libs/libc/time/lib_tzset.c
@@ -0,0 +1,46 @@
+/****************************************************************************
+ * libs/libc/time/lib_tzset.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <time.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: tzset
+ *
+ * Description:
+ *   Set up the time zone from the TZ environment variable.  Without
+ *   CONFIG_LIBC_LOCALTIME there are no time zones (local time is UTC), so
+ *   there is nothing to set up.  The function exists because POSIX
+ *   requires it and portable programs call it.
+ *
+ ****************************************************************************/
+
+void tzset(void)
+{
+}


(nuttx) 02/02: libs/libc/locale: Add getlocalename_l().

Posted by xi...@apache.org.
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 dcc3b7b384f9ea35c23371884645b428435fb716
Author: Marco Casaroli <ma...@gmail.com>
AuthorDate: Thu Oct 8 22:01:47 2026 +0200

    libs/libc/locale: Add getlocalename_l().
    
    POSIX.1-2024 adds getlocalename_l(), which returns the name of the
    locale of one category of a locale object.  NuttX supports only the "C"
    locale, so the function returns "C" for every valid category, and NULL
    with errno set to EINVAL for an invalid one.  It is built with
    CONFIG_LIBC_LOCALE, like the other locale functions.
    
    Assisted-by: Claude Code:claude-opus-5-5
    Signed-off-by: Marco Casaroli <ma...@gmail.com>
---
 include/locale.h                       |  1 +
 libs/libc/locale/CMakeLists.txt        |  3 +-
 libs/libc/locale/Make.defs             |  2 +-
 libs/libc/locale/lib_getlocalename_l.c | 67 ++++++++++++++++++++++++++++++++++
 4 files changed, 71 insertions(+), 2 deletions(-)

diff --git a/include/locale.h b/include/locale.h
index 742dd0f5d32..228e1342c2a 100644
--- a/include/locale.h
+++ b/include/locale.h
@@ -117,6 +117,7 @@ locale_t duplocale(locale_t locobj);
 void freelocale(locale_t locobj);
 
 locale_t uselocale(locale_t newloc);
+FAR const char *getlocalename_l(int category, locale_t locobj);
 
 #undef EXTERN
 #ifdef __cplusplus
diff --git a/libs/libc/locale/CMakeLists.txt b/libs/libc/locale/CMakeLists.txt
index 6c6f530366f..d684943d1fb 100644
--- a/libs/libc/locale/CMakeLists.txt
+++ b/libs/libc/locale/CMakeLists.txt
@@ -33,5 +33,6 @@ if(CONFIG_LIBC_LOCALE)
             lib_gettext.c
             lib_langinfo.c
             lib_iconv.c
-            lib_maxlocale.c)
+            lib_maxlocale.c
+            lib_getlocalename_l.c)
 endif()
diff --git a/libs/libc/locale/Make.defs b/libs/libc/locale/Make.defs
index ddd27c9427a..0e8737f6d07 100644
--- a/libs/libc/locale/Make.defs
+++ b/libs/libc/locale/Make.defs
@@ -27,7 +27,7 @@ ifeq ($(CONFIG_LIBC_LOCALE),y)
 CSRCS += lib_duplocale.c lib_freelocale.c lib_localeconv.c
 CSRCS += lib_newlocale.c lib_setlocale.c lib_uselocale.c
 CSRCS += lib_catalog.c lib_gettext.c lib_langinfo.c lib_iconv.c
-CSRCS += lib_maxlocale.c
+CSRCS += lib_maxlocale.c lib_getlocalename_l.c
 
 # Add the locale directory to the build
 
diff --git a/libs/libc/locale/lib_getlocalename_l.c b/libs/libc/locale/lib_getlocalename_l.c
new file mode 100644
index 00000000000..3582ee5fb34
--- /dev/null
+++ b/libs/libc/locale/lib_getlocalename_l.c
@@ -0,0 +1,67 @@
+/****************************************************************************
+ * libs/libc/locale/lib_getlocalename_l.c
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.  The
+ * ASF licenses this file to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the
+ * License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ *
+ ****************************************************************************/
+
+/****************************************************************************
+ * Included Files
+ ****************************************************************************/
+
+#include <nuttx/config.h>
+
+#include <errno.h>
+#include <locale.h>
+#include <stddef.h>
+
+/****************************************************************************
+ * Public Functions
+ ****************************************************************************/
+
+/****************************************************************************
+ * Name: getlocalename_l
+ *
+ * Description:
+ *   Return the name of the locale of one category of a locale object
+ *   (POSIX.1-2024).  LC_GLOBAL_LOCALE means the global locale.  NuttX
+ *   supports only the "C" locale, so every category of every locale is
+ *   "C".
+ *
+ * Input Parameters:
+ *   category - LC_CTYPE, LC_NUMERIC, ... (not LC_ALL)
+ *   locobj   - A locale object, or LC_GLOBAL_LOCALE
+ *
+ * Returned Value:
+ *   The name of the locale, or NULL with errno set to EINVAL if the
+ *   category is not valid.
+ *
+ ****************************************************************************/
+
+FAR const char *getlocalename_l(int category, locale_t locobj)
+{
+  UNUSED(locobj);
+
+  if (category < 0 || category >= LC_ALL)
+    {
+      set_errno(EINVAL);
+      return NULL;
+    }
+
+  return "C";
+}