Tracepoint API namespacing 'TRACEPOINT_CREATE_PROBES'
[lttng-ust.git] / src / lib / lttng-ust / tracef.c
... / ...
CommitLineData
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
15static inline
16void __lttng_ust_vtracef(const char *fmt, va_list ap)
17 __attribute__((always_inline, format(printf, 1, 0)));
18static inline
19void __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);
30end:
31 return;
32}
33
34/*
35 * FIXME: We should include <lttng/tracef.h> for the declarations here, but it
36 * fails with tracepoint magic above my paygrade.
37 */
38
39void _lttng_ust_vtracef(const char *fmt, va_list ap)
40 __attribute__((format(printf, 1, 0)));
41void _lttng_ust_vtracef(const char *fmt, va_list ap)
42{
43 __lttng_ust_vtracef(fmt, ap);
44}
45
46void _lttng_ust_tracef(const char *fmt, ...)
47 __attribute__((format(printf, 1, 2)));
48void _lttng_ust_tracef(const char *fmt, ...)
49{
50 va_list ap;
51
52 va_start(ap, fmt);
53 __lttng_ust_vtracef(fmt, ap);
54 va_end(ap);
55}
This page took 0.022798 seconds and 4 git commands to generate.