1POSIX_TYPED_MEM_OPEN(3P) POSIX Programmer's Manual POSIX_TYPED_MEM_OPEN(3P)
2
3
4
6 This manual page is part of the POSIX Programmer's Manual. The Linux
7 implementation of this interface may differ (consult the corresponding
8 Linux manual page for details of Linux behavior), or the interface may
9 not be implemented on Linux.
10
12 posix_typed_mem_open - open a typed memory object (ADVANCED REALTIME)
13
15 #include <sys/mman.h>
16
17 int posix_typed_mem_open(const char *name, int oflag, int tflag);
18
19
21 The posix_typed_mem_open() function shall establish a connection
22 between the typed memory object specified by the string pointed to by
23 name and a file descriptor. It shall create an open file description
24 that refers to the typed memory object and a file descriptor that
25 refers to that open file description. The file descriptor is used by
26 other functions to refer to that typed memory object. It is unspecified
27 whether the name appears in the file system and is visible to other
28 functions that take pathnames as arguments. The name argument shall
29 conform to the construction rules for a pathname. If name begins with
30 the slash character, then processes calling posix_typed_mem_open() with
31 the same value of name shall refer to the same typed memory object. If
32 name does not begin with the slash character, the effect is implementa‐
33 tion-defined. The interpretation of slash characters other than the
34 leading slash character in name is implementation-defined.
35
36 Each typed memory object supported in a system shall be identified by a
37 name which specifies not only its associated typed memory pool, but
38 also the path or port by which it is accessed. That is, the same typed
39 memory pool accessed via several different ports shall have several
40 different corresponding names. The binding between names and typed mem‐
41 ory objects is established in an implementation-defined manner. Unlike
42 shared memory objects, there is no way within IEEE Std 1003.1-2001 for
43 a program to create a typed memory object.
44
45 The value of tflag shall determine how the typed memory object behaves
46 when subsequently mapped by calls to mmap(). At most, one of the fol‐
47 lowing flags defined in <sys/mman.h> may be specified:
48
49 POSIX_TYPED_MEM_ALLOCATE
50 Allocate on mmap().
51
52 POSIX_TYPED_MEM_ALLOCATE_CONTIG
53 Allocate contiguously on mmap().
54
55 POSIX_TYPED_MEM_MAP_ALLOCATABLE
56 Map on mmap(), without affecting allocatability.
57
58
59 If tflag has the flag POSIX_TYPED_MEM_ALLOCATE specified, any subse‐
60 quent call to mmap() using the returned file descriptor shall result in
61 allocation and mapping of typed memory from the specified typed memory
62 pool. The allocated memory may be a contiguous previously unallocated
63 area of the typed memory pool or several non-contiguous previously
64 unallocated areas (mapped to a contiguous portion of the process
65 address space). If tflag has the flag POSIX_TYPED_MEM_ALLOCATE_CONTIG
66 specified, any subsequent call to mmap() using the returned file
67 descriptor shall result in allocation and mapping of a single contigu‐
68 ous previously unallocated area of the typed memory pool (also mapped
69 to a contiguous portion of the process address space). If tflag has
70 none of the flags POSIX_TYPED_MEM_ALLOCATE or POSIX_TYPED_MEM_ALLO‐
71 CATE_CONTIG specified, any subsequent call to mmap() using the returned
72 file descriptor shall map an application-chosen area from the specified
73 typed memory pool such that this mapped area becomes unavailable for
74 allocation until unmapped by all processes. If tflag has the flag
75 POSIX_TYPED_MEM_MAP_ALLOCATABLE specified, any subsequent call to
76 mmap() using the returned file descriptor shall map an application-cho‐
77 sen area from the specified typed memory pool without an effect on the
78 availability of that area for allocation; that is, mapping such an
79 object leaves each byte of the mapped area unallocated if it was unal‐
80 located prior to the mapping or allocated if it was allocated prior to
81 the mapping. The appropriate privilege to specify the
82 POSIX_TYPED_MEM_MAP_ALLOCATABLE flag is implementation-defined.
83
84 If successful, posix_typed_mem_open() shall return a file descriptor
85 for the typed memory object that is the lowest numbered file descriptor
86 not currently open for that process. The open file description is new,
87 and therefore the file descriptor shall not share it with any other
88 processes. It is unspecified whether the file offset is set. The
89 FD_CLOEXEC file descriptor flag associated with the new file descriptor
90 shall be cleared.
91
92 The behavior of msync(), ftruncate(), and all file operations other
93 than mmap(), posix_mem_offset(), posix_typed_mem_get_info(), fstat(),
94 dup(), dup2(), and close(), is unspecified when passed a file descrip‐
95 tor connected to a typed memory object by this function.
96
97 The file status flags of the open file description shall be set accord‐
98 ing to the value of oflag. Applications shall specify exactly one of
99 the three access mode values described below and defined in the
100 <fcntl.h> header, as the value of oflag.
101
102 O_RDONLY
103 Open for read access only.
104
105 O_WRONLY
106 Open for write access only.
107
108 O_RDWR Open for read or write access.
109
110
112 Upon successful completion, the posix_typed_mem_open() function shall
113 return a non-negative integer representing the lowest numbered unused
114 file descriptor. Otherwise, it shall return -1 and set errno to indi‐
115 cate the error.
116
118 The posix_typed_mem_open() function shall fail if:
119
120 EACCES The typed memory object exists and the permissions specified by
121 oflag are denied.
122
123 EINTR The posix_typed_mem_open() operation was interrupted by a sig‐
124 nal.
125
126 EINVAL The flags specified in tflag are invalid (more than one of
127 POSIX_TYPED_MEM_ALLOCATE, POSIX_TYPED_MEM_ALLOCATE_CONTIG, or
128 POSIX_TYPED_MEM_MAP_ALLOCATABLE is specified).
129
130 EMFILE Too many file descriptors are currently in use by this process.
131
132 ENAMETOOLONG
133 The length of the name argument exceeds {PATH_MAX} or a pathname
134 component is longer than {NAME_MAX}.
135
136 ENFILE Too many file descriptors are currently open in the system.
137
138 ENOENT The named typed memory object does not exist.
139
140 EPERM The caller lacks the appropriate privilege to specify the flag
141 POSIX_TYPED_MEM_MAP_ALLOCATABLE in argument tflag.
142
143
144 The following sections are informative.
145
147 None.
148
150 None.
151
153 None.
154
156 None.
157
159 close(), dup(), exec(), fcntl(), fstat() , ftruncate(), mmap(),
160 msync(), posix_mem_offset(), posix_typed_mem_get_info(), umask(), the
161 Base Definitions volume of IEEE Std 1003.1-2001, <fcntl.h>,
162 <sys/mman.h>
163
165 Portions of this text are reprinted and reproduced in electronic form
166 from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
167 -- Portable Operating System Interface (POSIX), The Open Group Base
168 Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
169 Electrical and Electronics Engineers, Inc and The Open Group. In the
170 event of any discrepancy between this version and the original IEEE and
171 The Open Group Standard, the original IEEE and The Open Group Standard
172 is the referee document. The original Standard can be obtained online
173 at http://www.opengroup.org/unix/online.html .
174
175
176
177IEEE/The Open Group 2003 POSIX_TYPED_MEM_OPEN(3P)