memctl(2) DG/UX 4.30 memctl(2)
NAME
memctl - Change data segment space allocation.
SYNOPSIS
int memctl (base, length, state)
_GENERIC_PTR_TYPE base;
int length;
int state;
PARAMETERS
base Address of first byte in the region to be
modified
length The length, in bytes, of the region of memory
to be modified by the call. The length must
be a multiple of the system's memory control
unit.
state One of the valid states (defined below) to
which the region should be set.
DESCRIPTION
The memctl system call is used to set the state of a region
of memory. At any one time, a valid region of memory may be
in one of three states:
State Readable Writeable Executable
MCT_TEXT yes no yes
MCT_DATA yes yes no
MCT_RONLY yes no no
The .text section is initially in state MCT_TEXT. The .data
(including the stack) and .bss sections are initially in
state MCT_DATA.
A BCS (Binary Compatibility Standard) conforming application
shall be allowed to perform the accesses designated above as
"yes" in each state. A conforming application shall not
attempt to write to memory that is not writable (states
MCT_TEXT and MCT_RONLY). A conforming application shall not
attempt to execute memory that is not executable (states
MCT_DATA and MCT_RONLY). An application that attempts
improper access to a region of memory valid for the process
is non-conforming; the results of such are implementation
defined.
After the last reference (read or write) and before the
first execution of any region of a shared memory segment,
(see shmat(2)), all processes that have referenced or will
execute the region must issue a memctl call to set the state
of the given region to MCT_TEXT. Similarly, after the last
execution and before the first reference of any region of a
Licensed material--property of copyright holder(s) Page 1
memctl(2) DG/UX 4.30 memctl(2)
shared memory segment, all processes that have executed or
will reference the region must issue a memctl call to set
the state of the given region to MCT_DATA or MCT_RONLY;
thus, when changing from MCT_TEXT the process may set the
region to either of the non-executable modes, depending on
whether or not it will write to the shared memory segment.
The region of memory is defined by the base and length
arguments. The base argument is the byte address of the
first byte of the region. The length argument is the length
of the region in bytes. The state argument may be one of
the following values: MCT_TEXT, MCT_DATA, or MCT_RONLY.
The base and length must be an integral multiple of the
memory control unit (see sysconf(2) to determine the
system's memory control unit).
ACCESS CONTROL
The region of memory must be valid.
RETURN VALUE
0 The memctl call executed successfully.
-1 The memctl call failed, and errno is set to
indicate the error.
EXCEPTIONS
If the memctl system call fails, it will not make any change
to the state of a region of memory. The possible errno
values and failures are:
EINVAL The state argument is invalid; or the base
argument is not an integral multiple of the
memory control unit for the system; or the
length argument is not an integral multiple
of the memory control unit for the system.
EFAULT The region of memory is not valid for the
application.
Licensed material--property of copyright holder(s) Page 2