Port: Remove _GNU_SOURCE, defined in config.h
[lttng-tools.git] / src / bin / lttng-relayd / cmd-2-4.c
1 /*
2 * Copyright (C) 2013 - Julien Desfossez <jdesfossez@efficios.com>
3 * David Goulet <dgoulet@efficios.com>
4 * 2015 - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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
20 #define _LGPL_SOURCE
21 #include <assert.h>
22 #include <string.h>
23
24 #include <common/common.h>
25 #include <common/sessiond-comm/relayd.h>
26
27 #include <common/compat/endian.h>
28
29 #include "cmd-generic.h"
30 #include "lttng-relayd.h"
31
32 int cmd_create_session_2_4(struct relay_connection *conn,
33 char *session_name, char *hostname,
34 uint32_t *live_timer, bool *snapshot)
35 {
36 int ret;
37 struct lttcomm_relayd_create_session_2_4 session_info;
38
39 ret = cmd_recv(conn->sock, &session_info, sizeof(session_info));
40 if (ret < 0) {
41 ERR("Unable to recv session info version 2.4");
42 goto error;
43 }
44
45 strncpy(session_name, session_info.session_name,
46 sizeof(session_info.session_name));
47 strncpy(hostname, session_info.hostname,
48 sizeof(session_info.hostname));
49 *live_timer = be32toh(session_info.live_timer);
50 *snapshot = be32toh(session_info.snapshot);
51
52 ret = 0;
53
54 error:
55 return ret;
56 }
This page took 0.030514 seconds and 4 git commands to generate.