lkml.org 
[lkml]   [2009]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] vfs: new O_NODE open flag
From
Date
On Fri, 25 Sep 2009, Valdis.Kletnieks wrote:
> On Fri, 25 Sep 2009 19:35:23 BST, "Dr. David Alan Gilbert" said:
>
> > I know it's not possible without this flag, my interest is whether
> > it would be possible WITH this flag to promote an fd opened with the
> > O_NODE to a normal fd, guaranteeing that it's still operating on the
> > same object.
>
> Well, maybe the question is if we should treat "promote" differently than
> "re-open"?
>
> (And now I'm wondering what happens if you dup() one of these beasts....)

dup() only duplicates _references_ to an open file, it does not create
a new file. The same applies to fork().

BTW I just checked, and it is possible to re-open or promote an fd
opened with O_NODE like this:

char tmp[64];

fd = open(filename, O_NODE | O_NOACCESS);
/* ... */
sprintf(tmp, "/proc/self/fd/%i", fd);
fd_rw = open(tmp, O_RDWR);

Now fd_rw is guaranteed to refer to the same inode as fd.

Thanks,
Miklos


\
 
 \ /
  Last update: 2009-09-28 12:27    [W:0.334 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site