OSDN Git Service

LDP: Update original to LDP v3.79
[linuxjm/LDP_man-pages.git] / original / man2 / shmctl.2
index d893947..58f6714 100644 (file)
@@ -2,6 +2,7 @@
 .\" and Copyright 1993 Giorgio Ciucci <giorgio@crcc.it>
 .\" and Copyright 2004, 2005 Michael Kerrisk <mtk.manpages@gmail.com>
 .\"
+.\" %%%LICENSE_START(VERBATIM)
 .\" Permission is granted to make and distribute verbatim copies of this
 .\" manual provided the copyright notice and this permission notice are
 .\" preserved on all copies.
@@ -21,6 +22,7 @@
 .\"
 .\" Formatted or processed versions of this manual, if unaccompanied by
 .\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
 .\"
 .\" Modified 1993-07-28, Rik Faith <faith@cs.unc.edu>
 .\" Modified 1993-11-28, Giorgio Ciucci <giorgio@crcc.it>
@@ -40,9 +42,9 @@
 .\"    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 2008-08-07 "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>
@@ -55,7 +57,7 @@ shmctl \- shared memory control
 .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
@@ -81,7 +83,7 @@ struct shmid_ds {
 .PP
 The
 .I ipc_perm
-structure is defined in \fI<sys/ipc.h>\fP as follows
+structure is defined as follows
 (the highlighted fields are settable using
 .BR IPC_SET ):
 .PP
@@ -134,13 +136,17 @@ of the shared memory segment, or the caller must be privileged.
 .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
@@ -148,12 +154,17 @@ 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
@@ -167,7 +178,7 @@ feature test macro is defined:
 .nf
 .in +4n
 
-struct  shminfo {
+struct shminfo {
     unsigned long shmmax; /* Maximum segment size */
     unsigned long shmmin; /* Minimum segment size;
                              always 1 */
@@ -193,7 +204,7 @@ files of the same name; see
 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.
@@ -223,7 +234,7 @@ struct shm_info {
 .fi
 .TP
 .BR SHM_STAT " (Linux-specific)"
-Returns a
+Return a
 .I shmid_ds
 structure as for
 .BR IPC_STAT .
@@ -269,7 +280,7 @@ resource limit (see
 .\" be applied to a segment, regardless of ownership of the segment.
 .\" This was a botch-up in the move to RLIMIT_MEMLOCK, and was fixed
 .\" in 2.6.10.  MTK, May 2005
-.SH "RETURN VALUE"
+.SH RETURN VALUE
 A successful
 .B IPC_INFO
 or
@@ -363,29 +374,43 @@ capability).
 (Since Linux 2.6.9, this error can also occur if the
 .B RLIMIT_MEMLOCK
 is 0 and the caller is not privileged.)
-.SH "CONFORMING TO"
+.SH CONFORMING TO
 SVr4, POSIX.1-2001.
 .\" SVr4 documents additional error conditions EINVAL,
 .\" ENOENT, ENOSPC, ENOMEM, EEXIST.  Neither SVr4 nor SVID documents
 .\" an EIDRM error condition.
 .SH NOTES
+The inclusion of
+.I <sys/types.h>
+and
+.I <sys/ipc.h>
+isn't required on Linux or by any version of POSIX.
+However,
+some old implementations required the inclusion of these header files,
+and the SVID also documented their inclusion.
+Applications intended to be portable to such old systems may need
+to include these header files.
+.\" Like Linux, the FreeBSD man pages still document
+.\" the inclusion of these header files.
+
 The
 .BR IPC_INFO ,
 .B SHM_STAT
 and
 .B SHM_INFO
 operations are used by the
-.BR ipcs (8)
+.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))
 a shared memory segment that has already been marked for deletion
 using
 .IR shmctl(IPC_RMID) .
-This feature is not available on other Unix implementations;
+This feature is not available on other UNIX implementations;
 portable applications should avoid relying on it.
 
 Various fields in a \fIstruct shmid_ds\fP were typed as
@@ -400,10 +425,19 @@ a recompilation under glibc-2.1.91 or later should suffice.
 .B IPC_64
 flag in
 .IR cmd .)
-.SH "SEE ALSO"
+.SH SEE ALSO
 .BR mlock (2),
 .BR setrlimit (2),
 .BR shmget (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/.