Skip to contentSkip to conversation

dumpcap: fix warnings when primary exits

PATCH Superseded Stephen Hemminger 1 participant 2 messages Jul 22, 2025 – Jul 23, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 dumpcap: fix warnings when primary exits

If primary process exits, there is no point in calling pdump to release resources.

Bugzilla ID: 1760

Fixes cbb44143be74 ("app/dumpcap: add new packet capture application")
---
 app/dumpcap/main.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
app/dumpcap/main.c +6 -5
index 3d3c0dbc66..df649722ec 100644
@@ -541,7 +541,7 @@ monitor_primary(void *arg __rte_unused)
 		rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
 	} else {
 		fprintf(stderr,
-			"Primary process is no longer active, exiting...\n");
+			"\nPrimary process is no longer active, exiting...\n");
 		rte_atomic_store_explicit(&quit_signal, true, rte_memory_order_relaxed);
 	}
 }
@@ -1058,10 +1058,11 @@ int main(int argc, char **argv)
 	else
 		pcap_dump_close(out.dumper);
 
-	cleanup_pdump_resources();
-
-	rte_ring_free(r);
-	rte_mempool_free(mp);
+	if (rte_eal_primary_proc_alive(NULL)) {
+	    cleanup_pdump_resources();
+	    rte_ring_free(r);
+	    rte_mempool_free(mp);
+	}
 
 	return rte_eal_cleanup() ? EXIT_FAILURE : 0;
 }
Signature · 1 line
2.47.2
#1 lore raw

PATCH v2 1/1 dumpcap: fix warnings when primary exits

If primary process exits, there is no point in calling pdump to release resources.

Bugzilla ID: 1760

Fixes cbb44143be74 ("app/dumpcap: add new packet capture application")

---
v2 - fix indentation

 app/dumpcap/main.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
app/dumpcap/main.c +6 -5
index 3d3c0dbc66..5d1df0ad03 100644
@@ -541,7 +541,7 @@ monitor_primary(void *arg __rte_unused)
 		rte_eal_alarm_set(MONITOR_INTERVAL, monitor_primary, NULL);
 	} else {
 		fprintf(stderr,
-			"Primary process is no longer active, exiting...\n");
+			"\nPrimary process is no longer active, exiting...\n");
 		rte_atomic_store_explicit(&quit_signal, true, rte_memory_order_relaxed);
 	}
 }
@@ -1058,10 +1058,11 @@ int main(int argc, char **argv)
 	else
 		pcap_dump_close(out.dumper);
 
-	cleanup_pdump_resources();
-
-	rte_ring_free(r);
-	rte_mempool_free(mp);
+	if (rte_eal_primary_proc_alive(NULL)) {
+		cleanup_pdump_resources();
+		rte_ring_free(r);
+		rte_mempool_free(mp);
+	}
 
 	return rte_eal_cleanup() ? EXIT_FAILURE : 0;
 }
Signature · 1 line
2.47.2