| SHMCTL(2) | System Calls Manual | SHMCTL(2) |
shmctl — shared
memory control
Standard C Library (libc, -lc)
#include
<sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
int
shmctl(int
shmid, int cmd,
struct shmid_ds
*buf);
Performs the action specified by cmd on the shared memory segment identified by shmid:
IPC_STATIPC_SETIPC_RMIDThe shmid_ds structure is defined as follows:
struct shmid_ds {
struct ipc_perm shm_perm; /* operation permission structure */
size_t shm_segsz; /* size of segment in bytes */
pid_t shm_lpid; /* process ID of last shared memory op */
pid_t shm_cpid; /* process ID of creator */
int shm_nattch; /* number of current attaches */
time_t shm_atime; /* time of last shmat() */
time_t shm_dtime; /* time of last shmdt() */
time_t shm_ctime; /* time of last change by shmctl() */
};
The shmctl() function returns the
value 0 if successful; otherwise the value -1 is returned and
the global variable errno is set to indicate the
error.
The shmctl() system call will fail if:
EINVAL]EPERM]EACCES]| October 10, 2015 | Debian |