Fix: event-notifier: not propagating error counter indexes
[lttng-ust.git] / liblttng-ust / tracef.c
CommitLineData
641c659a
MD
1/*
2 * Copyright (C) 2013-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a copy
5 * of this software and associated documentation files (the "Software"), to deal
6 * in the Software without restriction, including without limitation the rights
7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 * copies of the Software, and to permit persons to whom the Software is
9 * furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20 * SOFTWARE.
21 */
22
641c659a
MD
23#define _LGPL_SOURCE
24#include <stdio.h>
171fcc6f 25#include <helper.h>
641c659a
MD
26
27#define TRACEPOINT_CREATE_PROBES
28#define TRACEPOINT_DEFINE
29#include "lttng-ust-tracef-provider.h"
30
cfd56ee1
MRB
31static inline __attribute__((always_inline))
32void __lttng_ust_vtracef(const char *fmt, va_list ap)
641c659a 33{
641c659a 34 char *msg;
cfd56ee1 35 const int len = vasprintf(&msg, fmt, ap);
641c659a 36
641c659a
MD
37 /* len does not include the final \0 */
38 if (len < 0)
39 goto end;
5dadb547 40 __tracepoint_cb_lttng_ust_tracef___event(msg, len,
171fcc6f 41 LTTNG_UST_CALLER_IP());
641c659a
MD
42 free(msg);
43end:
cfd56ee1
MRB
44 return;
45}
46
47void _lttng_ust_vtracef(const char *fmt, va_list ap)
48{
49 __lttng_ust_vtracef(fmt, ap);
50}
51
52void _lttng_ust_tracef(const char *fmt, ...)
53{
54 va_list ap;
55
56 va_start(ap, fmt);
57 __lttng_ust_vtracef(fmt, ap);
641c659a
MD
58 va_end(ap);
59}
This page took 0.028017 seconds and 4 git commands to generate.