Date: Thu, 24 Nov 2011 09:12:35 +0200 From: Mikolaj Golub <trociny@freebsd.org> To: mdf@FreeBSD.org Cc: svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org Subject: Re: svn commit: r227873 - head/usr.bin/procstat Message-ID: <86ipmaq9i4.fsf@in138.ua3> In-Reply-To: <CAMBSHm9=kToWP8kmc5YqfMeAC%2BeX_677MPsVK5cqrNaHekSctA@mail.gmail.com> (mdf@freebsd.org's message of "Wed, 23 Nov 2011 11:10:47 -0800") References: <201111230734.pAN7YA78032998@svn.freebsd.org> <CAMBSHm9=kToWP8kmc5YqfMeAC%2BeX_677MPsVK5cqrNaHekSctA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, 23 Nov 2011 11:10:47 -0800 mdf@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. 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. It looks like both 0x%lx and %#lx are widely spread in our source, I like %#lx a little more. It looks for me that (u_long) will be ok for now, so the chage for the printf above would be: printf(" AT_IGNORE=%#lx", (u_long)auxv[i].a_un.a_val); Anyway, printing all values in the same format was considered by me as a temporary solution. I am going to have format depending on a_type, so e.g. AT_PAGESZ will be 4096, not 0x1000. Also, now they are printed as one string for a process: PID COMM AUXV 2520 firefox-bin AT_PHDR=0x400040 AT_PHENT=0x38 AT_PHNUM=0x7 AT_PAGESZ=0x1000 ... I am considering changing this too, to something like below: PID COMM AUXV VALUE 2520 firefox-bin AT_PHDR 0x400040 2520 firefox-bin AT_PHENT 56 2520 firefox-bin AT_PHNUM 7 ... -- Mikolaj Golub
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?86ipmaq9i4.fsf>