src/libruntime/portal.c
/**
 * @brief Allocates a portal.
 *
 * @return Upon successful completion, the ID of the newly allocated
 * portal is returned. Upon failure, -1 is returned instead.
 *
 * @note this function is @b not thread safe.
 */
@brief Allocates a portal.
@return Upon successful completion, the ID of the newly allocated
portal is returned. Upon failure, -1 is returned instead.

@note this function is @b not thread safe.
@brief Allocates a portal . @return Upon successful completion the ID of the newly allocated portal is returned . Upon failure - 1 is returned instead . @note this function is @b not thread safe .
static int nanvix_portal_alloc(void)
{
	for (int i = 0; i < NANVIX_PORTAL_MAX; i++)
	{
		if (!nanvix_portal_is_used(i))
		{
			nanvix_portal_set_used(i);
			return (i);
		}
	}
	kprintf("[nanvix][runtime][ipc][portal] portal table overflow\n");
	return (-1);
}
static int nanvix_portal_alloc ( void ) { for ( int i = 0 ; i < NANVIX_PORTAL_MAX ; i ++ ) { if ( ! nanvix_portal_is_used ( i ) ) { nanvix_portal_set_used ( i ) ; return ( i ) ; } } kprintf ( " \n " ) ; return ( -1 ) ; }
@brief Allocates a portal.
@brief Allocates a portal .
/* Search for a free portal. */ /* Found. */