summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/memfd/memfd_test.c
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2014-08-08 14:25:29 -0700
committerMaciej Wereski <m.wereski@partner.samsung.com>2014-12-29 09:31:35 +0100
commit5ea1e3301b22ca848fd1bf21dff65f0abe10e624 (patch)
tree9192c185297c6a4407959c36e8e42ddf1bb28753 /tools/testing/selftests/memfd/memfd_test.c
parent57ad118090f109ea3338869cef66150cc2a9550f (diff)
downloadlinux-3.10-5ea1e3301b22ca848fd1bf21dff65f0abe10e624.tar.gz
linux-3.10-5ea1e3301b22ca848fd1bf21dff65f0abe10e624.tar.bz2
linux-3.10-5ea1e3301b22ca848fd1bf21dff65f0abe10e624.zip
shm: add memfd_create() syscall
memfd_create() is similar to mmap(MAP_ANON), but returns a file-descriptor that you can pass to mmap(). It can support sealing and avoids any connection to user-visible mount-points. Thus, it's not subject to quotas on mounted file-systems, but can be used like malloc()'ed memory, but with a file-descriptor to it. memfd_create() returns the raw shmem file, so calls like ftruncate() can be used to modify the underlying inode. Also calls like fstat() will return proper information and mark the file as regular file. If you want sealing, you can specify MFD_ALLOW_SEALING. Otherwise, sealing is not supported (like on all other regular files). Compared to O_TMPFILE, it does not require a tmpfs mount-point and is not subject to a filesystem size limit. It is still properly accounted to memcg limits, though, and to the same overcommit or no-overcommit accounting as all user memory. Signed-off-by: David Herrmann <dh.herrmann@gmail.com> Acked-by: Hugh Dickins <hughd@google.com> Cc: Michael Kerrisk <mtk.manpages@gmail.com> Cc: Ryan Lortie <desrt@desrt.ca> Cc: Lennart Poettering <lennart@poettering.net> Cc: Daniel Mack <zonque@gmail.com> Cc: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Change-Id: I2ac7e2b47a1d68d4b83680f4527e5ed2aa9a420c Origin: https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=9183df25fe7b194563db3fec6dc3202a5855839c Backported-by: Maciej Wereski <m.wereski@partner.samsung.com> Signed-off-by: Maciej Wereski <m.wereski@partner.samsung.com>
Diffstat (limited to 'tools/testing/selftests/memfd/memfd_test.c')
0 files changed, 0 insertions, 0 deletions