Red Hat Bugzilla – Bug 585843
lsof does not spot files open by a thread which does not share its father's fd table
Last modified: 2012-05-24 09:24:56 EDT
Created attachment 409106 [details]
Description of problem:
lsof does not spot files open by a thread which does not share its father's fd table.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
2. lsof -c clonenofd |grep /tmp
No opened file in /tmp/ directory is displayed by lsof.
It should displays a line like the following:
clonenofd 4985 root 3u REG 253,0 0 144152 /tmp/foo.QPKwSV
There is a bug in kernel that make /proc/<pid>/task/<tid>/fdinfo/ gives the link to open files, like /proc/<pid>/task/<tid>/fd/. You may have to wait for that to be solved in order to be able to show offsets correctly. I've posted a patch against that recently.
This bug appears to have been reported against 'rawhide' during the Fedora 14 development cycle.
Changing version to '14'.
More information and reason for this action is here:
This package has changed ownership in the Fedora Package Database. Reassigning to the new owner of this component.
I am not able to compile your reproducer on F17 because of the following error:
$ gcc clonenofd.c -o clonenofd
clonenofd.c: In function ‘main’:
clonenofd.c:41:17: error: ‘CLONE_THREAD’ undeclared (first use in this function)
clonenofd.c:41:17: note: each undeclared identifier is reported only once for each function it appears in
clonenofd.c:41:32: error: ‘CLONE_SIGHAND’ undeclared (first use in this function)
clonenofd.c:41:48: error: ‘CLONE_VM’ undeclared (first use in this function)
Please, do you know how to fix it?
Created attachment 580218 [details]
_GNU_SOURCE should be defined before including the first header. This version of the reproducer corrects that.
I've just find out, that if you want to list tasks of processes, you have to use -K option:
$ lsof -aK -c clonenofd | grep /tmp
clonenofd 23065 23066 schiffer 3u REG 8,3 0 1705804 /tmp/foo.x6fJhf
Please, confirm that this is what you need.
Yes this is correct. This -K option has been added to lsof 4.84.
Thanks. Since lsof 4.84 is available in F15, I am closing this as NEXTRELEASE.