.\" attaches to a segment that has already been marked for deletion.
.\" 2005-08-02, mtk: Added IPC_INFO, SHM_INFO, SHM_STAT descriptions.
.\"
-.TH SHMCTL 2 2012-05-31 "Linux" "Linux Programmer's Manual"
+.TH SHMCTL 2 2014-02-07 "Linux" "Linux Programmer's Manual"
.SH NAME
-shmctl \- shared memory control
+shmctl \- System V shared memory control
.SH SYNOPSIS
.ad l
.B #include <sys/ipc.h>
.BR shmctl ()
performs the control operation specified by
.I cmd
-on the shared memory segment whose identifier is given in
+on the System\ V shared memory segment whose identifier is given in
.IR shmid .
.PP
The
.TP
.B IPC_RMID
Mark the segment to be destroyed.
-The segment will only actually be destroyed
-after the last process detaches it (i.e., when the
+The segment will actually be destroyed
+only after the last process detaches it (i.e., when the
.I shm_nattch
member of the associated structure
.I shmid_ds
is zero).
-The caller must be the owner or creator, or be privileged.
+The caller must be the owner or creator of the segment, or be privileged.
+The
+.I buf
+argument is ignored.
+.IP
If a segment has been marked for destruction, then the (nonstandard)
.B SHM_DEST
flag of the
field in the associated data structure retrieved by
.B IPC_STAT
will be set.
-.PP
+.IP
The caller \fImust\fP ensure that a segment is eventually destroyed;
otherwise its pages that were faulted in will remain in memory or swap.
+.IP
+See also the description of
+.I /proc/sys/kernel/shm_rmid_forced
+in
+.BR proc (5).
.TP 10
.BR IPC_INFO " (Linux-specific)"
-Returns information about system-wide shared memory limits and
+Return information about system-wide shared memory limits and
parameters in the structure pointed to by
.IR buf .
This structure is of type
.nf
.in +4n
-struct shminfo {
+struct shminfo {
unsigned long shmmax; /* Maximum segment size */
unsigned long shmmin; /* Minimum segment size;
always 1 */
for details.
.TP
.BR SHM_INFO " (Linux-specific)"
-Returns a
+Return a
.I shm_info
structure whose fields contain information
about system resources consumed by shared memory.
.fi
.TP
.BR SHM_STAT " (Linux-specific)"
-Returns a
+Return a
.I shmid_ds
structure as for
.BR IPC_STAT .
operations are used by the
.BR ipcs (1)
program to provide information on allocated resources.
-In the future these may modified or moved to a /proc file system
-interface.
+In the future, these may modified or moved to a
+.I /proc
+filesystem interface.
Linux permits a process to attach
.RB ( shmat (2))
.BR shmop (2),
.BR capabilities (7),
.BR svipc (7)
+.SH COLOPHON
+This page is part of release 3.79 of the Linux
+.I man-pages
+project.
+A description of the project,
+information about reporting bugs,
+and the latest version of this page,
+can be found at
+\%http://www.kernel.org/doc/man\-pages/.