/*
- * lttng-ust-comm.c
+ * SPDX-License-Identifier: LGPL-2.1-only
*
* Copyright (C) 2011 David Goulet <david.goulet@polymtl.ca>
* Copyright (C) 2011 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; only
- * version 2.1 of the License.
- *
- * This library 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
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#define _LGPL_SOURCE
#include "../libringbuffer/getcpu.h"
#include "getenv.h"
#include "ust-events-internal.h"
+#include "context-internal.h"
/* Concatenate lttng ust shared library name with its major version number. */
#define LTTNG_UST_LIB_SO_NAME "liblttng-ust.so." __ust_stringify(CONFIG_LTTNG_UST_LIBRARY_VERSION_MAJOR)
/* Counter commands */
[ LTTNG_UST_COUNTER_GLOBAL ] = "Create Counter Global",
[ LTTNG_UST_COUNTER_CPU ] = "Create Counter CPU",
+ [ LTTNG_UST_COUNTER_EVENT ] = "Create Counter Event",
};
static const char *str_timeout;
ret = -ENOSYS;
break;
}
+ case LTTNG_UST_COUNTER_EVENT:
+ {
+ /* Receive struct lttng_ust_counter_event */
+ struct lttng_ust_counter_event counter_event;
+ if (sizeof(counter_event) != lum->u.counter_event.len) {
+ DBG("incorrect counter event data message size: %u", lum->u.counter_event.len);
+ ret = -EINVAL;
+ goto error;
+ }
+ len = ustcomm_recv_unix_sock(sock, &counter_event, sizeof(counter_event));
+ switch (len) {
+ case 0: /* orderly shutdown */
+ ret = 0;
+ goto error;
+ default:
+ if (len == sizeof(counter_event)) {
+ DBG("counter event data received");
+ break;
+ } else if (len < 0) {
+ DBG("Receive failed from lttng-sessiond with errno %d", (int) -len);
+ if (len == -ECONNRESET) {
+ ERR("%s remote end closed connection", sock_info->name);
+ ret = len;
+ goto error;
+ }
+ ret = len;
+ goto error;
+ } else {
+ DBG("incorrect event notifier data message size: %zd", len);
+ ret = -EINVAL;
+ goto error;
+ }
+ }
+ if (ops->cmd)
+ ret = ops->cmd(lum->handle, lum->cmd,
+ (unsigned long) &counter_event,
+ &args, sock_info);
+ else
+ ret = -ENOSYS;
+ break;
+ }
default:
if (ops->cmd)
ret = ops->cmd(lum->handle, lum->cmd,