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
The following commit(s) were added to refs/heads/master by this push:
new f4bf81a8d1c include/sys/types.h: Make id_t unsigned, as uid_t and gid_t
f4bf81a8d1c is described below
commit f4bf81a8d1c956f0a63bbbfca47d8806b19b42d3
Author: Marco Casaroli <[email protected]>
AuthorDate: Mon Nov 2 21:22:17 2026 +0100
include/sys/types.h: Make id_t unsigned, as uid_t and gid_t
POSIX: id_t can hold a pid_t, a uid_t or a gid_t. NuttX has int; glibc and
musl have unsigned int, the type of uid_t and gid_t. A program that uses a
uid_t as an id_t and checks with a static assertion that the types are the
same does not build.
id_t is now unsigned int. The size does not change. getpriority(),
setpriority() and waitid() only compare it with 0 or convert it to a
pid_t, so they work as before.
Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Marco Casaroli <[email protected]>
---
include/sys/types.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/sys/types.h b/include/sys/types.h
index fb853f6f215..433346ba41a 100644
--- a/include/sys/types.h
+++ b/include/sys/types.h
@@ -168,10 +168,11 @@ typedef uint16_t nlink_t;
typedef int pid_t;
/* id_t is a general identifier that can be used to contain at least a pid_t,
- * uid_t, or gid_t.
+ * uid_t, or gid_t. It has the type of uid_t and gid_t, as in glibc and
+ * musl.
*/
-typedef int id_t;
+typedef unsigned int id_t;
/* Unix requires a key of type key_t defined in file sys/types.h for
* requesting resources such as shared memory segments, message queues and