


     shmget(XPG4.os/ipcRelease 4.4.1 (The Open Groushmget(XPG4.os/ipc)



     NAME
	  XPG4.os/ipc/shmget - get shared memory segment.

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

     TESTS
     Compliance
	  1    When key	specifies an existing shared memory segment,
	       then a successful call to shmget(key,size,shmflg)
	       returns the shared memory identifier associated with
	       key.

	  2    When key	is equal to IPC_PRIVATE, then a	successful
	       call to shmget(key,size,shmflg) creates a new shared
	       memory segment with
	       a.  shm_segsz set equal to size
	       b. shm_perm.cuid	and shm_perm.uid set equal to the
	       effective user ID of the	calling	process
	       c. shm_perm.cgid	and shm_perm.gid set equal to the
	       effective group ID of the calling process
	       d. the access permission	bits in	shm_perm.mode set
	       equal to	the access permissions specified in shmflg
	       e. shm_lpid, shm_nattch,	shm_atime, and shm_dtime set
	       to 0
	       f. shm_ctime set	equal to the current time.

	  3    When key	does not already have a	shared memory
	       associated with it and the IPC_CREAT bit	is set in
	       shmflag,	then a successful call to
	       shmget(key,size,shmflg) creates a new shared memory
	       segment with
	       a.  shm_segsz set equal to size
	       b. shm_perm.cuid	and shm_perm.uid set equal to the
	       effective user ID of the	calling	process
	       c. shm_perm.cgid	and shm_perm.gid set equal to the
	       effective group ID of the calling process
	       d. the access permission	bits in	shm_perm.mode set
	       equal to	the access permissions specified in shmflg
	       e. shm_lpid, shm_nattch,	shm_atime, and shm_dtime are
	       set to 0
	       f. shm_ctime set	equal to the current time

	  4    When key	already	has a shared memory segment associated
	       with it,	the IPC_CREAT bit is set and the IPC_EXCL bit
	       is not set in shmflag, then a successful	call to
	       shmget(key,size,shmflg) returns the shared memory
	       identifier associated with key.

     Deviance
	  5    EINVAL in errno and return -1 on	a call to



     Page 1					    (printed 2/21/103)






     shmget(XPG4.os/ipcRelease 4.4.1 (The Open Groushmget(XPG4.os/ipc)



	       shmget(key,size,shmflg) when an identifier exists for
	       key and the size	of the corresponding memory segment is
	       less than size and size is not equal to 0.

	  6    EACCES in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when key	specifies an existing
	       shared memory identifier	for which the caller does not
	       have access permission.

	  7    ENOENT in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when key	does not specify an
	       existing	shared memory identifier and IPC_CREAT is not
	       set in shmflg.

	  8    EEXIST in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when key	specifies an existing
	       shared memory identifier	and the	IPC_CREAT and IPC_EXCL
	       bits are	both set in shmflg.

	  9    If _XOPEN_SHM is	-1:
		   A call to shmget() returns -1 and sets errno	to
		   ENOSYS.

     Untestable	Aspects
	  1    EINVAL in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when size is less than the
	       system imposed minimum.
	       Reason: This requires knowledge of a system imposed
	       limit. Could be passed by a config parameter if not
	       variable.

	  2    EINVAL in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when size is greater than the
	       system imposed maximum.
	       Reason: This requires knowledge of a system imposed
	       limit. Could be passed by a config parameter if not
	       variable.

	  3    ENOSPC in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when the	number of shared
	       memory identifiers allowed by the system	is exceeded.
	       Reason: This requires knowledge of a system imposed
	       limit. Could be passed by a config parameter if not
	       variable.

	  4    ENOMEM in errno and return -1 on	a call to
	       shmget(key,size,shmflg) when a shared memory identifier
	       and associated shared memory segment are	to be created,
	       but the amount of available physical memory is not
	       sufficient to fill the request.
	       Reason: Reaching	a situation where there	is not enough
	       memory available	is implementation specific.



     Page 2					    (printed 2/21/103)






     shmget(XPG4.os/ipcRelease 4.4.1 (The Open Groushmget(XPG4.os/ipc)



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



















































     Page 3					    (printed 2/21/103)



