FreeBSD/sys/compat/cloudabi/cloudabi_mem.c
/* Converts CloudABI's memory protection flags to FreeBSD's. */
Converts CloudABI's memory protection flags to FreeBSD's.
Converts CloudABI ' s memory protection flags to FreeBSD ' s .
static int
convert_mprot(cloudabi_mprot_t in, int *out)
{
	if ((in & ~(CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE |
	    CLOUDABI_PROT_READ)) != 0)
		return (ENOTSUP);
	if ((in & (CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE)) ==
	    (CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE))
		return (ENOTSUP);
	*out = 0;
	if (in & CLOUDABI_PROT_EXEC)
		*out |= PROT_EXEC;
	if (in & CLOUDABI_PROT_WRITE)
		*out |= PROT_WRITE;
	if (in & CLOUDABI_PROT_READ)
		*out |= PROT_READ;
	return (0);
}
static int convert_mprot ( cloudabi_mprot_t in , int * out ) { if ( ( in & ~ ( CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE | CLOUDABI_PROT_READ ) ) != 0 ) return ( ENOTSUP ) ; if ( ( in & ( CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE ) ) == ( CLOUDABI_PROT_EXEC | CLOUDABI_PROT_WRITE ) ) return ( ENOTSUP ) ; * out = 0 ; if ( in & CLOUDABI_PROT_EXEC ) * out |= PROT_EXEC ; if ( in & CLOUDABI_PROT_WRITE ) * out |= PROT_WRITE ; if ( in & CLOUDABI_PROT_READ ) * out |= PROT_READ ; return ( 0 ) ; }
Converts CloudABI's memory protection flags to FreeBSD's.
Converts CloudABI ' s memory protection flags to FreeBSD ' s .
/* Unknown protection flags. */ /* W^X: Write and exec cannot be enabled at the same time. */