blob: 9a4ec11f4acda22f59de175d24b06d8da448da69 (
plain)
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
|
int
do_semop(arglast)
int *arglast;
{
#ifdef HAS_SEM
register STR **st = stack->ary_array;
register int sp = arglast[0];
STR *opstr;
char *opbuf;
int id, opsize;
id = (int)str_gnum(st[++sp]);
opstr = st[++sp];
opbuf = str_get(opstr);
opsize = opstr->str_cur;
if (opsize < sizeof(struct sembuf)
|| (opsize % sizeof(struct sembuf)) != 0) {
errno = EINVAL;
return -1;
}
errno = 0;
return semop(id, (struct sembuf *)opbuf, opsize/sizeof(struct sembuf));
#else
fatal("semop not implemented");
#endif
}
|