PTHREAD_JIT_WRITE_PROTECT_NP(3)

NAME
pthread_jit_write_protect_supported_np, pthread_jit_write_protect_np - thread JIT region write protection settings

SYNOPSIS
#include <pthread.h>
int
pthread_jit_write_protect_supported_np(void);
void
pthread_jit_write_protect_np(int enabled);

DESCRIPTION
The pthread_jit_write_protect_supported_np() function returns whether the pthread_jit_write_protect_np() API is supported on this platform. If pthread_jit_write_protect_np() API is supported on this platform, pthread_jit_write_protect_np() must be called to toggle per-thread write protection on the MAP_JIT region before the thread writes to or executes from the MAP_JIT region.

The pthread_jit_write_protect_np() function sets whether MAP_JIT region write protection is enabled for this thread.

On platforms where pthread_jit_write_protect_supported_np() is true, MAP_JIT regions are never writeable and executable simultaneously. When write protection is enabled for the thread, writes by the thread to the MAP_JIT region are denied and the MAP_JIT region is executable. When write protection is disabled for the thread, writes by the thread to the MAP_JIT region are allowed and the MAP_JIT region is not executable. Pass a non-zero value for the enabled parameter to enable thread JIT region write protection and allow execution. Pass a zero value for the enabled parameter to disable thread JIT write protection and deny execution.

On platforms where pthread_jit_write_protect_supported_np() is not supported, MAP_JIT regions are both simultaenously writeable and executable. Calls to pthread_jit_write_protect_np() are no-ops on unsupported platforms.

RETURN VALUES
If supported, the pthread_jit_write_protect_supported_np() function will return one. Otherwise the function will return zero.

SEE ALSO
mmap(2)