This fixes a bug occurred with 0b3e3c637e.
Dead processes still appeared in ${top} under FreeBSD and OpenBSD. This was
because I forgot to update the g_time variable which is used as time stamp in
the process list.
Signed-off-by: Alexander Graf <agraf@znc.in>
Linux-specific code in top.cc was moved to linux.cc.
Redundant code (e.g. the parts sorting by CPU usage, CPU time or memory
usage) was removed. Sorting etc. happens in top.cc, whilst
platform-dependent code in linux.cc, freebsd.cc or openbsd.cc just
builds up the process table.
In the Linux code, some functions had a return value which was never
evaluated. They return void now.
I tested it on FreeBSD and Linux; The OpenBSD port does not compile
anyway. I changed the OpenBSD parts, too, so that it will be less
effort to get conky working under OpenBSD.
Signed-off-by: Alexander Graf <agraf@znc.in>
- Displaying of CPU time of the processes now works
- ${top_time} (sorting by CPU time) works
- Using memcpy() instead of many sequential assignments (more clear,
less lines, maybe faster, less effort to change something)
Signed-off-by: Alexander Graf <agraf@znc.in>
Signed-off-by: Pavel Labath <pavelo@centrum.sk>
Example:
TEXT
alfa bravo
charlie ${alignr}delta
echo ${alignr}foxtrot
Note to self:
It could be that this fix brings back part of the bug that
40452c9712 fixed. Check this !
It was inside #ifdef __linux__, though it is not Linux specific.
Signed-off-by: Alexander Graf <agraf@znc.in>
Signed-off-by: Pavel Labath <pavelo@centrum.sk>
This allows compilation under FreeBSD without errors.
read_tcpip.cc: Avoid using of SOCK_NONBLOCK argument for socket().
SOCK_NONBLOCK is Linux-specific and its use was substituted with a
fcntl() call after socket().
freebsd.cc: Change return type of update_*() to int, as required by
common.h.
Signed-off-by: Alexander Graf <agraf@znc.in>
Signed-off-by: Pavel Labath <pavelo@centrum.sk>