[Tracker] Showing trackerd's status in ps and top output
- From: "Jeff Schroeder" <jeffschroed gmail com>
- To: tracker-list gnome org
- Subject: [Tracker] Showing trackerd's status in ps and top output
- Date: Wed, 2 Jan 2008 18:26:11 -0800
A few days ago while staring at ps and tracker was grinding my hard
drive, it occurred to me, "Wouldn't it be nice if trackerd showed its
status in ps / top?".
Looking at avahi-daemon's source led to setproctitle.c which is LGPLv2.1.
http://avahi.org/browser/trunk/avahi-daemon/setproctitle.c
setproctitle() is available on the various BSD's, prctl(PR_SET_NAME
seems to be a Linux-ism, and Solaris.
Hal took the above code and butchered it quite a bit to be Linux
specific, but Solaris and bsd should benefit from this change also.
Take a look at hal_set_proc_title_init and hal_set_proc_title at the
bottom:
http://gitweb.freedesktop.org/?p=hal.git;a=blob;h=ee97026aa0c63af0e77fce5d3996f7c30354ff07;hb=f018f6480384e2607aa3cac6aad5f114b832ebc0;f=hald/util_helper.c
So there are 3 ways to do this:
- prctl(PR_SET_NAME, ...): Linux specific. Sets the process name
in ps -o comm
- setproctitle(3): Available on the bsds, but not Solaris and
totally nonstandard
- mundge argv using nasty tricks.
The way avahi-daemon does it seems to be the most complete. If I were
to copy this code to src/trackerd/tracker-utils.c and add in hooks to
src/trackerd/trackerd.c to update the status, would this be accepted?
My plan was to look at tracker->status and use the different status's
from the TrackerStatus enum.
--
Jeff Schroeder
Don't drink and derive, alcohol and analysis don't mix.
http://www.digitalprognosis.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]