Port: Use LTTNG_NAME_MAX instead of NAME_MAX
[lttng-tools.git] / src / bin / lttng-relayd / cmd-generic.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
20#define _GNU_SOURCE
6c1c0768 21#define _LGPL_SOURCE
0f907de1
JD
22#include <assert.h>
23
24#include <common/common.h>
25
26#include "cmd-generic.h"
27
28int cmd_recv(struct lttcomm_sock *sock, void *buf, size_t len)
29{
30 int ret;
31
32 assert(sock);
33 assert(buf);
34
35 ret = sock->ops->recvmsg(sock, buf, len, 0);
36 if (ret < len) {
37 if (ret == 0) {
38 /* Orderly shutdown. Not necessary to print an error. */
39 DBG("Socket %d did an orderly shutdown", sock->fd);
40 } else {
41 ERR("Relay didn't receive valid add_stream struct size. "
8fd623e0 42 "Expected %zu, got %d", len, ret);
0f907de1
JD
43 }
44 ret = -1;
45 goto error;
46 }
47
48error:
49 return ret;
50}
This page took 0.039358 seconds and 5 git commands to generate.