Obtains a message queue identifier.
#include <sys/types.h> #include <sys/errno.h> #include <sys/stat.h> #include <sys/ipc.h> #include <sys/msg.h>
int kmsgget (key, msgflg, msqid) key_t key; int msgflg; int *msqid;
key | Specifies either a value of IPC_PRIVATE or an IPC key constructed by the ftok subroutine (or a similar algorithm). |
msgflg | Specifies that the msgflg parameter is constructed by logically ORing one or more of these values: |
msqid | A reference parameter where a valid message-queue ID is returned if the kmsgget kernel service is successful. |
The kmsgget kernel service returns the message-queue identifier specified by the msqid parameter associated with the specified key parameter value. The kmsgget kernel service provides the same functions for user-mode processes in kernel mode as the msgget subroutine performs for kernel processes or user-mode processes in user mode. The kmsgget service can be called by a user-mode process in kernel mode or by a kernel process. A kernel process can also call the msgget subroutine to provide the same function.
The kmsgget kernel service can be called from the process environment only.
0 | Indicates successful completion. The msqid parameter is set to a valid message-queue identifier. |
If the kmsgget kernel service fails, the msqid parameter is not valid and the return code is one of these four values:
The kmsgget kernel service is part of Base Operating System (BOS) Runtime.
The msgget subroutine.
Message Queue Kernel Services and Understanding System Call Execution in AIX Kernel Extensions and Device Support Programming Concepts.