Fix: Silence warning of function having no return value
[lttng-tools.git] / src / bin / lttng-relayd / cmd-2-2.c
CommitLineData
0f907de1
JD
1/*
2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
7591bab1 4 * 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
0f907de1
JD
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License, version 2 only, as
8 * published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope that it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 *
15 * You should have received a copy of the GNU General Public License along with
16 * this program; if not, write to the Free Software Foundation, Inc., 51
17 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
6c1c0768 20#define _LGPL_SOURCE
0f907de1
JD
21#include <assert.h>
22#include <string.h>
23
24#include <common/common.h>
25#include <common/sessiond-comm/relayd.h>
26
f263b7fd
JD
27#include <common/compat/endian.h>
28
0f907de1
JD
29#include "cmd-generic.h"
30#include "cmd-2-1.h"
31#include "utils.h"
32
7591bab1
MD
33/*
34 * cmd_recv_stream_2_2 allocates path_name and channel_name.
35 */
58eb9381 36int cmd_recv_stream_2_2(struct relay_connection *conn,
7591bab1
MD
37 char **ret_path_name, char **ret_channel_name,
38 uint64_t *tracefile_size, uint64_t *tracefile_count)
0f907de1
JD
39{
40 int ret;
41 struct lttcomm_relayd_add_stream_2_2 stream_info;
7591bab1
MD
42 char *path_name = NULL;
43 char *channel_name = NULL;
0f907de1 44
58eb9381 45 ret = cmd_recv(conn->sock, &stream_info, sizeof(stream_info));
0f907de1
JD
46 if (ret < 0) {
47 ERR("Unable to recv stream version 2.2");
48 goto error;
49 }
50
7591bab1
MD
51 path_name = create_output_path(stream_info.pathname);
52 if (!path_name) {
0f907de1
JD
53 PERROR("Path name allocation");
54 ret = -ENOMEM;
55 goto error;
56 }
57
7591bab1
MD
58 channel_name = strdup(stream_info.channel_name);
59 if (!channel_name) {
0f907de1
JD
60 ret = -errno;
61 PERROR("Path name allocation");
62 goto error;
63 }
64
7591bab1
MD
65 *tracefile_size = be64toh(stream_info.tracefile_size);
66 *tracefile_count = be64toh(stream_info.tracefile_count);
67 *ret_path_name = path_name;
68 *ret_channel_name = channel_name;
69 return 0;
0f907de1 70error:
7591bab1
MD
71 free(path_name);
72 free(channel_name);
0f907de1
JD
73 return ret;
74}
This page took 0.033555 seconds and 4 git commands to generate.