summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
18cef80)
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 wait_fd_is_copy;
int cpucount;
};
int wait_fd_is_copy;
int cpucount;
};
if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) {
close(stream->wait_fd);
}
if (stream->wait_fd >= 0 && !stream->wait_fd_is_copy) {
close(stream->wait_fd);
}
- if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd
- && !stream->shm_fd_is_copy) {
+ if (stream->shm_fd >= 0 && stream->wait_fd != stream->shm_fd) {
close(stream->shm_fd);
}
if (!--stream->chan->refcount)
close(stream->shm_fd);
}
if (!--stream->chan->refcount)
if (channel->wait_fd >= 0 && !channel->wait_fd_is_copy) {
close(channel->wait_fd);
}
if (channel->wait_fd >= 0 && !channel->wait_fd_is_copy) {
close(channel->wait_fd);
}
- if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd
- && !channel->shm_fd_is_copy) {
+ if (channel->shm_fd >= 0 && channel->wait_fd != channel->shm_fd) {
close(channel->shm_fd);
}
free(channel);
close(channel->shm_fd);
}
free(channel);
if (!chan->handle) {
return -ENOMEM;
}
if (!chan->handle) {
return -ENOMEM;
}
- /*
- * The channel fds are passed to ustctl, we only keep a copy.
- */
- chan->shm_fd_is_copy = 1;
chan->wait_fd_is_copy = 1;
chan->wait_fd_is_copy = 1;
stream->buf = ustctl_open_stream_read(stream->chan->handle, stream->cpu);
if (!stream->buf)
return -EBUSY;
stream->buf = ustctl_open_stream_read(stream->chan->handle, stream->cpu);
if (!stream->buf)
return -EBUSY;
+ /* ustctl_open_stream_read has closed the shm fd. */
+ stream->wait_fd_is_copy = 1;
+ stream->shm_fd = -1;
+
stream->mmap_base = ustctl_get_mmap_base(stream->chan->handle, stream->buf);
if (!stream->mmap_base) {
return -EINVAL;
}
stream->mmap_base = ustctl_get_mmap_base(stream->chan->handle, stream->buf);
if (!stream->mmap_base) {
return -EINVAL;
}
- /*
- * The stream fds are passed to ustctl, we only keep a copy.
- */
- stream->shm_fd_is_copy = 1;
- stream->wait_fd_is_copy = 1;