lkml.org 
[lkml]   [2009]   [May]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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...


\
 
 \ /
  Last update: 2009-05-21 11:55    [W:0.110 / U:0.732 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site