~ubuntu-branches/ubuntu/vivid/manpages-posix/vivid

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
.\" Copyright (c) 2001-2003 The Open Group, All Rights Reserved 
.TH "<sys/sem.h>" P 2003 "IEEE/The Open Group" "POSIX Programmer's Manual"
.\" <sys/sem.h> 
.SH NAME
sys/sem.h \- XSI semaphore facility
.SH SYNOPSIS
.LP
\fB#include <sys/sem.h> \fP
.SH DESCRIPTION
.LP
The \fI<sys/sem.h>\fP header shall define the following constants
and structures.
.LP
Semaphore operation flags:
.TP 7
SEM_UNDO
Set up adjust on exit entry.
.sp
.LP
Command definitions for the \fIsemctl\fP() function shall be provided
as follows:
.TP 7
GETNCNT
Get \fIsemncnt\fP.
.TP 7
GETPID
Get \fIsempid\fP.
.TP 7
GETVAL
Get \fIsemval\fP.
.TP 7
GETALL
Get all cases of \fIsemval\fP.
.TP 7
GETZCNT
Get \fIsemzcnt\fP.
.TP 7
SETVAL
Set \fIsemval\fP.
.TP 7
SETALL
Set all cases of \fIsemval\fP.
.sp
.LP
The \fBsemid_ds\fP structure shall contain the following members:
.sp
.RS
.nf

\fBstruct ipc_perm  sem_perm \fP Operation permission structure. \fB
unsigned short   sem_nsems\fP Number of semaphores in set. \fB
time_t           sem_otime\fP Last \fIsemop\fP
 () time. \fB
time_t           sem_ctime\fP Last time changed by \fIsemctl\fP
 (). \fB
\fP
.fi
.RE
.LP
The \fBpid_t\fP, \fBtime_t\fP, \fBkey_t\fP, and \fBsize_t\fP types
shall be defined as described in \fI<sys/types.h>\fP .
.LP
A semaphore shall be represented by an anonymous structure containing
the following members:
.sp
.RS
.nf

\fBunsigned short  semval  \fP Semaphore value. \fB
pid_t           sempid  \fP Process ID of last operation. \fB
unsigned short  semncnt \fP Number of processes waiting for \fIsemval\fP \fB
                        \fP to become greater than current value. \fB
unsigned short  semzcnt \fP Number of processes waiting for \fIsemval\fP \fB
                        \fP to become 0. \fB
\fP
.fi
.RE
.LP
The \fBsembuf\fP structure shall contain the following members:
.sp
.RS
.nf

\fBunsigned short  sem_num  \fP Semaphore number. \fB
short           sem_op   \fP Semaphore operation. \fB
short           sem_flg  \fP Operation flags. \fB
\fP
.fi
.RE
.LP
The following shall be declared as functions and may also be defined
as macros. Function prototypes shall be provided.
.sp
.RS
.nf

\fBint   semctl(int, int, int, ...);
int   semget(key_t, int, int);
int   semop(int, struct sembuf *, size_t);
\fP
.fi
.RE
.LP
In addition, all of the symbols from \fI<sys/ipc.h>\fP shall be defined
when
this header is included.
.LP
\fIThe following sections are informative.\fP
.SH APPLICATION USAGE
.LP
None.
.SH RATIONALE
.LP
None.
.SH FUTURE DIRECTIONS
.LP
None.
.SH SEE ALSO
.LP
\fI<sys/ipc.h>\fP , \fI<sys/types.h>\fP , \fIsemctl\fP(), \fIsemget\fP(),
\fIsemop\fP()
.SH COPYRIGHT
Portions of this text are reprinted and reproduced in electronic form
from IEEE Std 1003.1, 2003 Edition, Standard for Information Technology
-- Portable Operating System Interface (POSIX), The Open Group Base
Specifications Issue 6, Copyright (C) 2001-2003 by the Institute of
Electrical and Electronics Engineers, Inc and The Open Group. In the
event of any discrepancy between this version and the original IEEE and
The Open Group Standard, the original IEEE and The Open Group Standard
is the referee document. The original Standard can be obtained online at
http://www.opengroup.org/unix/online.html .