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 12:49:02 -0400	[thread overview]
Message-ID: <20070619164902.GB67517@kris.home> (raw)
In-Reply-To: <14ec7b180706190917j3d1f2edbt68ef2c8d5df9f8cc@mail.gmail.com>

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

On Tue, Jun 19, 2007 at 10:17:17AM -0600, andrey mirtchovski wrote:
> i just found a small program i had forgotten about that mimics unix'
> lsof. it's in /contrib/andrey/cmd/lsof.c

I don't really see the point. It seems only marginally easier, if at 
all, than grepping /proc/*/fd. Most of the time, I think you'd want to 
grap the output, anyway, in which case, it's easier to just grep /proc. 
But, assuming it's useful, why write it in C when you may as well write 
it in rc?

#!/bin/rc

if(~ $#* 0)
	* = `{cd /proc; echo *}

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

-- 
Kris Maglione

You can't fix it if it ain't broke.

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

  reply	other threads:[~2007-06-19 16:49 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 [this message]
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
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=20070619164902.GB67517@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).