.BR "#include <sys/syscall.h>" " /* Definition of " SYS_* " constants */"
.B #include <unistd.h>
.P
-.BI "long syscall(SYS_keyctl, KEYCTL_DESCRIBE, unsigned long " arg2 ,
-.BI " unsigned long " arg3 ", unsigned long " arg4 ,
-.BI " unsigned long " arg5 );
+.BI "long syscall(SYS_keyctl, KEYCTL_DESCRIBE, key_serial_t " key ,
+.BI " char " desc "[_Nullable ." size "], size_t " size );
.fi
.SH DESCRIPTION
-.TP
-.BR KEYCTL_DESCRIBE " (since Linux 2.6.10)"
Obtain a string describing the attributes of a specified key.
-.IP
+.P
The ID of the key to be described is specified in
-.I arg2
-(cast to
-.IR key_serial_t ).
+.IR key .
The descriptive string is returned in the buffer pointed to by
-.I arg3
-(cast to
-.IR char\~* );
-.I arg4
-(cast to
-.IR size_t )
+.IR desc ;
+.I size
specifies the size of that buffer in bytes.
-.IP
+.P
The key must grant the caller
.I view
permission.
-.IP
+.P
The returned string is null-terminated and
contains the following information about the key:
-.IP
+.P
.in +4n
.IR type ; uid ; gid ; perm ; description
.in
-.IP
+.P
In the above,
.I type
and
.I perm
is a hexadecimal permissions mask.
The descriptive string is written with the following format:
-.IP
+.P
.in +4n
.EX
%s;%d;%d;%08x;%s
.EE
.in
-.IP
+.P
.B Note: the intention is that the descriptive string should
.B be extensible in future kernel versions.
In particular, the
to find the last semicolon.
This allows future semicolon-delimited fields to be inserted
in the descriptive string in the future.
-.IP
+.P
Writing to the buffer is attempted only when
-.I arg3
+.I desc
is non-NULL and the specified buffer size
is large enough to accept the descriptive string
(including the terminating null byte).
.\" security/keyctl.c
In order to determine whether the buffer size was too small,
check to see if the return value of the operation is greater than
-.IR arg4 .
-.IP
-The
-.I arg5
-argument is ignored.
-.IP
-This operation is exposed by
-.I libkeyutils
-via the function
-.BR keyctl_describe (3).
+.IR size .
.SH RETURN VALUE
-.TP
-.B KEYCTL_DESCRIBE
-The size of the description (including the terminating null byte),
+On success,
+the size of the description (including the terminating null byte),
irrespective of the provided buffer size.
.P
On error, \-1 is returned, and