src/libruntime/portal.c
/**
 * @brief Destroys a portal.
 *
 * @param id ID of the target portal.
 *
 * @returns Upon successful completion zero, is returned. Upon
 * failure, a negative error code is returned instead.
 *
 * @note This function is @b NOT thread safe.
 */
@brief Destroys a portal.
@param id ID of the target portal.

@returns Upon successful completion zero, is returned. Upon
failure, a negative error code is returned instead.

@note This function is @b NOT thread safe.
@brief Destroys a portal . @param id ID of the target portal . @returns Upon successful completion zero is returned . Upon failure a negative error code is returned instead . @note This function is @b NOT thread safe .
int nanvix_portal_unlink(int id)
{
	if (!nanvix_portal_is_valid(id))
		return (-EINVAL);
	if (!nanvix_portal_is_used(id))
		return (-EINVAL);
	if (nanvix_portal_is_wronly(id))
		return (-EINVAL);
	if (name_unlink(portals[id].name) != 0)
		return (-EAGAIN);
	if (portals[id].owner != knode_get_num())
		return (-EINVAL);
	nanvix_portal_free(id);
	return (0);
}
int nanvix_portal_unlink ( int id ) { if ( ! nanvix_portal_is_valid ( id ) ) return ( - EINVAL ) ; if ( ! nanvix_portal_is_used ( id ) ) return ( - EINVAL ) ; if ( nanvix_portal_is_wronly ( id ) ) return ( - EINVAL ) ; if ( name_unlink ( portals [ id ] . name ) != 0 ) return ( - EAGAIN ) ; if ( portals [ id ] . owner != knode_get_num ( ) ) return ( - EINVAL ) ; nanvix_portal_free ( id ) ; return ( 0 ) ; }
@brief Destroys a portal.
@brief Destroys a portal .
/* Invalid portal ID.*/ /* Bad portal. */ /*  Invalid portal. */ /* Unlink name. */ /* Not the owner. */ /*
	 * Underlying unnamed mailbox is
	 * destroyed when unloading the runtime system
	 */