5.3.3.3.3 msgget()
This function is invoked to create a new message queue, or to get a descriptor of an existing queue based on a
key. The newly created credentials of the message queue are initialized from the credentials of the creating
process.
5.3.3.3.4 msgsnd()
This function is invoked to send a message to a message queue. DAC is performed by invoking the
ipcperms() function. A message is copied from the user buffer into the newly allocated msg_msg
structure. Page frames are allocated in the buffer space of the kernel using kmalloc() and the
GFP_KERNEL flag. Thus, no special object reuse handling is required.
5.3.3.3.5 msgrcv()
This function is invoked to receive a message from a message queue. DAC is performed by invoking the
ipcperms() function.
5.3.3.3.6 msgctl()
This function is invoked to set attributes of, query status of, or delete a message queue. Message queues are
not deleted until the process waiting for the message has received it. DAC is performed by invoking the
ipcperms() function.
5.3.3.4 Semaphores
Semaphores allow processes to synchronize execution by performing a set of operations atomically on
themselves. An important data structure implementing semaphores in the kernel is sem_array, which
describes the structure of the semaphore. Important functions are semget(), semop(), and semctl().
Once marked for deletion, no further operation on a semaphore is possible.
5.3.3.4.1 sem_array
Describes the structure and state information for a semaphore object. sem_array contains fields including
as sem_perm, the kern_ipc_perm data structure; sem_base, which is a pointer to the first semaphore;
and, sem_pending, which is a pointer to pending operations.
5.3.3.4.2 semget()
A function that is invoked to create a new semaphore or to get a descriptor of an existing semaphore based on
a key. The newly created semaphore’s credentials are initialized from the creating process’s credentials.
The newly allocated semaphores are explicitly initialized to zero by a call to memset().
5.3.3.4.3 semop()
This function is invoked to perform atomic operations on semaphores. DAC is performed by invoking the
ipcperms() function.
66