On Fri, Jul 12, 2013 at 12:42:15PM -0700, Linus Torvalds wrote: > As to the mode argument: we should encourage people to have it, since > the inode *may* become visible afterwards. See above (can you do > linkat() to just turn an fd into a name? I didn't really check, but I > think you can do it as a "link(/proc/sef/fd/..)" thing regardless). link() won't do it, linkat() with the right arguments will (link(2) doesn't follow symlinks on the oldname). It's a bit more complicated, though: * vfs_link() will refuse to link with link count that went down to 0 (always had, and that's a damn good idea for security reasons) * with O_TMPFILE, vfs_link() will act as usual *if* you give open() O_EXCL as well - files created that way cannot be linked in, ever. They stay with link count 0 and they die as soon as they are closed. Again, that's the behaviour we'd have with O_CREAT open + unlink. tmpfile(3) ought to call it that way. * O_TMPFILE _without_ O_EXCL == you may link it in once you've decided that you've set it up enough. In that case you are supposed to open it, write whatever you want to write, fchmod/fchown/fsetxattr/etc. and use linkat() to put it in place. Or use vfs_link() if you are doing that kernel-side. -- To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html