


     mprotect_P(rt.os/mpVSRTc5.1.1 (The	Openmprotect_P(rt.os/mprotect)



     NAME
	  rt.os/mprotect/mprotect_P - set protection of	memory mapping
	  testset

     DESCRIPTION
	  Tests	the mprotect() function	for conformance	to System
	  Interfaces and Headers, Issue	5 Page:	mprotect().
	  These	tests overlap with those defined for this function in
	  VSU.	They are to be used in the POSIX mode of VSRT to allow
	  standalone testing of	just 1003.1b requirements.

     TESTS
     Compliance
	  1    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A successful call to mprotect() when prot has the
		 PROT_READ flag	set shall change the access
		 protections for the range [addr,addr+len] to allow
		 the page(s) to	be read	and return 0.

	  2    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A successful call to mprotect() when prot has the
		 PROT_WRITE flag set shall change the access
		 protections for the range [addr,addr+len] to allow
		 the page(s) to	be written and return 0.

	  3    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A successful call to mprotect() when prot has the
		 PROT_READ and PROT_WRITE flags	set shall change the
		 access	protections for	the range [addr,addr+len] to
		 allow the page(s) to be read and written and return
		 0.

	  4    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5 and
	       the implementation supports use of PROT_EXEC:
		 A successful call to mprotect() when prot has the
		 PROT_EXEC flag	set shall change the access
		 protections for the range [addr,addr+len] to allow
		 the page(s) to	be executed and	return 0.

	  5    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A successful call to mprotect() when prot has the
		 PROT_NONE flag	set shall change the access



     Page 1					    (printed 2/21/103)






     mprotect_P(rt.os/mpVSRTc5.1.1 (The	Openmprotect_P(rt.os/mprotect)



		 protections for the range [addr,addr+len] to not
		 allow the page(s) to be accessed and return 0.

	  6    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A successful call to int mprotect(void	*addr, size_t
		 len, int prot)	shall round len	to the next multiple
		 of the	page size.

     Deviance
	  7    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when the memory object was not
		 opened	for write and PROT_WRITE was specified for a
		 MAP_SHARED type mapping shall return -1 and set errno
		 to EACCES.

	  8    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when addresses in	the range
		 [addr,addr+len] are outside the range allowed for the
		 address space of a process shall return -1 and	set
		 errno to ENOMEM.

	  9    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when addresses in	the range
		 [addr,addr+len] specify one or	more pages that	are
		 not mapped shall return -1 and	set errno to ENOMEM.

	  10   If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5 and
	       the implementation does not support some	of the
	       possibly	valid values for prot:
		 A call	to mprotect() when the implementation does not
		 support the combination of accesses requested in prot
		 shall return -1 and set errno to ENOTSUP.

	  11   If _POSIX_MEMORY_PROTECTION is not defined and the
	       implementation does not support the mprotect() function
	       as described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() shall return -1 and set errno to
		 ENOSYS.

     Untestable	Aspects
	  1    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as



     Page 2					    (printed 2/21/103)






     mprotect_P(rt.os/mpVSRTc5.1.1 (The	Openmprotect_P(rt.os/mprotect)



	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when prot	specifies PROT_WRITE
		 over a	MAP_PRIVATE mapping and	there are insufficient
		 memory	resources to reserve for locking the private
		 pages,	if required, shall return -1 and set errno to
		 EAGAIN.
		 Reason	for omission: There is no known	portable test
		 method	for this assertion.

	  2    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when prot	specifies PROT_WRITE
		 over a	MAP_PRIVATE mapping and	it would require more
		 space than the	system is able to supply for locking
		 the private pages shall return	-1 and set errno to
		 ENOMEM.
		 Reason	for omission: There is no known	portable test
		 method	for this assertion.

	  3    If _POSIX_MEMORY_PROTECTION is defined or the
	       implementation supports the mprotect() function as
	       described in System Interfaces and Headers, Issue 5:
		 A call	to mprotect() when the value of	addr is	not a
		 multiple of the page size may return -1 and set errno
		 to ENOMEM.
		 Reason	for omission: The specification	is inadequate
		 for testing as	it does	not specify under what
		 circumstances this error may occur.

     RELEASE
	  Release VSRT 5.1.1
	  Copyright (c)	1997 X/Open Company Ltd., A member of The Open
	  Group.
	  All rights reserved




















     Page 3					    (printed 2/21/103)



