From: Julien Desfossez Date: Thu, 23 May 2013 20:13:35 +0000 (-0400) Subject: Fix: close wait_fd on kernel tracing X-Git-Tag: v2.2.0-rc3~50 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4c95e622041958250db73b497097ed93f7715e20;p=lttng-tools.git Fix: close wait_fd on kernel tracing The wait_fd in the kernel consumer streams was not closed causing a leak of FDs in the consumer and never triggering the teardown mechanism in the kernel tracer. This applies for metadata and data stream. Signed-off-by: Julien Desfossez Signed-off-by: David Goulet --- diff --git a/src/common/consumer.c b/src/common/consumer.c index 044a504ce..990db9e26 100644 --- a/src/common/consumer.c +++ b/src/common/consumer.c @@ -463,6 +463,13 @@ void consumer_del_stream(struct lttng_consumer_stream *stream, PERROR("munmap"); } } + + if (stream->wait_fd >= 0) { + ret = close(stream->wait_fd); + if (ret) { + PERROR("close"); + } + } break; case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: @@ -1876,6 +1883,13 @@ void consumer_del_metadata_stream(struct lttng_consumer_stream *stream, PERROR("munmap metadata stream"); } } + + if (stream->wait_fd >= 0) { + ret = close(stream->wait_fd); + if (ret < 0) { + PERROR("close kernel metadata wait_fd"); + } + } break; case LTTNG_CONSUMER32_UST: case LTTNG_CONSUMER64_UST: