X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=src%2Fbin%2Flttng-relayd%2Fcmd-2-2.c;fp=src%2Fbin%2Flttng-relayd%2Fcmd-2-2.c;h=0450fbf9d7d3c7bde8762fd7e0e4c24a24444372;hb=0f907de1f20c91a2bd1a08ee4d50332d1958754b;hp=0000000000000000000000000000000000000000;hpb=fe4477ee14abb348ce9e167f8b4c09312d67de36;p=lttng-tools.git diff --git a/src/bin/lttng-relayd/cmd-2-2.c b/src/bin/lttng-relayd/cmd-2-2.c new file mode 100644 index 000000000..0450fbf9d --- /dev/null +++ b/src/bin/lttng-relayd/cmd-2-2.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2013 - Julien Desfossez + * 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. + * + * 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 _GNU_SOURCE +#include +#include + +#include +#include + +#include "cmd-generic.h" +#include "cmd-2-1.h" +#include "utils.h" + +int cmd_recv_stream_2_2(struct relay_command *cmd, struct relay_stream *stream) +{ + int ret; + struct lttcomm_relayd_add_stream_2_2 stream_info; + + assert(cmd); + assert(stream); + + ret = cmd_recv(cmd->sock, &stream_info, sizeof(stream_info)); + if (ret < 0) { + ERR("Unable to recv stream version 2.2"); + goto error; + } + + stream->path_name = create_output_path(stream_info.pathname); + if (stream->path_name == NULL) { + PERROR("Path name allocation"); + ret = -ENOMEM; + goto error; + } + + stream->channel_name = strdup(stream_info.channel_name); + if (stream->channel_name == NULL) { + ret = -errno; + PERROR("Path name allocation"); + goto error; + } + + stream->tracefile_size = be64toh(stream_info.tracefile_size); + stream->tracefile_count = be64toh(stream_info.tracefile_count); + ret = 0; + +error: + return ret; +}