Re: New system call wanted: fdreopen

From: Chris Adams
Date: Sun Dec 09 2012 - 14:53:57 EST


Once upon a time, Tristan Wibberley <tristan.wibberley@xxxxxxxxx> said:
>A common idiom on Linux is to open a file and keep the fd open so that
>the underlying file can be unlinked from its directory. But if the file
>needs to be read from several different parts of the codebase then due to
>the file descriptor having exactly one read pointer those different parts
>must be synchronised which is a relatively difficult task.

I think you can get similar behavior entirely in user space and in a
fashion portable to at least BSD systems. You could fork() (which would
create a separate FD in the child), pass the FD back to the parent over
a socket, and then have the child exit.

--
Chris Adams <cmadams@xxxxxxxxxx>
Systems and Network Administrator - HiWAAY Internet Services
I don't speak for anybody but myself - that's enough trouble.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/