GNU Info

Info Node: (ipc.info)shmctl

(ipc.info)shmctl


Next: shmlimits Prev: shmdt Up: Shared Memory
Enter node , (file) or (file)node

shmctl
------

Destroys allocated segments. Reads/Writes the control structures.

     int shmctl (int shmid, int cmd, struct shmid_ds *buf);

   * shmid : id got from call to shmget.

   * cmd : IPC_STAT, IPC_SET, IPC_RMID (Note: syscalls).
          IPC_SET : Used to set the owner uid, gid, and shm_perms.mode
          field.

          IPC_RMID : The segment is marked destroyed. It is only
          destroyed on the last detach.

          IPC_STAT : The shmid_ds structure is copied into the user
          allocated buffer.

   * buf : used to read (IPC_STAT) or write (IPC_SET) information.

   * returns : 0 on success, -1 on failure.

   The user must execute an IPC_RMID shmctl call to free the memory
allocated by the shared segment. Otherwise all the pages faulted in
will continue to live in memory or swap.

Errors:
EACCES : Do not have permission for requested access.
EFAULT : buf is not accessible.
EINVAL : shmid < 0 or unused.
EIDRM  : identifier destroyed.
EPERM  : not creator, owner or super-user (IPC_SET, IPC_RMID).


automatically generated by info2www version 1.2.2.9