sched/gettid: Move thread ID to TLS

There is no need for a gettid() syscall, as the thread ID is stable through
the life of the process. It is safe to put a copy of TID to TLS. This way
a user processes can access TID quickly via its own stack, instead of
having to use an expensive syscall.

Signed-off-by: Ville Juven <ville.juven@unikie.com>
This commit is contained in:
Ville Juven
2025-04-04 13:50:56 +03:00
committed by Xiang Xiao
parent b3567fe964
commit 04e760b1c2
10 changed files with 79 additions and 37 deletions
-1
View File
@@ -48,7 +48,6 @@
"getppid","unistd.h","defined(CONFIG_SCHED_HAVE_PARENT)","pid_t"
"getsockname","sys/socket.h","defined(CONFIG_NET)","int","int","FAR struct sockaddr *","FAR socklen_t *"
"getsockopt","sys/socket.h","defined(CONFIG_NET)","int","int","int","int","FAR void *","FAR socklen_t *"
"gettid","unistd.h","","pid_t"
"gettimeofday","sys/time.h","","int","FAR struct timeval *","FAR struct timezone *"
"getuid","unistd.h","defined(CONFIG_SCHED_USER_IDENTITY)","uid_t"
"inotify_add_watch","sys/inotify.h","defined(CONFIG_FS_NOTIFY)","int","int","FAR const char *","uint32_t"
1 _assert assert.h void FAR const char * int FAR const char * FAR void *
48 getppid unistd.h defined(CONFIG_SCHED_HAVE_PARENT) pid_t
49 getsockname sys/socket.h defined(CONFIG_NET) int int FAR struct sockaddr * FAR socklen_t *
50 getsockopt sys/socket.h defined(CONFIG_NET) int int int int FAR void *
gettid unistd.h pid_t
51 gettimeofday sys/time.h int FAR struct timeval * FAR struct timezone *
52 getuid unistd.h defined(CONFIG_SCHED_USER_IDENTITY) uid_t
53 inotify_add_watch sys/inotify.h defined(CONFIG_FS_NOTIFY) int int FAR const char * uint32_t