src/libruntime/portal.c
/**
 * @brief Opens a portal.
 *
 * @param name Portal name.
 *
 * @returns Upon successful completion, the ID of the target portal is
 * returned. Upon failure, a negative error code is returned instead.
 */
@brief Opens a portal.
@param name Portal name.

@returns Upon successful completion, the ID of the target portal is
returned. Upon failure, a negative error code is returned instead.
@brief Opens a portal . @param name Portal name . @returns Upon successful completion the ID of the target portal is returned . Upon failure a negative error code is returned instead .
int nanvix_portal_open(const char *name, int port)
{
	int id;	   
	int nodenum;  
	int portalid; 
	if (name == NULL)
		return (-EINVAL);
	if ((nodenum = name_lookup(name)) < 0)
		return (-EAGAIN);
	if ((id = nanvix_portal_alloc()) < 0)
		return (-EAGAIN);
	if ((portalid = kportal_open(knode_get_num(), nodenum, port)) < 0)
		goto error0;
	portals[id].portalid = portalid;
	portals[id].owner = knode_get_num();
	nanvix_portal_set_wronly(id);
	return (id);
error0:
	nanvix_portal_free(id);
	return (-EAGAIN);
}
int nanvix_portal_open ( const char * name , int port ) { int id ; int nodenum ; int portalid ; if ( name == NULL ) return ( - EINVAL ) ; if ( ( nodenum = name_lookup ( name ) ) < 0 ) return ( - EAGAIN ) ; if ( ( id = nanvix_portal_alloc ( ) ) < 0 ) return ( - EAGAIN ) ; if ( ( portalid = kportal_open ( knode_get_num ( ) , nodenum , port ) ) < 0 ) goto error0 ; portals [ id ] . portalid = portalid ; portals [ id ] . owner = knode_get_num ( ) ; nanvix_portal_set_wronly ( id ) ; return ( id ) ; error0 : nanvix_portal_free ( id ) ; return ( - EAGAIN ) ; }
@brief Opens a portal.
@brief Opens a portal .
/* Portal ID.				 */ /* NoC node.				  */ /* Underlying unnamed portal. */ /* Invalid name. */ /* Resolve name. */ /* Allocate a portal. */ /* Open underlying unnamed portal. */ /* Initialize portal. */