Commit Graph

30 Commits

Author SHA1 Message Date
Jan Ziak
bed04577a5 Add support for MemAvailable (!10)
MemAvailable is in /proc/meminfo since Linux 3.14.

This aligns the reported memory usage with the memory usage
reported by xfce4-systemload-plugin.

Closes !10
2020-10-12 14:57:23 -03:00
Landry Breuil
993ef78b81 Switch back all bzero() calls to use memset()
Even if it's uglier to use memset, bzero seems deprecated.
2018-06-03 17:56:31 +02:00
rim
8e1b48f8de Move getpwuid() from backends to gui, use getpwuid_r(), call only once on task add. (bug 14401) 2018-05-30 21:31:01 +02:00
rim
40a3e65803 Fix possible file descriptor leak on linux (bug 14401) 2018-05-30 21:30:19 +02:00
rim
ceb5a7d347 Make pid type: GPid (bug 14401) 2018-05-30 21:28:35 +02:00
Landry Breuil
159c3c1d0c Sort the task list by pid, as we're going to use bsearch() (bug 14403) 2018-05-26 23:52:46 +02:00
rim
704411a38b Properly use float for constants where appropriate (bug 14401, bug 14403) 2018-05-26 23:51:32 +02:00
rim
2329f243fb Properly zero memory where appropriate (bug 14401, bug 14403) 2018-05-26 23:40:11 +02:00
rim
5e0fb6f4bc Use sizeof() when appropriate instead of hardcoding values (bug 14401, bug 14403) 2018-05-26 23:19:55 +02:00
Bobby Hopere
946be33611 Fix UID reporting properly
The patch that was already committed apparently fixes the issue but
using a non-documented method. This patch fixes the issue as described in
"man proc". (The UID is extracted by parsing /proc/*/status not by using
stat() on /proc/*/task). Also, this patch can easily be extended to also
report other UIDs besides the "effective" UID: real, effective, saved
set, and filesystem UIDs.
2017-11-11 22:10:57 +01:00
Alberto Sepo
bd1e267062 Fix incorrect UID reporting (Bug #12970) 2017-06-14 00:13:25 +02:00
Landry Breuil
97f974f7a8 Use a gint since fgetc returns an int. (#10417)
Should fix a warning on arm, and maybe other issues there..
2014-12-03 17:26:42 +01:00
Mike Massonnet
9d8b776288 Fix SIGBUS on Debian x86_64 (original patch from Jérôme Guelfucci)
Something strange happened when doing a comparison between a guint type
and sizeof(), turning it back to gint fixes the issue. Fix other
compiler warnings at the same time.
2010-06-13 19:31:22 +02:00
Mike Massonnet
1506382577 [linux] Fix compiler warnings from Linux implementation 2010-06-08 22:43:36 +02:00
Mike Massonnet
bdeff4e269 [linux] Fix 64-bit issue with scanf
The fix is very trivial, all it takes is initializing values passed to
scanf to zero. In fact format conversions inside scanf/printf may fail
otherwise.
2010-06-08 06:23:15 -04:00
Mike Massonnet
f929d83f37 [linux|solaris] Fix regression introduced with the “Refresh rate” option
The CPU usage computation done for the processes were broken when the
refresh rate was different than a second. The introduced fix is only
necessary for the Linux and OpenSolaris implementations.
2010-05-24 19:41:41 +02:00
Mike Massonnet
6b8162b4e9 [linux|freebsd] Fix condition to calculate CPU usage 2010-05-21 15:29:45 +02:00
Mike Massonnet
0be1d45507 Don't recount CPU count in Linux implementation 2010-05-16 12:30:37 +02:00
Mike Massonnet
b961822ba4 Move POSIX code to task-manager.c
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.
2010-05-16 12:30:37 +02:00
Mike Massonnet
1788e3c220 Implement new function pid_is_sleeping()
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.
2010-05-09 01:34:56 +02:00
Mike Massonnet
07131a81b3 Context menu for sending signals and setting priorities
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.
2010-05-09 00:51:46 +02:00
Mike Massonnet
e524915ac7 Several micro fixes on the Linux implementation
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.
2010-05-08 14:49:12 +02:00
Mike Massonnet
a7465b61f4 Fix for scanf failing at parsing process names with spaces
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.
2010-05-08 00:10:22 +02:00
Mike Massonnet
553be8eee1 Temporary “fix” of a nasty segfault
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.
2010-05-07 21:52:46 +02:00
Mike Massonnet
2506eb50d8 Typo, that's why I hate commit and pushing right behind 2010-05-05 18:02:35 +02:00
Mike Massonnet
3cd86dca3d Well s/jiffles/jiffies/
I was quite sure I had a typo but didn't concider it.
2010-05-05 16:39:51 +02:00
Mike Massonnet
074f5039e1 Calculate CPU usage per process in Linux implementation
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.
2010-05-05 16:30:37 +02:00
Mike Massonnet
a02bf69573 Show list of tasks
Provide the list of tasks through a GArray and parse it in main.c to
update the GtkTreeModel.
2010-05-05 09:02:04 +02:00
Mike Massonnet
71d1684696 Add precision to memory/swap and CPU
Switched all the gushort against gfloat data types for the memory, swap
and CPU usages. Show them with a precision of two decimals in the GUI.
2010-05-02 17:03:58 +02:00
Mike Massonnet
4f04ca5cb7 Read information from memory/swap and CPU
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.
2010-05-02 17:00:30 +02:00