


     semop(XPG4.os/ipc)Release 4.4.1 (The Open Groupsemop(XPG4.os/ipc)



     NAME
	  XPG4.os/ipc/semop - semaphore	operations

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

     TESTS
     Compliance
	  1    When the	calling	process	has alter permission for the
	       semaphore set, sem_op is	negative and semval is greater
	       than or equal to	the absolute value of sem_op, then a
	       call to semop(semid,sops,nsops) subtracts the absolute
	       value of	sem_op from the	current	semval associated with
	       the specified sem_num and returns 0. The	current	semadj
	       value associated	with the semaphore which would alter
	       the value of the	semaphore when the calling process
	       exits is	not changed.

	  2    When the	calling	process	has alter permission for the
	       semaphore set and sem_op	is negative, semval is greater
	       than or equal to	the absolute value of sem_op, and the
	       sem_flg has SEM_UNDO set, then a	successful call	to
	       semop(semid,sops,nsops) subtracts the absolute value of
	       sem_op from the current semval associated with the
	       specified sem_num and returns 0.	The current semadj
	       value associated	with the semaphore which would alter
	       the value of the	semaphore when the calling process
	       exits is	increased by the value of sem_op.

	  3    When the	calling	process	has alter permission for the
	       semaphore set and sem_op	is negative and	semval is less
	       than the	absolute value of sem_op, and the IPC_NOWAIT
	       flag is set in sem_flag then a call to
	       semop(semid,sops,nsops) returns -1 and sets 'errno' to
	       EAGAIN.

	  4    When the	calling	process	has alter permission for the
	       semaphore set and sem_op	is negative and	semval is less
	       than the	absolute value of sem_op, and the IPC_NOWAIT
	       flag is not set in sem_flag then	a successful call to
	       semop(semid,sops,nsops) increments the semncnt
	       associated with the specified semaphore and suspends
	       the calling process awaiting a change in	the semval
	       associated with the specified semaphore.

	  5    When the	process	has been suspended awaiting an
	       increase	in a semaphore value and the value of the
	       semaphore semval	is changed such	that it	becomes
	       greater than or equal to	the absolute value of the
	       sem_op associated with the call to
	       semop(semid,sops,nsops) which caused the	process	to be



     Page 1					    (printed 2/21/103)






     semop(XPG4.os/ipc)Release 4.4.1 (The Open Groupsemop(XPG4.os/ipc)



	       suspended, then the value of semncnt associated with
	       the semaphore is	decremented and	the absolute value of
	       sem_op is subtracted from semval, and the absolute
	       value of	sem_op is added	to the semadj value if the
	       SEM_UNDO	flag is	set in sem_flg and the suspended call
	       shall return zero.

	  6    When the	process	has been suspended awaiting an
	       increase	in a semaphore value and the semaphore set
	       associated with semid is	removed	from the system, then
	       the call	to semop(semid,sops,nsops) returns -1 and sets
	       'errno' to EIDRM.

	  7    When the	process	has been suspended awaiting an
	       increase	in a semaphore value and the calling process
	       receives	a signal that is to be caught, then the	call
	       to semop(semid,sops,nsops) decrements the semncnt value
	       associated with the semaphore, returns -1 and sets
	       'errno' to EINTR.

	  8    When the	calling	process	has alter permission for the
	       semaphore set and sem_op	is positive, then a call to
	       semop(semid,sops,nsops) shall add the value of sem_op
	       to semval and return 0.

	  9    When the	calling	process	has alter permission for the
	       semaphore set and sem_op	is positive and	the SEM_UNDO
	       flag is set in sem_flag,	then a call to
	       semop(semid,sops,nsops) adds the	value of sem_op	to
	       semval, subtracts the value of sem_op from the calling
	       process's semadj	value for the specified	semaphore and
	       returns 0.

	  10   When the	calling	process	has read permission for	the
	       semaphore set and sem_op	is zero	and semval is zero,
	       then a successful call to semop(semid,sops,nsops)
	       returns 0.

	  11   When the	calling	process	has read permission for	the
	       semaphore set and sem_op	is zero, semval	is not zero
	       and the IPC_NOWAIT flag is set in sem_flag then a call
	       to semop(semid,sops,nsops) returns -1 and sets 'errno'
	       to EAGAIN.

	  12   When the	calling	process	has read permission for	the
	       semaphore set and sem_op	is zero	and semval is not
	       zero, and the IPC_NOWAIT	flag is	not set	in sem_flag
	       than a successful call to semop(semid,sops,nsops)
	       increments the semzcnt associated with the specified
	       semaphore and suspends the calling process awaiting a
	       change in the semval associated with the	specified
	       semaphore.



     Page 2					    (printed 2/21/103)






     semop(XPG4.os/ipc)Release 4.4.1 (The Open Groupsemop(XPG4.os/ipc)



	  13   When the	process	has been suspended awaiting zeroing of
	       a semaphore value and the value of the semaphore's
	       semval is changed such that it becomes zero, then the
	       value of	semzcnt	associated with	the semaphore is
	       decremented and the suspended call to
	       semop(semid,sops,nsops) returns zero.

	  14   When the	process	has been suspended awaiting zeroing of
	       a semaphore value and the semaphore set associated with
	       semid is	removed	from the system, then the call to
	       semop(semid,sops,nsops) returns -1 and sets errno to
	       EIDRM.

	  15   When the	process	has been suspended awaiting zeroing of
	       a semaphore value and the calling process receives a
	       signal that is to be caught, then the call to
	       semop(semid,sops,nsops) decrements the semzcnt value
	       associated with the semaphore, returns -1 and sets
	       errno to	EINTR.

     Deviance
	  16   EINVAL in 'errno' and return -1 on a call to
	       semop(semid,sops,nsops) when semid is not a valid
	       semaphore identifier.

	  17   EFBIG in	errno and return -1 on a call to
	       semop(semid,sops,nsops) when the	value of sem_num is
	       less than 0.

	  18   EFBIG in	errno and return -1 on a call to
	       semop(semid,sops,nsops) when the	value of sem_num is
	       greater than or equal to	the number of semaphores
	       associated with semid.

	  19   EACCES in errno and return -1 on	a call to
	       semop(semid,sops,nsops) when the	permission to perform
	       the required operation is denied.

     Untestable	Aspects
	  1    EINVAL in errno and return -1 on	a call to
	       semop(semid,sops,nsops) when the	number of sempahores
	       for which the calling process is	attempting a SEM_UNDO
	       would exceed the	limit.
	       Reason: This depends on a system	imposed	limit. This
	       could be	provided by a config parameter or could	be
	       untestable.

	  2    E2BIG in	errno and return -1 on a call to
	       semop(semid,sops,nsops) when the	value of nsops is
	       greater than the	system imposed maximum.
	       Reason: This depends on a system	imposed	limit. This
	       could be	provided by a config parameter or could	be



     Page 3					    (printed 2/21/103)






     semop(XPG4.os/ipc)Release 4.4.1 (The Open Groupsemop(XPG4.os/ipc)



	       untestable.

	  3    ENOSPC in errno and return -1 on	a call to
	       semop(semid,sops,nsops) when the	limit on the number of
	       processes requesting a SEM_UNDO would be	exceeded.
	       Reason: This depends on a system	imposed	limit. This
	       could be	provided by a config parameter or could	be
	       untestable.

	  4    ERANGE in errno and return -1 on	a call to
	       semop(semid,sops,nsops) is an operation would cause a
	       semval value to exceed the system imposed limit.
	       Reason: This depends on a system	imposed	limit. This
	       could be	provided by a config parameter or could	be
	       untestable.

	  5    ERANGE in errno and return -1 on	a call to
	       semop(semid,sops,nsops) is an operation would cause a
	       semadj value to overflow	the system imposed limit.
	       Reason: This depends on a system	imposed	limit. This
	       could be	provided by a config parameter or could	be
	       untestable.

     PROBLEMS
	  The assertions in the	compliance section are written as if
	  there	was only one semaphore being altered by	the call. This
	  is not the case, and there is	no description in the XPG as
	  to what happens in the various combinatorial cases.

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






















     Page 4					    (printed 2/21/103)



