


     shmat(XPG4.os/ipc)Release 4.4.1 (The Open Groupshmat(XPG4.os/ipc)



     NAME
	  XPG4.os/ipc/shmat - attach shared memory segment.

     DESCRIPTION
	  Shmat	tests the shmat() subroutine call interface for
	  conformance to the XSI System	Interfaces Page:shmat()

     TESTS
     Compliance
	  1    When the	calling	process	has read and write permission
	       on the shared memory segment, then a call to
	       shmat(shmid,0,shmflg) shall attach the segment for
	       reading and writing at an address selected by the
	       system and return the segment start address.

	  2    When the	calling	process	has read and write permission
	       on the shared memory segment, the value of the SHM_RND
	       bit is set in shmflg and	the value of shmaddr is	not
	       zero, then a call to shmat(shmid,shmaddr,shmflg)
	       attaches	the segment for	reading	and writing at the
	       address given by	(shmaddr - (shmaddr modulus SHMLBA))
	       and returns the segment start address.

	  3    When the	calling	process	has read and write permission
	       on the shared memory segment, the value of the SHM_RND
	       bit is not set in shmflg	and the	value of shmaddr is
	       not zero, then a	call to	shmat(shmid,shmaddr,shmflg)
	       attaches	the segment for	reading	and writing at the
	       address given by	shmaddr	and returns the	segment	start
	       address.

	  4    When the	calling	process	has read permission on the
	       shared memory segment, and the SHM_RDONLY bit is	set in
	       semflg then a call to shmat(shmid,shmaddr,shmflg)
	       attaches	the segment for	reading	at the address
	       specified by shmaddr and	returns	the segment start
	       address.

	  5    When the	SHM_RDONLY bit is not set in semflg then a
	       call to shmat(shmid,shmaddr,shmflg) attaches a segment
	       which is	available for reading and writing to processes
	       with appropriate	permission.

     Deviance
	  6    EACCES in errno and return -1 on	a call to
	       shmat(shmid,shmaddr,shmflg) when	permission for the
	       operation is denied to the calling process.

	  7    EINVAL in errno and return -1 on	a call to
	       shmat(shmid,shmaddr,shmflg) when	the shared memory
	       identifier shmid	is invalid.




     Page 1					    (printed 2/21/103)






     shmat(XPG4.os/ipc)Release 4.4.1 (The Open Groupshmat(XPG4.os/ipc)



	  8    If _XOPEN_SHM is	-1:
		   A call to shmat() returns (void *)-1	and sets errno
		   to ENOSYS.

     Untestable	Aspects
	  1    EMFILE in errno and return -1 on	a call to
	       shmat(shmid,shmaddr,shmflg) when	an attempt is made to
	       attach more than	the system-imposed limit on the	number
	       of segments.
	       Reason: The system imposed limit	is not available to
	       the process through an XPG call.	This could be passed
	       as a config parameter if	it is constant.	Otherwise it
	       is untestable.

	  2    EINVAL in errno and return -1 on	a call to
	       shmat(shmid,shmaddr,shmflg) when	shmaddr	is not 0 and
	       the value of (shmaddr - (shmaddr	modulus	SHMLBA)) is an
	       illegal address.
	       Reason: The production of an illegal address is
	       implementation specific.	This could be provided by a
	       parameter, otherwise, untestable.

	  3    EINVAL in errno and return -1 on	a call to
	       shmat(shmid,shmaddr,shmflg) when	shmaddr	is not 0, the
	       SHM_RND flag is not set in shmflg and the value of
	       shmaddr is an illegal address.
	       Reason: The production of an illegal address is
	       implementation specific.	This could be provided by a
	       parameter, otherwise, untestable.

	  4    ENOMEM in errno and return -1 on	a call to shmat() when
	       the available data space	is not large enough to
	       accommodate the shared memory segment.
	       Reason: Reaching	a situation where there	is not enough
	       memory available	is implementation specific.

     RELEASE
	  4.4.1	(06/09/97)
	  Copyright 1997, The Open Group
	  All Rights Reserved















     Page 2					    (printed 2/21/103)



