svn commit: r227873 - head/usr.bin/procstat
Mikolaj Golub
trociny at freebsd.org
Sat Nov 26 16:43:09 UTC 2011
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
--
Mikolaj Golub
-------------- next part --------------
A non-text attachment was scrubbed...
Name: procstat_auxv.c.patch
Type: text/x-patch
Size: 6834 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/svn-src-all/attachments/20111126/d48e882a/procstat_auxv.c.bin
More information about the svn-src-all
mailing list