src/libruntime/portal.c
/**
 * @brief Enables read operations on a portal.
 *
 * @param id	   ID of the target portal.
 * @param nodenum  Target node.
 *
 * @returns Upons successful completion zero is returned. Upon failure,
 * a negative error code is returned instead.
 *
 * @note This function is NOT thread-safe.
 */
@brief Enables read operations on a portal.
@param id       ID of the target portal.
@param nodenum  Target node.

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

@note This function is NOT thread-safe.
@brief Enables read operations on a portal . @param id ID of the target portal . @param nodenum Target node . @returns Upons successful completion zero is returned . Upon failure a negative error code is returned instead . @note This function is NOT thread - safe .
int nanvix_portal_allow(int id, int nodenum)
{
	if (!nanvix_portal_is_valid(id))
		return (-EINVAL);
	if (!nanvix_portal_is_used(id))
		return (-EINVAL);
	if (nanvix_portal_is_wronly(id))
		return (-ENOTSUP);
	if (portals[id].owner != knode_get_num())
		return (-EINVAL);
	return (kportal_allow(portals[id].portalid, nodenum, kthread_self()));
}
int nanvix_portal_allow ( int id , int nodenum ) { if ( ! nanvix_portal_is_valid ( id ) ) return ( - EINVAL ) ; if ( ! nanvix_portal_is_used ( id ) ) return ( - EINVAL ) ; if ( nanvix_portal_is_wronly ( id ) ) return ( - ENOTSUP ) ; if ( portals [ id ] . owner != knode_get_num ( ) ) return ( - EINVAL ) ; return ( kportal_allow ( portals [ id ] . portalid , nodenum , kthread_self ( ) ) ) ; }
@brief Enables read operations on a portal.
@brief Enables read operations on a portal .
/* Invalid portal ID.*/ /*  Bad portal. */ /* Operation no supported. */ /* Not the owner. */