Man page of SEM182

Section: The sem182 library (3) Updated: RELEASE 2.4


seminit, semgrab, P, V, semrm - Semaphore operations 


#include <sem182.h>

int seminit (key_t key, int semperm, int initval);
int semgrab (key_t key);
int P (int semid);
int V (int semid);
int semrm (int semid);


These functions are easier to use than the standard interface.

seminit creates a semaphore with key using semperm as permissions and initializes the semaphore to initval. On success this function returns a valid descriptor for the semaphore. In case a semaphore with the specified key already exists, seminit returns -1.

semgrab delivers a valid descriptor for an already existing semaphore.

P waits for the semaphore given by semid.

V signals to the semaphore given by semid.

semrm removes the semaphore given by semid.  


All functions return -1 in case of error.  


You have to specify the library to the compiler, e.g.

c89 program.c -lsem182  


semget(2), semop(2), semctl(2), msem182(3)  


The sem182 library is provided "as is" for education purposes only. There is no warranty for the correct functionality and we do not accept any responsibility whatsoever for any loss or damage that is caused by the use of the sem182 library.  


Implemented by Günther Leber, Heinz Kantz and Raimund Kirner. Tested by Peter Holzer.

Manual page written by by Günther Leber. Cleaned-up and reformatted by Thomas Perl.  


Many thanks go to Gerhard J. Fohler for inventing the name semgrab and to Gustav Pospischil for stomping around in our room and providing us with no coffee and no cakes (we didn't ask him for coffee and cakes, but he didn't bring them anyway :-). Also thanks to Alexander Vrchoticky for optimizing semgrab.