summaryrefslogtreecommitdiffstats
path: root/man-pages-posix-2017/man3p/posix_typed_mem_open.3p
blob: 114ec663db5672f1713a7c2c44ee66a38b4cb99c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
'\" et
.TH POSIX_TYPED_MEM_OPEN "3P" 2017 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\"
.SH PROLOG
This manual page is part of the POSIX Programmer's Manual.
The Linux implementation of this interface may differ (consult
the corresponding Linux manual page for details of Linux behavior),
or the interface may not be implemented on Linux.
.\"
.SH NAME
posix_typed_mem_open
\(em open a typed memory object
(\fBADVANCED REALTIME\fP)
.SH SYNOPSIS
.LP
.nf
#include <sys/mman.h>
.P
int posix_typed_mem_open(const char *\fIname\fP, int \fIoflag\fP, int \fItflag\fP);
.fi
.SH DESCRIPTION
The
\fIposix_typed_mem_open\fR()
function shall establish a connection between the typed memory object
specified by the string pointed to by
.IR name
and a file descriptor. It shall create an open file description that
refers to the typed memory object and a file descriptor that refers to
that open file description. The file descriptor shall be allocated as
described in
.IR "Section 2.14" ", " "File Descriptor Allocation"
and can be used by other functions to refer to that typed
memory object. It is unspecified whether the name appears in
the file system and is visible to other functions that take
pathnames as arguments. The
.IR name
argument conforms to the construction rules for a pathname, except that
the interpretation of
<slash>
characters other than the leading
<slash>
character in
.IR name
is implementation-defined, and that the length limits for the
.IR name
argument are implementation-defined and need not be the same as the
pathname limits
{PATH_MAX}
and
{NAME_MAX}.
If
.IR name
begins with the
<slash>
character, then processes calling
\fIposix_typed_mem_open\fR()
with the same value of
.IR name
shall refer to the same typed memory object. If
.IR name
does not begin with the
<slash>
character, the effect is implementation-defined.
.P
Each typed memory object supported in a system shall be identified by a name
which specifies not only its associated typed memory pool, but also the
path or port by which it is accessed. That is, the same typed memory
pool accessed via several different ports shall have several different
corresponding names. The binding between names and typed memory objects
is established in an implementation-defined manner. Unlike shared
memory objects, there is no way within POSIX.1\(hy2008 for a program to create a
typed memory object.
.P
The value of
.IR tflag
shall determine how the typed memory object behaves when subsequently
mapped by calls to
\fImmap\fR().
At most, one of the following flags defined in
.IR <sys/mman.h> 
may be specified:
.IP POSIX_TYPED_MEM_ALLOCATE 6
.br
Allocate on
\fImmap\fR().
.IP POSIX_TYPED_MEM_ALLOCATE_CONTIG 6
.br
Allocate contiguously on
\fImmap\fR().
.IP POSIX_TYPED_MEM_MAP_ALLOCATABLE 6
.br
Map on
\fImmap\fR(),
without affecting allocatability.
.P
If
.IR tflag
has the flag POSIX_TYPED_MEM_ALLOCATE specified, any subsequent call to
\fImmap\fR()
using the returned file descriptor shall result in allocation and
mapping of typed memory from the specified typed memory pool. The
allocated memory may be a contiguous previously unallocated area of the
typed memory pool or several non-contiguous previously unallocated
areas (mapped to a contiguous portion of the process address space). If
.IR tflag
has the flag POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent
call to
\fImmap\fR()
using the returned file descriptor shall result in allocation and
mapping of a single contiguous previously unallocated area of the typed
memory pool (also mapped to a contiguous portion of the process address
space). If
.IR tflag
has none of the flags POSIX_TYPED_MEM_ALLOCATE or
POSIX_TYPED_MEM_ALLOCATE_CONTIG specified, any subsequent call to
\fImmap\fR()
using the returned file descriptor shall map an application-chosen area
from the specified typed memory pool such that this mapped area becomes
unavailable for allocation until unmapped by all processes. If
.IR tflag
has the flag POSIX_TYPED_MEM_MAP_ALLOCATABLE specified, any subsequent
call to
\fImmap\fR()
using the returned file descriptor shall map an application-chosen area
from the specified typed memory pool without an effect on the
availability of that area for allocation; that is, mapping such an
object leaves each byte of the mapped area unallocated if it was
unallocated prior to the mapping or allocated if it was allocated prior
to the mapping. Appropriate privileges to specify the
POSIX_TYPED_MEM_MAP_ALLOCATABLE flag are implementation-defined.
.P
If successful,
\fIposix_typed_mem_open\fR()
shall return a file descriptor for the typed memory object.
The open file description is new, and therefore the file descriptor
shall not share it with any other processes. It is unspecified whether
the file offset is set. The FD_CLOEXEC file descriptor flag associated
with the new file descriptor shall be cleared.
.P
The behavior of
\fImsync\fR(),
\fIftruncate\fR(),
and all file operations other than
\fImmap\fR(),
\fIposix_mem_offset\fR(),
\fIposix_typed_mem_get_info\fR(),
\fIfstat\fR(),
\fIdup\fR(),
\fIdup2\fR(),
and
\fIclose\fR(),
is unspecified when passed a file descriptor connected to a typed
memory object by this function.
.P
The file status flags of the open file description shall be set
according to the value of
.IR oflag .
Applications shall specify exactly one of the three access mode values
described below and defined in the
.IR <fcntl.h> 
header, as the value of
.IR oflag .
.IP O_RDONLY 12
Open for read access only.
.IP O_WRONLY 12
Open for write access only.
.IP O_RDWR 12
Open for read or write access.
.SH "RETURN VALUE"
Upon successful completion, the
\fIposix_typed_mem_open\fR()
function shall return a non-negative integer representing the
file descriptor. Otherwise, it shall return \-1 and set
.IR errno
to indicate the error.
.SH ERRORS
The
\fIposix_typed_mem_open\fR()
function shall fail if:
.TP
.BR EACCES
The typed memory object exists and the permissions specified by
.IR oflag
are denied.
.TP
.BR EINTR
The
\fIposix_typed_mem_open\fR()
operation was interrupted by a signal.
.TP
.BR EINVAL
.ad l
The flags specified in
.IR tflag
are invalid (more than one of POSIX_TYPED_MEM_ALLOCATE,
POSIX_TYPED_MEM_ALLOCATE_CONTIG, or POSIX_TYPED_MEM_MAP_ALLOCATABLE is
specified).
.ad b
.TP
.BR EMFILE
All file descriptors available to the process are currently open.
.TP
.BR ENFILE
Too many file descriptors are currently open in the system.
.TP
.BR ENOENT
The named typed memory object does not exist.
.TP
.BR EPERM
The caller lacks appropriate privileges to specify the
POSIX_TYPED_MEM_MAP_ALLOCATABLE flag in the
.IR tflag
argument.
.P
The
\fIposix_typed_mem_open\fR()
function may fail if:
.TP
.BR ENAMETOOLONG
.br
The length of the
.IR name
argument exceeds
{_POSIX_PATH_MAX}
on systems that do not support the XSI option
or exceeds
{_XOPEN_PATH_MAX}
on XSI systems,
or has a pathname component that is longer than
{_POSIX_NAME_MAX}
on systems that do not support the XSI option
or longer than
{_XOPEN_NAME_MAX}
on XSI systems.
.LP
.IR "The following sections are informative."
.SH EXAMPLES
None.
.SH "APPLICATION USAGE"
None.
.SH RATIONALE
None.
.SH "FUTURE DIRECTIONS"
None.
.SH "SEE ALSO"
.IR "Section 2.14" ", " "File Descriptor Allocation",
.IR "\fIclose\fR\^(\|)",
.IR "\fIdup\fR\^(\|)",
.IR "\fIexec\fR\^",
.IR "\fIfcntl\fR\^(\|)",
.IR "\fIfstat\fR\^(\|)",
.IR "\fIftruncate\fR\^(\|)",
.IR "\fImmap\fR\^(\|)",
.IR "\fImsync\fR\^(\|)",
.IR "\fIposix_mem_offset\fR\^(\|)",
.IR "\fIposix_typed_mem_get_info\fR\^(\|)",
.IR "\fIumask\fR\^(\|)"
.P
The Base Definitions volume of POSIX.1\(hy2017,
.IR "\fB<fcntl.h>\fP",
.IR "\fB<sys_mman.h>\fP"
.\"
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1-2017, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 7, 2018 Edition,
Copyright (C) 2018 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group.
In the event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .
.PP
Any typographical or formatting errors that appear
in this page are most likely
to have been introduced during the conversion of the source files to
man page format. To report such errors, see
https://www.kernel.org/doc/man-pages/reporting_bugs.html .