The functions send_signal_to_pid() and set_priority_to_pid() are using
POSIX functions and “should” be safe in task-manager.c. Still keep the
enumeration as a bridge between virtual values and real values, there is
no benefit removing them (wasting minutes) and it won't make the code
look better (or worse).
The functions have been removed from the Linux and BSD implementations.
The function pid_is_sleeping() is implement by the different OS
implementations and returns TRUE or FALSE. It is used in the tree view
context menu to show either the signal Stop or Continue.
Base signals and priorities are defined inside the task-manager.h file
to be reused as general values inside the interface. The different OS
implementations have to do the conversion from the enumeration to real
values.
Fix one segfault where some processes like “ls” live very briefly and
those may be catched up but at the time to read the cmdline the process
tree already disappeared. Also terminate the cmdline with \0.
I ran the application on my netbook, which doesn't have /proc/<PID>/comm
files... The code has been updated to read the short command from the
buffer.
The code still uses scanf to parse the stat file, but the process name
is being cleansed so that it never fails. The name is read from the
“comm” file. It is still a truncated version of the name, and will
likely remain for very long like this. There is one solution, but since
the name isn't currently used inside the interface there is no point
wasting time.
On the Linux implementation, when a process name has a space in it the
sscanf function is unable to parse the line properly. This will have to
be changed, but in the meantime ignore such processes and avoid the
segfault, there are going to be Beta releases.
Added a utility function that stores old jiffles inside a hash table in
order to be able to provide usage values of system and user time in
percentage.
This commit is the second of an incremental serie. There will be other
commits with the information about tasks and the support for BSD and
Solaris once things are settled.
The TaskManager class is build with a new source task-manager-linux.c
that provides functions specific to the Linux implementation. It has
functions to read the usage of the memory/swap and the CPU.