SECTION(3) Library Functions Manual SECTION(3)

SECTION, SECTION_ITERATEsection macros

#include <libks/section.h>

SECTION(name);

int
SECTION_ITERATE(type *it, name);

The section macros can be used to store and access data in custom binary sections.

The () macro is used to annotate that a variable resides in the section identified by name.

The () macro iterates over all elements stored in the section identified by name in which each element is expected to be of type. The current element can be accessed through it which must be zero initialized upon the first invocation.

static struct element SECTION(elements);

const struct element *it = NULL;
while (SECTION_ITERATE(it, elements))
	handle_element(it);

Anton Lindqvist <anton@basename.se>

OpenBSD 7.8 August 13, 2024 SECTION(3)