summaryrefslogtreecommitdiffstats
path: root/man2/shmctl.2
diff options
context:
space:
mode:
Diffstat (limited to 'man2/shmctl.2')
-rw-r--r--man2/shmctl.248
1 files changed, 26 insertions, 22 deletions
diff --git a/man2/shmctl.2 b/man2/shmctl.2
index 4bfb2c5..5d5176a 100644
--- a/man2/shmctl.2
+++ b/man2/shmctl.2
@@ -24,7 +24,7 @@
.\" 2005-08-02, mtk: Added IPC_INFO, SHM_INFO, SHM_STAT descriptions.
.\" 2018-03-20, dbueso: Added SHM_STAT_ANY description.
.\"
-.TH shmctl 2 2023-03-30 "Linux man-pages 6.05.01"
+.TH shmctl 2 2024-03-03 "Linux man-pages 6.7"
.SH NAME
shmctl \- System V shared memory control
.SH LIBRARY
@@ -33,21 +33,21 @@ Standard C library
.SH SYNOPSIS
.nf
.B #include <sys/shm.h>
-.PP
-.BI "int shmctl(int " shmid ", int " cmd ", struct shmid_ds *" buf );
+.P
+.BI "int shmctl(int " shmid ", int " op ", struct shmid_ds *" buf );
.fi
.SH DESCRIPTION
.BR shmctl ()
performs the control operation specified by
-.I cmd
+.I op
on the System\ V shared memory segment whose identifier is given in
.IR shmid .
-.PP
+.P
The
.I buf
argument is a pointer to a \fIshmid_ds\fP structure,
defined in \fI<sys/shm.h>\fP as follows:
-.PP
+.P
.in +4n
.EX
struct shmid_ds {
@@ -64,7 +64,7 @@ struct shmid_ds {
};
.EE
.in
-.PP
+.P
The fields of the
.I shmid_ds
structure are as follows:
@@ -106,13 +106,13 @@ system call on this segment.
.TP
.I shm_nattch
Number of processes that have this segment attached.
-.PP
+.P
The
.I ipc_perm
structure is defined as follows
(the highlighted fields are settable using
.BR IPC_SET ):
-.PP
+.P
.in +4n
.EX
struct ipc_perm {
@@ -127,7 +127,7 @@ struct ipc_perm {
};
.EE
.in
-.PP
+.P
The least significant 9 bits of the
.I mode
field of the
@@ -143,7 +143,7 @@ l l.
0004 Read by others
0002 Write by others
.TE
-.PP
+.P
Bits 0100, 0010, and 0001 (the execute bits) are unused by the system.
(It is not necessary to have execute permission on a segment
in order to perform a
@@ -151,9 +151,9 @@ in order to perform a
call with the
.B SHM_EXEC
flag.)
-.PP
+.P
Valid values for
-.I cmd
+.I op
are:
.TP
.B IPC_STAT
@@ -307,9 +307,11 @@ is not checked for read access for
meaning that any user can employ this operation (just as any user may read
.I /proc/sysvipc/shm
to obtain the same information).
-.PP
+.P
The caller can prevent or allow swapping of a shared
-memory segment with the following \fIcmd\fP values:
+memory segment with the following
+.I op
+values:
.TP
.BR SHM_LOCK " (Linux-specific)"
Prevent swapping of the shared memory segment.
@@ -325,7 +327,7 @@ will be set.
.TP
.BR SHM_UNLOCK " (Linux-specific)"
Unlock the segment, allowing it to be swapped out.
-.PP
+.P
Before Linux 2.6.10, only a privileged process
could employ
.B SHM_LOCK
@@ -363,7 +365,7 @@ operation returns the identifier of the shared memory segment
whose index was given in
.IR shmid .
Other operations return 0 on success.
-.PP
+.P
On error, \-1 is returned, and
.I errno
is set to indicate the error.
@@ -379,7 +381,7 @@ capability in the user namespace that governs its IPC namespace.
.TP
.B EFAULT
The argument
-.I cmd
+.I op
has value
.B IPC_SET
or
@@ -392,8 +394,10 @@ isn't accessible.
\fIshmid\fP points to a removed identifier.
.TP
.B EINVAL
-\fIshmid\fP is not a valid identifier, or \fIcmd\fP
-is not a valid command.
+.I shmid
+is not a valid identifier, or
+.I op
+is not a valid operation.
Or: for a
.B SHM_STAT
or
@@ -456,7 +460,7 @@ POSIX.1-2001, SVr4.
.\" SVr4 documents additional error conditions EINVAL,
.\" ENOENT, ENOSPC, ENOMEM, EEXIST. Neither SVr4 nor SVID documents
.\" an EIDRM error condition.
-.PP
+.P
Various fields in a \fIstruct shmid_ds\fP were typed as
.I short
under Linux 2.2
@@ -468,7 +472,7 @@ a recompilation under glibc-2.1.91 or later should suffice.
(The kernel distinguishes old and new calls by an
.B IPC_64
flag in
-.IR cmd .)
+.IR op .)
.SH NOTES
The
.BR IPC_INFO ,