Mirror of the lttng-dev mailing list
 help / color / mirror / Atom feed
* [ltt-dev] [UST PATCH] libust: Fix multiple fd close during fork
@ 2011-02-23 12:40 Nils Carlson
  2011-02-23 12:43 ` Nils Carlson
  0 siblings, 1 reply; 10+ messages in thread
From: Nils Carlson @ 2011-02-23 12:40 UTC (permalink / raw)


Remove superfluous fd closes during fork and also destroy all
traces instead of just "auto".

Reported-by: Yannick Brosseau <yannick.brosseau at gmail.com>
Signed-off-by: Nils Carlson <nils.carlson at ericsson.com>
---
 libust/tracectl.c |   17 ++++++++---------
 1 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/libust/tracectl.c b/libust/tracectl.c
index 1bd7229..1fc0118 100644
--- a/libust/tracectl.c
+++ b/libust/tracectl.c
@@ -1569,6 +1569,7 @@ static void ust_fork(void)
 {
 	struct ust_buffer *buf, *buf_tmp;
 	struct ustcomm_sock *sock, *sock_tmp;
+	struct ust_trace *trace, *trace_tmp;
 	int result;
 
 	/* FIXME: technically, the locks could have been taken before the fork */
@@ -1589,18 +1590,16 @@ static void ust_fork(void)
 	/* Delete all blocked consumers */
 	cds_list_for_each_entry_safe(buf, buf_tmp, &open_buffers_list,
 				 open_buffers_list) {
-		result = close(buf->data_ready_fd_read);
-		if (result == -1) {
-			PERROR("close");
-		}
-		result = close(buf->data_ready_fd_write);
-		if (result == -1) {
-			PERROR("close");
-		}
 		cds_list_del(&buf->open_buffers_list);
 	}
 
-	ltt_trace_destroy("auto", 1);
+	/*
+	 * FIXME: This could be prettier, we loop over the list twice and
+	 * following good locking practice should lock around the loop
+	 */
+	cds_list_for_each_entry_safe(trace, trace_tmp, &ltt_traces.head, list) {
+		ltt_trace_destroy(trace->trace_name, 1);
+	}
 
 	/* Clean up the listener socket and epoll, keeping the scoket file */
 	ustcomm_del_named_sock(listen_sock, 1);
-- 
1.7.1





^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2011-02-23 18:54 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-23 12:40 [ltt-dev] [UST PATCH] libust: Fix multiple fd close during fork Nils Carlson
2011-02-23 12:43 ` Nils Carlson
2011-02-23 14:46   ` Yannick Brosseau
2011-02-23 15:54     ` Nils Carlson
2011-02-23 15:40       ` Mathieu Desnoyers
     [not found]       ` <BLU0-SMTP169B3ABCBCF5E7D9DB528B96DB0@phx.gbl>
2011-02-23 16:03         ` Nils Carlson
2011-02-23 15:49           ` Mathieu Desnoyers
     [not found]           ` <BLU0-SMTP63BB495BA90023E1C54C0E96DB0@phx.gbl>
2011-02-23 16:14             ` Nils Carlson
2011-02-23 16:16               ` Mathieu Desnoyers
     [not found]               ` <BLU0-SMTP763331DEBE2782CAA18D5F96DB0@phx.gbl>
2011-02-23 18:54                 ` Nils Carlson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox