struct sembuf ops[1]; ops[0].sem_num = 0; ops[0].sem_op = -1; ops[0].sem_flg = 0; semop(semid, ops, 1);