KCOV_REMOTE_REGISTER(9)

NAME
kcov_remote_register, kcov_remote_unregister, kcov_remote_enter, kcov_remote_leave - remote kernel code coverage collection interface

SYNOPSIS
#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);

DESCRIPTION
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 an 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.

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

kcov_remote_unregister() 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.

kcov_remote_enter() 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.

kcov_remote_leave() leaves a remote section.

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

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

SEE ALSO
kcov(4)

HISTORY
These functions first appeared in OpenBSD 6.8.