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
精彩评论