In kernel space, you donβt need to ask something about the thread, as in the user space that you call by calling gettid() - you already have access to the task_struct your task:
struct task_struct* tsk = kthread_run(...); pid_t tid = tsk->pid;
myaut source share