|
|
#include <sys/types.h> #include <sys/ipc.h> #include <sys/shm.h>int shmctl(int shmid, int cmd, ... /* struct shmid_ds *buf */);
shm_perm.uid shm_perm.gid shm_perm.mode / only access permission bits /
This command can be executed only by a process that has an effective user ID equal to the value of shm_perm.cuid or shm_perm.uid in the data structure associated with shmid, or by a process that has the P_OWNER privilege.
Details are provided in the shmid_ds data structure, where the relevant fields are:
off_t shm_off
size_t shm_nbytes
If shm_off and shm_nbytes are both set to zero, the policy applies to the entire shared memory segment.
int shm_placepolicy
The following are the possible values for int shm_placepolicy
:
The granularity of the balanced allocations is given by
shm_granularity
. This will be rounded up
if necessary to an integral multiple of the page size.
If shm_granularity
is 0, the system default granularity should apply
The balanced allocation will be for future memory allocations only.
shm_cpugroup
.
A value of NOCGID for shm_cpugroup
specifies that
the CPU-Group where the caller is currently executing should
be used for the allocations.
The CPU-Group allocation will be for future memory allocations only.
cgid_t shm_cg
shm_placepolicy
indicates that allocation from a
particular CPU-Group is required. It specifies the required
CPU-Group.
unsigned int shm_granularity
shm_placepolicy
indicates that blanced allocation
across all CPU-Groups is required. It specifies the required
allocation granularity.
The SHM_SETPLACE command can be executed only by a process that
has an effective user ID equal to the value of shm_perm.cuid
or shm_perm.uid
in the data structure associated with shmid or by
a process that has the P_OWNER privilege.