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

@returns Upon successful completion, the ID of the new portal is
returned. Upon failure, a negative error code is returned instead.
@brief Creates a portal . @param name Portal name . @returns Upon successful completion the ID of the new portal is returned . Upon failure a negative error code is returned instead .
int nanvix_portal_create(const char *name)
{
	int id;       
	int nodenum;  
	int portalid; 
	if (name == NULL)
		return (-EINVAL);
	if (ustrlen(name) > MAILBOX_MSG_SIZE)
		return (-EINVAL);
	if ((portalid = get_inportal()) < 0)
		return (-EAGAIN);
	if ((id = nanvix_portal_alloc()) < 0)
		return (-EAGAIN);
	nodenum = knode_get_num();
	if (name_link(nodenum, name) != 0)
		goto error0;
	portals[id].portalid = portalid;
	portals[id].owner = nodenum;
	ustrcpy(portals[id].name, name);
	return (id);
error0:
	nanvix_portal_free(id);
	return (-EAGAIN);
}
int nanvix_portal_create ( const char * name ) { int id ; int nodenum ; int portalid ; if ( name == NULL ) return ( - EINVAL ) ; if ( ustrlen ( name ) > MAILBOX_MSG_SIZE ) return ( - EINVAL ) ; if ( ( portalid = get_inportal ( ) ) < 0 ) return ( - EAGAIN ) ; if ( ( id = nanvix_portal_alloc ( ) ) < 0 ) return ( - EAGAIN ) ; nodenum = knode_get_num ( ) ; if ( name_link ( nodenum , name ) != 0 ) goto error0 ; portals [ id ] . portalid = portalid ; portals [ id ] . owner = nodenum ; ustrcpy ( portals [ id ] . name , name ) ; return ( id ) ; error0 : nanvix_portal_free ( id ) ; return ( - EAGAIN ) ; }
@brief Creates a portal.
@brief Creates a portal .
/* Portal ID.                 */ /* NoC node.                  */ /* Underlying unnamed portal. */ /* Invalid name. */ /* Check name length. */ /* Runtime not initialized. */ /* Allocate portal. */ /* Link name. */ /* Initialize portal. */