OpenBSD manual page server

Manual Page Search Parameters

KCOV_REMOTE_REGISTER(9) Kernel Developer's Manual KCOV_REMOTE_REGISTER(9)

kcov_remote_register, kcov_remote_unregister, kcov_remote_enter, kcov_remote_leaveremote kernel code coverage collection interface

#include <sys/kcov.h>

void
kcov_remote_register(int subsystem, void *id);

void
kcov_remote_unregister(int subsystem, void *id);

void
kcov_remote_enter(int subsystem, void *id);

void
kcov_remote_leave(int subsystem, void *id);

These functions provide an interface to collect code coverage from various kernel subsystems using kcov(4). The subsystem must be one of the following:

#define KCOV_REMOTE_COMMON 0

The id must be a unique identifier for a resource tied to subsystem that is known both by kernel and user space. For instance, a network interface driver could form a subsystem using the unique interface identifier as the id.

() registers a new instance of the given subsystem. Calling this function more than once with the same arguments is idempotent.

() unregisters an existing instance of the given subsystem, if present. If one or many threads are currently within a remote section, kcov_remote_unregister() will sleep until all the sections have been left.

() enters a remote section. If the current thread has kcov(4) enabled, code coverage will collected inside the remote section. Remote sections may not be nested.

() leaves a remote section.

kcov_remote_register() and kcov_remote_unregister() can be called from process context. kcov_remote_enter() and kcov_remote_leave() can be called from interrupt and process context.

These functions are implemented in sys/dev/kcov.c.

kcov(4)

These functions first appeared in OpenBSD 6.8.

Anton Lindqvist <anton@openbsd.org>

February 1, 2021 OpenBSD-7.2