84 lines
3.4 KiB
HTML
84 lines
3.4 KiB
HTML
<html><!-- This HTML file has been created by texi2html 1.29
|
|
from syscalls.texi on 4 June 1994 -->
|
|
|
|
<TITLE>Syscall specifications of Linux - shmctl</TITLE>
|
|
<P>Go to the <A HREF="syscalls_80.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_80.html">previous</A>, <A HREF="syscalls_82.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_82.html">next</A> section.<P>
|
|
<H2><A NAME="SEC81" HREF="syscalls_toc.html#SEC81" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC81">shmctl</A></H2>
|
|
<P>
|
|
<H3>SYNOPSIS</H3>
|
|
<P>
|
|
<CODE>int shmctl(int <VAR>shmid</VAR>, int <VAR>cmd</VAR>, struct shmid_ds
|
|
*<VAR>buf</VAR>);</CODE>
|
|
<P>
|
|
<H3>PARAMETERS</H3>
|
|
<P>
|
|
<VAR>shmid</VAR>: [in] the memory segment to manipulate.
|
|
<P>
|
|
<VAR>cmd</VAR>: [in] the operation to perform.
|
|
<P>
|
|
<VAR>buf</VAR>: [in out] parameter for the operation (see description).
|
|
|
|
<H3>DESCRIPTION</H3>
|
|
<P>
|
|
This calls manipulates some operational parameters of shared memory
|
|
segments. The <CODE>shmid_ds</CODE> structure has the following layout:
|
|
<P>
|
|
<PRE>
|
|
struct shmid_ds {
|
|
struct ipc_perm shm_perm; /* operation perms */
|
|
int shm_segsz; /* size of segment (bytes) */
|
|
time_t shm_atime; /* last attach time */
|
|
time_t shm_dtime; /* last detach time */
|
|
time_t shm_ctime; /* last change time */
|
|
unsigned short shm_cpid; /* pid of creator */
|
|
unsigned short shm_lpid; /* pid of last operator */
|
|
short shm_nattch; /* no. of current attaches */
|
|
/* the following are private */
|
|
unsigned short shm_npages; /* size of segment (pages) */
|
|
unsigned long *shm_pages; /* array of ptrs to frames -> SHMMAX */
|
|
struct shm_desc *attaches; /* descriptors for attaches */
|
|
};
|
|
</PRE>
|
|
<P>
|
|
<VAR>cmd</VAR> can take the following values:
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT><CODE>IPC_STAT</CODE>
|
|
<DD>retreives the <CODE>shmid_ds</CODE> structure of the memory segment. The
|
|
calling taks must have read privileges on the segment.
|
|
<P>
|
|
<DT><CODE>IPC_SET</CODE>
|
|
<DD>sets the <CODE>shmid_ds</CODE> structure of the memory segment. The calling
|
|
task must have alter privileges on the segment. Only the members
|
|
<CODE>uid</CODE>, <CODE>gid</CODE> and the lower 9 bits of <CODE>mode</CODE> of
|
|
<CODE>shm_perm</CODE> can be modified.
|
|
<P>
|
|
<DT><CODE>IPC_RMID</CODE>
|
|
<DD>mark the shared memory segment as destroyed. The calling taks must have
|
|
the same uid of the creator or the owner of the memory segment or be the
|
|
superuser.
|
|
<P>
|
|
<DT><CODE>SHM_LOCK</CODE>
|
|
<DD>prevents the memory segment to be swaped out to disk. Only a task with
|
|
superuser privileges may use this command.
|
|
<P>
|
|
<DT><CODE>SHM_UNLOCK</CODE>
|
|
<DD>allows the memory segment to be swaped out to disk. Only a task with
|
|
superuser privileges may use this command.
|
|
<P>
|
|
</DL>
|
|
<P>
|
|
<H3>RETURN VALUE</H3>
|
|
<P>
|
|
On success, the call returns zero. On error -1 is returned and
|
|
<CODE>errno</CODE> is set to one of the following values:
|
|
<P>
|
|
<UL>
|
|
<LI><CODE>EINVAL</CODE>: <VAR>shmid</VAR> or <VAR>cmd</VAR> are not valid.
|
|
<LI><CODE>EPERM</CODE>: the calling task does not have enough privileges on
|
|
the memory segment to perform the operation.
|
|
<LI><CODE>EFAULT</CODE> or <CODE>EIDRM</CODE>.
|
|
</UL>
|
|
<P>
|
|
<P>Go to the <A HREF="syscalls_80.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_80.html">previous</A>, <A HREF="syscalls_82.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_82.html">next</A> section.<P>
|