-
Notifications
You must be signed in to change notification settings - Fork 165
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
new(userspace): plugin api to dump async events #2152
base: master
Are you sure you want to change the base?
Changes from all commits
f9a925b
dcc53a4
b425744
b3601e2
9a8be80
d01b079
6b32c70
7fcd4dc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -159,7 +159,7 @@ bool sinsp::is_initialstate_event(scap_evt* pevent) const { | |
return pevent->type == PPME_CONTAINER_E || pevent->type == PPME_CONTAINER_JSON_E || | ||
pevent->type == PPME_CONTAINER_JSON_2_E || pevent->type == PPME_USER_ADDED_E || | ||
pevent->type == PPME_USER_DELETED_E || pevent->type == PPME_GROUP_ADDED_E || | ||
pevent->type == PPME_GROUP_DELETED_E; | ||
pevent->type == PPME_GROUP_DELETED_E || pevent->type == PPME_ASYNCEVENT_E; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Initial state events parsing enablement for |
||
} | ||
|
||
void sinsp::consume_initialstate_events() { | ||
|
@@ -181,7 +181,7 @@ void sinsp::consume_initialstate_events() { | |
if(res == SCAP_SUCCESS) { | ||
// Setting these to non-null will make sinsp::next use them as a scap event | ||
// to avoid a call to scap_next. In this way, we can avoid the state parsing phase | ||
// once we reach a container-unrelated event. | ||
// once we reach a non-initialstate event. | ||
m_replay_scap_evt = pevent; | ||
m_replay_scap_cpuid = pcpuid; | ||
m_replay_scap_flags = flags; | ||
|
@@ -228,9 +228,9 @@ void sinsp::init() { | |
m_fds_to_remove.clear(); | ||
|
||
// | ||
// If we're reading from file, we try to pre-parse the container events before | ||
// If we're reading from file, we try to pre-parse all initial state-building events before | ||
// importing the thread table, so that thread table filtering will work with | ||
// container filters | ||
// full information. | ||
// | ||
if(is_capture()) { | ||
consume_initialstate_events(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,7 +29,7 @@ extern "C" { | |
// | ||
// todo(jasondellaluce): when/if major changes to v4, check and solve all todos | ||
#define PLUGIN_API_VERSION_MAJOR 3 | ||
#define PLUGIN_API_VERSION_MINOR 9 | ||
#define PLUGIN_API_VERSION_MINOR 10 | ||
#define PLUGIN_API_VERSION_PATCH 0 | ||
|
||
// | ||
|
@@ -1053,6 +1053,25 @@ typedef struct { | |
ss_plugin_rc (*set_async_event_handler)(ss_plugin_t* s, | ||
ss_plugin_owner_t* owner, | ||
const ss_plugin_async_event_handler_t handler); | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't fully enjoy the fact that this is tied to the async events capability. For instances, certain plugins may collect some state through However, I see the point. It also makes sense to "recycle" |
||
// | ||
// Called by the framework when a capture file dump is requested. | ||
// | ||
// Required: no | ||
// Arguments: | ||
// - s: the plugin state, returned by init(). Can be NULL. | ||
// - owner: Opaque pointer to the plugin's owner. Must be passed | ||
// as an argument to the async event function handler. | ||
// - handler: Function handler to be used for sending events to be dumped | ||
// to the plugin's owner. The handler must be invoked with | ||
// the same owner opaque pointer passed to this function, and with | ||
// an event pointer owned and controlled by the plugin. The event | ||
// pointer is not retained by the handler after it returns. | ||
// | ||
// Return value: A ss_plugin_rc with values SS_PLUGIN_SUCCESS or SS_PLUGIN_FAILURE. | ||
ss_plugin_rc (*dump_state)(ss_plugin_t* s, | ||
ss_plugin_owner_t* owner, | ||
const ss_plugin_async_event_handler_t handler); | ||
}; | ||
|
||
// Sets a new plugin configuration when provided by the framework. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume we don't have thread safety issue here compared to the async event handler, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly!