KEYCTL_DESCRIBE(2const) — Linux manual page

NAME | LIBRARY | SYNOPSIS | DESCRIPTION | RETURN VALUE | VERSIONS | STANDARDS | HISTORY | SEE ALSO | COLOPHON

KEYCTL_DESCRIBE(2const)                           KEYCTL_DESCRIBE(2const)

NAME         top

       KEYCTL_DESCRIBE - describe a key

LIBRARY         top

       Standard C library (libc, -lc)

SYNOPSIS         top

       #include <linux/keyctl.h>  /* Definition of KEY* constants */
       #include <sys/syscall.h>   /* Definition of SYS_* constants */
       #include <unistd.h>

       long syscall(SYS_keyctl, KEYCTL_DESCRIBE, key_serial_t key,
                    char desc[_Nullable .size], size_t size);

DESCRIPTION         top

       Obtain a string describing the attributes of a specified key.

       The ID of the key to be described is specified in key.  The
       descriptive string is returned in the buffer pointed to by desc;
       size specifies the size of that buffer in bytes.

       The key must grant the caller view permission.

       The returned string is null-terminated and contains the following
       information about the key:

           type;uid;gid;perm;description

       In the above, type and description are strings, uid and gid are
       decimal strings, and perm is a hexadecimal permissions mask.  The
       descriptive string is written with the following format:

           %s;%d;%d;%08x;%s

       Note: the intention is that the descriptive string should be
       extensible in future kernel versions.  In particular, the
       description field will not contain semicolons; it should be parsed
       by working backwards from the end of the string to find the last
       semicolon.  This allows future semicolon-delimited fields to be
       inserted in the descriptive string in the future.

       Writing to the buffer is attempted only when desc is non-NULL and
       the specified buffer size is large enough to accept the
       descriptive string (including the terminating null byte).  In
       order to determine whether the buffer size was too small, check to
       see if the return value of the operation is greater than size.

RETURN VALUE         top

       On success, the size of the description (including the terminating
       null byte), irrespective of the provided buffer size.

       On error, -1 is returned, and errno is set to indicate the error.

VERSIONS         top

       A wrapper is provided in the libkeyutils library:
       keyctl_describe(3).

STANDARDS         top

       Linux.

HISTORY         top

       Linux 2.6.10.

SEE ALSO         top

       keyctl(2), keyctl_describe(3), keyctl_describe_alloc(3)

COLOPHON         top

       This page is part of the man-pages (Linux kernel and C library
       user-space interface documentation) project.  Information about
       the project can be found at 
       ⟨https://www.kernel.org/doc/man-pages/⟩.  If you have a bug report
       for this manual page, see
       ⟨https://git.kernel.org/pub/scm/docs/man-pages/man-pages.git/tree/CONTRIBUTING⟩.
       This page was obtained from the tarball man-pages-6.10.tar.gz
       fetched from
       ⟨https://mirrors.edge.kernel.org/pub/linux/docs/man-pages/⟩ on
       2025-02-02.  If you discover any rendering problems in this HTML
       version of the page, or you believe there is a better or more up-
       to-date source for the page, or you have corrections or
       improvements to the information in this COLOPHON (which is not
       part of the original manual page), send a mail to
       man-pages@man7.org

Linux man-pages 6.10            2024-08-21        KEYCTL_DESCRIBE(2const)

Pages that refer to this page: keyctl(2)KEYCTL_SETPERM(2const)