summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
ee77a7b)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
size_t mmap_len;
struct lttng_ust_shm_handle *handle;
int nr_streams;
size_t mmap_len;
struct lttng_ust_shm_handle *handle;
int nr_streams;
+ int shm_fd_is_copy;
+ int wait_fd_is_copy;
};
/* Forward declaration for UST. */
};
/* Forward declaration for UST. */
void *mmap_base;
size_t mmap_len;
enum lttng_event_output output; /* splice or mmap */
void *mmap_base;
size_t mmap_len;
enum lttng_event_output output; /* splice or mmap */
+ int shm_fd_is_copy;
+ int wait_fd_is_copy;
/* For UST */
struct lttng_ust_lib_ring_buffer *buf;
int cpu;
/* For UST */
struct lttng_ust_lib_ring_buffer *buf;
int cpu;
if (stream->out_fd >= 0) {
close(stream->out_fd);
}
if (stream->out_fd >= 0) {
close(stream->out_fd);
}
- if (stream->wait_fd >= 0) {
+ if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) {
close(stream->wait_fd);
}
close(stream->wait_fd);
}
- if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd) {
+ if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd
+ && !stream->shm_fd_is_copy) {
close(stream->shm_fd);
}
if (!--stream->chan->refcount)
close(stream->shm_fd);
}
if (!--stream->chan->refcount)
- if (channel->wait_fd >= 0) {
+ if (channel->wait_fd >= 0 && !channel->wait_fd_is_copy) {
close(channel->wait_fd);
}
close(channel->wait_fd);
}
- if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd) {
+ if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd
+ && !channel->shm_fd_is_copy) {
close(channel->shm_fd);
}
free(channel);
close(channel->shm_fd);
}
free(channel);
- * The channel shm and wait fds are passed to ustctl, set them
- * to -1 here.
+ * The channel fds are passed to ustctl, we only keep a copy.
- chan->shm_fd = -1;
- chan->wait_fd = -1;
+ chan->shm_fd_is_copy = 1;
+ chan->wait_fd_is_copy = 1;
+
- * The stream shm and wait fds are passed to ustctl, set them to
- * -1 here.
+ * The stream fds are passed to ustctl, we only keep a copy.
- stream->shm_fd = -1;
- stream->wait_fd = -1;
+ stream->shm_fd_is_copy = 1;
+ stream->wait_fd_is_copy = 1;