[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090521095217.GU8633@ZenIV.linux.org.uk>
Date: Thu, 21 May 2009 10:52:17 +0100
From: Al Viro <viro@...IV.linux.org.uk>
To: Alan Stern <stern@...land.harvard.edu>
Cc: Kernel development list <linux-kernel@...r.kernel.org>
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...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists