Manual Pages for UNIX Darwin command on man semctl
MyWebUniversity

Manual Pages for UNIX Darwin command on man semctl

SEMCTL(2) BSD System Calls Manual SEMCTL(2)

NAME

sseemmccttll - control operations on a semaphore set

SYNOPSIS

##iinncclluuddee <>

int sseemmccttll(int semid, int semnum, int cmd, ...);

DESCRIPTION

The sseemmccttll() system call performs the operation indicated by cmd on the semaphore set indicated by semid. A fourth argument, a union semun arg, is required for certain values of cmd. For the commands that use the arg argument, union semun is defined as follows: union semun { int val; /* value for SETVAL */ struct semidds *buf; /* buffer for IPCSTAT & IPCSET */ ushort *array; /* array for GETALL & SETALL */ }; Commands are performed as follows: IPCSTAT Fetch the semaphore set's struct semidds, storing it in the memory pointed to by arg.buf. IPCSET Changes the semperm.uid, semperm.gid, and semperm.mode members of the semaphore set's struct semidds to match those of the struct pointed to by arg.buf. The calling process's effective uid must match either semperm.uid or semperm.cuid, or it must have superuser privileges. IPCRMID Immediately removes the semaphore set from the system. The calling process's effective uid must equal the semaphore set's semperm.uid or semperm.cuid, or the process must have superuser privileges. GETVAL Return the value of semaphore number semnum.

SETVAL Set the value of semaphore number semnum to arg.val. Out-

standing adjust on exit values for this semaphore in any process are cleared. GETPID Return the pid of the last process to perform an operation on semaphore number semnum. GETNCNT Return the number of processes waiting for semaphore number semnum's value to become greater than its current value. GETZCNT Return the number of processes waiting for semaphore number semnum's value to become 0. GETALL Fetch the value of all of the semaphores in the set into the array pointed to by arg.array. SETALL Set the values of all of the semaphores in the set to the values in the array pointed to by arg.array. Outstanding adjust on exit values for all semaphores in this set, in any process are cleared. The struct semidds is defined as follows: struct semidds { struct ipcperm semperm; /* operation permission struct */ struct sem *sembase; /* pointer to first semaphore in set */ ushort semnsems; /* number of sems in set */ timet semotime; /* last operation time */ long sempad1; /* SVABI/386 says I need this here */ timet semctime; /* last change time */ /* Times measured in secs since */ /* 00:00:00 GMT, Jan. 1, 1970 */ long sempad2; /* SVABI/386 says I need this here */ long sempad3[4]; /* SVABI/386 says I need this here */ };

RETURN VALUES

On success, when cmd is one of GETVAL, GETPID, GETNCNT or GETZCNT, sseemmccttll() returns the corresponding value; otherwise, 0 is returned. On

failure, -1 is returned, and errno is set to indicate the error.

EERRRROORRSS The sseemmccttll() system call will fail if: [EACCES] Permission denied due to mismatch between operation and mode of semaphore set. [EINVAL] No semaphore set corresponds to semid.

[EINVAL] The semnum argument is not in the range of valid sema-

phores for given semaphore set. [EPERM] The calling process's effective uid does not match the uid of the semaphore set's owner or creator. [ERANGE] SETVAL or SETALL attempted to set a semaphore outside the allowable range [0 .. SEMVMX].

LEGACY SYNOPSIS

##iinncclluuddee <>

##iinncclluuddee <>

##iinncclluuddee <>

The include files and are necessary.

SEE ALSO

semget(2), semop(2), compat(5)

BUGS

SETALL may update some semaphore elements before returning an error. BSD September 12, 1995 BSD




Contact us      |      About us      |      Term of use      |       Copyright © 2000-2019 MyWebUniversity.com ™