Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

46. System V Message Queues > Displaying All Message Queues on the System

Displaying All Message Queues on the System

In Obtaining a List of All IPC Objects, we looked at one way to obtain a list of all of the IPC objects on the system: via a set of files in the /proc file system. We now look at a second method of obtaining the same information: via a set of Linux-specific IPC ctl (msgctl(), semctl(), and shmctl()) operations. (The ipcs program employs these operations.) These operations are as follows:

  • MSG_INFO, SEM_INFO, and SHM_INFO: The MSG_INFO operation serves two purposes. First, it returns a structure detailing resources consumed by all message queues on the system. Second, as the function result of the ctl call, it returns the index of the maximum item in the entries array pointing to data structures for the message queue objects (see Figure 45-1, in Algorithm Employed by System V IPC get Calls). The SEM_INFO and SHM_INFO operations perform an analogous task for semaphore sets and shared memory segments, respectively. We must define the _GNU_SOURCE feature test macro to obtain the definitions of these three constants from the corresponding System V IPC header files.


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint