ust: be able to list markers using ust
[lttng-ust.git] / libmallocwrap / mallocwrap.c
CommitLineData
e541a28d
PMF
1#define _GNU_SOURCE
2#include <dlfcn.h>
3#include <sys/types.h>
4#include <stdio.h>
5
fbd8191b
PMF
6#include "marker.h"
7
e541a28d
PMF
8void *(*plibc_malloc)(size_t size) = NULL;
9
10void *malloc(size_t size)
11{
12 if(plibc_malloc == NULL) {
13 plibc_malloc = dlsym(RTLD_NEXT, "malloc");
14 if(plibc_malloc == NULL) {
15 fprintf(stderr, "mallocwrap: unable to find malloc\n");
16 return NULL;
17 }
18 }
fbd8191b
PMF
19
20 trace_mark(ust, malloc, "%d", (int)size);
21
e541a28d
PMF
22 fprintf(stderr, "mallocating size %d\n", size);
23 return plibc_malloc(size);
24}
fbd8191b
PMF
25
26MARKER_LIB
This page took 0.024314 seconds and 4 git commands to generate.