mprotect man page on Ultrix

Man page or keyword search:  
man Server   3690 pages
apropos Keyword Search (all sections)
Output format
Ultrix logo
[printable version]

mprotect(2)							   mprotect(2)

Name
       mprotect - memory protection control

Syntax
       #include <sys/mman.h>
       #include <sys/types.h>

       int mprotect (addr, len, prot)
       caddr_t addr;
       int len, prot;

Description
       The  system  call  changes the protection of portions of an application
       program's data memory.  Protection is performed on page cluster	boundÔÇÉ
       aries.  The default protection for data memory on process invocation is
       user READ/WRITE.	 The addr argument is the  beginning  address  of  the
       data block and must fall on a page cluster boundary.

       The len argument is the length of the data block, in bytes.  The length
       of the block is rounded up to a cluster boundary, and the size  of  the
       block to be protected is returned.

       The  prot argument is the requested protection for the block of memory.
       Protection values affect only the user process.	Protection values  are
       defined in <mman.h> as:
       /* protections are chosen from these bits, ORed together */
       #define PROT_READ       0x1     /* pages can be read */
       #define PROT_WRITE      0x2     /* pages can be written */
       #define PROT_EXEC       0x4     /* pages can be executed */
       Setting the prot argument to zero (0) indicates that the process cannot
       reference the memory block, without causing a fault.

       A protected page faults if the protection is  violated,	and  a	SIGBUS
       signal  is issued.  If the process has a handler defined for the SIGBUS
       signal, the code parameter, described in and is used  to	 pass  in  the
       virtual address that faulted.

Restrictions
       The  page  cluster  size may change in future versions of ULTRIX.  As a
       result, should be used to determine the correct len  argument,  and  or
       should be used to determine the correct addr argument.

       If  the	user  handles  a SIGBUS signal, the signal handler must either
       abort the process or correct the condition that caused  the  protection
       fault  (SIGBUS).	  If  some corrective action is not taken, an infinite
       loop results because the faulting instruction  is  restarted.   If  the
       user  permits the default SIGBUS handler to be used, the process aborts
       if a referenced page causes a fault.

       The VAX	architecture  makes  the  following  implications;  PROT_WRITE
       implies	(PROT_WRITE  |	PROT_READ  | PROT_EXEC), and PROT_READ implies
       (PROT_READ | PROT_EXEC).

       Only the application can change the call's private  data	 space.	  This
       means  that  attempts  to  change  text,	 shared memory, or stack space
       causes a EACCES failure.

Return Values
       Upon successful completion, the size of the protected memory block,  in
       bytes,  is returned.  Otherwise, a value of -1 is returned and errno is
       set to indicate the error.

Diagnostics
       The call fails under the following conditions:

       [EALIGN]	      The addr argument is not on a cluster boundary.

       [EINVAL]	      The prot argument is not a valid protection mask.

       [EACCES]	      The memory block is not fully contained  within  private
		      data space.

See Also
       getpagesize(2), sbrk(2), sigvec(2), malloc(3), signal(3)

								   mprotect(2)
[top]

List of man pages available for Ultrix

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
...................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net