diff --git a/lib/libc/sys/semctl.2 b/lib/libc/sys/semctl.2 --- a/lib/libc/sys/semctl.2 +++ b/lib/libc/sys/semctl.2 @@ -23,7 +23,7 @@ .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. .\" -.Dd July 9, 2020 +.Dd October 2, 2023 .Dt SEMCTL 2 .Os .Sh NAME @@ -79,6 +79,15 @@ .Fa "struct semid_ds" , storing it in the memory pointed to by .Fa arg.buf . +.It Dv SEM_STAT +Return a +.Fa "semid_ds" +structure as for +.Dv IPC_STAT . +However, for this command we assume +.Fa semid +is an array index in the kernel's internal array that maintains information +about all semaphore sets on the system rather than an id of a semaphore set. .It Dv IPC_SET Changes the .Fa sem_perm.uid , @@ -161,7 +170,14 @@ or .Dv GETZCNT , .Fn semctl -returns the corresponding value; otherwise, 0 is returned. +returns the corresponding value, when +.Fa cmd +is +.Dv SEM_STAT +.Fn semctl +returns the identifier of the semaphore set whose index was given in +.Fa semid ; +otherwise, 0 is returned. On failure, -1 is returned, and .Va errno is set to indicate the error.