Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

FreeBSD 11.0 - man page for efi_setvar (freebsd section 3)

LIBEFI(3)						   BSD Library Functions Manual 						 LIBEFI(3)

efi_getvar, efi_nextvarname, efi_setvar -- interface for accessing the EFI variable services
library ``libefi''
#include <libefi.h> int efi_getvar(char *name, uuid_t *vendor, uint32_t *attrib, size_t *datasize, void *data); int efi_nextvarname(size_t *namesize, char *name, uuid_t *vendor); int efi_setvar(char *name, uuid_t *vendor, uint32_t attrib, size_t datasize, void *data);
The libefi library provides access to a select set of the runtime services of the Extensible Firmware Interface (EFI). The efi_nextvarname() function is used to enumerate the variables. The namesize parameter needs to be set to the size of the buffer pointed to by name. On return, namesize is set to the length of the variable name (including the terminating '\0') irrespective of whether the buf- fer was big enough. The buffer pointed to by name contains the full or partial variable name on return. Only on successful completion of the request is the vendor updated. The values returned should be passed to successive calls to efi_nextvarname() until all variables have been enumerated. The variable name and vendor as returned by efi_nextvarname() can be passed to efi_getvar() to obtain the value and attribute of the vari- able. The buffer that is to contain the value is specified by data and the size of the buffer is given by datasize. The attribute pointed to by attrib consists of the bit values defined by the EFI specification. Variables can be created, modified and deleted using the efi_setvar() function. All new variables must be non-volatile and runtime accessi- ble in order for the request to succeed. Note that for runtime accessable variables the boottime accessable bit must be set as well. To delete a variable, set datasize to 0. The vendor UUID is used to avoid collisions between variable names of different vendors. Variables created for use by FreeBSD should use the EFI_FREEBSD_VARIABLE UUID as defined in the <libefi.h> header file.
Upon successful completion, these functions return 0. Otherwise, the error number is returned. These functions will fail if: [EACCES] Insufficient permissions to access the EFI services. [EILSEQ] The variable name is not in UTF-8. [EINVAL] The request has invalid parameters. [ENOENT] The variable does not exist or no more variables exist. [ENOMEM] Temporary storage could not be allocated. [EOVERFLOW] The variable name is too long or the data is too big to fit in the buffer provided.
errno(2), uuid(3)
The libefi library first appeared in FreeBSD 9.0 for the ia64 architecture.
The libefi library and this manual page were written by Marcel Moolenaar <>.
January 29, 2010 BSD