src/libruntime/portal.c
/**
 * @brief Reads data from a portal.
 *
 * @param id  ID of the target portal.
 * @param buf Location from where data should be written.
 * @param n   Number of bytes to write.
 *
 * @returns See kportal_aread().
 */
@brief Reads data from a portal.
@param id  ID of the target portal.
@param buf Location from where data should be written.
@param n   Number of bytes to write.


@brief Reads data from a portal . @param id ID of the target portal . @param buf Location from where data should be written . @param n Number of bytes to write .
int nanvix_portal_read(int id, void *buf, size_t n)
{
	int ret;
	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 (buf == NULL)
		return (-EINVAL);
	if (n < 1)
		return (-EINVAL);
	if (portals[id].owner != knode_get_num())
		return (-EINVAL);
	ret = kportal_read(portals[id].portalid, buf, n);
	return (ret);
}
int nanvix_portal_read ( int id , void * buf , size_t n ) { int ret ; 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 ( buf == NULL ) return ( - EINVAL ) ; if ( n < 1 ) return ( - EINVAL ) ; if ( portals [ id ] . owner != knode_get_num ( ) ) return ( - EINVAL ) ; ret = kportal_read ( portals [ id ] . portalid , buf , n ) ; return ( ret ) ; }
@brief Reads data from a portal.
@brief Reads data from a portal .
/* Invalid portal ID.*/ /*  Bad portal. */ /* Operation no supported. */ /* Invalid buffer. */ /* Invalid buffer size. */ /* Not the owner. */