Add the kernel internal variant of `gettid`, `uk_sys_gettid`. This
allows kernel internal code to call this system call's logic without
having the syscall shim wrapper logic intervene.
Signed-off-by: Sergiu Moga <sergiu@unikraft.io>
Reviewed-by: Michalis Pappas <michalis@unikraft.io>
Reviewed-by: Andrei Tatar <andrei@unikraft.io>
Approved-by: Andrei Tatar <andrei@unikraft.io>
GitHub-Closes: #1583
waitid
getpid
getppid
+uk_sys_gettid
gettid
exit
exit_group
#include <uk/config.h>
#include <stdbool.h>
#include <sys/resource.h>
+#include <sys/types.h> /* pid_t */
#if CONFIG_LIBUKSCHED
#include <uk/thread.h>
#endif
DECONST(struct rlimit *, rlim), NULL);
}
+pid_t uk_sys_gettid(void);
+
#if CONFIG_LIBUKSCHED
int uk_posix_process_create(struct uk_alloc *a,
struct uk_thread *thread,
return pthread_self->process->pid;
}
-UK_SYSCALL_R_DEFINE(pid_t, gettid)
+pid_t uk_sys_gettid(void)
{
if (!pthread_self)
return -ENOTSUP;
return UNIKRAFT_PID;
}
-UK_SYSCALL_R_DEFINE(int, gettid)
+pid_t uk_sys_gettid(void)
{
return UNIKRAFT_TID;
}
}
#endif /* !CONFIG_LIBPOSIX_PROCESS_PIDS */
+
+UK_SYSCALL_R_DEFINE(pid_t, gettid)
+{
+ return uk_sys_gettid();
+}