Penguin

Differences between current version and predecessor to the previous major change of semctl(2).

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 2 Last edited on Tuesday, April 15, 2003 1:31:52 am by PerryLorier
Older page: version 1 Last edited on Tuesday, June 4, 2002 12:23:45 am by perry Revert
@@ -1,265 +1,77 @@
-SEMCTL  
-!!!SEMCTL  
-NAME  
-SYNOPSIS  
-DESCRIPTION  
-RETURN VALUE  
-ERRORS  
-NOTES  
-CONFORMING TO  
-SEE ALSO  
-----  
 !!NAME 
-  
-  
 semctl - semaphore control operations 
 !!SYNOPSIS 
+ __#include <sys/types.h>__  
+ __#include <sys/ipc.h>__  
+ __#include <sys/sem.h>__  
  
-  
-__#include  
-__#if defined(__GNU_LIBRARY__)  
-__ __int semctl (int__ ''semid''__, int__ ''semnum''__, int__ ''cmd''__, union semun__ ''arg''__ )__ 
+ __int semctl(int __''semid''__, int __''semnum''__, int __''cmd''__, ... ); __ 
 !!DESCRIPTION 
  
  
-The function performs the control operation specified by  
- ''cmd'' on the semaphore set (or on the ''semnum''-th  
- semaphore of the set) identified by ''semid''. The first  
-semaphore of the set is indicated by a value ____ for  
- ''semnum''. 
+The function performs the control operation specified by ''cmd'' on the semaphore set (or on the ''semnum''-th semaphore of the set) identified by ''semid''. The first  
+semaphore of the set is indicated by a value ____ for ''semnum''. 
  
  
 Legal values for ''cmd'' are 
+;__IPC_STAT__: Copy info from the semaphore set data structure into the structure pointed to by ''arg''__.buf__. The argument ''semnum'' is ignored. The calling process must have read access privileges on the semaphore set.  
+;__IPC_SET__: Write the values of some members of the __semid_ds__ structure pointed to by ''arg''__.buf__ to the semaphore set data structure, updating also its  
+__sem_ctime__ member. Considered members from the user supplied __struct semid_ds__ pointed to by ''arg''__.buf__ are  
+ __ sem_perm.uid__  
+ __sem_perm.gid__  
+ __sem_perm.mode__ /* only lowest 9-bits */  
+;:The calling process effective user-ID must be one among super-user, creator or owner of the semaphore set. The argument ''semnum'' is ignored.  
  
+;__IPC_RMID__: Remove immediately the semaphore set and its data structures awakening all waiting processes (with an error return and __errno__ set to __EIDRM__). The calling process effective user-ID must be one among super-user, creator or owner of the semaphore set. The argument ''semnum'' is ignored.  
  
-__IPC _STAT __ 
+; __GETALL __: Return __semval__ for all semaphores of the set into ''arg''__.array__. The argument ''semnum'' is ignored. The calling process must have read access privileges on the semaphore set.  
  
+;__GETNCNT__: The system call returns the value of __semncnt__ for the ''semnum''-th semaphore of the set (i.e. the number of processes waiting for an increase of __semval__ for the ''semnum''-th semaphore of the set). The calling process must have read access privileges on the semaphore set.  
  
-Copy info from the semaphore set data structure into the  
-structure pointed to by ''arg''__.buf__. The argument  
-''semnum'' is ignored. The calling process must have read  
-access privileges on the semaphore set.  
-  
-  
-__IPC_SET__  
-  
-  
-Write the values of some members of the __semid_ds__  
-structure pointed to by ''arg''__.buf__ to the  
-semaphore set data structure, updating also its  
-__sem_ctime__ member. Considered members from the user  
-supplied __struct semid_ds__ pointed to by  
-''arg''__.buf__ are  
-  
-  
-__ sem_perm.uid  
-sem_perm.gid  
-sem_perm.mode__ /* only lowest 9-bits */  
-The calling process effective user-ID must be one among super-user, creator or owner of the semaphore set. The argument ''semnum'' is ignored.  
-  
-  
-__IPC_RMID__  
-  
-  
-Remove immediately the semaphore set and its data structures  
-awakening all waiting processes (with an error return and  
-__errno__ set to __EIDRM__). The calling process  
-effective user-ID must be one among super-user, creator or  
-owner of the semaphore set. The argument ''semnum'' is  
-ignored.  
-  
-  
-__GETALL__  
-  
-  
-Return __semval__ for all semaphores of the set into  
-''arg''__.array__. The argument ''semnum'' is  
-ignored. The calling process must have read access  
-privileges on the semaphore set.  
-  
-  
- __GETNCNT __  
-  
-  
- The system call returns the value of __semncnt __ for the  
- ''semnum''-th semaphore of the set (i.e. the number of  
-processes waiting for an increase of __semval __ for the  
- ''semnum''-th semaphore of the set). The calling process  
- must have read access privileges on the semaphore 
+; __GETPID __: The system call returns the value of __sempid __ for the ''semnum''-th semaphore of the set (i.e. the pid of the process that executed the last __semop __ call for the ''semnum''-th semaphore of the set). The calling process must have read access privileges on the semaphore 
 set. 
  
+;__GETVAL__: The system call returns the value of __semval__ for the ''semnum''-th semaphore of the set. The calling process must have read access privileges on the semaphore set.  
  
-__GETPID __ 
+; __GETZCNT __: The system call returns the value of __semzcnt__ for the ''semnum''-th semaphore of the set (i.e. the number of processes waiting for __semval__ of the ''semnum''-th semaphore of the set to become ). The calling process must have read access privileges on the semaphore set.  
  
+;__SETALL__: Set __semval__ for all semaphores of the set using ''arg''__.array__'','' updating also the __sem_ctime__ member of the __semid_ds__ structure associated to the set. Undo entries are cleared for altered semaphores in all processes. Processes sleeping on the wait queue are awakened if some __semval__ becomes 0 or increases. The argument ''semnum'' is ignored. The calling process must have alter access privileges on the semaphore set.  
  
-The system call returns the value of __sempid __ for the  
-''semnum''-th semaphore of the set (i.e. the pid of the  
-process that executed the last __semop__ call for the  
-''semnum''-th semaphore of the set). The calling process  
-must have read access privileges on the semaphore  
-set.  
-  
-  
-__GETVAL__  
-  
-  
-The system call returns the value of __semval__ for the  
- ''semnum ''-th semaphore of the set. The calling process  
-must have read access privileges on the semaphore  
-set.  
-  
-  
- __GETZCNT__  
-  
-  
-The system call returns the value of __semzcnt __ for the  
- ''semnum''-th semaphore of the set (i.e. the number of  
-processes waiting for __semval__ of the ''semnum''-th  
-semaphore of the set to become ). The calling process must  
-have read access privileges on the semaphore  
-set.  
-  
-  
-__SETALL__  
-  
-  
-Set __semval__ for all semaphores of the set using  
-''arg''__.array__'' ,'' updating also the  
- __sem_ctime__ member of the __semid_ds__ structure  
- associated to the set. Undo entries are cleared for altered  
-semaphores in all processes. Processes sleeping on the wait  
- queue are awakened if some __semval__ becomes 0 or  
- increases. The argument ''semnum'' is ignored. The  
- calling process must have alter access privileges on the  
- semaphore set.  
-  
-  
-__SETVAL__  
-  
+; __SETVAL __: Set the value of __semval__ to ''arg ''__.val __ for the ''semnum''-th semaphore of the set, updating also the __sem_ctime__ member of the __semid_ds__ structure associated to the set. Undo entry is cleared for altered semaphore in all processes. Processes sleeping on the wait queue are awakened if __semval__ becomes 0 or increases. The calling process must have alter access privileges on the semaphore set. 
  
-Set the value of __semval__ to ''arg''__.val__ for  
-the ''semnum''-th semaphore of the set, updating also the  
-__sem_ctime__ member of the __semid_ds__ structure  
-associated to the set. Undo entry is cleared for altered  
-semaphore in all processes. Processes sleeping on the wait  
-queue are awakened if __semval__ becomes 0 or increases.  
-The calling process must have alter access privileges on the  
-semaphore set.  
 !!RETURN VALUE 
+On fail the system call returns __-1__ with __errno__ indicating the error. Otherwise the system call returns a nonnegative value depending on ''cmd'' as follows:  
  
+;__GETNCNT__: The value of __semncnt__.  
  
-On fail the system call returns __-1 __ with __errno __  
-indicating the error . Otherwise the system call returns a  
-nonnegative value depending on ''cmd'' as  
-follows:  
+; __GETPID __: the value of __sempid __. 
  
+;__GETVAL__: the value of __semval__.  
  
-__GETNCNT __ 
+; __GETZCNT __: the value of __semzcnt__.  
  
-  
-the value of __semncnt__.  
-  
-  
-__GETPID__  
-  
-  
-the value of __sempid__.  
-  
-  
-__GETVAL__  
-  
-  
-the value of __semval__.  
-  
-  
-__GETZCNT__  
-  
-  
-the value of __semzcnt__.  
 !!ERRORS 
-  
-  
- For a failing return, __errno__ will be set to one among  
- the following values:  
-  
-  
-__ EACCES__  
-  
-  
- The calling process has no access permissions needed to  
- execute ''cmd''.  
-  
-  
-__ EFAULT__  
-  
-  
- The address pointed to by ''arg''__.buf__ or  
- ''arg''__.array__ isn't accessible.  
-  
-  
-__ EIDRM__  
-  
-  
- The semaphore set was removed.  
-  
-  
-__ EINVAL__  
-  
-  
- Invalid value for ''cmd'' or ''semid''.  
-  
-  
-__ EPERM__  
-  
-  
- The argument ''cmd'' has value __IPC_SET__ or  
- __IPC_RMID__ but the calling process effective user-ID  
- has insufficient privileges to execute the 
+For a failing return, __errno__ will be set to one among the following values:  
+;[ EACCES]: The calling process has no access permissions needed to execute ''cmd''.  
+;[ EFAULT]: The address pointed to by ''arg''__.buf__ or ''arg''__.array__ isn't accessible.  
+;[ EIDRM]: The semaphore set was removed.  
+;[ EINVAL]: Invalid value for ''cmd'' or ''semid''.  
+;[ EPERM]: The argument ''cmd'' has value __IPC_SET__ or __IPC_RMID__ but the calling process effective user-ID has insufficient privileges to execute the 
 command. 
-  
-  
-__ ERANGE__  
-  
-  
- The argument ''cmd'' has value __SETALL__ or  
- __SETVAL__ and the value to which __semval__ has to be  
- set (for some semaphore of the set) is less than 0 or  
-greater than the implementation value  
- __SEMVMX__. 
+;[ ERANGE]: The argument ''cmd'' has value __SETALL__ or __SETVAL__ and the value to which __semval__ has to be set (for some semaphore of the set) is less than 0 or  
+greater than the implementation value __SEMVMX__. 
 !!NOTES 
+The __IPC_INFO__, __SEM_STAT__ and __SEM_INFO__ control calls are used by the ipcs(8) program to provide information on allocated resources. In the future  
+these can be modified as needed or moved to a proc file system interface.  
  
+Various fields in a ''struct semid_ds'' were shorts under Linux 2.2 and have become longs under Linux 2.4. To take advantage of this, a recompilation under glibc-2.1.91 or later should suffice. (The kernel distinguishes old and new calls by a IPC_64 flag in ''cmd''.)  
  
-The __IPC _INFO __, __SEM_STAT__ and __SEM_INFO__  
-control calls are used by the ipcs(8) program to  
-provide information on allocated resources. In the future  
-these can be modified as needed or moved to a proc file  
-system interface.  
+The following system limit on semaphore sets affects a __semctl __ call:  
  
+;__SEMVMX__: Maximum value for __semval__: implementation dependent (32767).  
  
-Various fields in a ''struct semid_ds'' were shorts under  
-Linux 2.2 and have become longs under Linux 2.4. To take  
-advantage of this, a recompilation under glibc-2.1.91 or  
-later should suffice. (The kernel distinguishes old and new  
-calls by a IPC_64 flag in ''cmd''.)  
-  
-  
-The following system limit on semaphore sets affects a  
-__semctl__ call:  
-  
-  
-__SEMVMX__  
-  
-  
-Maximum value for __semval__: implementation dependent  
-(32767).  
 !!CONFORMING TO 
+SVr4, SVID. SVr4 documents more error conditions [EINVAL] and [EOVERFLOW].  
  
-  
-SVr4, SVID. SVr4 documents more error conditions EINVAL and  
-EOVERFLOW.  
 !!SEE ALSO 
-  
-  
- ipc(5), shmget(2), shmat(2),  
- shmdt(2)  
-----  
+ipc(5), shmget(2), shmat(2), shmdt(2) 
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.