This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit cbc8e5b6eae510fdf03a69fefc10be05f293442f Author: Marco Casaroli <[email protected]> AuthorDate: Fri Oct 23 05:48:08 2026 +0200 include/sys/stat.h: Hide utimens() and lutimens() with NUTTX_NO_EXTENSIONS. utimens() and lutimens() are not in POSIX; POSIX has utimensat() and futimens(). Other code uses these names for its own functions with another meaning, and a program that defines NUTTX_NO_EXTENSIONS must be able to declare them. Declare the two functions only without NUTTX_NO_EXTENSIONS, and add them to the list in nuttx/compiler.h. libc and the system calls still have them, and NuttX code does not define NUTTX_NO_EXTENSIONS. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- include/nuttx/compiler.h | 10 +++++----- include/sys/stat.h | 9 +++++++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/include/nuttx/compiler.h b/include/nuttx/compiler.h index 25a86232830..fc6350fbe54 100644 --- a/include/nuttx/compiler.h +++ b/include/nuttx/compiler.h @@ -1619,11 +1619,11 @@ /* A program can define NUTTX_NO_EXTENSIONS before the first #include to * keep some non-standard names free for its own use. Then the headers do * not define ERROR and OK (sys/types.h), set_errno() and get_errno() - * (errno.h), zalloc() (stdlib.h), O_TEXT and O_BINARY (fcntl.h) and the - * helper macros of this file below, such as memory_barrier() and UNUSED(). - * The headers that a program includes do not use these names. A - * definition that the program made before is restored (saved at the start - * of this file). + * (errno.h), zalloc() (stdlib.h), O_TEXT and O_BINARY (fcntl.h), utimens() + * and lutimens() (sys/stat.h) and the helper macros of this file below, + * such as memory_barrier() and UNUSED(). The headers that a program + * includes do not use these names. A definition that the program made + * before is restored (saved at the start of this file). */ #ifdef NUTTX_NO_EXTENSIONS diff --git a/include/sys/stat.h b/include/sys/stat.h index c269e3fe358..f94731589da 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -181,12 +181,17 @@ int chmod(FAR const char *path, mode_t mode); int lchmod(FAR const char *path, mode_t mode); int fchmod(int fd, mode_t mode); int fchmodat(int dirfd, FAR const char *path, mode_t mode, int flags); -int utimens(FAR const char *path, const struct timespec times[2]); int utimensat(int dirfd, FAR const char *path, const struct timespec times[2], int flags); -int lutimens(FAR const char *path, const struct timespec times[2]); int futimens(int fd, const struct timespec times[2]); +/* Non-standard: not with NUTTX_NO_EXTENSIONS, see nuttx/compiler.h */ + +#ifndef NUTTX_NO_EXTENSIONS +int utimens(FAR const char *path, const struct timespec times[2]); +int lutimens(FAR const char *path, const struct timespec times[2]); +#endif + mode_t umask(mode_t mask); mode_t getumask(void);
