add directory Ref-docs
This commit is contained in:
90
Ref-docs/syscalls/syscalls_80.html
Normal file
90
Ref-docs/syscalls/syscalls_80.html
Normal file
@@ -0,0 +1,90 @@
|
||||
<html><!-- This HTML file has been created by texi2html 1.29
|
||||
from syscalls.texi on 4 June 1994 -->
|
||||
|
||||
<TITLE>Syscall specifications of Linux - shmat</TITLE>
|
||||
<P>Go to the <A HREF="syscalls_79.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_79.html">previous</A>, <A HREF="syscalls_81.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_81.html">next</A> section.<P>
|
||||
<H2><A NAME="SEC80" HREF="syscalls_toc.html#SEC80" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC80">shmat and shmdt</A></H2>
|
||||
<P>
|
||||
<H3>SYNOPSIS</H3>
|
||||
<P>
|
||||
<CODE>char *shmat(int <VAR>shmid</VAR>, char *<VAR>shmaddr</VAR>, int <VAR>shmflg</VAR>);</CODE>
|
||||
<P>
|
||||
<CODE>int shmdt(char *<VAR>shmaddr</VAR>);</CODE>
|
||||
<P>
|
||||
<H3>PARAMETERS</H3>
|
||||
<P>
|
||||
<VAR>shmid</VAR>: [in] the shared memory identificator.
|
||||
<P>
|
||||
<VAR>shmaddr</VAR>: [in] the start of the shared memory.
|
||||
<P>
|
||||
<VAR>shmflg</VAR>: [in] some flags (see description).
|
||||
<P>
|
||||
<H3>DESCRIPTION</H3>
|
||||
<P>
|
||||
<CODE>shmat</CODE> attaches a shared memory identificator to a memory range in
|
||||
the task address space. If <VAR>shmaddr</VAR> is zero the range where to
|
||||
attach the shared memory is choosen by the system. If <VAR>shmaddr</VAR> is
|
||||
not zero and the flag <CODE>SHM_RND</CODE> is specified, the address is
|
||||
rounded down at a multiple of <CODE>SHMBLA</CODE>. In any other cases, the
|
||||
address must be page alligned.
|
||||
<P>
|
||||
If the flag <CODE>SHM_RDONLY</CODE> is specified the task must have read
|
||||
privileges to the segment and it is attached for reading only.
|
||||
Otherwise, the task must have read and write privileges on the segment
|
||||
and it is attached for reading and writing. The same segment may be
|
||||
attached more than once is the same address space with different flags.
|
||||
<P>
|
||||
On success, the following members of the <CODE>shmid_ds</CODE> structure of
|
||||
the segment are modified:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>shm_atime</CODE>
|
||||
<DD>is set to the current time.
|
||||
<P>
|
||||
<DT><CODE>shm_lpid</CODE>
|
||||
<DD>is set to the current pid.
|
||||
<P>
|
||||
<DT><CODE>shm_nattch</CODE>
|
||||
<DD>is incremented by one.
|
||||
</DL>
|
||||
<P>
|
||||
<CODE>shmdt</CODE> detaches shared memory segments attached by <CODE>shmat</CODE>.
|
||||
The <VAR>shmaddr</VAR> parameter must be the same value returned by the
|
||||
<CODE>shmat</CODE> that attached the segment.
|
||||
<P>
|
||||
On success, the following members of the <CODE>shmid_ds</CODE> structure of
|
||||
the segment are modified:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>shm_dtime</CODE>
|
||||
<DD>is set to the current time.
|
||||
<P>
|
||||
<DT><CODE>shm_lpid</CODE>
|
||||
<DD>is set to the current pid.
|
||||
<P>
|
||||
<DT><CODE>shm_nattch</CODE>
|
||||
<DD>is decremented by one. If it becomes 0 and the segment is marked for
|
||||
deletionm, the segment is deleted.
|
||||
</DL>
|
||||
<P>
|
||||
Attached memory segments are inherited through the <CODE>fork</CODE> call.
|
||||
They are detached after a <CODE>exec</CODE> or <CODE>exit</CODE> call.
|
||||
<P>
|
||||
<H3>RETURN VALUE</H3>
|
||||
<P>
|
||||
On success <CODE>shmat</CODE> returns the address of the new memory segment
|
||||
and <CODE>shmdt</CODE> returns zero. On error, both calls return -1, and set
|
||||
<CODE>errno</CODE>. The possibles values of <CODE>errno</CODE> are:
|
||||
<P>
|
||||
for <CODE>shmat</CODE>:
|
||||
<P>
|
||||
<UL>
|
||||
<LI><CODE>EACCESS</CODE>: not enough privileges on the segment.
|
||||
<LI><CODE>EINVAL</CODE>: <VAR>shmid</VAR> or <VAR>shmaddr</VAR> invalid.
|
||||
<LI><CODE>ENOMEM</CODE>.
|
||||
</UL>
|
||||
<P>
|
||||
for <CODE>shmdt</CODE>: the only possible value is <CODE>EINVAL</CODE> for an
|
||||
invalid value of <VAR>shmaddr</VAR>.
|
||||
<P>
|
||||
<P>Go to the <A HREF="syscalls_79.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_79.html">previous</A>, <A HREF="syscalls_81.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_81.html">next</A> section.<P>
|
||||
Reference in New Issue
Block a user