.\" Copyright 1993 Giorgio Ciucci (giorgio@crcc.it)
.\"
+.\" %%%LICENSE_START(VERBATIM)
.\" Permission is granted to make and distribute verbatim copies of this
.\" manual provided the copyright notice and this permission notice are
.\" preserved on all copies.
.\"
.\" Formatted or processed versions of this manual, if unaccompanied by
.\" the source, must acknowledge the copyright and authors of this work.
+.\" %%%LICENSE_END
.\"
.\" Modified 1996-10-22, Eric S. Raymond <esr@thyrsus.com>
.\" Modified 2002-01-08, Michael Kerrisk <mtk.manpages@gmail.com>
.\" 2005-04-08, mtk, Noted kernel version numbers for semtimedop()
.\" 2007-07-09, mtk, Added an EXAMPLE code segment.
.\"
-.TH SEMOP 2 2012-05-10 "Linux" "Linux Programmer's Manual"
+.TH SEMOP 2 2012-08-27 "Linux" "Linux Programmer's Manual"
.SH NAME
semop, semtimedop \- semaphore operations
.SH SYNOPSIS
unsigned short semval; /* semaphore value */
unsigned short semzcnt; /* # waiting for zero */
unsigned short semncnt; /* # waiting for increase */
-pid_t sempid; /* process that did last op */
+pid_t sempid; /* ID of process that did last op */
.sp
.in -4n
.fi
.RI ( semval ).
Furthermore, if
.B SEM_UNDO
-is specified for this operation, the system updates the process undo count
+is specified for this operation, the system updates the undo count
.RI ( semadj )
for this semaphore.
-This operation can always proceed\(emit never forces a process to wait.
+This operation can always proceed\(emit never forces a thread to wait.
The calling process must have alter permission on the semaphore set.
.PP
If
is performed).
Otherwise
.I semzcnt
-(the count of processes waiting until this semaphore's value becomes zero)
-is incremented by one and the process sleeps until
+(the count of threads waiting until this semaphore's value becomes zero)
+is incremented by one and the thread sleeps until
one of the following occurs:
.IP \(bu 3
.I semval
set to
.BR EIDRM .
.IP \(bu
-The calling process catches a signal:
+The calling thread catches a signal:
the value of
.I semzcnt
is decremented and
.IR semval ,
and, if
.B SEM_UNDO
-is specified for this operation, the system updates the process undo count
+is specified for this operation, the system updates the undo count
.RI ( semadj )
for this semaphore.
If the absolute value of
is performed).
Otherwise
.I semncnt
-(the counter of processes waiting for this semaphore's value to increase)
-is incremented by one and the process sleeps until
+(the counter of threads waiting for this semaphore's value to increase)
+is incremented by one and the thread sleeps until
one of the following occurs:
.IP \(bu 3
.I semval
.I semval
and, if
.B SEM_UNDO
-is specified for this operation, the system updates the process undo count
+is specified for this operation, the system updates the undo count
.RI ( semadj )
for this semaphore.
.IP \(bu
set to
.BR EIDRM .
.IP \(bu
-The calling process catches a signal:
+The calling thread catches a signal:
the value of
.I semncnt
is decremented and
.I sempid
value for each semaphore specified in the array pointed to by
.I sops
-is set to the process ID of the calling process.
+is set to the caller's process ID.
In addition, the
.I sem_otime
.\" and
.BR semtimedop ()
behaves identically to
.BR semop ()
-except that in those cases were the calling process would sleep,
+except that in those cases where the calling thread would sleep,
the duration of that sleep is limited by the amount of elapsed
time specified by the
.I timespec
.BR semtimedop ()
behaves exactly like
.BR semop ().
-.SH "RETURN VALUE"
+.SH RETURN VALUE
If successful
.BR semop ()
and
The semaphore set was removed.
.TP
.B EINTR
-While blocked in this system call, the process caught a signal; see
+While blocked in this system call, the thread caught a signal; see
.BR signal (7).
.TP
.B EINVAL
Glibc support for
.BR semtimedop ()
first appeared in version 2.3.3.
-.SH "CONFORMING TO"
+.SH CONFORMING TO
SVr4, POSIX.1-2001.
.\" SVr4 documents additional error conditions EINVAL, EFBIG, ENOSPC.
.SH NOTES
+The inclusion of
+.I <sys/types.h>
+and
+.I <sys/ipc.h>
+isn't required on Linux or by any version of POSIX.
+However,
+some old implementations required the inclusion of these header files,
+and the SVID also documented their inclusion.
+Applications intended to be portable to such old systems may need
+to include these header files.
+.\" Like Linux, the FreeBSD man pages still document
+.\" the inclusion of these header files.
+
The
.I sem_undo
structures of a process aren't inherited by the child produced by
termination to proceed immediately.
In kernels 2.6.x, x <= 10, there is a bug that in some circumstances
-prevents a process that is waiting for a semaphore value to become
+prevents a thread that is waiting for a semaphore value to become
zero from being woken up when the value does actually become zero.
This bug is fixed in kernel 2.6.11.
.\" The bug report:
exit(EXIT_FAILURE);
}
.fi
-.SH "SEE ALSO"
+.SH SEE ALSO
+.BR clone (2),
.BR semctl (2),
.BR semget (2),
.BR sigaction (2),