1
0
Files
irix-657m-src/eoe/man/man2/shmctl.2
2022-09-29 17:59:04 +03:00

137 lines
3.9 KiB
Groff

'\"macro stdmacro
.if n .pH g2.shmctl @(#)shmctl 41.5 of 5/26/91
.\" Copyright 1991 UNIX System Laboratories, Inc.
.\" Copyright 1989, 1990 AT&T
.nr X
.if \nX=0 .ds x} shmctl 2 "" "\&"
.if \nX=1 .ds x} shmctl 2 ""
.if \nX=2 .ds x} shmctl 2 "" "\&"
.if \nX=3 .ds x} shmctl "" "" "\&"
.TH \*(x}
.SH NAME
\f4shmctl\f1 \- shared memory control operations
.SH SYNOPSIS
\f4#include <sys/types.h>\f1
.br
\f4#include <sys/ipc.h>\f1
.br
\f4#include <sys/shm.h>\f1
.PP
\f4int shmctl (int shmid, int cmd, .../\(** struct shmid_ds \(**buf \(**/); \f1
.SH DESCRIPTION
\f4shmctl\fP
provides a variety of shared memory control operations as specified by
.IR cmd .
The following
.IR cmd s
are available:
.TP \w'SHM_UNLOCK\ \ 'u
\f4IPC_STAT\f1
Place the current value of each member of the data structure associated with
.I shmid
into the structure pointed to by
.IR buf .
The contents of this structure are defined in
\f4intro\fP(2).
.SM {READ}
.TP
\f4IPC_SET\f1
Set the value of the following members of the data structure associated with
.I shmid
to the corresponding value found in the structure pointed to by
.IR buf :
.nf
.IP "" \w'SHM_UNLOCK\ \ \ \ \ \ 'u
.ft 4
shm_perm.uid
shm_perm.gid
shm_perm.mode /\(** only access permission bits \(**/
.ft 1
.fi
.IP "" \w'SHM_UNLOCK\ \ 'u
This command can be executed only by a process that has an effective user
ID equal to the value of \f4shm_perm.cuid\f1
or \f4shm_perm.uid\f1 in the data structure associated with \f2shmid\fP
or to a process that has the \f4super-user\fP privilege.
.TP
\f4IPC_RMID\f1
Remove the shared memory identifier specified by
.I shmid
from the system and destroy the shared memory segment and data structure
associated with it.
This command can be executed only by a process that has an effective user
ID equal to the value of \f4shm_perm.cuid\f1
or \f4shm_perm.uid\f1 in the data structure associated with \f2shmid\fP
or to a process that has the \f4super-user\fP privilege.
.TP
\f4SHM_LOCK\f1
Lock the shared memory segment specified by \f2shmid\fP in memory.
This command can be executed only by a process that has the
\f4super-user\fP privilege. Locking occurs per address space; multiple
processes or sprocs mapping the area at different addresses each need to
issue the lock (this is primarily an issue with the per-process page
tables).
.TP
\f4SHM_UNLOCK\f1
Unlock the shared memory segment specified by \f2shmid\fP.
This command can be executed only by a process that has the
\f4super-user\fP privilege.
.PP
\f4shmctl\fP
fails if one or more of the following are true:
.TP 12
\f4EACCES\fP
.I cmd
is equal to \f4IPC_STAT\f1 and
.SM {READ}
operation permission is denied to the calling process [see
\f4intro\fP(2)].
.TP 12
\f4EINVAL\fP
.I shmid
is not a valid shared memory identifier.
.TP
\f4EINVAL\fP
.I cmd
is not a valid command.
.TP
\f4EINVAL\fP
\f2cmd\f1 is \f4IPC_SET\fP and \f4shm_perm.uid\fP or \f4shm_perm.gid\fP
is not valid.
.TP
\f4EOVERFLOW\fP
\f2cmd\f1 is \f4IPC_STAT\fP and \f2uid\f1 or \f2gid\f1 is too large
to be stored in the structure pointed to by \f2buf\f1.
.TP
\f4EPERM\fP
\f2cmd\fP is equal to \f4IPC_RMID\f1 or \f4IPC_SET\f1 and the effective user
is not equal to the value of \f4shm_perm.cuid\f1 or \f4shm_perm.uid\f1
in the data structure associated with \f2shmid\fP and the process does
not have the \f4super-user\fP privilege.
.TP
\f4EPERM\fP
\f2cmd\fP is equal to \f4SHM_LOCK\f1 or \f4SHM_UNLOCK\f1 and the
calling process does not have the \f4super-user\fP privilege.
.TP
\f4EFAULT\fP
.I buf
points to an illegal address.
.TP
\f4ENOMEM\fP
.I cmd
is equal to
\f4SHM_LOCK\f1
and there is not enough memory.
.SH SEE ALSO
\f4shmget\fP(2), \f4shmop\fP(2).
.SH "DIAGNOSTICS"
Upon successful completion, a value of 0 is returned. Otherwise, a
value of \-1 is returned and
\f4errno\fP
is set to indicate the error.
.SH NOTES
The user must explicitly remove shared memory segments
after the last reference to them has been removed.
.\" @(#)shmctl.2 5.2 of 5/18/82 + paging changes
.Ee