__getipc() — Query interprocess communications

Standards

Standards / Extensions C or C++ Dependencies
z/OS® UNIX both  

Format

#define _XOPEN_SOURCE
#include <sys/__getipc.h>

int __getipc(int token_id, IPCQPROC *bufptr, size_t buflng, int cmd);

General description

The __getipc() function provides means for obtaining information about the status of interprocess communications (IPC) resources, message queues, semaphores, shared memory, and map service memory.

The argument token_id is a number that identifies the relative position of an IPC member in the system or specifies a message queue ID, semaphore ID, or shared memory ID. Zero represents the first IPC member ID in the system. On the first call to __getipc(), pass the a token_id of zero; the function will return the token that identifies the next IPC resource to which the caller has access. Use this token on the next call to __getipc().

The argument bufptr is the address where the data is to be stored.

The argument buflen is the length of the buffer.

The argument cmd specifies one of the following commands:
IPCQALL
Retrieve the next shared memory, semaphore, or message queue
IPCQMSG
Retrieve the next message member
IPCQSEM
Retrieve the next semaphore member
IPCQSHM
Retrieve the next shared memory member
IPCQMAP
Retrieve the next map service memory currently allocated
IPCQOVER
Overview of system variables. Ignores the value of the first argument token_id.

Returned value

If successful, __getipc() returns 0.

If unsuccessful, __getipc() returns -1 and sets errno to one of the following values:
Error Code
Description
EACCES
Operation permission (read) is denied to the calling process for the member ID specified by token_id.
EFAULT
The argument bufptr contains an non-valid address.
EINVAL
The member ID specified in the argument token_id is not valid for the command specified, or the argument cmd is not a valid command.

Related information