lazybios 3.0.0
Lightweight SMBIOS/DMI parsing library
Loading...
Searching...
No Matches
lazybios

A lightweight, dependency-free C library for parsing SMBIOS/DMI tables.

lazybios reads the firmware tables that describe a machine — its BIOS, board, processors, memory, slots, sensors, and more — and hands them back as plain C structures. It implements the DMTF SMBIOS specification, plus a growing set of vendor-specific structures.

Every parsed field comes with three views, so you never have to guess what the firmware actually said:

View Example What it tells you
raw t->wake_up_type6 the encoding the firmware wrote
decoded t->decoded.wake_up_type"Power Switch" what that encoding means
field_status LAZYBIOS_FIELD_STATUS whether the firmware populated it at all

Where to start

If you want to… Go to
Build the library or add it to your project Building and Integration
See working code and the required call sequence Getting Started
Understand ownership, cleanup, and field status Core Concepts and Ownership
Look up what a particular SMBIOS type means Standard SMBIOS Type Guides
Read a vendor-specific structure OEM SMBIOS Type Guides
Know where the data comes from on each OS Backends and Input Modes
Browse every function and structure Public API

New to the library? Read Getting Started, then Core Concepts and Ownership. Those two pages cover everything needed to use the rest of the API correctly.

A complete example

int read_host_bios(void) {
lazybiosCTX_t* ctx = lazybiosCTXNew();
if (!ctx) return -1;
if (lazybiosInit(ctx, NULL, NULL) != 0) {
return -1;
}
ctx->Type0 = lazybiosGetType0(ctx->DMIData);
if (!ctx->Type0) {
return -1;
}
return 0;
}

Every workflow follows the same three steps: create a context, load data into it, then parse the types you care about. The context owns what it hands you, so a single lazybiosCleanup at the end releases all of it.

lazybiosInit is the one loader. Two NULL paths read this machine; a single path reads a merged dump; two paths read a separate entry point and table. The file modes need no privileges and behave the same on every platform.

Each getter returns a result set holding an entries array and its count, so the two can never drift apart. A set whose count is zero means the machine has none of that structure — an ordinary answer, not a failure. To fill the whole context in one call, use lazybiosParseAll. The full lifecycle is described in Core Concepts and Ownership.

What's covered

  • Standard structures — SMBIOS types 0 through 46, implemented against the latest published DMTF specification. See Standard SMBIOS Type Guides to find a type by topic, or SMBIOS Structure APIs for the declarations.
  • Vendor structures — Dell and HP OEM records under ctx->oem->dell and ctx->oem->hp, listed in OEM SMBIOS Type Guides. They hang off a vendor because an OEM structure number means nothing without one: type 212 is Dell Indexed I/O Access and also HPE 64-bit CRU Information.
  • Decoding — every encoded field is decoded during parsing into decoded, including multi-flag text. There are no decoder functions to call.
  • Extensions — JSON output for every standard and OEM type, described in Library Extensions. lazybiosParseJSONAll serializes the whole table in one call.

Data sources

lazybios reads from the host system on Linux, Windows, macOS, OpenBSD, FreeBSD and its derivatives, NetBSD, SunOS (Solaris/illumos), DragonFly BSD, Haiku, BeOS, ReactOS, QNX Neutrino, and MINIX 3.

It can also parse saved table dumps, which needs no privileges and works on any build platform. That makes dump files the practical choice for testing and for reproducing a report from another machine. Both modes are covered in Backends and Input Modes, and the platform-specific caveats in Platform Notes and Limitations.

Reliability

Parsed input is untrusted firmware data, so the project treats it that way: seven libFuzzer targets cover the entry points, table walkers, loaders, and JSON serializers, and a deterministic semantic suite checks specification conformance on a corpus of real machine dumps. See Testing, Fuzzing, and Regressions.

Project

Licensed under LGPL-2.1-or-later, with a static-linking exception for open-source projects.