stapbpf PR22330 incomplete WIP :: rudiments of perf_events transport layer
* bpf-internal.h (BPF_MAXPRINTFARGS): New define.
(value::format_type): New field.
(value::value): Set default format_type in constructor.
(globals::perf_event_map_idx): New variable denoting perf_events map.
(globals::NUM_CPUS_PLACEHOLDER): New constant replaced by # CPUs at load time.
(globals::perf_event_type): Initial set of transport msgs.
(globals::interned_str_map): WIP String constants to embed in the ELF file.
(globals::interned_strings): Tracks already interned strings.
* bpf-translate.cxx (print_format_add_tag): Delete both variants.
(bpf_unparser::this_in_arg0): Bugfix -- default to NULL.
(bpf_unparser::emit_transport_msg): WIP New function.
(bpf_unparser::visit_embeddedcode): Allow more printf args, don't add tag.
(intern_string): New function to create an interned string.
(bpf_unparser::emit_print_format): Use helper call for sprintf and perf_event
messages for regular printf.
(bpf_unparser::visit_print_format): Allow more printf args, don't add tag.
(build_internal_globals): Create a perf_events map.
(bpf_unparser::add_prologue): Use globals::internal_map_idx for consistency.
* stapbpf.cxx (perf_fds): New variable (one perf fd per CPU).
(perf_headers): New variable (one ring buffer per CPU).
(perf_event_page_size): New variable.
(perf_event_page_count): New variable.
(perf_event_mmap_size): New variable.
(instantiate_maps): Replace NUM_CPUS_PLACEHOLDER for perf_event maps.
(init_internal_globals): Initialize perf_fds and perf_headers.
(perf_event_handle): WIP Will handle transport messages.
(perf_event_loop): WIP Listens for transport messages.
(print_trace_output): WIP Will be deleted.
(main): Replace print_trace_output with perf_event_loop.
* libbpf.h (bpf_perf_event_ret): New enum from libbpf.
(bpf_perf_event_print_t): New typedef from libbpf.
(bpf_perf_event_read_simple): New function from libbpf.
* libbpf.c (ring_buffer_read_head): New function imitating ring_buffer.h.
(ring_buffer_write_tail): New function imitating ring_buffer.h.
(bpf_perf_event_read_simple): New function from libbpf.