Go to the previous, next section.

semop

SYNOPSIS

int semop(int semid, struct sembuf *sops, unsigned nsops);

PARAMETERS

semid: [in] the semaphore set on which to perform the operations.

sops: [in] points to an array of operations to perfrom.

nsops: [in] the number of element in sops.

DESCRIPTION

Perform operations on a semaphore set. The sops parameter a structure sembuf of the form:

short sem_num
which semaphore to operate on (0 is the first).

short sem_op;
the operation.

short sem_flg;

sem_flg may be IPC_NOWAIT for non blocking calls and SEM_UNDO to specify an operation that will be undone on task termination. The individual operations are perfomed if and only if all of them will succeed.

The possible values of cmd are:

Whenever a call succeed, the sempid member of the semaphore set structure is set to the pid of the current task and the sem_ctime and sem_otime member are set to the current time.

RETURN VALUE

On success, the call returns zero. On error -1 is returned and errno is set to one of the following values:

Go to the previous, next section.