Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lsfd: add shortcut for --file (or --inode) and --fs #2567

Open
mjt0k opened this issue Nov 2, 2023 · 4 comments
Open

lsfd: add shortcut for --file (or --inode) and --fs #2567

mjt0k opened this issue Nov 2, 2023 · 4 comments
Assignees

Comments

@mjt0k
Copy link

mjt0k commented Nov 2, 2023

lsof has a very useful feature, lsof /file/name to list processes which has this file open. An alternative with lsfd for this is to get the inode number and filesystem id of this file and use lsof -Q 'INODE == 4321 && MNTID == 123. This is just too clumsy for regular usage. This is what I'd suggest to have --inode. Note: it is not really -Q 'NAME == "/file/name"' - since the file might be open by more than single name in case it has multiple links, - this is why --file is different from --inode.

And another very useful shortcut is --fs /mntpt (or --mountpoint /mntpt) - to list all files open from the given filesystem (which should be equivalent to -Q 'MNTID == 123', I think).

@masatake
Copy link
Member

masatake commented Nov 3, 2023

I'll work on this item after #2531 is merged.

This one was in the checklists .

@masatake
Copy link
Member

masatake commented Nov 7, 2023

Like Wireshark, lsfd has two types of filters.

  1. early filter, working in the gathering-data stage, and
  2. display filter, working in the printing-result stage

-Q option is for specifying display filters.

--file, --inode, and maybe --fs can be implemented in the early filter.

Before implementing --inode, I must solve the btrfs-specific issue:

#2349 (comment)

@masatake
Copy link
Member

#2349 was solved via #2803. I'll try to solve this issue.

@masatake
Copy link
Member

masatake commented May 23, 2024

@karelzak Could you assign me to this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants