Messages in this thread | | | Date | Thu, 21 May 2009 10:52:17 +0100 | From | Al Viro <> | Subject | Re: How to tell whether a struct file is held by a process? |
| |
On Tue, May 19, 2009 at 12:57:21PM -0400, Alan Stern wrote: > What's the best way to tell whether the current process has a > particular struct file among its open files? Is there any better way > to find out than blindly calling fget() for each possible fd? > > Is this a totally insane thing to do?
It is insane. You might lock fdtable and scan it, but as soon as you drop the spinlock your return value is worthless.
What are you trying to do? If the process is cooperating, you don't really need that in the kernel, if it's not, the check is not usable...
| |