1rsm_memseg_export_creRaetmeo(t3eRSSMh)ared Memory LibraryrFsumn_cmteimosnesg_export_create(3RSM)
2
3
4

NAME

6       rsm_memseg_export_create,      rsm_memseg_export_destroy,      rsm_mem‐
7       seg_export_rebind - resource allocation and  management  functions  for
8       export memory segments
9

SYNOPSIS

11       cc [ flag... ] file... -lrsm [ library... ]
12       #include <rsmapi.h>
13
14       int rsm_memseg_export_create(
15            rsmapi_controller_handle_t controller,
16            rsm_memseg_export_handle_t *memseg, void *vaddr,
17            size_t length, uint_t flags);
18
19
20       int rsm_memseg_export_destroy(
21            rsm_memseg_export_handle_t memseg);
22
23
24       int rsm_memseg_export_rebind(
25            rsm_memseg_export_handle_t memseg,
26            void *vaddr, offset_t off, size_t length);
27
28

DESCRIPTION

30       The    rsm_memseg_export_create(),   rsm_memseg_export_destroy(),   and
31       rsm_memseg_export_rebind() functions provide for allocation and manage‐
32       ment  of resources supporting export  memory segments. Exporting a mem‐
33       ory segment involves the application allocating memory in  its  virtual
34       address  space  through  the System V shared memory interface or normal
35       operating system memory allocation functions. This is followed  by  the
36       calls  to  create the export segment and bind physical pages to back to
37       allocated virtual address space.
38
39
40       The rsm_memseg_export_create() creates a new memory  segment.  Physical
41       memory  pages  are  allocated  and are associated with the segment. The
42       segment lifetime is the same as the lifetime of the creating process or
43       until  a destroy operation is performed. The controller argument is the
44       controller  handle  obtained  from  a  prior  call   to    rsm_get_con‐
45       troller(3RSM). The export memory segment handle is obtained through the
46       memseg argument for use in subsequent operations.  The  vaddr  argument
47       specifies  the  process  virtual  address  for  the segment. It must be
48       aligned according to the controller page  size  attribute.  The  length
49       argument specifies the size of the segment in bytes and must be in mul‐
50       tiples of the controller page size.  The flags argument is a bitmask of
51       flags. Possible values are:
52
53       RSM_ALLOW_REBIND           Unbind  and rebind is allowed on the segment
54                                  during its lifetime.
55
56
57       RSM_CREATE_SEG_DONTWAIT    The   RSMAPI   segment   create   operations
58                                  rsm_memseg_export_create()    and   rsm_mem‐
59                                  seg_export_publish(3RSM)  should  not  block
60                                  for  resources  and  return  RSMERR_INSUFFI‐
61                                  CIENT_RESOURCES to indicate resource  short‐
62                                  age.
63
64
65       RSM_LOCK_OPS               This  segment  can  be  used for lock opera‐
66                                  tions.
67
68
69
70       The rsm_memseg_export_destroy() function deallocates the physical  mem‐
71       ory  pages associated with the segment and disconnects all importers of
72       the segment. The memseg argument is the export  memory  segment  handle
73       obtained by a call to rsm_memseg_export_create().
74
75
76       The  rsm_memseg_export_rebind()  function  releases the current backing
77       pages associated with the segment and  allocates  new  physical  memory
78       pages.  This  operation is transparent to the importers of the segment.
79       It is the responsibility of the application to prevent data  access  to
80       the  export  segment  until the rebind operation has completed. Segment
81       data access during rebind does not cause a system failure but data con‐
82       tent  results  are undefined. The memseg argument is the export segment
83       handle pointer  obtained  from  rsm_memseg_export_create().  The  vaddr
84       argument must be aligned with respect to the page size attribute of the
85       controller. The length argument modulo controller page size must be  0.
86       The off argument is currently unused.
87

RETURN VALUES

89       Upon  successful  completion,  these functions return 0.  Otherwise, an
90       error value is returned to indicate the error.
91

ERRORS

93       The   rsm_memseg_export_create(),   rsm_memseg_export_destroy(),    and
94       rsm_memseg_export_rebind() functions can return the following errors:
95
96       RSMERR_BAD_SEG_HNDL     Invalid segment handle.
97
98
99
100       The rsm_memseg_export_create() and rsm_memseg_export_rebind() functions
101       can return the following errors:
102
103       RSMERR_BAD_CTLR_HNDL
104
105           Invalid controller handle.
106
107
108       RSMERR_CTLR_NOT_PRESENT
109
110           Controller not present.
111
112
113       RSMERR_BAD_LENGTH
114
115           Length zero or length exceeds controller limits.
116
117
118       RSMERR_BAD_ADDR
119
120           Invalid address.
121
122
123       RSMERR_INSUFFICIENT_MEM
124
125           Insufficient memory.
126
127
128       RSMERR_INSUFFICIENT_RESOURCES
129
130           Insufficient resources.
131
132
133       RSMERR_PERM_DENIED
134
135           Permission denied.
136
137
138       RSMERR_NOT_CREATOR
139
140           Not creator of segment.
141
142
143       RSMERR_REBIND_NOT_ALLOWED
144
145           Rebind not allowed.
146
147
148
149       The  rsm_memseg_export_create()  function  can  return  the   following
150       errors:
151
152       RSMERR_BAD_MEM_ALIGNMENT    The address is not aligned on a page bound‐
153                                   ary.
154
155
156
157       The  rsm_memseg_export_rebind()  function  can  return  the   following
158       errors:
159
160       RSMERR_INTERRUPTED    The operation was interrupted by a signal.
161
162
163
164       The  rsm_memseg_export_destroy()  function  can  return  the  following
165       errors:
166
167       RSMERR_POLLFD_IN_USE     Poll file descriptor in use.
168
169

USAGE

171       Exporting a memory segment involves the application  allocating  memory
172       in  its virtual address space through the System V Shared Memory inter‐
173       face or other normal operating system memory allocation methods such as
174       valloc()  (  see  malloc(3C)) or mmap(2). Memory for a file mapped with
175       mmap() must be mapped MAP_PRIVATE.
176

ATTRIBUTES

178       See attributes(5) for descriptions of the following attributes:
179
180
181
182
183       ┌─────────────────────────────┬─────────────────────────────┐
184ATTRIBUTE TYPE               ATTRIBUTE VALUE              
185       ├─────────────────────────────┼─────────────────────────────┤
186       │Interface Stability          │Unstable                     │
187       ├─────────────────────────────┼─────────────────────────────┤
188       │MT-Level                     │MT-Safe                      │
189       └─────────────────────────────┴─────────────────────────────┘
190

SEE ALSO

192       rsm_get_controller(3RSM),              rsm_memseg_export_publish(3RSM),
193       attributes(5)
194
195
196
197SunOS 5.11                        8 Apr 2003    rsm_memseg_export_create(3RSM)
Impressum