diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2023-06-27 18:46:20 +0000 |
commit | c933bf105b0de89e3fd524517daf163a16dd0d44 (patch) | |
tree | 50cb525f946e4ac65a416178766e2e124167a40f /collectors/ebpf.plugin/ebpf_fd.c | |
parent | Releasing debian version 1.40.0-2. (diff) | |
download | netdata-c933bf105b0de89e3fd524517daf163a16dd0d44.tar.xz netdata-c933bf105b0de89e3fd524517daf163a16dd0d44.zip |
Merging upstream version 1.40.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/ebpf.plugin/ebpf_fd.c')
-rw-r--r-- | collectors/ebpf.plugin/ebpf_fd.c | 31 |
1 files changed, 10 insertions, 21 deletions
diff --git a/collectors/ebpf.plugin/ebpf_fd.c b/collectors/ebpf.plugin/ebpf_fd.c index 6d3868952..d39e6ae20 100644 --- a/collectors/ebpf.plugin/ebpf_fd.c +++ b/collectors/ebpf.plugin/ebpf_fd.c @@ -370,39 +370,28 @@ static inline int ebpf_fd_load_and_attach(struct fd_bpf *obj, ebpf_module_t *em) *****************************************************************/ /** - * FD Free + * FD Exit * - * Cleanup variables after child threads to stop + * Cancel child thread and exit. * * @param ptr thread data. */ -static void ebpf_fd_free(ebpf_module_t *em) +static void ebpf_fd_exit(void *ptr) { - pthread_mutex_lock(&ebpf_exit_cleanup); - em->enabled = NETDATA_THREAD_EBPF_STOPPING; - pthread_mutex_unlock(&ebpf_exit_cleanup); + ebpf_module_t *em = (ebpf_module_t *)ptr; - freez(fd_values); - freez(fd_vector); +#ifdef LIBBPF_MAJOR_VERSION + if (fd_bpf_obj) + fd_bpf__destroy(fd_bpf_obj); +#endif + if (em->objects) + ebpf_unload_legacy_code(em->objects, em->probe_links); pthread_mutex_lock(&ebpf_exit_cleanup); em->enabled = NETDATA_THREAD_EBPF_STOPPED; pthread_mutex_unlock(&ebpf_exit_cleanup); } -/** - * FD Exit - * - * Cancel child thread and exit. - * - * @param ptr thread data. - */ -static void ebpf_fd_exit(void *ptr) -{ - ebpf_module_t *em = (ebpf_module_t *)ptr; - ebpf_fd_free(em); -} - /***************************************************************** * * MAIN LOOP |