src/libruntime/mailbox.c
int nanvix_mailbox_close(int mbxid)
{
	int r;		/* Return value. */

	/* Invalid mailbox ID.*/
	if (!nanvix_mailbox_is_valid(mbxid))
		return (-EINVAL);

	/* Bad mailbox. */
	if (!nanvix_mailbox_is_used(mbxid))
		return (-EINVAL);

	/* Not the owner. */
	if (mailboxes[mbxid].owner != knode_get_num())
		return (-EPERM);

	/*  Invalid mailbox. */
	if (!nanvix_mailbox_is_wronly(mbxid))
		return (-EINVAL);

	if ((r = kmailbox_close(mailboxes[mbxid].fd)) != 0)
		return (r);

	nanvix_mailbox_free(mbxid);

	return (0);
}
/**
 * @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_close(int mbxid)
{
	int r;		
	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 (-EINVAL);
	if ((r = kmailbox_close(mailboxes[mbxid].fd)) != 0)
		return (r);
	nanvix_mailbox_free(mbxid);
	return (0);
}
int nanvix_mailbox_close ( int mbxid ) { int r ; 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 ( - EINVAL ) ; if ( ( r = kmailbox_close ( mailboxes [ mbxid ] . fd ) ) != 0 ) return ( r ) ; nanvix_mailbox_free ( mbxid ) ; return ( 0 ) ; }
@todo TODO: provide a detailed description for this function.
@todo TODO : provide a detailed description for this function .
/* Return value. */ /* Invalid mailbox ID.*/ /* Bad mailbox. */ /* Not the owner. */ /*  Invalid mailbox. */