On Apr 27, 2011, at 4:03 AM, Jan Görig wrote: > Hi, > I am sending you output from my /proc/*/cgroup. '\0's are replaced with new > lines. > > Replacing semicolon with comma is probably a good idea... Thanks a lot Jan. The live cgroup data allowed me to finalize cgroup support with more confidence. Below are two sets of patches, one for the library and another for top's stuff. I've also included a suggested commit message (short + long) that you might chose to use when (if?) you decide to commit. I decided to go with the comma separator for readability. I also tried displaying the cgroup number and found that it made the results are even more readable. So that's the way readproc is currently set up but is easily changed via an '#if 0' directive. If you approve of my libproc approach, perhaps we should extend a similar service for command lines. It sure would simplify top's refresh, sort and display logic. And as was true with cgroups, such a new 'flag' need not affect existing code in any way. -------------------------------------------------------------------- cgroup support migrated to libproc, plus miscellaneous re-formatting This source patchset addresses the following: Library Extension (readproc) . added PROC_FILLCGRPCVT flag . added an internal (static) fill_cgroup_cvt function: . reads AND parses /proc/#/cgroup . returns result as a single string in a single vector . thus no changes to proc_t structure or free memory logic Program Enhancements . removed parse_cgroup logic in favor of libproc . eliminated cgroup sort recurring overhead . converted WCHAN field to variable width . generalized variable width field logic in task_show . real-time notation under P col more distinctive as 'rt' Program Cosmetic . CGROUP now known as CGROUPS (plural) . moved jan's attribution from top.c to 'Notes' in top.h . numerous comments tweaked Document Enhancements . documented CGROUPS field (required renumbering all fields) . adapted narratives for the 3 current variable width fields . expanded real-time scheduling notes, 'RT' now shown as 'rt' --------------------------------------------------------------------