Skip to content

Commit bca6f31

Browse files
committed
fix(userspace/falco): fixed source of SIGTRAP in stats_writer for zig debug builds.
Signed-off-by: Federico Di Pierro <[email protected]>
1 parent 2a9a673 commit bca6f31

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

userspace/falco/stats_writer.cpp

+3-1
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,9 @@ void stats_writer::collector::get_metrics_output_fields_wrapper(
336336
if (machine_info)
337337
{
338338
output_fields["evt.hostname"] = machine_info->hostname; /* Explicitly add hostname to log msg in case hostname rule output field is disabled. */
339-
output_fields["falco.host_boot_ts"] = machine_info->boot_ts_epoch;
339+
// This line generates a SIGTRAP in zig debug builds if the casting is removed.
340+
// It seems caused by the pragma pack for the scap_machine_info structure.
341+
output_fields["falco.host_boot_ts"] = (uint64_t)machine_info->boot_ts_epoch;
340342
output_fields["falco.host_num_cpus"] = machine_info->num_cpus;
341343
}
342344
output_fields["falco.outputs_queue_num_drops"] = m_writer->m_outputs->get_outputs_queue_num_drops();

0 commit comments

Comments
 (0)