e321ee07a497c3043243f7d8199a26d423743a5a
[lttng-ust.git] / src / lib / lttng-ust / tracef.c
1 /*
2 * SPDX-License-Identifier: MIT
3 *
4 * Copyright (C) 2013-2014 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 */
6
7 #define _LGPL_SOURCE
8 #include <stdio.h>
9 #include "common/macros.h"
10
11 #define LTTNG_UST_TRACEPOINT_CREATE_PROBES
12 #define LTTNG_UST_TRACEPOINT_DEFINE
13 #include "lttng-ust-tracef-provider.h"
14
15 static inline
16 void lttng_ust___vtracef(const char *fmt, va_list ap)
17 __attribute__((always_inline, format(printf, 1, 0)));
18 static inline
19 void lttng_ust___vtracef(const char *fmt, va_list ap)
20 {
21 char *msg;
22 const int len = vasprintf(&msg, fmt, ap);
23
24 /* len does not include the final \0 */
25 if (len < 0)
26 goto end;
27 lttng_ust_tracepoint_cb_lttng_ust_tracef___event(msg, len,
28 LTTNG_UST_CALLER_IP());
29 free(msg);
30 end:
31 return;
32 }
33
34 void lttng_ust__vtracef(const char *fmt, va_list ap)
35 __attribute__((format(printf, 1, 0)));
36 void lttng_ust__vtracef(const char *fmt, va_list ap)
37 {
38 lttng_ust___vtracef(fmt, ap);
39 }
40
41 void lttng_ust__tracef(const char *fmt, ...)
42 __attribute__((format(printf, 1, 2)));
43 void lttng_ust__tracef(const char *fmt, ...)
44 {
45 va_list ap;
46
47 va_start(ap, fmt);
48 lttng_ust___vtracef(fmt, ap);
49 va_end(ap);
50 }
This page took 0.030048 seconds and 3 git commands to generate.