|
As with message queues, the kernel maintains a special internal data structure for each semaphore set which exists within its addressing space. This structure is of type semid_ds, and is defined in linux/sem.h as follows:
/* One semid data structure for each set of semaphores in the system. */ struct semid_ds { struct ipc_perm sem_perm; /* permissions .. see ipc.h */ time_t sem_otime; /* last semop time */ time_t sem_ctime; /* last change time */ struct sem *sem_base; /* ptr to first semaphore in array */ struct wait_queue *eventn; struct wait_queue *eventz; struct sem_undo *undo; /* undo requests on this array */ ushort sem_nsems; /* no. of semaphores in array */ };
This is an instance of the ipc_perm structure, which is defined for us in linux/ipc.h. This holds the permission information for the semaphore set, including the access permissions, and information about the creator of the set (uid, etc).
Time of the last semop() operation (more on this in a moment)
Time of the last change to this structure (mode change, etc)
Pointer to the first semaphore in the array (see next structure)
Number of undo requests in this array (more on this in a moment)
Number of semaphores in the semaphore set (the array)
Hosting by: Hurra Communications Ltd.
Generated: 2007-01-26 17:57:43