-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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: Support pidfs #2866
lsfd: Support pidfs #2866
Conversation
ae24222
to
6e05a45
Compare
Oops, Maybe I need to include something before it? |
Yes, it needs |
In Glibc, <sys/syscall.h> only contains SYS_* macros and the syscall() function is in <unistd.h>. So include it. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Though pidfs is introduced, lsfd still reports the SOURCE for the fd opening a file on the file system as "anon_inodefs". It should be "pidfs". The solution may be more complicated. The original code deals with fds opening files on anon_inodefs. |
Yes, I've considered that but to me it needs more time (maybe days) to be designed and implemented... So turning this into a draft for now. |
Oops, forgotten meson. |
Done. Tested on kernel 6.8.2 and 6.9-rc2. |
We'll reuse these logic for pidfd support on Linux >= 6.9. This should be a no-functional change. Besides moving the code, this change also renames anon_pidfd_data to pidfd_data, and removes a redundant nullity check for free (because free(NULL) will just do nothing per the C standard). Signed-off-by: Xi Ruoyao <xry111@xry111.site>
In Linux 6.9 pidfds are moved from the anonymous inode infrastructure to a tiny pseudo filesystem named pidfs. Recognize it properly. Fixes util-linux#2865. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
On Linux >= 6.9, pidfds are from pidfs instead of anonymous inode. Thus: STTYPE is REG on Linux >= 6.9, UNKN on Linux < 6.9. KNAME is pidfd:[inode number] on Linux >= 6.9, anon_inode:[pidfd] on Linux < 6.9. And ainode_class test cannot work on Linux >= 6.9, just skip this sub test if STTYPE is REG. Signed-off-by: Xi Ruoyao <xry111@xry111.site>
Had to do another push to fix |
@masatake, what about moving misc-utils/lsfd* files to separate lsfd/ directory (and removing the |
@karelzak I see. After finishing in-flight pull requests, I will make a pull request for introducing |
In Linux 6.9 pidfds are moved from the anonymous inode infrastructure to a tiny pseudo filesystem named pidfs. Recognize it properly.
Fixes #2865.