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 via email to