Skip to contentSkip to conversation

named sockets

ot Mikael Pettersson 1 participant 1 message May 8, 2001

lore
Share & tools
lore
#0 lore raw
Quoted 3 lines · Adam

So I'm wondering, is there a way, kind of like "relink" system call which coule take existing file descriptor (they are still so the fd is there, just unlinked) and link it back to file name?

POSIX' fattach(int fd, const char *path) library call does that, although it's often limited to STREAMS fd:s. It's usually implemented as mounting "namefs" at the path (SVR4) or setting a magic mount option (OSF1), with the fd passed in as mount-point specific data. Regular users are allowed to do this special mount().

Linux currently doesn't have this functionality, but it could probably be implemented as a pseudo-fs in 2.4, assuming the 2.4 VFS properly supports stacking of file systems. (There's some gotchas concerning chown/chmod changes and restoring the original object after the fd is unmounted.)

Not that I think Linux really needs this creeping featurism ...

/Mikael