diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
commit | 3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 (patch) | |
tree | 3ee7a3ec64525911fa865bb984c86d997d855527 /man2/memfd_create.2 | |
parent | Adding debian version 6.05.01-1. (diff) | |
download | manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.tar.xz manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.zip |
Merging upstream version 6.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man2/memfd_create.2')
-rw-r--r-- | man2/memfd_create.2 | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/man2/memfd_create.2 b/man2/memfd_create.2 index fb18abc..c7cf859 100644 --- a/man2/memfd_create.2 +++ b/man2/memfd_create.2 @@ -3,7 +3,7 @@ .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" -.TH memfd_create 2 2023-05-03 "Linux man-pages 6.05.01" +.TH memfd_create 2 2023-10-31 "Linux man-pages 6.7" .SH NAME memfd_create \- create an anonymous file .SH LIBRARY @@ -13,7 +13,7 @@ Standard C library .nf .BR "#define _GNU_SOURCE" " /* See feature_test_macros(7) */" .B #include <sys/mman.h> -.PP +.P .BI "int memfd_create(const char *" name ", unsigned int " flags ");" .fi .SH DESCRIPTION @@ -39,14 +39,14 @@ memory allocations such as those allocated using with the .B MAP_ANONYMOUS flag. -.PP +.P The initial size of the file is set to 0. Following the call, the file size should be set using .BR ftruncate (2). (Alternatively, the file may be populated by calls to .BR write (2) or similar.) -.PP +.P The name supplied in .I name is used as a filename and will be displayed @@ -57,7 +57,7 @@ The displayed name is always prefixed with and serves only for debugging purposes. Names do not affect the behavior of the file descriptor, and as such multiple files can have the same name without any side effects. -.PP +.P The following values may be bitwise ORed in .I flags to change the behavior of @@ -105,7 +105,11 @@ in .I flags is supported since Linux 4.16. .TP -.BR MFD_HUGE_2MB ", " MFD_HUGE_1GB ", " "..." +.B MFD_HUGE_2MB +.TQ +.B MFD_HUGE_1GB +.TQ +\&.\|.\|. Used in conjunction with .B MFD_HUGETLB to select alternative hugetlb page sizes (respectively, 2\ MB, 1\ GB, ...) @@ -117,11 +121,11 @@ huge page sizes are included in the header file 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). -.PP +.P Unused bits in .I flags must be 0. -.PP +.P As its return value, .BR memfd_create () returns a new file descriptor that can be used to refer to the file. @@ -130,7 +134,7 @@ This file descriptor is opened for both reading and writing and .B O_LARGEFILE is set for the file descriptor. -.PP +.P With respect to .BR fork (2) and @@ -215,7 +219,7 @@ The primary purpose of is to create files and associated file descriptors that are used with the file-sealing APIs provided by .BR fcntl (2). -.PP +.P The .BR memfd_create () system call also has uses without file sealing @@ -247,13 +251,13 @@ location in the shared memory region. (Dealing with this possibility necessitates the use of a handler for the .B SIGBUS signal.) -.PP +.P Dealing with untrusted peers imposes extra complexity on code that employs shared memory. Memory sealing enables that extra complexity to be eliminated, by allowing a process to operate secure in the knowledge that its peer can't modify the shared memory in an undesired fashion. -.PP +.P An example of the usage of the sealing mechanism is as follows: .IP (1) 5 The first process creates a @@ -342,7 +346,7 @@ seal has not yet been applied). Below are shown two example programs that demonstrate the use of .BR memfd_create () and the file sealing API. -.PP +.P The first program, .IR t_memfd_create.c , creates a @@ -357,18 +361,18 @@ The first argument is the name to associate with the file, the second argument is the size to be set for the file, and the optional third argument is a string of characters that specify seals to be set on the file. -.PP +.P The second program, .IR t_get_seals.c , can be used to open an existing file that was created via .BR memfd_create () and inspect the set of seals that have been applied to that file. -.PP +.P The following shell session demonstrates the use of these programs. First we create a .BR tmpfs (5) file and set some seals on it: -.PP +.P .in +4n .EX $ \fB./t_memfd_create my_memfd_file 4096 sw &\fP @@ -376,7 +380,7 @@ $ \fB./t_memfd_create my_memfd_file 4096 sw &\fP PID: 11775; fd: 3; /proc/11775/fd/3 .EE .in -.PP +.P At this point, the .I t_memfd_create program continues to run in the background. @@ -392,7 +396,7 @@ Using that pathname, we inspect the content of the symbolic link, and use our .I t_get_seals program to view the seals that have been placed on the file: -.PP +.P .in +4n .EX $ \fBreadlink /proc/11775/fd/3\fP |