9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Kris Maglione <bsdaemon@comcast.net>
To: 9fans@cse.psu.edu
Subject: Re: [9fans] equivalent of fstat | grep $portnumber ?
Date: Tue, 19 Jun 2007 13:38:18 -0400	[thread overview]
Message-ID: <20070619173818.GD67517@kris.home> (raw)
In-Reply-To: <14ec7b180706191016w6062421am906a8578cd62be12@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]

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 
program at all. Even if it were part of the main distrobution, it's 
still such a trivial program that it seems fitting that it be provided 
as a script, as are many other such programs.

As for the speed, I just can't imagine it being an issue in practice, 
but I also can't really imagine using the program at all, rather than 
just grepping /proc. All in all, it doesn't matter much to me, it just 
seems much simpler to just write it in rc.

The other problems you mentioned seem trivial. Redirecting greps stderr 
to /dev/null solves the second 2. There are a number of simple ways to 
solve the first.

#!/bin/rc

if(~ $#* 0)
	f = /proc/*/fd
if not
	f = /proc/^$*^/fd
f = `{ls $f | sort -t/ -n +2}

grep '.?' $f >[2]/dev/null | sed 's,^/proc/([0-9]+)/fd:,\1	,'

-- 
Kris Maglione

Serving coffee on aircraft causes turbulence.

[-- Attachment #2: Type: application/pgp-signature, Size: 194 bytes --]

  reply	other threads:[~2007-06-19 17:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-19 15:27 Matthias Bauer
2007-06-19 15:39 ` Skip Tavakkolian
2007-06-19 16:09   ` ron minnich
2007-06-19 16:13   ` Kris Maglione
2007-06-19 16:17     ` andrey mirtchovski
2007-06-19 16:49       ` Kris Maglione
2007-06-19 16:53         ` andrey mirtchovski
2007-06-19 16:57           ` Kris Maglione
2007-06-19 17:16             ` andrey mirtchovski
2007-06-19 17:38               ` Kris Maglione [this message]
2007-06-19 18:09                 ` Roman Shaposhnick
2007-06-19 18:08                   ` Kris Maglione
2007-06-19 18:53                     ` Kris Maglione
2007-06-19 18:13           ` jmk
2007-06-19 18:21             ` jmk
2007-06-19 18:28               ` Roman Shaposhnick
2007-06-20  0:46             ` Russ Cox
2007-06-20  5:48               ` Bruce Ellis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070619173818.GD67517@kris.home \
    --to=bsdaemon@comcast.net \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).