aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlejandro Colomar <alx@kernel.org>2024-07-11 01:32:54 +0200
committerAlejandro Colomar <alx@kernel.org>2024-08-21 23:51:10 +0200
commit55feaa8f74cedc790f7aae45fee5913aecaf24fa (patch)
tree80a4fcf4bedcfe479daed832629d883b44023b79
parent54985b6b8c4f1cc2094af9f817e1fd8f922d1d04 (diff)
downloadman-pages-55feaa8f74cedc790f7aae45fee5913aecaf24fa.tar.gz
KEYCTL_READ.2const: Tweak after split
Signed-off-by: Alejandro Colomar <alx@kernel.org>
-rw-r--r--man/man2const/KEYCTL_READ.2const55
1 files changed, 15 insertions, 40 deletions
diff --git a/man/man2const/KEYCTL_READ.2const b/man/man2const/KEYCTL_READ.2const
index 0ebe271d38..e69f833c42 100644
--- a/man/man2const/KEYCTL_READ.2const
+++ b/man/man2const/KEYCTL_READ.2const
@@ -20,33 +20,24 @@ Standard C library
.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "long syscall(SYS_keyctl, KEYCTL_READ, unsigned long " arg2 ,
-.BI " unsigned long " arg3 ", unsigned long " arg4 ,
-.BI " unsigned long " arg5 );
+.BI "long syscall(SYS_keyctl, KEYCTL_READ, key_serial_t " key ,
+.BI " char " buf "[_Nullable ." size "], size_t " size );
.fi
.SH DESCRIPTION
-.TP
-.BR KEYCTL_READ " (since Linux 2.6.10)"
Read the payload data of a key.
-.IP
+.P
The ID of the key whose payload is to be read is specified in
-.I arg2
-(cast to
-.IR key_serial_t ).
+.IR key .
This can be the ID of an existing key,
or any of the special key IDs listed for
.BR KEYCTL_GET_KEYRING_ID (2const).
.\" including KEY_SPEC_REQKEY_AUTH_KEY
-.IP
+.P
The payload is placed in the buffer pointed by
-.I arg3
-(cast to
-.IR "char\ *" );
+.IR buf ;
the size of that buffer must be specified in
-.I arg4
-(cast to
-.IR size_t ).
-.IP
+.IR size .
+.P
The returned data will be processed for presentation
according to the key type.
For example, a keyring will return an array of
@@ -55,12 +46,9 @@ entries representing the IDs of all the keys that are linked to it.
The
.I user
key type will return its data as is.
-If a key type does not implement this function,
-the operation fails with the error
-.BR EOPNOTSUPP .
-.IP
+.P
If
-.I arg3
+.I buf
is not NULL,
as much of the payload data as will fit is copied into the buffer.
On a successful return,
@@ -68,27 +56,17 @@ the return value is always the total size of the payload data.
To determine whether the buffer was of sufficient size,
check to see that the return value is less than or equal to
the value supplied in
-.IR arg4 .
-.IP
+.IR size .
+.P
The key must either grant the caller
.I read
permission, or grant the caller
.I search
permission when searched for from the process keyrings
(i.e., the key is possessed).
-.IP
-The
-.I arg5
-argument is ignored.
-.IP
-This operation is exposed by
-.I libkeyutils
-via the function
-.BR keyctl_read (3).
.SH RETURN VALUE
-.TP
-.B KEYCTL_READ
-The amount of data that is available in the key,
+On success,
+the amount of data that is available in the key,
irrespective of the provided buffer size.
.P
On error, \-1 is returned, and
@@ -97,10 +75,7 @@ is set to indicate the error.
.SH ERRORS
.TP
.B EOPNOTSUPP
-.I operation
-was
-.B KEYCTL_READ
-and the key type does not support reading
+The key type does not support reading
(e.g., the type is
.IR \[dq]login\[dq] ).
.SH VERSIONS