开发者

How do I get a list of processes in a gnome-shell-extension?

开发者 https://www.devze.com 2023-04-03 07:37 出处:网络
I am writing a gnome-shell-extension and I am trying to get a list of all the processes that are currently 开发者_开发知识库running. I have tried using glibtop, which has a function for retrieving pro

I am writing a gnome-shell-extension and I am trying to get a list of all the processes that are currently 开发者_开发知识库running. I have tried using glibtop, which has a function for retrieving processes glibtop_get_proclist, but the problem is, that this function returns a pointer to the list, so if I do:

let proclist = new GTop.glibtop_proclist;
pid_list = GTop.glibtop_get_proclist(proclist, 0, 0); 

pid_list becomes of type number. Now javascript doesn't have pointer arithmetic, so I have no idea how I could access the list.

The proclist variable only contains a few number parameters such as proclist total and proclist size.

So how can I access the list that the get_proclist method returns? Or is there an easier way of getting a list of pids of running processes?


This will give you an idea of how to walk though the list you retrieved: 1

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号