svn commit: r227956 - head/usr.bin/procstat

Mikolaj Golub trociny at freebsd.org
Sat Dec 10 08:26:53 UTC 2011


On Thu, 08 Dec 2011 16:32:16 -0500 John Baldwin wrote:

 >>   JB>  Hmm, I would stick as close to limits output as possible.  I would
 >>   JB>  consider duplicating the unit field in each of soft and hard, so you
 >>   JB>  end up with something like this:
 >>
 >>   JB>    PID  COMM            RLIMIT     SOFT           HARD
 >>   JB>  48798  zsh             cputime      100000 secs  infinity secs
 >>   JB>  48798  zsh             filesize   infinity kb    infinity kb
 >>   JB>  48798  zsh             datasize     524288 kb      524288 kb
 >>
 >>   JB>  etc.
 >>
 >> Ok.
 >>
 >>   JB>  (Things like 'openfiles' is simply more intuitive than 'nofile' (no
 >>   JB>  file?, huh? oh, num open files.. (except not all users will make the
 >>   JB>  last step there).
 >>
 >> Then why do we have so non-intuitive rlimit_ident names?
 >>
 >> It looks like they are used only in procfs_rlimit.c. Do procfs(5) users always
 >> make that last step with 'nofile'? :-)

 JB> Well, I suspect it's best not to change the names in procfs in case
 JB> there are existing binaries that parse the output of that file
 JB> (unfortunately).

 >> Is it possible to change rlimit_ident names? Just to ones that are used by
 >> limit(1) or (if they look too long) to something like below:

 JB> Hmm, I have no idea what other things might use rlimit_ident.  Probably
 JB> not many.  (Also, for fun, note that the 'ulimit' and 'limit' built-in
 JB> commands in sh and csh also have their own sets of names, fun!)  I would
 JB> maybe add a rlimit_names[] (just leave rlimit_ident alone), and give
 JB> that the names from limits(1), and change both procstat and sh's
 JB> ulimit' command to use those.

Adding yet another rlimit names to the header file does not look so attractive
for me as it was just using/reusing what we had :-). So I decided to hardcode
the names in procstat_rlimit.c (see the attached patch).

Output example:

  PID COMM             RLIMIT                  SOFT             HARD     
11949 zsh              cputime                10000 sec     infinity     
11949 zsh              filesize            infinity         infinity     
11949 zsh              datasize              524288 kB        524288 kB  
11949 zsh              stacksize              65536 kB         65536 kB  
11949 zsh              coredumpsize          190734 MB        190734 MB  
11949 zsh              memoryuse           infinity         infinity     
11949 zsh              memorylocked        infinity         infinity     
11949 zsh              maxprocesses            5547             5547     
11949 zsh              openfiles              11095            11095     
11949 zsh              sbsize              infinity         infinity     
11949 zsh              vmemoryuse          infinity         infinity     
11949 zsh              pseudo-terminals    infinity         infinity     
11949 zsh              swapuse             infinity         infinity     

-- 
Mikolaj Golub

-------------- next part --------------
A non-text attachment was scrubbed...
Name: procstat_rlimit.c.patch
Type: text/x-patch
Size: 2780 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-head/attachments/20111210/4dc8e8c9/procstat_rlimit.c.bin


More information about the svn-src-head mailing list