Benoît Dejean
4f36c74b68
Fix build on freebsd and darwin.
2018-03-07 20:47:44 +01:00
Benoît Dejean
c65cb3e46b
Rename GLIBTOP_SUID_PROC_FILE to GLIBTOP_SUID_PROC_OPEN_FILES.
...
The previous name is incorrect and inconsistent with the code generated
by lib.pl.
Also add missing hooks.
This symbol, although exposed in public headers is not part of the API
and is only used internally.
2018-03-07 19:44:41 +01:00
Benoît Dejean
42b049f338
Fix darwin build by adding dummy proc_io implementation.
...
https://gitlab.gnome.org/GNOME/libgtop/issues/36
2018-02-11 09:12:54 +01:00
Benoît Dejean
f38d9c6523
Regenerate with gperf-3.1.
2017-08-31 18:10:21 +02:00
Benoit Dejean
d3df61ddbf
Fix build for FreeBSD 11.1.
...
The ufs struct inode has changed a requires a different code to get the
device number.
2017-07-29 14:18:45 +02:00
Robert Roth
43740ddab7
Merge branch 'wip/diskio'
2017-05-23 00:02:47 +03:00
Benoit Dejean
779386cb15
Implement disk_rbytes and disk_wbytes for FreeBSD.
2017-05-20 11:34:25 +02:00
Robert Roth
5880e04fcc
Prepended disk io struct fields with disk_ prefix
2017-05-12 05:14:17 +03:00
Robert Roth
1bf16bfffd
Renamed procdiskio to procio
2017-05-12 05:08:41 +03:00
Benoît Dejean
aae804c3dc
Add NULL pointer checker (bug found with scan-build).
2017-05-01 06:32:41 +02:00
Benoit Dejean
c29d7de9a0
Add dummy proc_diskio implementation for FreeBSD.
2017-02-25 16:30:18 +01:00
Benoît Dejean
1defc74f07
Set glibtop_proc_diskio.flags.
...
Check linux version code before reading /proc/PID/io.
2017-02-21 12:50:37 +01:00
Robert Roth
dff7c5588e
New API to retrieve process io stats, with Linux implementation
2017-02-12 17:59:08 +02:00
Benoît Dejean
1a103bf142
When parsing /proc/cpuinfo, ignore paragraphs that do not describe a CPU/core.
2017-01-28 09:39:43 +01:00
Benoît Dejean
01a56e2e30
Use g_ascii_isspace instead of isspace because the later is slower and we
...
only need to deal with ascii.
2017-01-22 10:45:26 +01:00
Benoît Dejean
7afc81f99d
Do not cache getpagesize(), it is already.
2017-01-22 10:45:26 +01:00
Benoît Dejean
b0ab056e99
Use a dynamically allocated buffer to read /proc/cpuinfo to handle computers
...
with a lot of CPUs.
https://bugzilla.gnome.org/show_bug.cgi?id=323354
2017-01-22 10:45:26 +01:00
Robert Roth
70e00a0262
Fixed indentation problem
2016-11-27 20:10:00 +02:00
Florian Müllner
f99bb61446
procstate: Fill in last_processor member on linux
...
The field was added almost 20 years ago, but has only been set on
Solaris so far. It turns out we have a use for it now in the new
"Usage" application, so also fill it in on Linux.
https://bugzilla.gnome.org/show_bug.cgi?id=775182
2016-11-27 20:07:20 +02:00
Ting-Wei Lan
59d9780eae
freebsd: Support GLIBTOP_IF_FLAGS_WIRELESS in netload
...
The ioctl call used in this patch doesn't seems to be documented. It is
what ifconfig(8) command uses to display the media type, and its usage
can be learned by reading the source code of ifconfig(8).
https://bugzilla.gnome.org/show_bug.cgi?id=770165
2016-08-20 16:46:15 +03:00
Gleb Smirnoff
305701c637
freebsd: Rewrite netload implementation with getifaddrs and ioctl
...
Instead of using a documented and official API to get information related
to a network interface, the old implementation uses kvm library to access
kernel memory directly, which is not easy to understand and can be easily
broken by changing kernel symbols or structs. Besides, FreeBSD 11 hides
severai required kernel struct definitions from userspace programs, which
causes compilation error because the definition of 'struct ifaddr' is not
available unless _KERNEL is defined.
This patch is primarily authored by Gleb Smirnoff <glebius@FreeBSD.org >,
with other simple modification made by Antoine Brodin <antoine@FreeBSD.org >,
Koop Mast <kwm@FreeBSD.org > and Ting-Wei Lan <lantw@src.gnome.org > applied.
It was first submitted to FreeBSD ports and has been used by FreeBSD users
for more than 18 months on all supported versions of FreeBSD.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=194187
https://svnweb.freebsd.org/changeset/ports/371082
https://github.com/freebsd/freebsd-ports-gnome/commit/be884cd
https://github.com/freebsd/freebsd-ports-gnome/commit/422a418
https://github.com/freebsd/freebsd-ports-gnome/commit/a4b1913
https://bugzilla.gnome.org/show_bug.cgi?id=770165
2016-08-20 16:46:15 +03:00
Kylie McClain
94968b4406
Fix building on musl-libc
...
libgtop fails to build on musl libc, due to the header
resulting in the headers that would be loaded for libc 5 being
loaded on musl libc.
musl defines headers which are also defined in linux-headers'
in.h, causing redefinition errors.
https://bugzilla.gnome.org/show_bug.cgi?id=760655
Signed-off-by: Benoît Dejean <bdejean@gmail.com >
2016-02-16 18:12:00 +01:00
Antoine Jacoutot
de408a6bba
openbsd: only PID 1 is special (init)
2016-01-12 17:14:20 +01:00
Jasper Lievisse Adriaanse
02070b7170
Add various headers to unbreak compilation
2015-12-11 15:03:49 +01:00
Jasper Lievisse Adriaanse
fcfacf3213
PROT_EXECUTE -> PROT_EXEC
2015-12-11 14:59:11 +01:00
Jasper Lievisse Adriaanse
7925f83b57
Fix compilation because glibtop_machine definition has moved.
2015-12-11 14:57:34 +01:00
Benoît Dejean
eec96d8ae8
Fix Darwin build.
...
Patch by David Evans.
Bug https://bugzilla.gnome.org/show_bug.cgi?id=753743 .
2015-08-18 16:43:00 +02:00
Benoit Dejean
7437509412
Fix compilation because glibtop_machine definition has moved.
2015-08-15 10:57:25 +02:00
Benoit Dejean
c9e73e52ac
glibtop_machine is defined in glibtop.h.
...
Don't duplicate the typedef (error unless C11).
2015-08-15 10:56:41 +02:00
Benoit Dejean
4c455ac8a0
Implement glibtop_map_entry Pss and Swap.
...
Regenerate hash function for fast parsing.
2015-08-15 10:39:39 +02:00
Benoît Dejean
b74d6abf19
server->machine is now a pointer, so propagate the change from . to ->.
2015-08-08 14:36:47 +02:00
Benoît Dejean
ca42f1f3af
Define glibtop_machine for Linux as empty because it's not used.
...
Fix compilation.
2015-08-08 11:11:30 +02:00
Benoit Dejean
0642c2d610
Turn glibtop::machine from a value to a pointer, allocated on init.
...
This hides the glibtop_machine implementation.
2015-08-08 11:00:57 +02:00
Benoit Dejean
8f2f236404
No use for glibtop_machine for now, but who knows in the future.
2015-08-08 11:00:57 +02:00
Benoit Dejean
5c6879baab
Exclude the "idle" kernel process when GLIBTOP_EXCLUDE_IDLE.
2015-08-08 10:56:25 +02:00
Benoit Dejean
d817bee619
Remove useless/meaningless calls to glibtop_init_[prs]() with sysdeps/{freebsd,linux}.
2015-08-08 10:56:25 +02:00
Benoit Dejean
d3a247a60f
Don't include the ':' in smaps keys.
...
Regenerate the hashtable.
2015-08-08 10:56:24 +02:00
Benoit Dejean
45c8452140
More debug messages to trace euid/egid changes.
2015-08-08 10:56:24 +02:00
Benoit Dejean
0e8f911410
Add some debug code to trace effective GID changes.
2015-08-08 10:56:24 +02:00
Benoit Dejean
4e57a6222d
Don't install glibtop_private.h.
2015-07-18 22:07:59 +02:00
Benoit Dejean
1dbe133a24
Fix utime/stime/cutime/cstime computation.
2015-07-18 20:46:07 +02:00
Benoit Dejean
3bd720ad81
Do the math correctly to avoid loss of precision for rtime.
...
I've noticed this with system-monitor where all processes got
a perfectly round CPU time to the second.
2015-07-18 15:46:26 +02:00
Benoit Dejean
0099cbb6b4
Rework logic by turning two dark while into fors.
...
Also, if kvm_read fail, exit rather than looping forever.
2015-07-15 18:39:06 +02:00
Benoit Dejean
cd5649f326
Print message to stderr at once, to avoid mixups.
2015-07-15 18:39:06 +02:00
Benoit Dejean
185396d674
Check getloadavg() return value and call the function directly
...
on the glibtop_loadavg buffer member.
2015-07-15 18:39:06 +02:00
Benoit Dejean
172f0a50ba
Convert lots of fprintf(stderr, ...) to glibtop_debug*().
2015-07-15 18:38:28 +02:00
Benoit Dejean
887092a05d
Define glibtop_debug(_r) as macros, eventually calling real C function.
...
Keep these as macros so that if debug is not enable, although the
debug message is parsed, it's not run.
It's better this way because the debug message is always parsed and
checked instead of being deleted by the preprocessor.
2015-07-15 18:38:27 +02:00
Benoit Dejean
b2a2f6b5c2
Print client and server pids in messages.
2015-07-15 18:38:27 +02:00
Benoit Dejean
65c5ca842f
Add a level (DEBUG, WARNING, ERROR) to printing functions.
2015-07-15 18:38:27 +02:00
Benoit Dejean
82ff91b74c
Add proper (and private) debug functions glibtop_debug*
2015-07-15 18:38:27 +02:00