src/libruntime/mailbox.c
/**
 * @todo TODO: provide a detailed description for this function.
 */
@todo TODO: provide a detailed description for this function.
@todo TODO : provide a detailed description for this function .
int nanvix_mailbox_read(int mbxid, void *buf, size_t n)
{
	if (!nanvix_mailbox_is_valid(mbxid))
		return (-EINVAL);
	if (!nanvix_mailbox_is_used(mbxid))
		return (-EINVAL);
	if (mailboxes[mbxid].owner != knode_get_num())
		return (-EPERM);
	if (nanvix_mailbox_is_wronly(mbxid))
		return (-ENOTSUP);
	if (buf == NULL)
		return (-EINVAL);
	if (kmailbox_read(mailboxes[mbxid].fd, buf, n) < 0)
		return (-EINVAL);
	return (0);
}
int nanvix_mailbox_read ( int mbxid , void * buf , size_t n ) { if ( ! nanvix_mailbox_is_valid ( mbxid ) ) return ( - EINVAL ) ; if ( ! nanvix_mailbox_is_used ( mbxid ) ) return ( - EINVAL ) ; if ( mailboxes [ mbxid ] . owner != knode_get_num ( ) ) return ( - EPERM ) ; if ( nanvix_mailbox_is_wronly ( mbxid ) ) return ( - ENOTSUP ) ; if ( buf == NULL ) return ( - EINVAL ) ; if ( kmailbox_read ( mailboxes [ mbxid ] . fd , buf , n ) < 0 ) return ( - EINVAL ) ; return ( 0 ) ; }
@todo TODO: provide a detailed description for this function.
@todo TODO : provide a detailed description for this function .
/* Invalid mailbox ID.*/ /*  Bad mailbox. */ /* Not the owner. */ /* Operation no supported. */ /* Invalid buffer. */ /* Read. */