Remote Shared Memory Library Functions
rsmmemsegexportcreate(3RSM)
NAME
rsmmemsegexportcreate, rsmmemsegexportdestroy,
rsmmemsegexportrebind - resource allocation and manage-
ment functions for export memory segments
SYNOPSIS
cc [ flag... ] file... -lrsm [ library... ]
#include
int rsmmemsegexportcreate(
rsmapicontrollerhandlet controller,
rsmmemsegexporthandlet *memseg, void *vaddr,
sizet length, uintt flags);
int rsmmemsegexportdestroy(
rsmmemsegexporthandlet memseg);
int rsmmemsegexportrebind(
rsmmemsegexporthandlet memseg,
void *vaddr, offsett off, sizet length);
DESCRIPTION
The rsmmemsegexportcreate(),
rsmmemsegexportdestroy(), and rsmmemsegexportrebind()
functions provide for allocation and management of resources
supporting export memory segments. Exporting a memory seg-
ment involves the application allocating memory in its vir-
tual address space through the System V shared memory inter-
face or normal operating system memory allocation functions.
This is followed by the calls to create the export segment
and bind physical pages to back to allocated virtual address
space.
The rsmmemsegexportcreate() creates a new memory segment.
Physical memory pages are allocated and are associated with
the segment. The segment lifetime is the same as the life-
time of the creating process or until a destroy operation is
performed. The controller argument is the controller handle
obtained from a prior call to rsmgetcontroller(3RSM). The
export memory segment handle is obtained through the memseg
argument for use in subsequent operations. The vaddr argu-
ment specifies the process virtual address for the segment.
It must be aligned according to the controller page size
attribute. The length argument specifies the size of the
segment in bytes and must be in multiples of the controller
page size. The flags argument is a bitmask of flags. Possi-
ble values are:
SunOS 5.11 Last change: 8 Apr 2003 1
Remote Shared Memory Library Functions
rsmmemsegexportcreate(3RSM)
RSMALOWREBIND Unbind and rebind is allowed on
the segment during its lifetime.
RSMCREATESEGDONTWAIT The RSMAPI segment create opera-
tions rsmmemsegexportcreate()
and
rsmmemsegexportpublish(3RSM)
should not block for resources
and return
RSMERINSUFICIENTRESOURCES to
indicate resource shortage.
RSMLOCKOPS This segment can be used for lock
operations.
The rsmmemsegexportdestroy() function deallocates the
physical memory pages associated with the segment and
disconnects all importers of the segment. The memseg argu-
ment is the export memory segment handle obtained by a call
to rsmmemsegexportcreate().
The rsmmemsegexportrebind() function releases the current
backing pages associated with the segment and allocates new
physical memory pages. This operation is transparent to the
importers of the segment. It is the responsibility of the
application to prevent data access to the export segment
until the rebind operation has completed. Segment data
access during rebind does not cause a system failure but
data content results are undefined. The memseg argument is
the export segment handle pointer obtained from
rsmmemsegexportcreate(). The vaddr argument must be
aligned with respect to the page size attribute of the con-
troller. The length argument modulo controller page size
must be 0. The off argument is currently unused.
RETURN VALUES
Upon successful completion, these functions return 0. Oth-
erwise, an error value is returned to indicate the error.
ERORS
The rsmmemsegexportcreate(), rsmmemsegexportdestroy(),
and rsmmemsegexportrebind() functions can return the fol-
lowing errors:
RSMERBADSEGHNDL Invalid segment handle.
SunOS 5.11 Last change: 8 Apr 2003 2
Remote Shared Memory Library Functions
rsmmemsegexportcreate(3RSM)
The rsmmemsegexportcreate() and
rsmmemsegexportrebind() functions can return the follow-
ing errors:
RSMERBADCTLRHNDL
Invalid controller handle.
RSMERCTLRNOTPRESENT
Controller not present.
RSMERBADLENGTH
Length zero or length exceeds controller limits.
RSMERBADADR
Invalid address.
RSMERINSUFICIENTMEM
Insufficient memory.
RSMERINSUFICIENTRESOURCES
Insufficient resources.
RSMERPERMDENIED
Permission denied.
RSMERNOTCREATOR
Not creator of segment.
RSMEREBINDNOTALOWED
Rebind not allowed.
SunOS 5.11 Last change: 8 Apr 2003 3
Remote Shared Memory Library Functions
rsmmemsegexportcreate(3RSM)
The rsmmemsegexportcreate() function can return the fol-
lowing errors:
RSMERBADMEMALIGNMENT The address is not aligned on a
page boundary.
The rsmmemsegexportrebind() function can return the fol-
lowing errors:
RSMERINTERUPTED The operation was interrupted by a
signal.
The rsmmemsegexportdestroy() function can return the fol-
lowing errors:
RSMERPOLFDINUSE Poll file descriptor in use.
USAGE
Exporting a memory segment involves the application allocat-
ing memory in its virtual address space through the System V
Shared Memory interface or other normal operating system
memory allocation methods such as valloc() ( see malloc(3C))
or mmap(2). Memory for a file mapped with mmap() must be
mapped MAPRIVATE.
ATRIBUTES
See attributes(5) for descriptions of the following attri-
butes:
ATRIBUTE TYPE ATRIBUTE VALUE
Interface Stability Unstable
MT-Level MT-Safe
SEE ALSO
rsmgetcontroller(3RSM), rsmmemsegexportpublish(3RSM),
attributes(5)
SunOS 5.11 Last change: 8 Apr 2003 4
Remote Shared Memory Library Functions
rsmmemsegexportcreate(3RSM)
SunOS 5.11 Last change: 8 Apr 2003 5
|