Re:How to change symlinks atomically (2005)
by JoshTriplett on Sunday August 21, 2016 @04:54AM
(#12330048)
> memfd_create() does not create an inode. It only creates a file descriptor.
It creates both; memfd_create (and timerfd_create, signalfd, eventfd, userfaultfd, epoll, and others) use a kernel subsystem called "anon_inode" to create an in-memory inode to back the file descriptor.
Re:How to change symlinks atomically (2005)
by JoshTriplett on Sunday August 21, 2016 @07:32AM
(#12330499)
(Minor correction: memfd_create creates an in-memory inode without using anon_inode, while the various other syscalls use anon_inode.)
Re:How to change symlinks atomically (2005)
by cyphar on Sunday August 21, 2016 @06:56AM
(#12330376)
It creates a full inode using shmem[1], which eventually goes to ramfs[2]. It's a real inode in every sense of the word.
[1]: http://lxr.free-electrons.com/source/mm/shmem.c?v=4.2#L2949 [2]: http://lxr.free-electrons.com/source/fs/ramfs/inode.c?v=4.2#...
With a file descriptor you can create multiple mappings to the same physical address -- something otherwise impossible on UNIX or Linux (although mach allows you to vm_remap[1] which is often sufficient).
[1]: http://web.mit.edu/darwin/src/modules/xnu/osfmk/man/vm_remap...