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/08/03 12:58:46 UTC
(nuttx) 01/04: sys/types: always use unsigned int for uid_t/gid_t
This is an automated email from the ASF dual-hosted git repository.
xiaoxiang781216 pushed a commit to branch releases/13.0
in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 87ad604f38645dc18799179329d17f649ed0efbb
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Sat Jun 20 21:36:03 2026 +0800
sys/types: always use unsigned int for uid_t/gid_t
Move uid_t/gid_t out of the CONFIG_SMALL_MEMORY #ifdef so they are
always defined as unsigned int regardless of SMALL_MEMORY.
Update include/nuttx/fs/hostfs.h to match: drop the int16_t variants
of nuttx_gid_t/nuttx_uid_t and keep a single unsigned int definition
so the hostfs RPC ABI stays in sync with sys/types.h.
Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
---
include/nuttx/fs/hostfs.h | 10 ++++++----
include/sys/types.h | 11 ++---------
2 files changed, 8 insertions(+), 13 deletions(-)
diff --git a/include/nuttx/fs/hostfs.h b/include/nuttx/fs/hostfs.h
index 3f9bad7bf8e..b69e46f7304 100644
--- a/include/nuttx/fs/hostfs.h
+++ b/include/nuttx/fs/hostfs.h
@@ -124,20 +124,21 @@
/* These must match the definitions in include/sys/types.h */
typedef int16_t nuttx_blksize_t;
+
# ifdef CONFIG_SMALL_MEMORY
-typedef int16_t nuttx_gid_t;
-typedef int16_t nuttx_uid_t;
typedef uint16_t nuttx_size_t;
typedef int16_t nuttx_ssize_t;
# else /* CONFIG_SMALL_MEMORY */
-typedef unsigned int nuttx_gid_t;
-typedef unsigned int nuttx_uid_t;
typedef uintptr_t nuttx_size_t;
typedef intptr_t nuttx_ssize_t;
# endif /* CONFIG_SMALL_MEMORY */
+
+typedef unsigned int nuttx_gid_t;
+typedef unsigned int nuttx_uid_t;
typedef uint32_t nuttx_dev_t;
typedef uint16_t nuttx_ino_t;
typedef uint16_t nuttx_nlink_t;
+
# ifdef CONFIG_FS_LARGEFILE
typedef int64_t nuttx_off_t;
typedef uint64_t nuttx_blkcnt_t;
@@ -145,6 +146,7 @@ typedef uint64_t nuttx_blkcnt_t;
typedef int32_t nuttx_off_t;
typedef uint32_t nuttx_blkcnt_t;
# endif
+
typedef unsigned int nuttx_mode_t;
typedef int nuttx_fsid_t[2];
diff --git a/include/sys/types.h b/include/sys/types.h
index 0836db8feb3..02ed42b08e6 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -123,19 +123,14 @@ typedef uint16_t size_t;
typedef int16_t ssize_t;
typedef uint16_t rsize_t;
-/* uid_t is used for user IDs
- * gid_t is used for group IDs.
- */
-
-typedef int16_t uid_t;
-typedef int16_t gid_t;
-
#else /* CONFIG_SMALL_MEMORY */
typedef _size_t size_t;
typedef _ssize_t ssize_t;
typedef _size_t rsize_t;
+#endif /* CONFIG_SMALL_MEMORY */
+
/* uid_t is used for user IDs
* gid_t is used for group IDs.
*/
@@ -143,8 +138,6 @@ typedef _size_t rsize_t;
typedef unsigned int uid_t;
typedef unsigned int gid_t;
-#endif /* CONFIG_SMALL_MEMORY */
-
/* dev_t is used for device IDs */
typedef uint32_t dev_t;