LLAPI\_PARAM\_GET\_VALUE(3) Lustre Library Functions LLAPI\_PARAM\_GET\_VALUE(3)

# [NAME](#NAME)

llapi\_param\_get\_value - read parameter files for Lustre to a buffer

# [SYNOPSIS](#SYNOPSIS)

```
#include <lustre/lustreapi.h>

int llapi_param_get_value(const char *path, char **buf, size_t *buflen);
```

# [DESCRIPTION](#DESCRIPTION)

The **llapi\_param\_get\_value()** function reads the contents of files in procfs, sysfs, etc. into a buffer. If the buffer is preallocated, it will have a fixed size. If the buffer is not preallocated, it will be automatically sized to fit the contents of the file. There is also an option to query the size of a file.

The behavior of **llapi\_param\_get\_value()** depends on the value of *buf*. If *buf* is NULL, then the contents of *path* will not be saved into *\*buf*, but the number of bytes needed to hold the file will be stored in *buflen*. This size will include the space needed for the NUL terminating byte. However, the size of the file can change because it is dynamically generated. This means that it's possible for the file size to increase which will cause the value stored in *buflen* to still not be large enough when used in a subsequent call.

If *buf* is not NULL but *\*buf* is NULL, then *\*buf* will point to an automatically allocated buffer that will hold the contents of *path*, and buflen will hold the number of bytes written excluding the NUL terminating byte.

If both *buf* and *\*buf* are not NULL, then *buf* is assumed to be a pre-allocated buffer of *\*buflen* size. The files contents will be put into *\*buf* and the number of bytes written to *\*buflen*, excluding the NUL terminating byte. In the case that *buflen* is too small to hold the NUL-terminated contents of the file, *buflen* will contain a suggested size for *\*buf*. This suggested size includes the NUL terminating byte, just as in the case where *buf* is NULL.

# [RETURN VALUES](#RETURN_VALUES)

**0**

on success

[-ve](#ve)

error code on failure and sets errno appropriately.

# [ERRORS](#ERRORS)

[**-EINVAL**](#EINVAL)

if either *path* or *buflen* are NULL.

[**-EOVERFLOW**](#EOVERFLOW)

if *buf* and *\*buf* are not NULL, and the pre-allocated buffer is too small.

[**-ENOMEM**](#ENOMEM)

if *buf* is not NULL, but the buffer allocation failed

# [AVAILABILITY](#AVAILABILITY)

**llapi\_param\_get\_value()** is part of the [**lustre**(7)](/man/enterprise-packages/lustre/lustre.7) user application interface library since release 2.14.0

# [SEE ALSO](#SEE_ALSO)

[**llapi\_get\_param\_paths**(3)](/man/enterprise-packages/lustre/llapi_get_param_paths.3), [**lustreapi**(7)](/man/enterprise-packages/lustre/lustreapi.7), [**lctl-get\_param**(8)](/man/enterprise-packages/lustre/lctl-get_param.8)

2024-08-27 Lustre User API

---

Document: llapi_param_get_value(3) from lustre 2.17.59-r2 (Chainguard OS)
Source: https://github.com/lustre/lustre-release
