add directory Ref-docs
This commit is contained in:
108
Ref-docs/syscalls/syscalls_77.html
Normal file
108
Ref-docs/syscalls/syscalls_77.html
Normal file
@@ -0,0 +1,108 @@
|
||||
<html><!-- This HTML file has been created by texi2html 1.29
|
||||
from syscalls.texi on 4 June 1994 -->
|
||||
|
||||
<TITLE>Syscall specifications of Linux - semctl</TITLE>
|
||||
<P>Go to the <A HREF="syscalls_76.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_76.html">previous</A>, <A HREF="syscalls_78.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_78.html">next</A> section.<P>
|
||||
<H2><A NAME="SEC77" HREF="syscalls_toc.html#SEC77" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC77">semctl</A></H2>
|
||||
<P>
|
||||
<H3>SYNOPSIS</H3>
|
||||
<P>
|
||||
<CODE>int semctl(int <VAR>semid</VAR>, int <VAR>semnun</VAR>, int <VAR>cmd</VAR>, union
|
||||
semun <VAR>arg</VAR>);</CODE>
|
||||
<P>
|
||||
<H3>PARAMETERS</H3>
|
||||
<P>
|
||||
<VAR>semid</VAR>: [in] the semaphore set to manipulate.
|
||||
<P>
|
||||
<VAR>semnum</VAR>: [in] the semaphore in the set to manipulate (0 is the first).
|
||||
<P>
|
||||
<VAR>cmd</VAR>: [in] the operation to perform.
|
||||
<P>
|
||||
<VAR>arg</VAR>: [in out] an argument to the operation (see description).
|
||||
<P>
|
||||
<H3>DESCRIPTION</H3>
|
||||
<P>
|
||||
Manipulates a semaphore set or members of a semaphore set. The possible
|
||||
values for <VAR>cmd</VAR> are:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>IPC_STAT</CODE>
|
||||
<DD>gets some information on the semaphore set. The calling task must have read
|
||||
access to the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>IPC_SET</CODE>
|
||||
<DD>modify some members of the <CODE>semid_ds</CODE> structure of a semaphore in
|
||||
the set. The members that can be modified are: <CODE>sem_perm.uid</CODE>,
|
||||
<CODE>sem_perm.gid</CODE>, and the lower 9 bits of <CODE>sem_perm.mode</CODE>. The
|
||||
calling task must be the owner or the creator of the semaphore set or the
|
||||
superuser. The <CODE>sem_ctime</CODE> field of the set is updated to the
|
||||
current time.
|
||||
<P>
|
||||
<DT><CODE>IPC_RMID</CODE>
|
||||
<DD>removes the semaphore set and awakens the process blocked on operations
|
||||
performed on that set. Only the creator or the owner of the set or the
|
||||
superuser may use this option.
|
||||
<P>
|
||||
<DT><CODE>GETALL</CODE>
|
||||
<DD>returns the <CODE>semval</CODE> value of all semaphore in an array.
|
||||
<P>
|
||||
<DT><CODE>GETNCNT</CODE>
|
||||
<DD>returns the number of processes waiting for the value of a specific
|
||||
semaphore in the semaphore set to increase. The calling task must have
|
||||
read privileges on the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>GETPPID</CODE>
|
||||
<DD>returns the pid of the last process to have executed a semaphore
|
||||
opreation a specific semaphore of the semaphore set. The calling task
|
||||
must have read privileges on the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>GETVAL</CODE>
|
||||
<DD>returns the value of a specific semaphore in the semaphore set. The
|
||||
calling task must have read privileges on the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>GETZCNT</CODE>
|
||||
<DD>returns the number of processes waiting for the value of a specific
|
||||
semaphore in the semaphore set to be zero. The calling task must have
|
||||
read privileges on the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>SETALL</CODE>
|
||||
<DD>sets the value of all semaphore in the semaphore set. The calling task
|
||||
must have alter privileges on the semaphore set.
|
||||
<P>
|
||||
<DT><CODE>SETVAL</CODE>
|
||||
<DD>sets the value of a specific semaphore in the semaphore set. The calling
|
||||
task must have alter privileges on the semaphore set.
|
||||
</DL>
|
||||
<P>
|
||||
<H3>RETURN VALUE</H3>
|
||||
<P>
|
||||
On success, with <VAR>cmd</VAR> equals to:
|
||||
<P>
|
||||
<DL COMPACT>
|
||||
<DT><CODE>GETNCNT</CODE>
|
||||
<DD>the number of waiting tasks (see description).
|
||||
<P>
|
||||
<DT><CODE>GETPID</CODE>
|
||||
<DD>the task pid (see description).
|
||||
<P>
|
||||
<DT><CODE>GETVAL</CODE>
|
||||
<DD>the value of the semaphore.
|
||||
<P>
|
||||
<DT><CODE>GETZCNT</CODE>
|
||||
<DD>the number of waiting tasks (see description).
|
||||
</DL>
|
||||
<P>
|
||||
For other values of <VAR>cmd</VAR>, it returns zero. On error, the call
|
||||
returns -1 and <CODE>errno</CODE> is set to one of the following values:
|
||||
<P>
|
||||
<UL>
|
||||
<LI><CODE>EACCESS</CODE>, <CODE>EFAULT</CODE>, <CODE>EIDRM</CODE>
|
||||
<LI><CODE>EINVAL</CODE>: invalid value for <VAR>cmd</VAR> or <VAR>semid</VAR>.
|
||||
<LI><CODE>EPERM</CODE>: the calling task tried <CODE>IPC_SET</CODE> or
|
||||
<CODE>IPC_RMID</CODE> but is not the creator or the owner of the semaphore set
|
||||
or the superuser.
|
||||
<LI><CODE>ERANGE</CODE>: the specified value for the semaphore is out of
|
||||
range.
|
||||
</UL>
|
||||
<P>
|
||||
<P>Go to the <A HREF="syscalls_76.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_76.html">previous</A>, <A HREF="syscalls_78.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_78.html">next</A> section.<P>
|
||||
Reference in New Issue
Block a user