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

Kostik Belousov kostikbel at gmail.com
Sat Nov 26 17:48:14 UTC 2011


On Sat, Nov 26, 2011 at 06:43:01PM +0200, Mikolaj Golub wrote:
> 
> On Thu, 24 Nov 2011 09:12:35 +0200 Mikolaj Golub wrote:
> 
>  MG> On Wed, 23 Nov 2011 11:10:47 -0800 mdf at FreeBSD.org wrote:
> 
>  >>>                        printf(" AT_IGNORE=0x%lu",
>  >>> -                           (unsigned long)aux->a_un.a_val);
>  >>> +                           (unsigned long)auxv[i].a_un.a_val);
> 
>  m>> I didn't see this before, but this gives very misleading output.  The
>  m>> 0x prefix implies the output will be hex, but it's printed as decimal,
>  m>> here and below.
> 
>  MG> Oh. Thanks! Will fix.
> 
>  m>> I don't know if there's a style preference for 0x%lx versus %#lx,
>  m>> though, or a preference for a different type for the print (uintmax_t,
>  m>> for example).  There is probably a preference for using u_long rather
>  m>> than unsigned long, since it's shorter.
> 
>  MG> It looks like both 0x%lx and %#lx are widely spread in our source, I like %#lx
>  MG> a little more. It looks for me that (u_long) will be ok for now, so the chage
>  MG> for the printf above would be:
> 
>  MG> printf(" AT_IGNORE=%#lx", (u_long)auxv[i].a_un.a_val);
> 
>  MG> Anyway, printing all values in the same format was considered by me as a
>  MG> temporary solution. I am going to have format depending on a_type, so e.g.
>  MG> AT_PAGESZ will be 4096, not 0x1000.
> 
>  MG> Also, now they are printed as one string for a process:
> 
>  MG>   PID COMM             AUXV
>  MG>  2520 firefox-bin      AT_PHDR=0x400040 AT_PHENT=0x38 AT_PHNUM=0x7 AT_PAGESZ=0x1000 ...
> 
>  MG> I am considering changing this too, to something like below:
> 
>  MG>   PID COMM             AUXV        VALUE
>  MG>  2520 firefox-bin      AT_PHDR     0x400040
>  MG>  2520 firefox-bin      AT_PHENT    56
>  MG>  2520 firefox-bin      AT_PHNUM    7
>  MG> ...
> 
> I am going to commit this patch if nobody has any other suggestions.
> 
> The typical output:
> 
> in138:~% procstat -x 2008
>   PID COMM             AUXV             VALUE           
>  2008 nginx            AT_PHDR          0x400040
>  2008 nginx            AT_PHENT         56
>  2008 nginx            AT_PHNUM         8
>  2008 nginx            AT_PAGESZ        4096
>  2008 nginx            AT_FLAGS         0
>  2008 nginx            AT_ENTRY         0x40de00
>  2008 nginx            AT_BASE          0x800689000
>  2008 nginx            AT_EXECPATH      0x7fffffffefca
>  2008 nginx            AT_OSRELDATE     1000001
>  2008 nginx            AT_CANARY        0x7fffffffef8a
>  2008 nginx            AT_CANARYLEN     64
>  2008 nginx            AT_NCPUS         2
>  2008 nginx            AT_PAGESIZES     0x7fffffffef72
>  2008 nginx            AT_PAGESIZESLEN  24
>  2008 nginx            AT_STACKPROT     VM_PROT_ALL
I like this output much better. The only thing I am unsure of is
the pretty-printing of AT_STACKPROT. Might be, change it to
EXECUTABLE/NONEXECUTABLE printout.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20111126/26cd06a9/attachment.pgp


More information about the svn-src-all mailing list