Date: Sat, 26 Nov 2011 19:48:09 +0200 From: Kostik Belousov <kostikbel@gmail.com> To: Mikolaj Golub <trociny@freebsd.org> Cc: svn-src-head@freebsd.org, mdf@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, Robert Watson <rwatson@freebsd.org> Subject: Re: svn commit: r227873 - head/usr.bin/procstat Message-ID: <20111126174808.GK50300@deviant.kiev.zoral.com.ua> In-Reply-To: <86vcq6n8bu.fsf@kopusha.home.net> References: <201111230734.pAN7YA78032998@svn.freebsd.org> <CAMBSHm9=kToWP8kmc5YqfMeAC%2BeX_677MPsVK5cqrNaHekSctA@mail.gmail.com> <86ipmaq9i4.fsf@in138.ua3> <86vcq6n8bu.fsf@kopusha.home.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--xrgBBsHnjfjm6j0J
Content-Type: text/plain; charset=koi8-r
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Sat, Nov 26, 2011 at 06:43:01PM +0200, Mikolaj Golub wrote:
>=20
> On Thu, 24 Nov 2011 09:12:35 +0200 Mikolaj Golub wrote:
>=20
> MG> On Wed, 23 Nov 2011 11:10:47 -0800 mdf@FreeBSD.org wrote:
>=20
> >>> =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9Aprintf(" AT_IGNORE=3D=
0x%lu",
> >>> - =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A (unsigned long=
)aux->a_un.a_val);
> >>> + =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A =9A (unsigned long=
)auxv[i].a_un.a_val);
>=20
> 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 decima=
l,
> m>> here and below.
>=20
> MG> Oh. Thanks! Will fix.
>=20
> 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.
>=20
> 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:
>=20
> MG> printf(" AT_IGNORE=3D%#lx", (u_long)auxv[i].a_un.a_val);
>=20
> 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, s=
o e.g.
> MG> AT_PAGESZ will be 4096, not 0x1000.
>=20
> MG> Also, now they are printed as one string for a process:
>=20
> MG> PID COMM AUXV
> MG> 2520 firefox-bin AT_PHDR=3D0x400040 AT_PHENT=3D0x38 AT_PHNUM=
=3D0x7 AT_PAGESZ=3D0x1000 ...
>=20
> MG> I am considering changing this too, to something like below:
>=20
> 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> ...
>=20
> I am going to commit this patch if nobody has any other suggestions.
>=20
> The typical output:
>=20
> in138:~% procstat -x 2008
> PID COMM AUXV VALUE =20
> 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.
--xrgBBsHnjfjm6j0J
Content-Type: application/pgp-signature
Content-Disposition: inline
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.18 (FreeBSD)
iEYEARECAAYFAk7RJlgACgkQC3+MBN1Mb4jG9gCfRyJ3b8bqX3aCVCkv+tFJ9d4z
L1IAnjxRsxeFT8FwxSJjGcBBT/s6e7kK
=aB77
-----END PGP SIGNATURE-----
--xrgBBsHnjfjm6j0J--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20111126174808.GK50300>
