The semid_ds structure used in the IPC_SET and IPC_STAT commands is
defined as follows in struct semid_ds { struct ipc_perm sem_perm;
/* operation permissions */
struct sem *sem_base; /* semaphore set */
u_short sem_nsems; /* number of sems in set */
time_t sem_otime; /* last operation time */
time_t sem_ctime; /* last change time */
};
The ipc_perm structure used inside the semid_ds structure is
defined in and looks like this: struct ipc_perm { ushort cuid; /*
creator user id */
ushort cgid; /* creator group id */
ushort uid; /* user id */
ushort gid; /* group id */
ushort mode; /* r/w permission (see chmod(2)
) */
ushort seq; /* sequence # (to generate unique msg/sem/shm id) */
key_t key; /* user specified msg/sem/shm key */
};
provides the following operations: Return the value of the semaphore. Set the value of the semaphore to Return the pid of the last process that did an operation on this semaphore. Return the number of processes waiting to acquire the semaphore. Return the number of processes waiting for the value of the semaphore to reach 0. Return the values for all the semaphores associated with Set the values for all the semaphores that are associated with the semaphore identifier to the corresponding values in Gather statistics about a semaphore and place the information in the semid_ds structure pointed to by (see above). Set the value of the and fields in the structure associated with the semaphore. The values are taken from the corresponding fields in the structure pointed to by This operation can only be executed by the super-user, or a process that has an effective user id equal to either or in the data structure associated with the message queue. Remove the semaphores associated with from the system and destroy the data structures associated with it. Only the super-user or a process with an effective uid equal to the or values in the data structure associated with the semaphore can do this.
The permission to read or change a message queue (see is determined by the field in the same way as is done with files (see but the effective uid can match either the field or the field, and the effective gid can match either or
is not a valid command. specifies an invalid address.