---
name: "keyctl_capabilities"
section: "3"
platform: "linux"
package: "keyutils"
version: "1.6.3-4"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/keyctl_capabilities"
---

# keyctl\_capabilities(3)

Query subsystem capabilities

## NAME

keyctl\_capabilities - Query subsystem capabilities

## SYNOPSIS

```
#include <keyutils.h>

long keyctl_capabilities(unsigned char *buffer, size_t buflen);
```

## DESCRIPTION

**keyctl\_capabilities**() queries the keyrings subsystem in the kernel to ask about its capabilities and fills in the array in the buffer with bits that indicate the presence or absence of specific features in the keyrings subsystem.

The function returns the amount of data the kernel has available, irrespective of the amount of buffer space available.  If the buffer is shorter than the data, a short copy will be made; if the buffer is larger than the data, the excess space will be cleared.

If this operation is not available in the kernel, the keyutils library will emulate it as best it can and the capability bit that indicates if the kernel operation is available will be cleared.

In *buffer\[0\]*, the following capabilities exist:

- **KEYCTL\_CAPS0\_CAPABILITIES**

  This is set if the kernel supports this operation and cleared otherwise.  If it is cleared, the rest of the flags are emulated.

- **KEYCTL\_CAPS0\_PERSISTENT\_KEYRINGS**

  This is set if the kernel supports persistent keyrings and cleared otherwise. See **keyctl\_get\_persistent**(**3**).

- **KEYCTL\_CAPS0\_DIFFIE\_HELLMAN**

  This is set if the kernel supports Diffie-Hellman calculation and cleared otherwise.  See **keyctl\_dh\_compute**(**3**).

- **KEYCTL\_CAPS0\_PUBLIC\_KEY**

  This is set if the kernel supports public-key operations and cleared otherwise.  See **keyctl\_pkey\_query**(**3**).

- **KEYCTL\_CAPS0\_BIG\_KEY**

  This is set if the kernel supports the big\_key key type and cleared otherwise.

- **KEYCTL\_CAPS0\_INVALIDATE**

  This is set if the kernel supports key invalidation and cleared otherwise. See **keyctl\_invalidate**(**3**).

- **KEYCTL\_CAPS0\_RESTRICT\_KEYRING**

  This is set if the kernel supports restrictions on keyrings and cleared otherwise.  See **keyctl\_restrict\_keyring**(**3**).

- **KEYCTL\_CAPS0\_MOVE**

  This is set if the kernel supports the move key operation and cleared otherwise.  See **keyctl\_move**(**3**).

In *buffer\[1\]*, the following capabilities exist:

- **KEYCTL\_CAPS1\_NS\_KEYRING\_NAME**

  This is set if the keyring names are segregated according to the user-namespace in which a keyring is created.

- **KEYCTL\_CAPS1\_NS\_KEY\_TAG**

  This is set if a key or keyring may get tagged with a namespace, thereby allowing multiple keys with the same type and description, but different namespace tags, to coexist within the same keyring.  Tagging may be automatic depending on the key type.  Only network-namespace tagging is currently used.

## RETURN VALUE

On success **keyctl\_capabilities**() returns the size of the data it has available, irrespective of the size of the buffer.  On error, the value **-1** will be returned and *errno* will have been set to an appropriate error.

## ERRORS

- **EFAULT**

  The buffer cannot be written to.

## LINKING

This is a library function that can be found in *libkeyutils*. When linking, **-lkeyutils** should be specified to the linker.

## SEE ALSO

[**keyctl**(1)](/keyctl/1.md), [**add\_key**(2)](/add_key/2.md), [**keyctl**(2)](/keyctl/2.md), [**request\_key**(2)](/request_key/2.md), [**keyctl**(3)](/keyctl/3.md), [**keyrings**(7)](/keyrings/7.md), [**keyutils**(7)](/keyutils/7.md)
