perl 5.0 alpha 2
[p5sagit/p5-mst-13.2.git] / do / semop
1 int
2 do_semop(arglast)
3 int *arglast;
4 {
5 #ifdef HAS_SEM
6     register STR **st = stack->ary_array;
7     register int sp = arglast[0];
8     STR *opstr;
9     char *opbuf;
10     int id, opsize;
11
12     id = (int)str_gnum(st[++sp]);
13     opstr = st[++sp];
14     opbuf = str_get(opstr);
15     opsize = opstr->str_cur;
16     if (opsize < sizeof(struct sembuf)
17         || (opsize % sizeof(struct sembuf)) != 0) {
18         errno = EINVAL;
19         return -1;
20     }
21     errno = 0;
22     return semop(id, (struct sembuf *)opbuf, opsize/sizeof(struct sembuf));
23 #else
24     fatal("semop not implemented");
25 #endif
26 }
27