git: a836dce6d085 - stable/13 - cap_*(2): Document ENOSYS behavior.

From: Xin LI <delphij_at_FreeBSD.org>
Date: Fri, 24 Mar 2023 06:40:14 UTC
The branch stable/13 has been updated by delphij:

URL: https://cgit.FreeBSD.org/src/commit/?id=a836dce6d08507cc556816a68697db36249ada66

commit a836dce6d08507cc556816a68697db36249ada66
Author:     Xin LI <delphij@FreeBSD.org>
AuthorDate: 2023-03-10 02:10:50 +0000
Commit:     Xin LI <delphij@FreeBSD.org>
CommitDate: 2023-03-24 06:39:58 +0000

    cap_*(2): Document ENOSYS behavior.
    
    Summary:
    All cap_* system calls would fail when capability mode support is
    not present.
    
    Reviewed by:    emaste, pauamma
    Differential Revision: https://reviews.freebsd.org/D38976
    
    (cherry picked from commit 75798f9b01055261881938326a5c77e55f79c7f7)
---
 lib/libc/sys/cap_enter.2        |  7 +++----
 lib/libc/sys/cap_fcntls_limit.2 |  5 ++++-
 lib/libc/sys/cap_ioctls_limit.2 | 29 ++++++++++++++---------------
 lib/libc/sys/cap_rights_limit.2 |  5 ++++-
 4 files changed, 25 insertions(+), 21 deletions(-)

diff --git a/lib/libc/sys/cap_enter.2 b/lib/libc/sys/cap_enter.2
index 428e0b0bcd09..56fc78a4b4f2 100644
--- a/lib/libc/sys/cap_enter.2
+++ b/lib/libc/sys/cap_enter.2
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2020
+.Dd March 9, 2023
 .Dt CAP_ENTER 2
 .Os
 .Sh NAME
@@ -113,9 +113,8 @@ system calls
 will fail if:
 .Bl -tag -width Er
 .It Bq Er ENOSYS
-The kernel is compiled without:
-.Pp
-.Cd "options CAPABILITY_MODE"
+The running kernel was compiled without
+.Cd "options CAPABILITY_MODE" .
 .El
 .Pp
 The
diff --git a/lib/libc/sys/cap_fcntls_limit.2 b/lib/libc/sys/cap_fcntls_limit.2
index b09aebbe78f0..b7b38ba2ab51 100644
--- a/lib/libc/sys/cap_fcntls_limit.2
+++ b/lib/libc/sys/cap_fcntls_limit.2
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2020
+.Dd March 9, 2023
 .Dt CAP_FCNTLS_LIMIT 2
 .Os
 .Sh NAME
@@ -111,6 +111,9 @@ argument is not a valid descriptor.
 The
 .Fa fcntlrightsp
 argument points at an invalid address.
+.It Bq Er ENOSYS
+The running kernel was compiled without
+.Cd "options CAPABILITY_MODE" .
 .El
 .Sh SEE ALSO
 .Xr cap_ioctls_limit 2 ,
diff --git a/lib/libc/sys/cap_ioctls_limit.2 b/lib/libc/sys/cap_ioctls_limit.2
index 0cf5ea8ca038..6696434e0bac 100644
--- a/lib/libc/sys/cap_ioctls_limit.2
+++ b/lib/libc/sys/cap_ioctls_limit.2
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2020
+.Dd March 9, 2023
 .Dt CAP_IOCTLS_LIMIT 2
 .Os
 .Sh NAME
@@ -110,8 +110,11 @@ On failure the value
 .Va -1
 is returned and the global variable errno is set to indicate the error.
 .Sh ERRORS
+The
 .Fn cap_ioctls_limit
-succeeds unless:
+and
+.Fn cap_ioctls_get
+system calls will fail if:
 .Bl -tag -width Er
 .It Bq Er EBADF
 The
@@ -121,6 +124,15 @@ argument is not a valid descriptor.
 The
 .Fa cmds
 argument points at an invalid address.
+.It Bq Er ENOSYS
+The running kernel was compiled without
+.Cd "options CAPABILITY_MODE" .
+.El
+.Pp
+The
+.Fn cap_ioctls_limit
+system call may also return the following errors:
+.Bl -tag -width Er
 .It Bq Er EINVAL
 The
 .Fa ncmds
@@ -132,19 +144,6 @@ would expand the list of allowed
 .Xr ioctl 2
 commands.
 .El
-.Pp
-.Fn cap_ioctls_get
-succeeds unless:
-.Bl -tag -width Er
-.It Bq Er EBADF
-The
-.Fa fd
-argument is not a valid descriptor.
-.It Bq Er EFAULT
-The
-.Fa cmds
-argument points at invalid address.
-.El
 .Sh SEE ALSO
 .Xr cap_fcntls_limit 2 ,
 .Xr cap_rights_limit 2 ,
diff --git a/lib/libc/sys/cap_rights_limit.2 b/lib/libc/sys/cap_rights_limit.2
index 37f311143a28..f08d5520b66e 100644
--- a/lib/libc/sys/cap_rights_limit.2
+++ b/lib/libc/sys/cap_rights_limit.2
@@ -32,7 +32,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd May 5, 2020
+.Dd March 9, 2023
 .Dt CAP_RIGHTS_LIMIT 2
 .Os
 .Sh NAME
@@ -120,6 +120,9 @@ argument is not a valid active descriptor.
 .It Bq Er EINVAL
 An invalid right has been requested in
 .Fa rights .
+.It Bq Er ENOSYS
+The running kernel was compiled without
+.Cd "options CAPABILITY_MODE" .
 .It Bq Er ENOTCAPABLE
 The
 .Fa rights