How to get a kernel thread ID? -



How to get a kernel thread ID? -

when create kernel thread using kthread_run(), how can tid of thread, there pthread_self() or gettid() in kernel space?

in kernel-space, don't need inquire thread in userspace calling gettid() -- have access task_struct of task:

struct task_struct* tsk = kthread_run(...); pid_t tid = tsk->pid; // thread id of newly created task (if successful)

linux-kernel

Comments