diff options
Diffstat (limited to '')
-rw-r--r-- | man2/semctl.2 | 62 |
1 files changed, 31 insertions, 31 deletions
diff --git a/man2/semctl.2 b/man2/semctl.2 index 6069169..c3724e4 100644 --- a/man2/semctl.2 +++ b/man2/semctl.2 @@ -20,7 +20,7 @@ .\" 2005-08-02, mtk: Added IPC_INFO, SEM_INFO, SEM_STAT descriptions. .\" 2018-03-20, dbueso: Added SEM_STAT_ANY description. .\" -.TH semctl 2 2023-03-30 "Linux man-pages 6.05.01" +.TH semctl 2 2024-03-03 "Linux man-pages 6.7" .SH NAME semctl \- System V semaphore control operations .SH LIBRARY @@ -29,26 +29,26 @@ Standard C library .SH SYNOPSIS .nf .B #include <sys/sem.h> -.PP -.BI "int semctl(int " semid ", int " semnum ", int " cmd ", ...);" +.P +.BI "int semctl(int " semid ", int " semnum ", int " op ", ...);" .fi .SH DESCRIPTION .BR semctl () performs the control operation specified by -.I cmd +.I op on the System\ V semaphore set identified by .IR semid , or on the .IR semnum -th semaphore of that set. (The semaphores in a set are numbered starting at 0.) -.PP +.P This function has three or four arguments, depending on -.IR cmd . +.IR op . When there are four, the fourth has the type .IR "union semun" . The \fIcalling program\fP must define this union as follows: -.PP +.P .in +4n .EX union semun { @@ -60,11 +60,11 @@ union semun { }; .EE .in -.PP +.P The .I semid_ds data structure is defined in \fI<sys/sem.h>\fP as follows: -.PP +.P .in +4n .EX struct semid_ds { @@ -76,7 +76,7 @@ struct semid_ds { }; .EE .in -.PP +.P The fields of the .I semid_ds structure are as follows: @@ -108,13 +108,13 @@ ranging from .B 0 to .IR sem_nsems\-1 . -.PP +.P The .I ipc_perm structure is defined as follows (the highlighted fields are settable using .BR IPC_SET ): -.PP +.P .in +4n .EX struct ipc_perm { @@ -128,7 +128,7 @@ struct ipc_perm { }; .EE .in -.PP +.P The least significant 9 bits of the .I mode field of the @@ -144,12 +144,12 @@ l l. 0004 Read by others 0002 Write by others .TE -.PP +.P In effect, "write" means "alter" for a semaphore set. Bits 0100, 0010, and 0001 (the execute bits) are unused by the system. -.PP +.P Valid values for -.I cmd +.I op are: .TP .B IPC_STAT @@ -380,7 +380,7 @@ The calling process must have alter permission on the semaphore set. On success, .BR semctl () returns a nonnegative value depending on -.I cmd +.I op as follows: .TP .B GETNCNT @@ -420,11 +420,11 @@ the identifier of the semaphore set whose index was given in .B SEM_STAT_ANY as for .BR SEM_STAT . -.PP +.P All other -.I cmd +.I op values return 0 on success. -.PP +.P On failure, .BR semctl () returns \-1 and sets @@ -434,7 +434,7 @@ to indicate the error. .TP .B EACCES The argument -.I cmd +.I op has one of the values .BR GETALL , .BR GETPID , @@ -464,7 +464,7 @@ The semaphore set was removed. .TP .B EINVAL Invalid value for -.I cmd +.I op or .IR semid . Or: for a @@ -475,7 +475,7 @@ referred to an array slot that is currently unused. .TP .B EPERM The argument -.I cmd +.I op has the value .B IPC_SET or @@ -493,7 +493,7 @@ capability. .TP .B ERANGE The argument -.I cmd +.I op has the value .B SETALL or @@ -525,7 +525,7 @@ and explicitly notes that this value is set by a successful call, with the implication that no other interface affects the .I sempid value. -.PP +.P While some implementations conform to the behavior specified in POSIX.1, others do not. (The fault here probably lies with POSIX.1 inasmuch as it likely failed @@ -543,7 +543,7 @@ on process termination as a consequence of the use of the .B SEM_UNDO flag (see .BR semop (2)). -.PP +.P Linux also updates .I sempid for @@ -563,7 +563,7 @@ POSIX.1-2008. .SH HISTORY POSIX.1-2001, SVr4. .\" SVr4 documents more error conditions EINVAL and EOVERFLOW. -.PP +.P Various fields in a \fIstruct semid_ds\fP were typed as .I short under Linux 2.2 @@ -575,8 +575,8 @@ a recompilation under glibc-2.1.91 or later should suffice. (The kernel distinguishes old and new calls by an .B IPC_64 flag in -.IR cmd .) -.PP +.IR op .) +.P In some earlier versions of glibc, the .I semun union was defined in \fI<sys/sem.h>\fP, but POSIX.1 requires @@ -598,7 +598,7 @@ program to provide information on allocated resources. In the future these may modified or moved to a .I /proc filesystem interface. -.PP +.P The following system limit on semaphore sets affects a .BR semctl () call: @@ -607,7 +607,7 @@ call: Maximum value for .BR semval : implementation dependent (32767). -.PP +.P For greater portability, it is best to always call .BR semctl () with four arguments. |