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_open(const char *name)
{
	int fd;      
	int nodenum; 
	int mbxid;   
	if (name == NULL)
		return (-EINVAL);
	if ((nodenum = name_lookup(name)) < 0)
		return (-EAGAIN);
	if ((mbxid = nanvix_mailbox_alloc()) < 0)
		return (-EAGAIN);
	if ((fd = kmailbox_open(nodenum)) < 0)
		goto error0;
	mailboxes[mbxid].fd = fd;
	mailboxes[mbxid].owner = knode_get_num();
	nanvix_mailbox_set_wronly(mbxid);
	return (mbxid);
error0:
	nanvix_mailbox_free(mbxid);
	return (-EAGAIN);
}
int nanvix_mailbox_open ( const char * name ) { int fd ; int nodenum ; int mbxid ; if ( name == NULL ) return ( - EINVAL ) ; if ( ( nodenum = name_lookup ( name ) ) < 0 ) return ( - EAGAIN ) ; if ( ( mbxid = nanvix_mailbox_alloc ( ) ) < 0 ) return ( - EAGAIN ) ; if ( ( fd = kmailbox_open ( nodenum ) ) < 0 ) goto error0 ; mailboxes [ mbxid ] . fd = fd ; mailboxes [ mbxid ] . owner = knode_get_num ( ) ; nanvix_mailbox_set_wronly ( mbxid ) ; return ( mbxid ) ; error0 : nanvix_mailbox_free ( mbxid ) ; return ( - EAGAIN ) ; }
@todo TODO: provide a detailed description for this function.
@todo TODO : provide a detailed description for this function .
/* NoC connector. */ /* NoC node.      */ /* ID of mailbix. */ /* Invalid name. */ /* Resolve name, */ /* Allocate a mailbox. */ /* Open underlying HW channel. */ /* Initialize mailbox. */