|
|
NM and CM callable.
Sends mail to another process. Process handling (PH) capability is required.
Syntax
U16 I16V I16V UDS U16V
mailstatus := SENDMAIL (pin, length, location, waitflag);
Functional Return
- mailstatus
16-bit unsigned integer (assigned functional return)
Returns one of the following values:
- Value
Meaning
- 0
Mail transmitted successfully and mailbox contained
no previous mail.
- 1
Mail was transmitted successfully and mailbox contained mail
sent previously that was overwritten by the new mail, or contained
previous incoming/outgoing mail that was cleared.
- 2
Mail not transmitted successfully; mailbox contained incoming
mail to be collected by the sending process (regardless of the
waitflag setting).
- 3
Error occurred; an illegal pin parameter was
specified or a bounds check failed.
- 4
Illegal wait request; produces a deadlock.
- 5
Request denied; length exceeded the maximum
mailbox size allowed by the system.
- 6
Request denied; storage resources for the mail data segment
were not available.
Parameters
- pin
16-bit signed integer by value (required)
The process to receive the mail. If you specify a child process,
pin is the process identification number (PIN) of that
process. If a parent process is specified, pin is
zero.
- length
16-bit signed integer by value (required)
The length of the message, in half words, transmitted from the stack of
the sending process. If 0 is specified, the mailbox is emptied of any
incoming or outgoing mail.
- location
user-defined structure (required)
The buffer containing the message.
- waitflag
16-bit unsigned integer by value (required)
Action to be taken if the mailbox contains previously sent mail, as
specified in bit (15:1):
- Bits
Value/Meaning
- 0
Cancel (overwrite) any mail sent previously with
the current mail.
- 1
Wait until the receiving process collects the previous
mail before sending current mail.
Operation Notes
If the receiving process mailbox contains an uncollected message from the
calling process, the action taken depends on the waitflag
parameter specified in the SENDMAIL call. If the mailbox currently is
being used by another process, SENDMAIL waits until the mailbox is
free and then sends the mail.
Condition Codes
- CCE (2)
Request granted. The mail was sent (value 0 or 1 is returned to
mailstatus), or the mail was not sent because the mailbox
contained incoming mail to be collected by the sending process (value 2
is returned to mailstatus).
- CCG (0)
Request denied. An illegal length parameter (value 5
is returned to mailstatus), an illegal
pin parameter was specified (value 3 is returned to
mailstatus), or storage for the mail data segment was not
available (value 6 is returned to mailstatus).
- CCL (1)
Request denied. The length or location
parameter does not allow write access on the stack address (value 3 is
returned to mailstatus), or both processes are waiting to
send mail (value 4 is returned to mailstatus).
Related Information
- Manual
Interprocess Communication Programmer's Guide
|