Skip to content

Commit

Permalink
docs(scap): document why we initialize the engine first
Browse files Browse the repository at this point in the history
Signed-off-by: Grzegorz Nosek <[email protected]>
  • Loading branch information
gnosek committed Oct 26, 2023
1 parent 0deb231 commit 053d38f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions userspace/libscap/scap.c
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@ int32_t scap_init(scap_t* handle, scap_open_args* oargs, const struct scap_vtabl

ASSERT(vtable != NULL);

// Initialize the engine before the platform
//
// While the two would ideally be independent, the linux platform can delegate some
// functionality to an engine through a scap_linux_vtable (currently only the kmod
// engine provides this).
//
// The kmod hooks in the scap_linux_vtable need an initialized engine, since they call
// ioctls on the driver fd, so we need to initialize the engine before the platform.

rc = scap_init_engine(handle, oargs, vtable);
if(rc != SCAP_SUCCESS)
{
Expand Down

0 comments on commit 053d38f

Please sign in to comment.