9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "andrey mirtchovski" <mirtchovski@gmail.com>
To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu>
Subject: Re: [9fans] equivalent of fstat | grep $portnumber ?
Date: Tue, 19 Jun 2007 11:16:44 -0600	[thread overview]
Message-ID: <14ec7b180706191016w6062421am906a8578cd62be12@mail.gmail.com> (raw)
In-Reply-To: <20070619165749.GC67517@kris.home>

> But your lsof is equivalent to about 3 lines of rc script, done almost
> entirely by programs written in C, and is much clearer. I doubt that
> there's any noteworthy difference in speed, or that it would matter much
> if there were, so I just can't imagine why you'd want to write it in C.

either i missed a smiley or you missed my point. lsof is not intended
for the Plan 9 distribution.

if you want to argue, however, here are a few points:

your script as you've supplied it is incorrect. adding the required
functionality will make it more complex:

- results are sorted alphabetically, not numerically by process id (in
other incarnations they'll need to be sorted by node, then by process
id)
- /proc/trace is not a directory
- race: at least one process has exited by the time the script tries
to cat its fd file, resulting in an error

as far as speed is concerned, the rc script is two to three times
slower on a single user machine, four to six times slower on a busy
machine with multiple users. if one is doing this on several machines
at the same time it becomes too much (think 'ps' on a 1000 node
cluster).


  reply	other threads:[~2007-06-19 17:16 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 [this message]
2007-06-19 17:38               ` Kris Maglione
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=14ec7b180706191016w6062421am906a8578cd62be12@mail.gmail.com \
    --to=mirtchovski@gmail.com \
    --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).