From mboxrd@z Thu Jan 1 00:00:00 1970 Date: Tue, 19 Jun 2007 13:38:18 -0400 From: Kris Maglione To: 9fans@cse.psu.edu Subject: Re: [9fans] equivalent of fstat | grep $portnumber ? Message-ID: <20070619173818.GD67517@kris.home> References: <20070619152735.GB6960@pestilenz.org> <20070619161347.GA67517@kris.home> <14ec7b180706190917j3d1f2edbt68ef2c8d5df9f8cc@mail.gmail.com> <20070619164902.GB67517@kris.home> <14ec7b180706190953x7a25471crbad6ec13e9763960@mail.gmail.com> <20070619165749.GC67517@kris.home> <14ec7b180706191016w6062421am906a8578cd62be12@mail.gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="rz+pwK2yUstbofK6" Content-Disposition: inline In-Reply-To: <14ec7b180706191016w6062421am906a8578cd62be12@mail.gmail.com> User-Agent: Mutt/1.5.15 (2007-04-06) Topicbox-Message-UUID: 81d58d7c-ead2-11e9-9d60-3106f5b1d025 --rz+pwK2yUstbofK6 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 19, 2007 at 11:16:44AM -0600, andrey mirtchovski wrote: > either i missed a smiley or you missed my point. lsof is not intended > for the Plan 9 distribution. Well, the original point was that I don't really see the point of the=20 program at all. Even if it were part of the main distrobution, it's=20 still such a trivial program that it seems fitting that it be provided=20 as a script, as are many other such programs. As for the speed, I just can't imagine it being an issue in practice,=20 but I also can't really imagine using the program at all, rather than=20 just grepping /proc. All in all, it doesn't matter much to me, it just=20 seems much simpler to just write it in rc. The other problems you mentioned seem trivial. Redirecting greps stderr=20 to /dev/null solves the second 2. There are a number of simple ways to=20 solve the first. #!/bin/rc if(~ $#* 0) f =3D /proc/*/fd if not f =3D /proc/^$*^/fd f =3D `{ls $f | sort -t/ -n +2} grep '.?' $f >[2]/dev/null | sed 's,^/proc/([0-9]+)/fd:,\1 ,' --=20 Kris Maglione Serving coffee on aircraft causes turbulence. --rz+pwK2yUstbofK6 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.3 (FreeBSD) iD8DBQFGeBSJseQZD8Aui4wRAiqHAJ9o8+uGzZfDTKSVyHGOOVCZMgpjsgCdHfBH 18v7tldWpnECq8EJrGymfqY= =CaNU -----END PGP SIGNATURE----- --rz+pwK2yUstbofK6--