ipcs - report inter-process communication facilities status
ipcs [ -qms ] [ -a | -bcopt ]
The ipcs utility writes information about active inter-process communication facilities.Without options, information is written in short format for message queues, shared memory segments and semaphores sets that are currently active in the system. Otherwise, the information that is displayed is controlled by the options specified.
The ipcs facility supports the XBD specification, Utility Syntax Guidelines .The ipcs utility accepts the following options:
- -q
- Write information about active message queues.
- -m
- Write information about active shared memory segments.
- -s
- Write information about active semaphores sets.
If -q, -m or -s are specified, only information about those facilities is written. If none of these three are specified, information about all three is written subject to the following options:
- -a
- Use all print options. (This is a shorthand notation for -b, -c, -o, -p and -t.)
- -b
- Write information on maximum allowable size. (Maximum number of bytes in messages on queue for message queues, size of segments for shared memory, and number of semaphores in each set for semaphores.)
- -c
- Write creator's user name and group name. See below.
- -o
- Write information on outstanding usage. (Number of messages on queue and total number of bytes in messages on queue for message queues, and number of processes attached to shared memory segments.)
- -p
- Write process number information. (Process ID of last process to send a message and process ID of last process to receive a message on message queues, process ID of creating process, and process ID of last process to attach or detach on shared memory segments.)
- -t
- Write time information. (Time of the last control operation that changed the access permissions for all facilities, time of last msgsnd() and msgrcv() operations on message queues, time of last shmat() and shmdt() operations on shared memory, and time of last semop() operation on semaphores.)
None.
Not used.
- the group database
- the user database.
The following environment variables affect the execution of ipcs:
- LANG
- Provide a default value for the internationalization variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalization variables contain an invalid setting, the utility will behave as if none of the variables had been set.
- LC_ALL
- If set to a non-empty string value, override the values of all the other internationalization variables.
- LC_CTYPE
- Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
- LC_MESSAGES
- Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error.
- NLSPATH
- Determine the location of message catalogues for the processing of LC_MESSAGES .
- TZ
- Determine the timezone for the time strings written by ipcs.
Default.
An introductory line is written with the format:"IPC status from %s as of %s\n", <source>, <date>
where <source> indicates the source used to gather the statistics and <date> is the information that would be produced by the command:
date
when invoked in the POSIX locale.
The ipcs utility then creates up to three reports depending upon the -q, -m and -s options. The first report indicates the status of message queues, the second report indicates the status of shared memory segments, and the third report indicates the status of semaphore sets.
If the corresponding facility is not installed or has not been used since the last reboot, then the report is written out in the format:
"%s facility not in system.\n", <facility>
where <facility> is Message Queue, Shared Memory or Semaphore as appropriate. If the facility has been installed and has been used since the last reboot, column headings separated by one or more spaces and followed by a new line will be written as indicated below followed by the facility name written out using the format:
"%s:\n", <facility>
where <facility> is Message Queues, Shared Memory or Semaphores as appropriate. On the second and third reports the column headings need not be written if the last column headings written already provide column headings for all information in that report.
The column headings provided in the first column below and the meaning of the information in those columns are given in order below; the letters in parentheses indicate the options that cause the corresponding column to appear; "all" means that the column always appears. Each column is separated by one or more space characters. Note that these options only determine what information is provided for each report; they do not determine which reports are written.
- T (all)
- Type of facility:
- q
- Message queue.
- m
- Shared memory segment.
- s
- Semaphore.
This field is a single character written using the format "%c".
- ID (all)
- The identifier for the facility entry. This field is written using the format "%d".
- KEY (all)
- The key used as an argument to msgget(), semget() or shmget() to create the facility entry.
This field is written using the format "0x%x".
- Note:
- The key of a shared memory segment is changed to IPC_PRIVATE when the segment has been removed until all processes attached to the segment detach it.
- MODE (all)
- The facility access modes and flags. The mode consists of 11 characters that are interpreted as follows.
The first character is:
- S
- If a process is waiting on a msgsnd() operation.
- -
- If the above is not true.
The second character is:
- R
- If a process is waiting on a msgrcv() operation.
- C or -
- If the associated shared memory segment is to be cleared when the first attach operation is executed.
- -
- If none of the above is true.
The next nine characters are interpreted as three sets of three bits each. The first set refers to the owner's permissions; the next to permissions of others in the usergroup of the facility entry; and the last to all others. Within each set, the first character indicates permission to read, the second character indicates permission to write or alter the facility entry, and the last character is a minus sign (-).
The permissions are indicated as follows:
- r
- If read permission is granted.
- w
- If write permission is granted.
- a
- If alter permission is granted.
- -
- If the indicated permission is not granted.
The first character following the permissions specifies if there is an alternate or additional access control method associated with the facility. If there is no alternate or additional access control method associated with the facility, a single space character will be written; otherwise another printable character will be written.
- OWNER (all)
- The user name of the owner of the facility entry. If the user name of the owner is found in the user database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the user ID of the owner is written using the format "%d".
- GROUP (all)
- The group name of the owner of the facility entry. If the group name of the owner is found in the group database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the group ID of the owner is written using the format "%d".
The following nine columns are only written out for message queues:
- CREATOR (a,c)
- The user name of the creator of the facility entry. If the user name of the creator is found in the user database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the user ID of the creator is written using the format "%d".
- CGROUP (a,c)
- The group name of the creator of the facility entry. If the group name of the creator is found in the group database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the group ID of the creator is written using the format "%d".
- CBYTES (a,o)
- The number of bytes in messages currently outstanding on the associated message queue. This field is written using the format "%d".
- QNUM (a,o)
- The number of messages currently outstanding on the associated message queue. This field is written using the format "%d".
- QBYTES (a,b)
- The maximum number of bytes allowed in messages outstanding on the associated message queue. This field is written using the format "%d".
- LSPID (a,p)
- The process ID of the last process to send a message to the associated queue. This field is written using the format:
where <pid> is 0 if no message has been sent to the corresponding message queue; otherwise, <pid> is the process ID of the last process to send a message to the queue."%d", <pid>
- LRPID (a,p)
- The process ID of the last process to receive a message from the associated queue. This field is written using the format:
where <pid> is 0 if no message has been received from the corresponding message queue; otherwise, <pid> is the process ID of the last process to receive a message from the queue."%d", <pid>
- STIME (a,t)
- The time the last message was sent to the associated queue. If a message has been sent to the corresponding message queue, the hour, minute and second of the last time a message was sent to the queue is written using the format "%d:%2.2d:%2.2d". Otherwise, the format " no-entry" will be written.
- RTIME (a,t)
- The time the last message was received from the associated queue. If a message has been received from the corresponding message queue, the hour, minute and second of the last time a message was received from the queue is written using the format "%d:%2.2d:%2.2d". Otherwise, the format " no-entry" will be written.
The following eight columns are only written out for shared memory segments.
- CREATOR (a,c)
- The user name of the creator of the facility entry. If the user name of the creator is found in the user database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the user ID of the creator is written using the format "%d".
- CGROUP (a,c)
- The group name of the creator of the facility entry. If the group name of the creator is found in the group database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the group ID of the creator is written using the format "%d".
- NATTCH (a,o)
- The number of processes attached to the associated shared memory segment. This field is written using the format "%d".
- SEGSZ (a,b)
- The size of the associated shared memory segment. This field is written using the format "%d".
- CPID (a,p)
- The process ID of the creator of the shared memory entry. This field is written using the format "%d".
- LPID (a,p)
- The process ID of the last process to attach or detach the shared memory segment. This field is written using the format:
where <pid> is 0 if no process has attached the corresponding shared memory segment; otherwise, <pid> is the process ID of the last process to attach or detach the segment."%d", <pid>
- ATIME (a,t)
- The time the last attach on the associated shared memory segment was completed. If the corresponding shared memory segment has ever been attached, the hour, minute and second of the last time the segment was attached is written using the format "%d:%2.2d:%2.2d". Otherwise, the format " no-entry" will be written.
- DTIME (a,t)
- The time the last detach on the associated shared memory segment was completed. If the corresponding shared memory segment has ever been detached, the hour, minute, and second of the last time the segment was detached is written using the format "%d:%2.2d:%2.2d". Otherwise, the format " no-entry" will be written.
The following four columns are only written out for semaphore sets:
- CREATOR (a,c)
- The user name of the creator of the facility entry. If the user name of the creator is found in the user database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the user ID of the creator is written using the format "%d".
- CGROUP (a,c)
- The group name of the creator of the facility entry. If the group name of the creator is found in the group database, at least the first eight column positions of the name are written using the format "%s". Otherwise, the group ID of the creator is written using the format "%d".
- NSEMS (a,t)
- The number of semaphores in the set associated with the semaphore entry. This field is written using the format "%d".
- OTIME (a,t)
- The time the last semaphore operation on the set associated with the semaphore entry was completed. If a semaphore operation has ever been performed on the corresponding semaphore set, the hour, minute and second of the last semaphore operation on the semaphore set is written using the format "%d:%2.2d:%2.2d". Otherwise, the format " no-entry" will be written.
The following column is written for all three reports when it is requested:
- CTIME (a,t)
- The time the associated entry was created or changed. The hour, minute and second of the time when the associated entry was created are written using the format "%d:%2.2d:%2.2d".
Used only for diagnostic messages.
None.
None.
The following exit values are returned:
- 0
- Successful completion.
- >0
- An error occurred.
Default.
Things can change while ipcs is running; the information it gives is guaranteed to be accurate only when it was retrieved.
None.
None.
The XSH specification description of msgrcv(), msgsnd(), semget(), semop(), shmat(), shmdt(), shmget().