kmsgget Kernel Service
Purpose
Obtains a message queue identifier.
Syntax
Parameters
| Item | Description |
|---|---|
| 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. |
Description
The kmsgget kernel service returns the message-queue identifier that is 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.
Execution Environment
The kmsgget kernel service can be called from the process environment only.
Return Values
| Item | Description |
|---|---|
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:
| Item | Description |
|---|---|
EACCES |
Indicates that a message queue ID exists for the key parameter but operation permission as specified by the msgflg parameter cannot be granted. |
ENOENT |
Indicates that a message queue ID does not exist for the key parameter
and the IPC_CREAT command is not set. |
ENOSPC |
Indicates that a message queue ID is to be created but the system-imposed limit on the maximum number of allowed message queue IDs systemwide will be exceeded. |
EEXIST |
Indicates that a message queue ID exists for the value that is specified by the
key parameter, and both the IPC_CREAT and
IPC_EXCL commands are set. |