summaryrefslogtreecommitdiffstats
path: root/man2/memfd_create.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/memfd_create.2')
-rw-r--r--man2/memfd_create.268
1 files changed, 34 insertions, 34 deletions
diff --git a/man2/memfd_create.2 b/man2/memfd_create.2
index 794aa0e54..6cfe506e1 100644
--- a/man2/memfd_create.2
+++ b/man2/memfd_create.2
@@ -35,16 +35,16 @@ have the same semantics as other anonymous
.\" those are accounted on "current" and "current->mm", that is, the
.\" process doing the first page access.
memory allocations such as those allocated using
-.BR mmap (2)
+.MR mmap 2
with the
.B MAP_ANONYMOUS
flag.
.P
The initial size of the file is set to 0.
Following the call, the file size should be set using
-.BR ftruncate (2).
+.MR ftruncate 2 .
(Alternatively, the file may be populated by calls to
-.BR write (2)
+.MR write 2
or similar.)
.P
The name supplied in
@@ -70,7 +70,7 @@ flag on the new file descriptor.
See the description of the
.B O_CLOEXEC
flag in
-.BR open (2)
+.MR open 2
for reasons why this may be useful.
.TP
.B MFD_ALLOW_SEALING
@@ -80,7 +80,7 @@ See the discussion of the
and
.B F_GET_SEALS
operations in
-.BR fcntl (2),
+.MR fcntl 2 ,
and also NOTES, below.
The initial set of seals is empty.
If this flag is not set, the initial set of seals will be
@@ -120,7 +120,7 @@ huge page sizes are included in the header file
.IP
For details on encoding huge page sizes not included in the header file,
see the discussion of the similarly named constants in
-.BR mmap (2).
+.MR mmap 2 .
.P
Unused bits in
.I flags
@@ -136,16 +136,16 @@ and
is set for the file descriptor.
.P
With respect to
-.BR fork (2)
+.MR fork 2
and
-.BR execve (2),
+.MR execve 2 ,
the usual semantics apply for the file descriptor created by
.BR memfd_create ().
A copy of the file descriptor is inherited by the child produced by
-.BR fork (2)
+.MR fork 2
and refers to the same file.
The file descriptor is preserved across
-.BR execve (2),
+.MR execve 2 ,
unless the close-on-exec flag has been set.
.SH RETURN VALUE
On success,
@@ -200,7 +200,7 @@ and is not a member of the
group; see the description of
.I /proc/sys/vm/sysctl_hugetlb_shm_group
in
-.BR proc (5).
+.MR proc 5 .
.SH STANDARDS
Linux.
.SH HISTORY
@@ -212,13 +212,13 @@ glibc 2.27.
The
.BR memfd_create ()
system call provides a simple alternative to manually mounting a
-.BR tmpfs (5)
+.MR tmpfs 5
filesystem and creating and opening a file in that filesystem.
The primary purpose of
.BR memfd_create ()
is to create files and associated file descriptors that are
used with the file-sealing APIs provided by
-.BR fcntl (2).
+.MR fcntl 2 .
.P
The
.BR memfd_create ()
@@ -261,20 +261,20 @@ its peer can't modify the shared memory in an undesired fashion.
An example of the usage of the sealing mechanism is as follows:
.IP (1) 5
The first process creates a
-.BR tmpfs (5)
+.MR tmpfs 5
file using
.BR memfd_create ().
The call yields a file descriptor used in subsequent steps.
.IP (2)
The first process
sizes the file created in the previous step using
-.BR ftruncate (2),
+.MR ftruncate 2 ,
maps it using
-.BR mmap (2),
+.MR mmap 2 ,
and populates the shared memory with the desired data.
.IP (3)
The first process uses the
-.BR fcntl (2)
+.MR fcntl 2
.B F_ADD_SEALS
operation to place one or more seals on the file,
in order to restrict further modifications on the file.
@@ -287,13 +287,13 @@ Otherwise, behavior similar to
can be achieved by using
.BR F_SEAL_FUTURE_WRITE ,
which will prevent future writes via
-.BR mmap (2)
+.MR mmap 2
and
-.BR write (2)
+.MR write 2
from succeeding while keeping existing shared writable mappings).
.IP (4)
A second process obtains a file descriptor for the
-.BR tmpfs (5)
+.MR tmpfs 5
file and maps it.
Among the possible ways in which this could happen are the following:
.RS
@@ -302,14 +302,14 @@ The process that called
.BR memfd_create ()
could transfer the resulting file descriptor to the second process
via a UNIX domain socket (see
-.BR unix (7)
+.MR unix 7
and
-.BR cmsg (3)).
+.MR cmsg 3 ).
The second process then maps the file using
-.BR mmap (2).
+.MR mmap 2 .
.IP \[bu]
The second process is created via
-.BR fork (2)
+.MR fork 2
and thus automatically inherits the file descriptor and mapping.
(Note that in this case and the next,
there is a natural trust relationship between the two processes,
@@ -328,11 +328,11 @@ is the number of the file descriptor returned by the call to
.BR memfd_create ()
in that process.
The second process then maps the file using
-.BR mmap (2).
+.MR mmap 2 .
.RE
.IP (5)
The second process uses the
-.BR fcntl (2)
+.MR fcntl 2
.B F_GET_SEALS
operation to retrieve the bit mask of seals
that has been applied to the file.
@@ -350,7 +350,7 @@ and the file sealing API.
The first program,
.IR t_memfd_create.c ,
creates a
-.BR tmpfs (5)
+.MR tmpfs 5
file using
.BR memfd_create (),
sets a size for the file, maps it into memory,
@@ -370,7 +370,7 @@ and inspect the set of seals that have been applied to that file.
.P
The following shell session demonstrates the use of these programs.
First we create a
-.BR tmpfs (5)
+.MR tmpfs 5
file and set some seals on it:
.P
.in +4n
@@ -541,9 +541,9 @@ main(int argc, char *argv[])
.EE
.\" SRC END
.SH SEE ALSO
-.BR fcntl (2),
-.BR ftruncate (2),
-.BR memfd_secret (2),
-.BR mmap (2),
-.BR shmget (2),
-.BR shm_open (3)
+.MR fcntl 2 ,
+.MR ftruncate 2 ,
+.MR memfd_secret 2 ,
+.MR mmap 2 ,
+.MR shmget 2 ,
+.MR shm_open 3