Messages in this thread | | | Date | Sun, 9 Dec 2012 13:37:33 -0600 | From | Chris Adams <> | Subject | Re: New system call wanted: fdreopen |
| |
Once upon a time, Tristan Wibberley <tristan.wibberley@gmail.com> 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@hiwaay.net> Systems and Network Administrator - HiWAAY Internet Services I don't speak for anybody but myself - that's enough trouble.
| |