Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ mprotect(2) — Atari System V ue12

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

memcntl(2)

mmap(2)

plock(2)

mlock(3C)

mlockall(3C)

sysconf(3C)





   mprotect(2)                                                     mprotect(2)


   NAME
         mprotect - set protection of memory mapping

   SYNOPSIS
         #include <sys/types.h>
         #include <sys/mman.h>
         int mprotect(caddrt addr, sizet len, int prot);

   DESCRIPTION
         The function mprotect changes the access protections on the mappings
         specified by the range [addr, addr + len) to be that specified by
         prot.  Legitimate values for prot are the same as those permitted for
         mmap and are defined in <sys/mman.h> as:
               PROTREAD                /* page can be read */
               PROTWRITE               /* page can be written */
               PROTEXEC                /* page can be executed */
               PROTNONE                /* page can not be accessed */

   RETURN VALUE
         Upon successful completion, the function mprotect returns a value of
         0; otherwise, it returns a value of -1 and sets errno to indicate an
         error.

   ERRORS
         Under the following conditions, the function mprotect fails and sets
         errno to:

        EACCES if prot specifies a protection that violates the access
                permission the process has to the underlying memory object.

        EAGAIN if prot specifies PROTWRITE over a MAPPRIVATE mapping and
                there are insufficient memory resources to reserve for locking
                the private page.

        EINVAL if addr is not a multiple of the page size as returned by
                sysconf.

        EINVAL The argument len has a value less than or equal to 0.

        ENOMEM if addresses in the range [addr, addr + len) are invalid for
                the address space of a process, or specify one or more pages
                which are not mapped.

         When mprotect fails for reasons other than EINVAL, the protections on
         some of the pages in the range [addr, addr + len) may have been
         changed.  If the error occurs on some page at addr2, then the
         protections of all whole pages in the range [addr, addr2] will have
         been modified.





   7/91                                                                 Page 1









   mprotect(2)                                                     mprotect(2)


   SEE ALSO
         memcntl(2), mmap(2), plock(2), mlock(3C), mlockall(3C),  sysconf(3C).



















































   Page 2                                                                 7/91





Typewritten Software • bear@typewritten.org • Edmonds, WA 98026