Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get process list from kernel space in Linux

How can I get list of all pairs process_name -> process_pid (user space and kernel space) from kernel module?

like image 243
ymn Avatar asked Sep 28 '26 11:09

ymn


1 Answers

In your kernel module, you can do something like this:

    rcu_read_lock();
    for_each_process(g) {
            printk("%s --> %d\n", g->comm, task_tgid_vnr(g));
    }
    rcu_read_unlock();
like image 192
Cong Wang Avatar answered Sep 30 '26 10:09

Cong Wang



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!