Make a system call to get list of processes

前端 未结 2 1380
没有蜡笔的小新
没有蜡笔的小新 2020-12-17 04:00

I\'m new on modules programming and I need to make a system call to retrieve the system processes and show how much CPU they are consuming.

How can I make this call?

2条回答
  •  既然无缘
    2020-12-17 04:18

    There are syscalls for that, called open, and read. The information of all processes are all kept in /proc/{pid} directories. You can gather process information by reading corresponding files.

    More explained here: http://www.tldp.org/LDP/Linux-Filesystem-Hierarchy/html/proc.html

提交回复
热议问题