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 }