The msgsnd service sends a message to a message queue.
Operation | Environment |
---|---|
Authorization: | Supervisor state or problem state, any PSW key |
Dispatchable unit mode: | Task or SRB |
Cross memory mode: | PASN = HASN |
AMODE (BPX1QSN): | 31-bit task or SRB mode |
AMODE (BPX4QSN): | 64-bit task mode only |
ASC mode: | Primary mode |
Interrupt status: | Enabled for interrupts |
Locks: | Unlocked |
Control parameters: | All parameters must be addressable by the caller and in the primary address space. |
|
AMODE 64 callers use BPX4QSN with the same parameters. The Message_address parameter is a doubleword.
Specifies the message queue identifier.
The name of a fullword (doubleword) field that contains the address of the message to be sent. This area is mapped by MSGBUG of MSGXBuf. The message type is the first word of the message. It must be greater than zero.
The name of the fullword that contains the ALET for Message_address that identifies the address space or data space where the buffer resides.
You should specify a Message_Alet of 0 if the buffer resides in the user's address space (current primary address space).
You should specify a Message_Alet of 2 if the buffer resides in the home address space.
If a value other than 0 or 2 is specified for the Message_Alet, the value must represent a valid entry in the dispatchable unit access list (DUAL).
Specifies the length of the message text that is pointed to by the Message_address parameter. The length does not include the 4-byte type that precedes the message text. For example, a message with a MSG_TYPE and no MSG_MTEXT would have a Message_Size of zero. A zero-length message is accepted.
The name of a fullword in which the msgsnd service returns -1 or 0. The message was sent unless a -1 is received.
Return_code | Explanation |
---|---|
EACCES | Operation permission is denied to the calling task: JRIpcDenied. If the message queue was built with Ipc_SndTypePID, and the MSG_TYPE was other than the invoker's process ID, the following reason code accompanies the return code: JRTypeNotPID. |
EAGAIN | The message cannot be sent, and Message_Flag is set to Ipc_NOWAIT. The following reason codes can accompany the return code: JRMsqQueueFullMessages, JRMsqQueueFullBytes. |
EIDRM | The Message_Queue_ID was removed from the system while the caller was waiting. The following reason code can accompany the return code: JRIpcRemoved. |
EINTR | The function was interrupted by a signal, and the message was not sent. The following reason code can accompany the return code: JRIpcSignaled. |
EINVAL | Message_Queue_ID is not a valid message queue identifier; the value of MSG _TYPE is less than 1; or the value of Message_Size is less than zero or greater than the system—imposed limit. The following reason codes can accompany the return code: JRIpcBadID, JRMsqBadSize, or JRMsqBadType. |
EFAULT | The Message_address parameter specified an address that caused the service to program check. The following reason code can accompany the return code: JRBadAddress. |
ENOMEM | There were not enough system storage exits to send the message; the message was not sent. The following reason code can accompany the return code: JrSmNoStorage. |
The name of a fullword in which the msgsnd service stores the reason code. The msgsnd service returns Reason_code only if Return_value is -1. Reason_code further qualifies the Return_code value. See z/OS UNIX System Services Messages and Codes for the reason codes.
The caller of this service is restricted by ownership and read and read-write permissions that are defined by msgget and msgctl Ipc_SET.
For an example using this callable service, see BPX1QSN (msgsnd) example.