Skip to content

Commit

Permalink
fix(userspace/falco): fixed source of SIGTRAP in stats_writer for zig…
Browse files Browse the repository at this point in the history
… debug builds.

Signed-off-by: Federico Di Pierro <[email protected]>
  • Loading branch information
FedeDP committed Sep 4, 2024
1 parent 2a9a673 commit bca6f31
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion userspace/falco/stats_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,9 @@ void stats_writer::collector::get_metrics_output_fields_wrapper(
if (machine_info)
{
output_fields["evt.hostname"] = machine_info->hostname; /* Explicitly add hostname to log msg in case hostname rule output field is disabled. */
output_fields["falco.host_boot_ts"] = machine_info->boot_ts_epoch;
// This line generates a SIGTRAP in zig debug builds if the casting is removed.
// It seems caused by the pragma pack for the scap_machine_info structure.
output_fields["falco.host_boot_ts"] = (uint64_t)machine_info->boot_ts_epoch;
output_fields["falco.host_num_cpus"] = machine_info->num_cpus;
}
output_fields["falco.outputs_queue_num_drops"] = m_writer->m_outputs->get_outputs_queue_num_drops();
Expand Down

0 comments on commit bca6f31

Please sign in to comment.