[Tracker] Showing trackerd's status in ps and top output

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.

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

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.

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]