From 9862ec0c5ce526973b2b3096d2bdae4cb77630e2 Mon Sep 17 00:00:00 2001 From: Michael Kerrisk Date: Thu, 7 Jan 2021 10:23:22 +0100 Subject: [PATCH] Various System V IPC pages: Improve wording describing RETURN VALUE and setting of 'errno' Signed-off-by: Michael Kerrisk --- man2/msgctl.2 | 4 ++-- man2/msgget.2 | 9 +++++---- man2/msgop.2 | 9 ++++----- man2/semctl.2 | 15 ++++++++------- man2/semget.2 | 9 +++++---- man2/semop.2 | 9 ++++----- 6 files changed, 28 insertions(+), 27 deletions(-) diff --git a/man2/msgctl.2 b/man2/msgctl.2 index b0f84c1ac..ae399b9da 100644 --- a/man2/msgctl.2 +++ b/man2/msgctl.2 @@ -331,9 +331,9 @@ or operation returns the identifier of the queue whose index was given in .IR msqid . .PP -On error, \-1 is returned with +On failure, \-1 is returned and .I errno -indicating the error. +is set to indicate the error. .SH ERRORS On failure, .I errno diff --git a/man2/msgget.2 b/man2/msgget.2 index ea448d734..6d430ea92 100644 --- a/man2/msgget.2 +++ b/man2/msgget.2 @@ -144,11 +144,12 @@ If the message queue already exists the permissions are verified, and a check is made to see if it is marked for destruction. .SH RETURN VALUE -If successful, the return value will be the message queue identifier (a -nonnegative integer), otherwise \-1 -with +On success, +.BR msgget () +returns the message queue identifier (a nonnegative integer). +On failure, \-1 is returned, and .I errno -indicating the error. +is set to indicate the error. .SH ERRORS On failure, .I errno diff --git a/man2/msgop.2 b/man2/msgop.2 index ed4632b50..f5a4ee5b8 100644 --- a/man2/msgop.2 +++ b/man2/msgop.2 @@ -336,11 +336,7 @@ is decremented by 1. .I msg_rtime is set to the current time. .SH RETURN VALUE -On failure both functions return \-1 -with -.I errno -indicating the error, -otherwise +On success, .BR msgsnd () returns 0 and @@ -348,6 +344,9 @@ and returns the number of bytes actually copied into the .I mtext array. +On failure, both functions return \-1, and set +.I errno +to indicate the error. .SH ERRORS When .BR msgsnd () diff --git a/man2/semctl.2 b/man2/semctl.2 index ed5e79efd..fb0d34c4c 100644 --- a/man2/semctl.2 +++ b/man2/semctl.2 @@ -395,14 +395,9 @@ If the changes to semaphore values would permit blocked calls in other processes to proceed, then those processes are woken up. The calling process must have alter permission on the semaphore set. .SH RETURN VALUE -On failure, +On success, .BR semctl () -returns \-1 -with -.I errno -indicating the error. -.PP -Otherwise, the system call returns a nonnegative value depending on +returns a nonnegative value depending on .I cmd as follows: .TP @@ -447,6 +442,12 @@ as for All other .I cmd values return 0 on success. +.PP +On failure, +.BR semctl () +returns \-1 and sets +.I errno +to indicate the error. .SH ERRORS On failure, .I errno diff --git a/man2/semget.2 b/man2/semget.2 index d3d37cbaf..bfd3e6b38 100644 --- a/man2/semget.2 +++ b/man2/semget.2 @@ -155,11 +155,12 @@ If the semaphore set already exists, the permissions are verified. .\" and a check is made to see if it is marked for destruction. .SH RETURN VALUE -If successful, the return value will be the semaphore set identifier -(a nonnegative integer), otherwise, \-1 -is returned, with +On sucess, +.BR semget () +ireturns the semaphore set identifier (a nonnegative integer). +On failure, \-1 is returned, and .I errno -indicating the error. +is set to indicate the error. .SH ERRORS On failure, .I errno diff --git a/man2/semop.2 b/man2/semop.2 index 77db49f82..8f7804d2a 100644 --- a/man2/semop.2 +++ b/man2/semop.2 @@ -297,15 +297,14 @@ the contents of .IR timeout are left unchanged. .SH RETURN VALUE -If successful, +On success, .BR semop () and .BR semtimedop () -return 0; -otherwise they return \-1 -with +return 0. +On failure, they return \-1, and set .I errno -indicating the error. +to indicate the error. .SH ERRORS On failure, .I errno