

sem                       Device Driver                       sem




Semaphore device driver


/dev/sem is  an interface to the semaphore  device driver.  It is
assigned major device 23 (minor  device 0) and can be accessed as
a character-special device.

All semaphore operations  are performed through the COHERENT sys-
tem  call ioctl.   The operations semctl,  semget, and  semop are
performed with an  integer parameter array.  The first element of
the array is reserved  for the return value (default -1).  Subse-
quent  elements represent  arguments.  The  call to  ioctl passes
SEMCTL,  SEMGET,  or  SEMOP  as  the  second  argument,  and  the
parameter array as the  third argument.  The first argument is an
open file descriptor to /dev/sem.

***** Access *****

Prior to accessing the devices, a entry must be created in  /dev,
as follows:


/etc/mknod /dev/sem c 23 0
chmod 666 /dev/sem


***** Bugs ***** Allocation of too many semaphore ids (NNSSEEMMIIDD) or
semaphores per  identifier (NNSSEEMM) can exhaust  kernel data space,
which will stop the system in its tracks.

Private semaphore sets  are not supported.  Semaphore ids must be
removed  manually  when   no  longer  required.   To  remove  all
semaphore identifiers, use the following code:


#include <sys/sem.h>
#define NSEMID 16

semget( 0, 0 );     /* must do first */

for ( id=0; id < NSEMID; ++id )
        semctl( id, 0, IPC_RMID, 0 );


To load the driver sem into memory, use the command drvld.

***** Files *****

/uussrr/iinncclluuddee/ssyyss/iippcc.hh
/uussrr/iinncclluuddee/ssyyss/sseemm.hh
/ddeevv/sseemm -- Device
/ddrrvv/sseemm -- Loadable device driver




COHERENT Lexicon                                           Page 1




sem                       Device Driver                       sem



***** See Also *****

device drivers, drvld, semctl(), semget(), semop()






















































COHERENT Lexicon                                           Page 2


