RECEIVE
Function
receive receives a message from a mailbox.
Synopsis
#include <types.h>
#include <stub.h>
int receive(Message_Header
*header, char *buffer, int *size);
Description
receive receives a message from the
mailbox specified by the field from
in header and stores it in buffer. size is a
two-way parameter: as input, it indicates the buffer size in bytes; as
output, it indicates the number of bytes actually received.
This system call is normally used by servers
to receive service requests from the clients. Although there is no formal
restrictions on its use by clients, the act system
call is by far more adequate.
Most reply messages sent by servers include
a status code that is returned by the offset
field in header. It is important not to confuse this status
code with the value returned by receive, which regards solely the
system call.
Differently from send, receive does
not support receiving from the kernel neither from a remote mailbox. The
unique option is to receive from a local mailbox.
If the mailbox being received from is empty,
receive blocks until a message arrives. When a message is present
in the mailbox, it is immediately copied into buffer.
Return Values
On success, receive returns 0 and buffer
holds a message that is size bytes long.
On fail, receive returns a negative
value indicating one of the following errors:
See Also
send, act,
Capability, Message_Header,
network server
Notes
receive is indeed, act(NULL,
NULL, 0, header, buffer, size).