2 * Copyright (C) 2009 Pierre-Marc Fournier
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 #include <sys/types.h>
23 #include <ust/marker.h>
25 void *malloc(size_t size
)
27 static void *(*plibc_malloc
)(size_t size
) = NULL
;
30 if (plibc_malloc
== NULL
) {
31 plibc_malloc
= dlsym(RTLD_NEXT
, "malloc");
32 if (plibc_malloc
== NULL
) {
33 fprintf(stderr
, "mallocwrap: unable to find malloc\n");
38 retval
= plibc_malloc(size
);
40 ust_marker(malloc
, "size %d ptr %p", (int)size
, retval
);
47 static void *(*plibc_free
)(void *ptr
) = NULL
;
49 if (plibc_free
== NULL
) {
50 plibc_free
= dlsym(RTLD_NEXT
, "free");
51 if (plibc_free
== NULL
) {
52 fprintf(stderr
, "mallocwrap: unable to find free\n");
57 ust_marker(free
, "ptr %p", ptr
);
This page took 0.061268 seconds and 4 git commands to generate.