[lug] lsof
Jeffrey S. Haemer
jeffrey.haemer at gmail.com
Fri Apr 13 16:54:28 MDT 2018
Folks,
Thanks for all the suggestions!
I'm not surprised that Debian returns just as fast as Fedora, but I want to
make this work on a Mac.
I specified the OSX version (10.13.4) because it worked fast before I
upgraded.
I didn't specify the hardware because it's slow on two different Macs
running 10.13.4: a new Macbook Pro Touchbar (work) and an old Macbook Pro
(my home laptop).
It has nothing to do with FUSE, since FUSE isn't even running.
(And I should be saying OSXFUSE, since that isn't the same as Linux FUSE.
That's a separate topic, but if you have lots of experience writing
OSXFUSE-based filesystems, please drop me a note.)
The '-n' flag to lsof doesn't help. The StackExchange post I'd seen on this
was several years old, which means that Macs have had this kind of problem
before -- probably before I started running lsof on them. Because '-n'
doesn't help, might be the same symptom, different problem?
And Bill's completely right about fs_usage, but my question isn't "Why is
lsof horked?" it's just "Can anyone tell me how to make lsof work at normal
speed, or suggest a faster way to find out, from a shell script, whether a
file's open on a Mac?"
(I actually haven't ever found fs_usage as useful as strace, but that's
probably my ignorance. I'm a Linux guy, not a Mac guy.)
Here's what I see
jshaemer at tw-mbp-sysadmin:tmp$ touch foo
jshaemer at tw-mbp-sysadmin:tmp$ time lsof foo
real 0m15.500s
user 0m0.085s
sys 0m15.397s
jshaemer at tw-mbp-sysadmin:tmp$ echo $?
1
jshaemer at tw-mbp-sysadmin:tmp$ while :; do date; sleep 10; done >>foo &
[1] 56149
jshaemer at tw-mbp-sysadmin:tmp$ time lsof foo
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
bash 56149 jshaemer 1w REG 1,4 145 4881088 foo
sleep 56153 jshaemer 1w REG 1,4 145 4881088 foo
real 0m14.566s
user 0m0.079s
sys 0m14.467s
jshaemer at tw-mbp-sysadmin:tmp$ echo $?
0
I do really appreciate all the pointers. Even if they don't help me now,
they might help another time, or help someone else reading the thread. This
mailing list is great: very high signal-to-noise ratio.
On Fri, Apr 13, 2018 at 3:16 PM, ghe <ghe at slsware.net> wrote:
> On 04/13/2018 01:50 PM, Jeffrey S. Haemer wrote:
>
> > On Linux, lsof, which reports whether someone's got a file open, returns
> > instantly. On 10.13.4, it returns in 10 seconds or so. It gets the
> > right answer, but verrrrrryyyyy sllllllllllllowwwwly.
>
> I just tried it on Debian Buster (also 10.<something>, I think). It
> 'thought' for a few milliseconds, then wrote several pages of data to
> the screen.
>
> Buster works good.
>
> --
> Glenn English
> _______________________________________________
> Web Page: http://lug.boulder.co.us
> Mailing List: http://lists.lug.boulder.co.us/mailman/listinfo/lug
> Join us on IRC: irc.hackingsociety.org port=6667 channel=#hackingsociety
>
--
Jeffrey Haemer <jeffrey.haemer at gmail.com>
720-837-8908 [cell], @goyishekop [twitter]
*פרייהייט? דאס איז יאַנג דינען וואָרט!*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lug.boulder.co.us/pipermail/lug/attachments/20180413/35b2fec8/attachment.html>
More information about the LUG
mailing list