


     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



     NAME
	  rt.os/mfiles/mmap_P -	map pages of memory testset

     DESCRIPTION
	  Tests	the mmap() function for	conformance to System
	  Interfaces and Headers, Issue	5 Page:	mmap().
	  These	tests overlap with those defined for this function in
	  VSU for testing mmap() applied to regular files.  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_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_SHARED flag is set in
		 flags,	and the	PROT_READ flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be read, and return the
		 location in the address space at which	the mapping is
		 made.

	  2    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_PRIVATE flag is set in
		 flags,	and the	PROT_READ flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be read, and return the
		 location in the address space at which	the mapping is
		 made.

	  3    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	the use	of PROT_EXEC:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_SHARED flag is set in
		 flags,	and the	PROT_EXEC flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be executed, and return the
		 location in the address space at which	the mapping is
		 made.

	  4    If _POSIX_MAPPED_FILES is defined or the	implementation



     Page 1					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	the use	of PROT_EXEC and supports the use of
	       MAP_PRIVATE:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_PRIVATE flag is set in
		 flags,	and the	PROT_EXEC flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be executed, and return the
		 location in the address space at which	the mapping is
		 made.

	  5    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_SHARED flag is set in
		 flags,	and the	PROT_NONE flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 not allow the mapped area to be accessed, and return
		 the location in the address space at which the
		 mapping is made.

	  6    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_PRIVATE flag is set in
		 flags,	and the	PROT_NONE flag is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 not allow the mapped area to be accessed, and return
		 the location in the address space at which the
		 mapping is made.

	  7    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_SHARED flag is set in
		 flags,	and the	PROT_WRITE flag	is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be written such that write
		 references change the file, and return	the location
		 in the	address	space at which the mapping is made.

	  8    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System



     Page 2					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_PRIVATE flag is set in
		 flags,	and the	PROT_WRITE flag	is set in prot shall
		 map len bytes at offset off in	the file associated
		 with fildes into the address space of the process,
		 allow the mapped area to be written such that write
		 references do not change the file, and	return the
		 location in the address space at which	the mapping is
		 made.

	  9    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_SHARED flag is set in
		 flags,	and the	PROT_READ and PROT_WRITE flags are set
		 in prot shall map len bytes at	offset off in the file
		 associated with fildes	into the address space of the
		 process, allow	the mapped area	to be read and
		 written, and return the location in the address space
		 at which the mapping is made.

	  10   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 A successful call to mmap() when fildes is associated
		 with a	regular	file, the MAP_PRIVATE flag is set in
		 flags,	and the	PROT_READ and PROT_WRITE flags are set
		 in prot shall map len bytes at	offset off in the file
		 associated with fildes	into the address space of the
		 process, allow	the mapped area	to be read and
		 written, and return the location in the address space
		 at which the mapping is made.

	  11   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_FIXED:
		 A call	to mmap() when fildes is associated with a
		 regular file and the MAP_FIXED	flag is	set in flags
		 shall cause the file associated with fildes to	be
		 mapped	at an address exactly matching addr.

	  12   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() shall	zero-fill any partial page at
		 the end of the	file.




     Page 3					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



	  13   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 The system shall not write out	modified portions of
		 the last page of a file mapped	by a call to mmap()
		 which are beyond the end of the file.

	  14   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 References to mapped pages beyond the page containing
		 the last byte of a file mapped	by a call to mmap()
		 shall result in the delivery of a SIGBUS signal.

	  15   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 After a successful call to mmap() the mapping created
		 shall be retained across a fork.

	  16   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 After a successful call to mmap() a subsequent	close
		 operation shall not affect the	mapping	and changes
		 made to the memory image shall	be reflected in	the
		 mapped	portion	of the file when the changes would
		 have been performed in	the absence of the close
		 operation.

	  17   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 After a call to mmap()	when MAP_SHARED	is set in
		 flags write references	made to	the memory region
		 shall be visible in all MAP_SHARED mappings of	the
		 same portion of the file by any process.

	  18   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 After a call to mmap()	with MAP_PRIVATE set in	flags
		 write references to the memory	region by the calling
		 process shall not be visible to any process in	other
		 mappings of the same portion of the file.

	  19   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_PRIVATE:
		 A call	to mmap() when MAP_PRIVATE is set in flags and



     Page 4					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



		 write references are made to the memory region	shall
		 not change the	file.

	  20   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 The st_atime field of a file mapped by	a call to
		 mmap()	shall be marked	for update on the first	read
		 or write reference to a mapped	region.

	  21   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 The st_ctime field of a file mapped by	a call to
		 mmap()	with MAP_SHARED	set in flags and PROT_WRITE
		 set in	prot shall be marked for update	between	a
		 write reference to a mapped region and	the next call
		 to msync with MS_ASYNC	or MS_SYNC.

	  22   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 The st_mtime field of a file mapped by	a call to
		 mmap()	with MAP_SHARED	set in flags and PROT_WRITE
		 set in	prot shall be marked for update	between	a
		 write reference to a mapped region and	the next call
		 to msync with MS_ASYNC	or MS_SYNC.

	  23   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 The mapping established by a call to mmap() shall
		 replace any previous mappings for those whole pages
		 containing any	part of	the address space of the
		 process starting at pa	and continuing for len bytes.

     Deviance
	  24   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when fildes is not a valid file
		 descriptor shall return MAP_FAILED and	set errno to
		 EBADF.

	  25   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when fildes is not open for reading,
		 regardless of the protection specified, shall return
		 MAP_FAILED and	set errno to EACCES.

	  26   If _POSIX_MAPPED_FILES is defined or the	implementation



     Page 5					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when fildes is not open for writing
		 and PROT_WRITE	is specified for a MAP_SHARED
		 operation shall return	MAP_FAILED and set errno to
		 EACCES.

	  27   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when flags does not contain either
		 MAP_PRIVATE or	MAP_SHARED shall return	MAP_FAILED and
		 set errno to EINVAL.

	  28   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       provides	a file type for	which mmap is not supported:
		 A call	to mmap() when fildes refers to	an object for
		 which mmap() is not supported shall return MAP_FAILED
		 and set errno to ENODEV.

	  29   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_FIXED:
		 A call	to mmap() when MAP_FIXED is not	specified and
		 there is insufficient room in the address space to
		 effect	the mapping.

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

	  31   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       does not	support	MAP_FIXED:
		 A call	to mmap() when MAP_FIXED is specified and the
		 implementation	does not support this functionality
		 shall return MAP_FAILED and set errno to ENOTSUP.

	  32   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       does not	support	MAP_PRIVATE:
		 A call	to mmap() when MAP_PRIVATE is specified	and



     Page 6					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



		 the implementation does not support this
		 functionality shall return MAP_FAILED and set errno
		 to ENOTSUP.

	  33   If _POSIX_MAPPED_FILES is not defined and the
	       implementation does not support the mmap() function as
	       defined in System Interfaces and	Headers, Issue 5:
		 A call	to mmap() shall	return MAP_FAILED and set
		 errno to ENOSYS.

	  34   If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_FIXED:
		 A call	to mmap() when MAP_FIXED is specified and the
		 range [addr,addr+len] exceeds that allowed for	the
		 address space of a process shall return MAP_FAILED
		 and set errno to ENOMEM.

     Untestable	Aspects
	  1    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when addr is not 0 shall cause the
		 system	to place the memory object near	addr and when
		 addr is 0 the system shall have freedom to place the
		 object	anywhere.
		 Reason	for omission: Specification is inadequate for
		 testing.

	  2    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 Updating of the st_ctime and st_mtime fields of a
		 file mapped by	a call to mmap() with MAP_SHARED set
		 in flags and PROT_WRITE set in	prot when a write
		 reference occurs to a mapped region and no call to
		 msync is made.
		 Reason	for omission: No portable way to induce	this
		 condition.

	  3    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when the mapping could not be	locked
		 in memory, if required	by mlockall(), due to a	lack
		 of resources shall return MAP_FAILED and set errno to
		 EAGAIN.
		 Reason	for omission: No portable test method for this
		 assertion.

	  4    If _POSIX_MAPPED_FILES is defined or the	implementation



     Page 7					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_FIXED:
		 A call	to mmap() when addr is not a multiple of the
		 page size and MAP_FIXED is specified shall return
		 MAP_FAILED and	set errno to EINVAL.
		 Reason	for omission: The specification	is inadequate
		 for testing as	it does	not specify the	conditions
		 under which this error	will occur.

	  5    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when off is not a multiple of	the
		 page size shall return	MAP_FAILED and set errno to
		 EINVAL.
		 Reason	for omission: The specification	is inadequate
		 for testing as	it does	not specify the	conditions
		 under which this error	will occur.

	  6    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when MAP_FIXED is not	specified and
		 there is insufficient room in the address space of
		 the process to	effect the mapping shall return
		 MAP_FAILED and	set errno to ENOMEM.
		 Reason	for omission: There is no portable test	method
		 for this assertion.

	  7    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5:
		 A call	to mmap() when addresses in the	range [off,
		 (off+len)] are	invalid	for the	object specified by
		 fildes	shall return MAP_FAILED	and set	errno to
		 ENXIO.
		 Reason	for omission: There is no portable test	method
		 for this assertion.

	  8    If _POSIX_MAPPED_FILES is defined or the	implementation
	       supports	the mmap() function as defined in System
	       Interfaces and Headers, Issue 5 and the implementation
	       supports	MAP_FIXED:
		 A call	to mmap() when MAP_FIXED is specified in flags
		 and the combination of	addr, len and off are invalid
		 for the object	specified by fildes shall return
		 MAP_FAILED and	set errno to ENXIO.
		 Reason	for omission: There is no portable test	method
		 for this assertion.

     RELEASE



     Page 8					    (printed 2/21/103)






     mmap_P(rt.os/mfilesVSRT 5.1.1 (The	Open Groupmmap_P(rt.os/mfiles)



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



















































     Page 9					    (printed 2/21/103)



