83 lines
3.6 KiB
HTML
83 lines
3.6 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 - semop</TITLE>
|
|
<P>Go to the <A HREF="syscalls_78.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_78.html">previous</A>, <A HREF="syscalls_80.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_80.html">next</A> section.<P>
|
|
<H2><A NAME="SEC79" HREF="syscalls_toc.html#SEC79" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_toc.html#SEC79">semop</A></H2>
|
|
<P>
|
|
<H3>SYNOPSIS</H3>
|
|
<P>
|
|
<CODE>int semop(int <VAR>semid</VAR>, struct sembuf *<VAR>sops</VAR>, unsigned
|
|
<VAR>nsops</VAR>);</CODE>
|
|
<P>
|
|
<H3>PARAMETERS</H3>
|
|
<P>
|
|
<VAR>semid</VAR>: [in] the semaphore set on which to perform the operations.
|
|
<P>
|
|
<VAR>sops</VAR>: [in] points to an array of operations to perfrom.
|
|
<P>
|
|
<VAR>nsops</VAR>: [in] the number of element in <VAR>sops</VAR>.
|
|
<P>
|
|
<H3>DESCRIPTION</H3>
|
|
<P>
|
|
Perform operations on a semaphore set. The <VAR>sops</VAR> parameter a
|
|
structure <CODE>sembuf</CODE> of the form:
|
|
<P>
|
|
<DL COMPACT>
|
|
<DT><CODE>short sem_num</CODE>
|
|
<DD>which semaphore to operate on (0 is the first).
|
|
<P>
|
|
<DT><CODE>short sem_op;</CODE>
|
|
<DD>the operation.
|
|
<P>
|
|
<DT><CODE>short sem_flg;</CODE>
|
|
<DD></DL>
|
|
<P>
|
|
<VAR>sem_flg</VAR> may be <CODE>IPC_NOWAIT</CODE> for non blocking calls and
|
|
<CODE>SEM_UNDO</CODE> to specify an operation that will be undone on task
|
|
termination. The individual operations are perfomed if and only if all
|
|
of them will succeed.
|
|
<P>
|
|
The possible values of <VAR>cmd</VAR> are:
|
|
<P>
|
|
<UL>
|
|
<LI><VAR>cmd</VAR> positive: the value of <VAR>cmd</VAR> is added to the value
|
|
of the semaphore. The calling task must have alter privileges on the
|
|
semaphore set.
|
|
<P>
|
|
<LI><VAR>cmd</VAR> equals to zero: if the value of the semaphore is zero,
|
|
the call returns. Otherwise, the call block until: the value of the
|
|
semaphore becomes zero, the semaphore set is removed, or a signal
|
|
occurs. The calling task must have read privileges on the semaphore set.
|
|
<P>
|
|
<LI><VAR>cmd</VAR> is lower than zero: if the value of the semaphore is
|
|
greater than the absolute value of <VAR>cmd</VAR>, the value of the semaphore
|
|
is decremented by the value of <VAR>cmd</VAR> and the call returns.
|
|
Otherwise, the call block until: the value of the semaphore becomes
|
|
greater than the absolute value of <VAR>cmd</VAR> at which time the value of
|
|
the semaphore is decremented by the value of <VAR>cmd</VAR> and then the call
|
|
returns, the semaphore set is removed, or a signal occurs. The calling
|
|
task must have alter privileges on the semaphore set.
|
|
</UL>
|
|
<P>
|
|
Whenever a call succeed, the <CODE>sempid</CODE> member of the semaphore set
|
|
structure is set to the pid of the current task and the <CODE>sem_ctime</CODE>
|
|
and <CODE>sem_otime</CODE> member are set to the current time.
|
|
<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>E2BIG</CODE>: there is too many operations requested (the maximum
|
|
is <CODE>SEMOPM</CODE>.
|
|
<LI><CODE>EFBIG</CODE>: the semaphore number of some operation is out of range.
|
|
<LI><CODE>EINVAL</CODE>: invalid value for <VAR>semid</VAR> or <VAR>nsops</VAR>.
|
|
<LI><CODE>ERANGE</CODE>: semaphore value out of range.
|
|
<LI><CODE>EACCESS</CODE>, <CODE>EAGAIN</CODE>, <CODE>EFAULT</CODE>, <CODE>EIDRM</CODE>,
|
|
<CODE>EINTR</CODE> or <CODE>ENOMEM</CODE>.
|
|
</UL>
|
|
<P>
|
|
<P>Go to the <A HREF="syscalls_78.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_78.html">previous</A>, <A HREF="syscalls_80.html" tppabs="http://www.infran.ru/TechInfo/syscalls/syscalls_80.html">next</A> section.<P>
|