


     semctl(XPG4.os/ipcRelease 4.4.1 (The Open Grousemctl(XPG4.os/ipc)



     NAME
	  XPG4.os/ipc/semctl - semaphore control operations.

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

     TESTS
     Compliance
	  1    When the	effective user ID matches the user ID of the
	       semaphore set and read permission is allowed for	the
	       owner of	the set, and read permission is	required for
	       the operation specified for cmd,	then a call to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.

	  2    When the	effective user ID matches the user ID of the
	       creator of the semaphore	set and	read permission	is
	       allowed for the owner of	the set, and read permission
	       is required for the operation specified for cmd,	then a
	       call to semctl(semid, semnum, cmd, arg) does not
	       indicate	an EACCES error.

	  3    When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and the
	       effective group ID or one of the	supplementary group
	       IDs matches the group ID	of the owner of	the semaphore
	       set and read permission is allowed for the group, and
	       read permission is required for the operation specified
	       for cmd,	then a call to semctl(semid, semnum, cmd, arg)
	       does not	indicate an EACCES error.

	  4    When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and the
	       effective group ID or one of the	supplementary group
	       IDs matches the group ID	of the creator of the
	       semaphore set and read permission is allowed for	the
	       group, and read permission is required for the
	       operation specified for cmd, then a call	to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.

	  5    When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and neither
	       the effective group ID nor any of the supplementary
	       group IDs match the group ID of the owner or creator of
	       the semaphore set and read permission is	allowed	for
	       others, and read	permission is required for the
	       operation specified for cmd then	a call to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.




     Page 1					    (printed 2/21/103)






     semctl(XPG4.os/ipcRelease 4.4.1 (The Open Grousemctl(XPG4.os/ipc)



	  6    when the	calling	process	has appropriate	privileges,
	       then a call to semctl(semid, semnum, cmd, arg) does not
	       indicate	an EACCES error.

	  7    When the	effective user ID matches the user ID of the
	       semaphore set and alter permission is allowed for the
	       owner of	the set, and alter permission is required for
	       the operation specified for cmd then a call to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.

	  8    When the	effective user ID matches the user ID of the
	       creator of the semaphore	set and	alter permission is
	       allowed for the owner of	the set, and alter permission
	       is required for the operation specified for cmd then a
	       call to semctl(semid, semnum, cmd, arg) does not
	       indicate	an EACCES error.

	  9    When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and the
	       effective group ID or one of the	supplementary group
	       IDs matches the group ID	of the owner of	the semaphore
	       set and alter permission	is allowed for the group, and
	       alter permission	is required for	the operation
	       specified for cmd then a	call to	semctl(semid, semnum,
	       cmd, arg) does not indicate an EACCES error.

	  10   When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and the
	       effective group ID or one of the	supplementary group
	       IDs matches the group ID	of the creator of the
	       semaphore set and alter permission is allowed for the
	       group, and alter	permission is required for the
	       operation specified for cmd then	a call to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.

	  11   When the	effective user ID does not match either	the
	       owner or	the creator of the semaphore set and neither
	       the effective group ID nor any of the supplementary
	       group IDs match the group ID of the owner or creator of
	       the semaphore set and alter permission is allowed for
	       others, and alter permission is required	for the
	       operation specified for cmd then	a call to
	       semctl(semid, semnum, cmd, arg) does not	indicate an
	       EACCES error.

	  12   When the	process	has alter permission, a	call to
	       semctl(semid,semnum,SETVAL,arg) sets the	semval of the
	       semaphore specified by semid and	semnum to the value
	       specified in arg	and returns zero. The adjustment value
	       semadj which adjusts the	value of the semaphore when



     Page 2					    (printed 2/21/103)






     semctl(XPG4.os/ipcRelease 4.4.1 (The Open Grousemctl(XPG4.os/ipc)



	       the process exits shall be set to zero in all processes
	       which are accessing the semaphore.

	  13   When the	process	has read permission, a call to
	       semctl(semid,semnum,GETVAL,arg) returns the value of
	       semval of the semaphore specified by semid and semnum.

	  14   When the	process	has alter permission, a	call to
	       semctl(semid,semnum,SETALL,arg) sets the	value of each
	       of the semaphores in the	set specified by semid to the
	       value specified in arg and returns zero.	The adjustment
	       value semadj which adjusts the value of a semaphore
	       when the	process	exits shall be set to zero for each
	       member of the set of semaphores in all processes	which
	       are accessing the semaphore set.

	  15   When the	process	has read permission, a call to
	       semctl(semid,semnum,GETALL,arg) provides	the current
	       semaphore values	for each of the	semaphores in the set
	       referenced by semid in the array	of unsigned shorts
	       referenced by arg.

	  16   When the	process	has read permission, a call to
	       semctl(semid,semnum,GETPID,arg) returns the value of
	       the process ID of the last process that performed a
	       semaphore operation on the semaphore referenced by
	       semid and semnum.

	  17   When the	process	has read permission, a call to
	       semctl(semid,semnum,GETNCNT,arg)	returns	the number of
	       processes which are waiting for the value associated
	       with the	semaphore referenced by	semid and semnum to
	       increase	from its current value.

	  18   When the	process	has read permission, a call to
	       semctl(semid,semnum,GETZCNT,arg)	returns	the number of
	       processes which are waiting for the value associated
	       with the	semaphore referenced by	semid and semnum to
	       become zero.

	  19   When the	process	has read permission, a call to
	       semctl(semid,semnum,IPC_STAT,arg) places	the contents
	       of the data structure associated	with semid into	the
	       data structure buf referenced by	arg and	returns	zero.

	  20   When the	effective user ID of the calling process
	       matches the owner of the	set of semaphores semid, then
	       a call to semctl(semid,semnum,IPC_RMID,arg) removes
	       that set	of semaphores and returns zero.

	  21   When the	effective user ID of the calling process
	       matches the creator of the set of semaphores semid,



     Page 3					    (printed 2/21/103)






     semctl(XPG4.os/ipcRelease 4.4.1 (The Open Grousemctl(XPG4.os/ipc)



	       then a call to semctl(semid,semnum,IPC_RMID,arg)
	       removes that set	of semaphores and return zero.

	  22   When the	calling	process	has the	appropriate
	       privileges, then	a call to
	       semctl(semid,semnum,IPC_RMID,arg) removes the set of
	       semaphores referenced by	semid and returns zero.

	  23   When the	effective user ID of the calling process
	       matches the owner of the	set of semaphores semid, then
	       a call to semctl(semid,semnum,IPC_SET,arg) changes the
	       user ID,	group ID and mode associated with the
	       semaphore set referenced	by semid to the	values
	       specified in the	buf structure pointed to by arg	and
	       returns zero.

	  24   When the	effective user ID of the calling process
	       matches the creator of the set of semaphores semid,
	       then a call to semctl(semid,semnum,IPC_SET,arg) changes
	       the user	ID, group ID and mode associated with the
	       semaphore set referenced	by semid to the	values
	       specified in the	buf structure pointed to by arg	and
	       return zero.

	  25   When the	calling	process	has the	appropriate
	       privileges, then	a call to
	       semctl(semid,semnum,IPC_SET,arg)	changes	the user ID,
	       group ID	and mode associated with the semaphore set
	       referenced by semid to the values specified in the buf
	       structure pointed to by arg and return zero.

     Deviance
	  26   EINVAL in errno and return -1 on	a call to
	       semctl(semid,semnum,cmd,arg) when the value of semid is
	       invalid.

	  27   EINVAL in errno and return -1 on	a call to
	       semctl(semid,semnum,cmd,arg) when the value of semnum
	       is less than zero.

	  28   EINVAL in errno and return -1 on	a call to
	       semctl(semid,semnum,cmd,arg) when the value of semnum
	       is greater than or equal	to the number of semaphores in
	       the set semid as	specified by sem_nsems.

	  29   EINVAL in errno and return -1 on	a call to
	       semctl(semid,semnum,cmd,arg) when the value of cmd does
	       not refer to a valid command.

	  30   EACCES in errno and return -1 on	a call to
	       semctl(semid,semnum,cmd,arg) when the required access
	       permission associated with cmd is not available to the



     Page 4					    (printed 2/21/103)






     semctl(XPG4.os/ipcRelease 4.4.1 (The Open Grousemctl(XPG4.os/ipc)



	       calling process.

	  31   EPERM in	errno and return -1 on a call to
	       semctl(semid,semnum,IPC_SET,arg)	when the effective
	       user ID of the calling process matches neither the
	       owner nor the creator of	the semaphore set and the
	       process does not	have appropriate privileges.

	  32   EPERM in	errno and return -1 on a call to
	       semctl(semid,semnum,IPC_RMID,arg) when the effective
	       user ID of the calling process matches neither the
	       owner nor the creator of	the semaphore set and the
	       process does not	have appropriate privileges.

     Untestable	Aspects
	  1    ERANGE in errno and return -1 on	a call to
	       semctl(semid,semnum,SETVAL,arg) when the	value of
	       semval is greater than the system imposed maximum.
	       Reason: This requires knowledge of the system imposed
	       maximum.	This value is not available through XPG
	       interfaces and may not be static.

	  2    ERANGE in errno and return -1 on	a call to
	       semctl(semid,semnum,SETALL,arg) when value of semval is
	       greater than the	system imposed maximum.
	       Reason: This requires knowledge of the system imposed
	       maximum.	This value is not available through XPG
	       interfaces and may not be static.

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






















     Page 5					    (printed 2/21/103)



