% CGC Application Binary Interface
receive - receive bytes from a file descriptor
library "libcgc"
#include <libcgc.h>
int receive(int fd, void *buf, size_t count, size_t *rx_bytes)
The receive system call reads up to count bytes from file descriptor fd to the buffer pointed to by buf. If count is zero, receive returns 0 and optionally sets *rx_bytes to zero.
The receive function is invoked through system call number 3.
On success, zero is returned and, if rx_bytes is not NULL, the number of bytes received is returned in *rx_bytes (zero indicates nothing was received or end-of-file). On error, an error code is returned and *rx_bytes is left unmodified.
EBADF fd is not a valid file descriptor or is not open. EFAULT buf or rx_bytes points to an invalid address.
allocate(2), cgcabi(2), deallocate(2), fdwait(2), random(2), _terminate(2), transmit(2)