Reputation: 6592
I have written a module where a user can read or write to a proc file - how do I determine the number of threads in a user process that is reading or writing in kernel-level programming?
Upvotes: 3
Views: 478
Reputation: 4024
Use current
as a pointer to the current task (current task_struct
) inside your read/write function:
#include <linux/sched.h>
struct task_struct * t;
for (t = next_thread(current); t != current; t = next_thread(t)) {
// do the stuff
}
Upvotes: 6