stkprotect(2) — SYSTEM CALLS
NAME
stkprotect − set permissions of stack
SYNOPSIS
#include <sys/types.h>
#include <sys/mman.h>
int stkprotect(unsigned perm);
DESCRIPTION
This function sets the permissions of the stack. Perm must be either PROT_READ|PROT_WRITE or PROT_READ|PROT_WRITE|PROT_EXEC.
Upon successful completion of an exec(2) function, a process’s stack shall have PROT_READ|PROT_WRITE permissions. A new process created via fork(2) shall inherit the stack permissions of its parent process.
Under the following conditions, stkprotect fails and sets errno to:
EINVAL perm is invalid.
DIAGNOSTICS
Upon successful completion a value of 0 is returned. Otherwise, a value of −1 is returned and errno is set to indicate the error.