Документ взят из кэша поисковой машины. Адрес оригинального документа : http://itpm.msu.su/LDP/lpg-0.4/node49.html
Дата изменения: Sun Apr 18 13:36:59 1999
Дата индексирования: Mon Oct 1 21:11:57 2012
Кодировка:
Kernel semid_ds structure next up previous contents
Next: Kernel sem structure Up: Internal Data Structures Previous: Internal Data Structures

Kernel semid_ds structure

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 */
        };

As with message queues, operations on this structure are performed by a special system call, and should not be tinkered with directly. Here are descriptions of the more pertinent fields:

sem_perm

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).

sem_otime

Time of the last semop() operation (more on this in a moment)

sem_ctime

Time of the last change to this structure (mode change, etc)

sem_base

Pointer to the first semaphore in the array (see next structure)

sem_undo

Number of undo requests in this array (more on this in a moment)

sem_nsems

Number of semaphores in the semaphore set (the array)



Converted on:
Fri Mar 29 14:43:04 EST 1996