Standards / Extensions | C or C++ | Dependencies |
---|---|---|
XPG4 |
both |
#define _XOPEN_SOURCE
#include <sys/shm.h>
int shmctl(int shmid, int cmd, struct shmid_ds *buf);
The shmctl() function provides a variety of shared memory control operations on the shared memory segment identified by the argument, shmid.
shm_perm.uid
shm_perm.gid
shm_perm.mode (only the low-order 9 bits)
This command can only be executed by a process that has an effective user ID equal to either that of a process with appropriate privileges or to the value of shm_perm.cuid or shm_perm.uid in the shmid_ds data structure associated with shmid.
Using the IPC_SET function to change the IPC_MODE for an __IPC_MEGA shared memory segment will have an immediate effect on all attaches to the target segment. That is, the read and write access of all current attachers is immediately affected by the permissions specified in the new IPC_MODE. To determine how the new mode affects access, you must consider the effect of all three parts of the mode field (the owner permissions, group permissions and other permissions). If all three read and all three write permissions in the new mode are set off, then the access for all attachors is changed to read. If any of the three read permission bits is set on but the corresponding write permission bit is off, then the access for all attachors is changed to read. Otherwise, the access of all attachors is changed to write.
The IPC_STAT option of shmctl() returns a structure named shmid_ds (mapped in shm.h). shmid_ds contains status information for the requested shared memory segment.
As part of its own dump priority support, the USS Kernel will be adding a new field to shmid_ds. This field will contain the dump priority of the requested shared memory segment. The new field will be added to the shmid_ds structure in shm.h.
If successful, shmctl() returns 0.