1POSIX_TYPED_MEM_OPEN(P)    POSIX Programmer's Manual   POSIX_TYPED_MEM_OPEN(P)
2
3
4

NAME

6       posix_typed_mem_open - open a typed memory object (ADVANCED REALTIME)
7

SYNOPSIS

9       #include <sys/mman.h>
10
11       int posix_typed_mem_open(const char *name, int oflag, int tflag);
12
13

DESCRIPTION

15       The   posix_typed_mem_open()  function  shall  establish  a  connection
16       between the typed memory object specified by the string pointed  to  by
17       name  and  a  file descriptor. It shall create an open file description
18       that refers to the typed memory  object  and  a  file  descriptor  that
19       refers  to  that  open file description. The file descriptor is used by
20       other functions to refer to that typed memory object. It is unspecified
21       whether  the  name  appears  in the file system and is visible to other
22       functions that take pathnames as arguments.  The  name  argument  shall
23       conform  to  the construction rules for a pathname. If name begins with
24       the slash character, then processes calling posix_typed_mem_open() with
25       the  same value of name shall refer to the same typed memory object. If
26       name does not begin with the slash character, the effect is implementa‐
27       tion-defined.  The  interpretation  of  slash characters other than the
28       leading slash character in name is implementation-defined.
29
30       Each typed memory object supported in a system shall be identified by a
31       name  which  specifies  not  only its associated typed memory pool, but
32       also the path or port by which it is accessed. That is, the same  typed
33       memory  pool  accessed  via  several different ports shall have several
34       different corresponding names. The binding between names and typed mem‐
35       ory  objects is established in an implementation-defined manner. Unlike
36       shared memory objects, there is no way within IEEE Std 1003.1-2001  for
37       a program to create a typed memory object.
38
39       The  value of tflag shall determine how the typed memory object behaves
40       when subsequently mapped by calls to mmap(). At most, one of  the  fol‐
41       lowing flags defined in <sys/mman.h> may be specified:
42
43       POSIX_TYPED_MEM_ALLOCATE
44              Allocate on mmap().
45
46       POSIX_TYPED_MEM_ALLOCATE_CONTIG
47              Allocate contiguously on mmap().
48
49       POSIX_TYPED_MEM_MAP_ALLOCATABLE
50              Map on mmap(), without affecting allocatability.
51
52
53       If  tflag  has  the flag POSIX_TYPED_MEM_ALLOCATE specified, any subse‐
54       quent call to mmap() using the returned file descriptor shall result in
55       allocation  and mapping of typed memory from the specified typed memory
56       pool. The allocated memory may be a contiguous  previously  unallocated
57       area  of  the  typed  memory  pool or several non-contiguous previously
58       unallocated areas (mapped  to  a  contiguous  portion  of  the  process
59       address  space).  If tflag has the flag POSIX_TYPED_MEM_ALLOCATE_CONTIG
60       specified, any subsequent  call  to  mmap()  using  the  returned  file
61       descriptor  shall result in allocation and mapping of a single contigu‐
62       ous previously unallocated area of the typed memory pool  (also  mapped
63       to  a  contiguous  portion of the process address space).  If tflag has
64       none of the  flags  POSIX_TYPED_MEM_ALLOCATE  or  POSIX_TYPED_MEM_ALLO‐
65       CATE_CONTIG specified, any subsequent call to mmap() using the returned
66       file descriptor shall map an application-chosen area from the specified
67       typed  memory  pool  such that this mapped area becomes unavailable for
68       allocation until unmapped by all  processes.  If  tflag  has  the  flag
69       POSIX_TYPED_MEM_MAP_ALLOCATABLE   specified,  any  subsequent  call  to
70       mmap() using the returned file descriptor shall map an application-cho‐
71       sen  area from the specified typed memory pool without an effect on the
72       availability of that area for allocation;  that  is,  mapping  such  an
73       object  leaves each byte of the mapped area unallocated if it was unal‐
74       located prior to the mapping or allocated if it was allocated prior  to
75       the    mapping.    The    appropriate    privilege   to   specify   the
76       POSIX_TYPED_MEM_MAP_ALLOCATABLE flag is implementation-defined.
77
78       If successful, posix_typed_mem_open() shall return  a  file  descriptor
79       for the typed memory object that is the lowest numbered file descriptor
80       not currently open for that process. The open file description is  new,
81       and  therefore  the  file  descriptor shall not share it with any other
82       processes. It is unspecified  whether  the  file  offset  is  set.  The
83       FD_CLOEXEC file descriptor flag associated with the new file descriptor
84       shall be cleared.
85
86       The behavior of msync(), ftruncate(), and  all  file  operations  other
87       than  mmap(),  posix_mem_offset(), posix_typed_mem_get_info(), fstat(),
88       dup(), dup2(), and close(), is unspecified when passed a file  descrip‐
89       tor connected to a typed memory object by this function.
90
91       The file status flags of the open file description shall be set accord‐
92       ing to the value of oflag. Applications shall specify  exactly  one  of
93       the  three  access  mode  values  described  below  and  defined in the
94       <fcntl.h> header, as the value of oflag.
95
96       O_RDONLY
97              Open for read access only.
98
99       O_WRONLY
100              Open for write access only.
101
102       O_RDWR Open for read or write access.
103
104

RETURN VALUE

106       Upon successful completion, the posix_typed_mem_open()  function  shall
107       return  a  non-negative integer representing the lowest numbered unused
108       file descriptor. Otherwise, it shall return -1 and set errno  to  indi‐
109       cate the error.
110

ERRORS

112       The posix_typed_mem_open() function shall fail if:
113
114       EACCES The  typed memory object exists and the permissions specified by
115              oflag are denied.
116
117       EINTR  The posix_typed_mem_open() operation was interrupted by  a  sig‐
118              nal.
119
120       EINVAL The  flags  specified  in  tflag  are  invalid (more than one of
121              POSIX_TYPED_MEM_ALLOCATE,  POSIX_TYPED_MEM_ALLOCATE_CONTIG,   or
122              POSIX_TYPED_MEM_MAP_ALLOCATABLE is specified).
123
124       EMFILE Too many file descriptors are currently in use by this process.
125
126       ENAMETOOLONG
127              The length of the name argument exceeds {PATH_MAX} or a pathname
128              component is longer than {NAME_MAX}.
129
130       ENFILE Too many file descriptors are currently open in the system.
131
132       ENOENT The named typed memory object does not exist.
133
134       EPERM  The caller lacks the appropriate privilege to specify  the  flag
135              POSIX_TYPED_MEM_MAP_ALLOCATABLE in argument tflag.
136
137
138       The following sections are informative.
139

EXAMPLES

141       None.
142

APPLICATION USAGE

144       None.
145

RATIONALE

147       None.
148

FUTURE DIRECTIONS

150       None.
151

SEE ALSO

153       close()  ,  dup() , exec() , fcntl() , fstat() , ftruncate() , mmap() ,
154       msync() , posix_mem_offset() , posix_typed_mem_get_info() ,  umask()  ,
155       the   Base   Definitions  volume  of  IEEE Std 1003.1-2001,  <fcntl.h>,
156       <sys/mman.h>
157
159       Portions of this text are reprinted and reproduced in  electronic  form
160       from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
161       -- Portable Operating System Interface (POSIX),  The  Open  Group  Base
162       Specifications  Issue  6,  Copyright  (C) 2001-2003 by the Institute of
163       Electrical and Electronics Engineers, Inc and The Open  Group.  In  the
164       event of any discrepancy between this version and the original IEEE and
165       The Open Group Standard, the original IEEE and The Open Group  Standard
166       is  the  referee document. The original Standard can be obtained online
167       at http://www.opengroup.org/unix/online.html .
168
169
170
171IEEE/The Open Group                  2003              POSIX_TYPED_MEM_OPEN(P)
Impressum