X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fconsumer%2Fconsumer-stream.c;h=8318d79d9a09e1451bf90c715d714bb9962f52e0;hp=fe1178795d9cf6d4f0bc1a300041e74690fcb535;hb=ab5be9fa2eb5ba9600a82cd18fd3cfcbac69169a;hpb=3b16476a9b2015e59bb869cdeb07975b8d1ec6c5 diff --git a/src/common/consumer/consumer-stream.c b/src/common/consumer/consumer-stream.c index fe1178795..8318d79d9 100644 --- a/src/common/consumer/consumer-stream.c +++ b/src/common/consumer/consumer-stream.c @@ -1,20 +1,10 @@ /* - * Copyright (C) 2011 - Julien Desfossez - * Mathieu Desnoyers - * Copyright (C) 2013 - David Goulet + * Copyright (C) 2011 Julien Desfossez + * Copyright (C) 2011 Mathieu Desnoyers + * Copyright (C) 2013 David Goulet * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License, version 2 only, as - * published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., 51 - * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #define _LGPL_SOURCE @@ -594,7 +584,7 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream, DBG("Opening stream output file \"%s\"", stream_path); chunk_status = lttng_trace_chunk_open_file(stream->trace_chunk, stream_path, - flags, mode, &stream->out_fd); + flags, mode, &stream->out_fd, false); if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { ERR("Failed to open stream file \"%s\"", stream->name); ret = -1; @@ -605,15 +595,15 @@ int consumer_stream_create_output_files(struct lttng_consumer_stream *stream, if (stream->index_file) { lttng_index_file_put(stream->index_file); } - stream->index_file = lttng_index_file_create_from_trace_chunk( + chunk_status = lttng_index_file_create_from_trace_chunk( stream->trace_chunk, stream->chan->pathname, stream->name, stream->chan->tracefile_size, stream->tracefile_count_current, CTF_INDEX_MAJOR, CTF_INDEX_MINOR, - false); - if (!stream->index_file) { + false, &stream->index_file); + if (chunk_status != LTTNG_TRACE_CHUNK_STATUS_OK) { ret = -1; goto end; } @@ -645,3 +635,13 @@ int consumer_stream_rotate_output_files(struct lttng_consumer_stream *stream) end: return ret; } + +bool consumer_stream_is_deleted(struct lttng_consumer_stream *stream) +{ + /* + * This function does not take a const stream since + * cds_lfht_is_node_deleted was not const before liburcu 0.12. + */ + assert(stream); + return cds_lfht_is_node_deleted(&stream->node.node); +}