GNOME Bugzilla – Bug 667829
[PATCH] systemd: add process view columns for unit, session, seat, owner
Last modified: 2012-01-23 16:14:21 UTC
Created attachment 205149 [details] [review] the patch This (optionally) hooks up the system monitor with systemd, adding four new columns to the process view: 1. Unit (i.e. the service name a system process belongs to) 2. Session (i.e. the login session a user process belongs to) 3. Seat (i.e. the physical seat the session of the process belongs to, only for multi-seat environments) 4. Owner (i.e. the user a process belongs to, which is not influenced by temporary UID changes like sudo/su/suid. This patch also enables that the Unit column is shown by default. If systemd is not around at runtime or at compile time none of the four new columns are shown.
I couldn't build this on my current system but as it's disabled by default and doesn't cause an issue in that case I'll let it in for testing. I've made a couple very minor changes; free to g_free in one place, moved otherwise unused variable inside ifdef, etc. Please mark the attachment as a patch next time so I can note these easily.
Ahum, the free() calls (instead of g_free()) were actually placed there for a reason: the memory is allocated by sd_pid_get_session() and friends -- which allocate their memory with malloc(), and not g_malloc(). In the normal case the backend of g_malloc() will simply be malloc(), however if people use g_mem_set_vtable() this might differ. i.e. you may use g_free() and free() only then interchangably if g_mem_is_system_malloc() is TRUE. Summary: replacing free() by g_free() will work most of the times but is incorrect. But yeah, this deserves an explanation as a comment. See: http://0pointer.de/public/systemd-man/sd_pid_get_session.html Where I even documented that explicitly.
Thanks for the explanation, Lennart. I've fixed that and included your comment in the commit msg. See commit f1f7bddf007c950608f5f8c5a771a7fb2ab187d5