More helper for debuging memory leaks
Signed-off-by: Karsten Keil <kkeil@linux-pingi.de>
This commit is contained in:
parent
c98ff662d6
commit
cc27afc5e4
|
@ -41,8 +41,10 @@ DIST_COMMON = README $(am__configure_deps) $(srcdir)/45-misdn.rules.in \
|
|||
COPYING.LIB ChangeLog INSTALL NEWS config.guess config.sub \
|
||||
depcomp install-sh ltmain.sh missing
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -38,8 +38,10 @@ bin_PROGRAMS = misdn_bridge$(EXEEXT)
|
|||
subdir = bridge
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
|
|
@ -14,7 +14,7 @@ else
|
|||
_USE_SOFTFAX =
|
||||
endif
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Werror -Wall $(_USE_SOFTFAX)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Werror -Wall $(_USE_SOFTFAX) $(_MEMLEAKDEBUG)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
||||
|
|
|
@ -38,8 +38,10 @@ sbin_PROGRAMS = mISDNcapid$(EXEEXT)
|
|||
subdir = capi20
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -204,7 +206,7 @@ mISDNcapid_SOURCES = daemon.c application.c lplci.c mplci.c ncci.c m_capi.h m_ca
|
|||
|
||||
mISDNcapid_LDADD = ../lib/libmisdn.la -lcapi20
|
||||
mISDNcapid_LDFLAGS = -shared
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Werror -Wall $(_USE_SOFTFAX)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Werror -Wall $(_USE_SOFTFAX) $(_MEMLEAKDEBUG)
|
||||
CLEANFILES = *~
|
||||
MISDN_SOCKET_DIR = /var/run/mISDNcapid
|
||||
all: all-am
|
||||
|
|
|
@ -17,14 +17,158 @@
|
|||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "mc_buffer.h"
|
||||
|
||||
#ifdef MI_MCBUFFER_DEBUG
|
||||
#include "m_capi.h"
|
||||
#define MI_MCBUFFER_DEBUG_BACKLOG 100 /* number of buffers before reuse */
|
||||
static pthread_mutex_t mcb_lock;
|
||||
|
||||
static struct mc_buf *mcb_lost_start = NULL;
|
||||
static struct mc_buf *mcb_lost_last = NULL;
|
||||
static struct mc_buf *mcb_free_start = NULL;
|
||||
static struct mc_buf *mcb_free_last = NULL;
|
||||
static int mcb_alloc_count = 0;
|
||||
static int mcb_free_count = 0;
|
||||
static int *crash = NULL;
|
||||
|
||||
void mc_buffer_init(void)
|
||||
{
|
||||
pthread_mutex_init(&mcb_lock, NULL);
|
||||
iprint("Setup mc buffer MI_MCBUFFER_DEBUG\n");
|
||||
}
|
||||
|
||||
void mc_buffer_cleanup(void)
|
||||
{
|
||||
struct mc_buf *mc;
|
||||
const char *deb;
|
||||
struct mISDNhead *hh;
|
||||
|
||||
iprint("Clean up mc buffers %d (min backlog %d) buffers alloc %d lost %d\n",
|
||||
mcb_free_count, MI_MCBUFFER_DEBUG_BACKLOG, mcb_alloc_count,
|
||||
mcb_alloc_count - mcb_free_count);
|
||||
pthread_mutex_lock(&mcb_lock);
|
||||
mI_debug_mask |= MIDEBUG_CAPIMSG;
|
||||
while (mcb_lost_start) {
|
||||
mc = mcb_lost_start;
|
||||
mcb_lost_start = mc->next;
|
||||
eprint("Buffer %p state %x len:%d allocated at %s:%d not freed\n",
|
||||
mc, mc->state, mc->len, mc->filename, mc->line);
|
||||
hh = (struct mISDNhead *)mc->rb;
|
||||
deb = mi_msg_type2str(hh->prim);
|
||||
if (deb)
|
||||
eprint("Buffer: prim %s (%x) pid = %x\n", deb, hh->prim, hh->id);
|
||||
if (mc->cmsg.Command != 0) /* it may crash if Command is undefined */
|
||||
mCapi_cmsg2str(mc);
|
||||
if (mc->l3m) {
|
||||
deb = mi_msg_type2str(mc->l3m->type);
|
||||
eprint("l3m: prim %s pid: %x\n", deb, mc->l3m->pid);
|
||||
free_l3_msg(mc->l3m);
|
||||
}
|
||||
free(mc);
|
||||
mcb_alloc_count--;
|
||||
}
|
||||
while (mcb_free_start) {
|
||||
mc = mcb_free_start;
|
||||
mcb_free_start = mc->next;
|
||||
free(mc);
|
||||
mcb_free_count--;
|
||||
}
|
||||
mcb_free_last = NULL;
|
||||
pthread_mutex_unlock(&mcb_lock);
|
||||
iprint("Clean up mc buffers finished count %d\n", mcb_free_count);
|
||||
}
|
||||
|
||||
struct mc_buf *__alloc_mc_buf(const char *file, int lineno, const char *func)
|
||||
{
|
||||
struct mc_buf *mc;
|
||||
|
||||
pthread_mutex_lock(&mcb_lock);
|
||||
if (mcb_free_count > MI_MCBUFFER_DEBUG_BACKLOG) {
|
||||
mc = mcb_free_start;
|
||||
mcb_free_start = mc->next;
|
||||
mcb_free_count--;
|
||||
memset(mc, 0, sizeof(*mc));
|
||||
mc->state = MSt_reused;
|
||||
} else {
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
mc = __mi_calloc(1, sizeof(struct mc_buf), __FILE__, __LINE__, __PRETTY_FUNCTION__);
|
||||
#else
|
||||
mc = calloc(1, sizeof(struct mc_buf));
|
||||
#endif
|
||||
mc->state = MSt_fresh;
|
||||
mcb_alloc_count++;
|
||||
}
|
||||
strncpy(mc->filename, file, 79);
|
||||
mc->line = lineno;
|
||||
if (mcb_lost_last)
|
||||
mcb_lost_last->next = mc;
|
||||
mc->prev = mcb_lost_last;
|
||||
mc->next = NULL;
|
||||
mcb_lost_last = mc;
|
||||
if (!mcb_lost_start)
|
||||
mcb_lost_start = mc;
|
||||
pthread_mutex_unlock(&mcb_lock);
|
||||
return mc;
|
||||
}
|
||||
|
||||
void __free_mc_buf(struct mc_buf *mc, const char *file, int lineno, const char *func)
|
||||
{
|
||||
/* Best we can do on free error is crash (dump core) to analyse via debugger */
|
||||
if (!mc)
|
||||
*crash = 99; /* crash */
|
||||
else if (mc->state == MSt_free) /* double free */
|
||||
*crash = 100; /* crash */
|
||||
else if (mc->state == Mst_NoAlloc) /* free a not allocated buffer */
|
||||
*crash = 101; /* crash */
|
||||
if (mc->l3m) {
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
__free_l3_msg(mc->l3m, file, lineno, func);
|
||||
#else
|
||||
free_l3_msg(mc->l3m);
|
||||
#endif
|
||||
mc->l3m = NULL;
|
||||
}
|
||||
strncpy(mc->filename, file, 79);
|
||||
mc->line = lineno;
|
||||
mc->state = MSt_free;
|
||||
pthread_mutex_lock(&mcb_lock);
|
||||
if (mc->prev)
|
||||
mc->prev->next = mc->next;
|
||||
if (mc->next)
|
||||
mc->next->prev = mc->prev;
|
||||
if (mcb_lost_last == mc)
|
||||
mcb_lost_last = mc->prev;
|
||||
if (mcb_lost_start == mc)
|
||||
mcb_lost_start = mc->next;
|
||||
|
||||
if (mcb_free_last)
|
||||
mcb_free_last->next = mc;
|
||||
mc->prev = mcb_free_last;
|
||||
mc->next = NULL;
|
||||
mcb_free_last = mc;
|
||||
if (!mcb_free_start)
|
||||
mcb_free_start = mc;
|
||||
mcb_free_count++;
|
||||
pthread_mutex_unlock(&mcb_lock);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
void mc_buffer_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
void mc_buffer_cleanup(void)
|
||||
{
|
||||
}
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
/*
|
||||
* free the message
|
||||
*/
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
void __free_mc_buf(struct mc_buf *mc, const char *file, int lineno, const char *func)
|
||||
{
|
||||
if (mc->l3m)
|
||||
|
@ -33,6 +177,9 @@ void __free_mc_buf(struct mc_buf *mc, const char *file, int lineno, const char *
|
|||
}
|
||||
|
||||
#else
|
||||
/*
|
||||
* free the message
|
||||
*/
|
||||
void free_mc_buf(struct mc_buf *mc)
|
||||
{
|
||||
if (mc->l3m)
|
||||
|
@ -40,7 +187,7 @@ void free_mc_buf(struct mc_buf *mc)
|
|||
free(mc);
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
void mc_clear_cmsg(struct mc_buf *mc)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#ifndef _MC_BUFFER_H
|
||||
#define _MC_BUFFER_H
|
||||
|
||||
#define MI_MCBUFFER_DEBUG 1
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -29,15 +30,42 @@ extern "C" {
|
|||
|
||||
#define MC_RB_SIZE 2112
|
||||
|
||||
#ifdef MI_MCBUFFER_DEBUG
|
||||
enum mstate {
|
||||
Mst_NoAlloc = 0,
|
||||
MSt_fresh = 0x5555aaaa,
|
||||
MSt_free = 0x42424242,
|
||||
MSt_reused = 0x55aa55aa
|
||||
};
|
||||
#endif
|
||||
|
||||
struct mc_buf {
|
||||
struct l3_msg *l3m;
|
||||
_cmsg cmsg;
|
||||
int len;
|
||||
unsigned char rb[MC_RB_SIZE];
|
||||
unsigned char *rp;
|
||||
#ifdef MI_MCBUFFER_DEBUG
|
||||
enum mstate state;
|
||||
char filename[80];
|
||||
int line;
|
||||
struct mc_buf *next;
|
||||
struct mc_buf *prev;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern void mc_buffer_init(void);
|
||||
extern void mc_buffer_cleanup(void);
|
||||
|
||||
#ifdef MI_MCBUFFER_DEBUG
|
||||
extern void __free_mc_buf(struct mc_buf *, const char *file, int lineno, const char *func);
|
||||
|
||||
#define free_mc_buf(p) __free_mc_buf(p, __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
extern struct mc_buf *__alloc_mc_buf(const char *file, int lineno, const char *func);
|
||||
#define alloc_mc_buf() __alloc_mc_buf( __FILE__, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
#else
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
/*
|
||||
* alloc a new mbuffer
|
||||
|
@ -61,6 +89,7 @@ extern void __free_mc_buf(struct mc_buf *, const char *file, int lineno, const
|
|||
*/
|
||||
extern void free_mc_buf(struct mc_buf *);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define mcbuf_rb2cmsg(m) capi_message2cmsg(&(m)->cmsg, (m)->rb)
|
||||
|
||||
|
|
|
@ -37,8 +37,10 @@ host_triplet = @host@
|
|||
subdir = capi20/module
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.68 for mISDNuser 2.0.5.
|
||||
# Generated by GNU Autoconf 2.68 for mISDNuser 2.0.6.
|
||||
#
|
||||
# Report bugs to <i4ldeveloper@isdn4linux.de>.
|
||||
#
|
||||
|
@ -709,8 +709,8 @@ MAKEFLAGS=
|
|||
# Identity of this package.
|
||||
PACKAGE_NAME='mISDNuser'
|
||||
PACKAGE_TARNAME='misdnuser'
|
||||
PACKAGE_VERSION='2.0.5'
|
||||
PACKAGE_STRING='mISDNuser 2.0.5'
|
||||
PACKAGE_VERSION='2.0.6'
|
||||
PACKAGE_STRING='mISDNuser 2.0.6'
|
||||
PACKAGE_BUGREPORT='i4ldeveloper@isdn4linux.de'
|
||||
PACKAGE_URL=''
|
||||
|
||||
|
@ -1459,7 +1459,7 @@ if test "$ac_init_help" = "long"; then
|
|||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures mISDNuser 2.0.5 to adapt to many kinds of systems.
|
||||
\`configure' configures mISDNuser 2.0.6 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
|
@ -1529,7 +1529,7 @@ fi
|
|||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of mISDNuser 2.0.5:";;
|
||||
short | recursive ) echo "Configuration of mISDNuser 2.0.6:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
|
@ -1641,7 +1641,7 @@ fi
|
|||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
mISDNuser configure 2.0.5
|
||||
mISDNuser configure 2.0.6
|
||||
generated by GNU Autoconf 2.68
|
||||
|
||||
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||
|
@ -2437,7 +2437,7 @@ cat >config.log <<_ACEOF
|
|||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by mISDNuser $as_me 2.0.5, which was
|
||||
It was created by mISDNuser $as_me 2.0.6, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
|
@ -3257,7 +3257,7 @@ fi
|
|||
|
||||
# Define the identity of the package.
|
||||
PACKAGE='misdnuser'
|
||||
VERSION='2.0.5'
|
||||
VERSION='2.0.6'
|
||||
|
||||
|
||||
cat >>confdefs.h <<_ACEOF
|
||||
|
@ -8582,6 +8582,10 @@ _lt_linker_boilerplate=`cat conftest.err`
|
|||
$RM -r conftest*
|
||||
|
||||
|
||||
## CAVEAT EMPTOR:
|
||||
## There is no encapsulation within the following macros, do not change
|
||||
## the running order or otherwise move them around unless you know exactly
|
||||
## what you are doing...
|
||||
if test -n "$compiler"; then
|
||||
|
||||
lt_prog_compiler_no_builtin_flag=
|
||||
|
@ -8607,11 +8611,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8610: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8614: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8614: \$? = $ac_status" >&5
|
||||
echo "$as_me:8618: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -8946,11 +8950,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:8949: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:8953: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:8953: \$? = $ac_status" >&5
|
||||
echo "$as_me:8957: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -9051,11 +9055,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9054: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:9058: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:9058: \$? = $ac_status" >&5
|
||||
echo "$as_me:9062: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -9106,11 +9110,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:9109: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:9113: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:9113: \$? = $ac_status" >&5
|
||||
echo "$as_me:9117: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -11474,7 +11478,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11477 "configure"
|
||||
#line 11481 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -11570,7 +11574,7 @@ else
|
|||
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
|
||||
lt_status=$lt_dlunknown
|
||||
cat > conftest.$ac_ext <<_LT_EOF
|
||||
#line 11573 "configure"
|
||||
#line 11577 "configure"
|
||||
#include "confdefs.h"
|
||||
|
||||
#if HAVE_DLFCN_H
|
||||
|
@ -13526,11 +13530,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13529: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13533: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>conftest.err)
|
||||
ac_status=$?
|
||||
cat conftest.err >&5
|
||||
echo "$as_me:13533: \$? = $ac_status" >&5
|
||||
echo "$as_me:13537: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s "$ac_outfile"; then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
# So say no if there are warnings other than the usual output.
|
||||
|
@ -13625,11 +13629,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13628: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13632: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13632: \$? = $ac_status" >&5
|
||||
echo "$as_me:13636: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -13677,11 +13681,11 @@ else
|
|||
-e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \
|
||||
-e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \
|
||||
-e 's:$: $lt_compiler_flag:'`
|
||||
(eval echo "\"\$as_me:13680: $lt_compile\"" >&5)
|
||||
(eval echo "\"\$as_me:13684: $lt_compile\"" >&5)
|
||||
(eval "$lt_compile" 2>out/conftest.err)
|
||||
ac_status=$?
|
||||
cat out/conftest.err >&5
|
||||
echo "$as_me:13684: \$? = $ac_status" >&5
|
||||
echo "$as_me:13688: \$? = $ac_status" >&5
|
||||
if (exit $ac_status) && test -s out/conftest2.$ac_objext
|
||||
then
|
||||
# The compiler can only warn and ignore the option if not recognized
|
||||
|
@ -16189,7 +16193,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
|
|||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by mISDNuser $as_me 2.0.5, which was
|
||||
This file was extended by mISDNuser $as_me 2.0.6, which was
|
||||
generated by GNU Autoconf 2.68. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
|
@ -16255,7 +16259,7 @@ _ACEOF
|
|||
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
|
||||
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
|
||||
ac_cs_version="\\
|
||||
mISDNuser config.status 2.0.5
|
||||
mISDNuser config.status 2.0.6
|
||||
configured by $0, generated by GNU Autoconf 2.68,
|
||||
with options \\"\$ac_cs_config\\"
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ misdntestlayer3_SOURCES = testlayer3.c
|
|||
misdnportinfo_SOURCES = misdnportinfo.c
|
||||
misdntestlayer3_LDADD = ../lib/libmisdn.la
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
|
|
@ -39,8 +39,10 @@ bin_PROGRAMS = misdntestcon$(EXEEXT) misdntestlayer1$(EXEEXT) \
|
|||
subdir = example
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -209,7 +211,7 @@ misdntestlayer1_SOURCES = testlayer1.c
|
|||
misdntestlayer3_SOURCES = testlayer3.c
|
||||
misdnportinfo_SOURCES = misdnportinfo.c
|
||||
misdntestlayer3_LDADD = ../lib/libmisdn.la
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
CLEANFILES = *~
|
||||
all: all-am
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
export _MEMLEAKDEBUG
|
||||
|
||||
SUBDIRS = qmisdnwatch
|
||||
|
||||
CLEANFILES = *~
|
||||
|
|
|
@ -36,8 +36,10 @@ host_triplet = @host@
|
|||
subdir = guitools
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -558,6 +560,7 @@ uninstall-am:
|
|||
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
|
||||
uninstall uninstall-am
|
||||
|
||||
export _MEMLEAKDEBUG
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
|
@ -6,7 +6,7 @@ QMISDNWATCH_S = res/16x16-bullet-gray.png res/16x16-bullet-green.png \
|
|||
src/mainWindow.cpp src/mainWindow.h src/misdn.cpp \
|
||||
src/misdn.h src/Ql1logThread.cpp src/Ql1logThread.h
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
|
||||
CLEANFILES = *~ src/*~ res/*~ Makefile.qt moc_*.cpp qrc_icons.cpp
|
||||
|
||||
|
|
|
@ -37,8 +37,10 @@ host_triplet = @host@
|
|||
subdir = guitools/qmisdnwatch
|
||||
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -200,7 +202,7 @@ QMISDNWATCH_S = res/16x16-bullet-gray.png res/16x16-bullet-green.png \
|
|||
src/mainWindow.cpp src/mainWindow.h src/misdn.cpp \
|
||||
src/misdn.h src/Ql1logThread.cpp src/Ql1logThread.h
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
CLEANFILES = *~ src/*~ res/*~ Makefile.qt moc_*.cpp qrc_icons.cpp
|
||||
EXTRA_DIST = $(QMISDNWATCH_S) $(srcdir)/qmisdnwatch.pro
|
||||
all: all-am
|
||||
|
|
|
@ -39,8 +39,10 @@ DIST_COMMON = $(nobase_include_HEADERS) $(noinst_HEADERS) \
|
|||
$(srcdir)/Makefile.am $(srcdir)/Makefile.in \
|
||||
$(srcdir)/config.h.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
|
|
@ -41,6 +41,13 @@ struct mqueue {
|
|||
int len;
|
||||
};
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
struct lhead {
|
||||
struct lhead *prev;
|
||||
struct lhead *next;
|
||||
};
|
||||
#endif
|
||||
|
||||
struct mbuffer {
|
||||
struct mbuffer *prev;
|
||||
struct mbuffer *next;
|
||||
|
@ -58,6 +65,11 @@ struct mbuffer {
|
|||
int len;
|
||||
struct l3_head l3h;
|
||||
struct l3_msg l3;
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
struct lhead Alist;
|
||||
char d_fn[80];
|
||||
int d_ln;
|
||||
#endif
|
||||
} __attribute__((__may_alias__));
|
||||
|
||||
#define MBUFFER_DATA_SIZE 280
|
||||
|
|
|
@ -26,11 +26,6 @@ extern "C" {
|
|||
#include <pthread.h>
|
||||
#include <mISDN/mISDNcompat.h>
|
||||
|
||||
#undef MEMLEAK_DEBUG
|
||||
#if MEMLEAKDEBUG_COMPILE
|
||||
#define MEMLEAK_DEBUG 1
|
||||
#endif
|
||||
|
||||
struct l3_head {
|
||||
unsigned char type;
|
||||
unsigned char crlen;
|
||||
|
|
|
@ -38,8 +38,10 @@ bin_PROGRAMS = l1oipctrl$(EXEEXT)
|
|||
subdir = l1oip
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
export _MEMLEAKDEBUG
|
||||
|
||||
ASN1_SRC = asn1/asn1.c asn1/asn1_enc.c asn1/asn1_generic.c
|
||||
|
||||
SUPPSERV_SRC = suppserv/aoc.c suppserv/basic_service.c suppserv/component.c \
|
||||
|
@ -18,6 +20,6 @@ lib_LTLIBRARIES = libmisdn.la
|
|||
libmisdn_la_SOURCES = $(MISC_SRC) $(LAYER3_SRC) $(INCLUDE_SRC) $(ASN1_SRC) $(SUPPSERV_SRC)
|
||||
libmisdn_la_LDFLAGS = -version-info 1:0:0
|
||||
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Iinclude $(__MEMLEAKDEBUG)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Iinclude $(_MEMLEAKDEBUG)
|
||||
|
||||
CLEANFILES = *~ */*~
|
||||
|
|
|
@ -37,8 +37,10 @@ host_triplet = @host@
|
|||
subdir = lib
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -241,7 +243,7 @@ INCLUDE_SRC = include/debug.h include/dss1.h include/fsm.h include/helper.h incl
|
|||
lib_LTLIBRARIES = libmisdn.la
|
||||
libmisdn_la_SOURCES = $(MISC_SRC) $(LAYER3_SRC) $(INCLUDE_SRC) $(ASN1_SRC) $(SUPPSERV_SRC)
|
||||
libmisdn_la_LDFLAGS = -version-info 1:0:0
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Iinclude $(__MEMLEAKDEBUG)
|
||||
AM_CPPFLAGS = -I$(top_srcdir)/include -Iinclude $(_MEMLEAKDEBUG)
|
||||
CLEANFILES = *~ */*~
|
||||
all: all-am
|
||||
|
||||
|
@ -680,6 +682,7 @@ uninstall-am: uninstall-libLTLIBRARIES
|
|||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
||||
|
||||
export _MEMLEAKDEBUG
|
||||
|
||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
||||
|
|
|
@ -25,11 +25,6 @@
|
|||
#include <errno.h>
|
||||
#include <mISDN/mISDNcompat.h>
|
||||
|
||||
#undef MEMLEAK_DEBUG
|
||||
#if MEMLEAKDEBUG_COMPILE
|
||||
#define MEMLEAK_DEBUG 1
|
||||
#endif
|
||||
|
||||
#define L3_DEB_WARN 0x00000001
|
||||
#define L3_DEB_PROTERR 0x00000002
|
||||
#define L3_DEB_STATE 0x00000004
|
||||
|
|
|
@ -29,16 +29,111 @@ static int Max_Cache;
|
|||
#define MB_TYP_L2 2
|
||||
#define MB_TYP_L3 3
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
static struct Aqueue {
|
||||
struct lhead Alist;
|
||||
pthread_mutex_t lock;
|
||||
int len;
|
||||
} AllocQueue;
|
||||
|
||||
static inline void
|
||||
Aqueue_init(struct Aqueue *q)
|
||||
{
|
||||
pthread_mutex_init(&q->lock, NULL);
|
||||
q->len = 0;
|
||||
q->Alist.prev = &q->Alist;
|
||||
q->Alist.next = &q->Alist;
|
||||
}
|
||||
|
||||
static inline int Amqueue_len(struct Aqueue *q)
|
||||
{
|
||||
return q->len ;
|
||||
}
|
||||
|
||||
static inline void __list_add(struct lhead *new, struct lhead *prev, struct lhead *next)
|
||||
{
|
||||
next->prev = new;
|
||||
new->next = next;
|
||||
new->prev = prev;
|
||||
prev->next = new;
|
||||
}
|
||||
|
||||
static inline void __list_del(struct lhead * prev, struct lhead * next)
|
||||
{
|
||||
next->prev = prev;
|
||||
prev->next = next;
|
||||
}
|
||||
|
||||
static inline void Aqueue_head(struct Aqueue *q, struct mbuffer *newm)
|
||||
{
|
||||
pthread_mutex_lock(&q->lock);
|
||||
q->len++;
|
||||
__list_add(&newm->Alist, &q->Alist, q->Alist.next);
|
||||
pthread_mutex_unlock(&q->lock);
|
||||
}
|
||||
|
||||
|
||||
static inline void Aqueue_tail(struct Aqueue *q, struct mbuffer *newm)
|
||||
{
|
||||
pthread_mutex_lock(&q->lock);
|
||||
q->len++;
|
||||
__list_add(&newm->Alist, q->Alist.prev, &q->Alist);
|
||||
pthread_mutex_unlock(&q->lock);
|
||||
}
|
||||
|
||||
|
||||
static inline struct mbuffer *Adequeue(struct Aqueue *q)
|
||||
{
|
||||
struct mbuffer *m;
|
||||
struct lhead *le;
|
||||
|
||||
pthread_mutex_lock(&q->lock);
|
||||
if (q->len) {
|
||||
le = q->Alist.next;
|
||||
__list_del(le->prev, le->next);
|
||||
q->len--;
|
||||
m = container_of(le, struct mbuffer, Alist);
|
||||
} else
|
||||
m = NULL;
|
||||
pthread_mutex_unlock(&q->lock);
|
||||
return m;
|
||||
}
|
||||
static void Aqueue_remove(struct Aqueue *q, struct mbuffer *mb)
|
||||
{
|
||||
pthread_mutex_lock(&q->lock);
|
||||
__list_del(mb->Alist.prev, mb->Alist.next);
|
||||
q->len--;
|
||||
pthread_mutex_unlock(&q->lock);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
init_mbuffer(int max_cache)
|
||||
{
|
||||
mqueue_init(&free_queue_l2);
|
||||
mqueue_init(&free_queue_l3);
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
Aqueue_init(&AllocQueue);
|
||||
#endif
|
||||
if (max_cache < MIN_CACHE)
|
||||
max_cache = MIN_CACHE;
|
||||
Max_Cache = max_cache;
|
||||
}
|
||||
|
||||
static void
|
||||
__mqueue_purge(struct mqueue *q) {
|
||||
struct mbuffer *mb;
|
||||
|
||||
while ((mb = mdequeue(q))!=NULL) {
|
||||
if (mb->head)
|
||||
free(mb->head);
|
||||
if (mb->chead)
|
||||
free(mb->chead);
|
||||
free(mb);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MEMLEAK_DEBUG
|
||||
|
||||
static struct mbuffer *
|
||||
|
@ -94,6 +189,9 @@ _alloc_mbuffer(int typ, const char *file, int lineno, const char *func)
|
|||
m = _new_mbuffer(typ, file, lineno, func);
|
||||
else
|
||||
__mi_reuse(m, file, lineno, func);
|
||||
strncpy(m->d_fn, file, 79);
|
||||
m->d_ln = lineno;
|
||||
Aqueue_tail(&AllocQueue, m);
|
||||
return m;
|
||||
}
|
||||
|
||||
|
@ -112,6 +210,9 @@ __free_mbuffer(struct mbuffer *m, const char *file, int lineno, const char *func
|
|||
m->refcnt--;
|
||||
return;
|
||||
}
|
||||
Aqueue_remove(&AllocQueue, m);
|
||||
strncpy(m->d_fn, file, 79);
|
||||
m->d_ln = -lineno;
|
||||
if (m->list) {
|
||||
if (m->list == &free_queue_l3)
|
||||
dprint(DBGM_L3BUFFER, "%s l3 buffer %p already freed: %lx\n", __FUNCTION__, m, (unsigned long)__builtin_return_address(0));
|
||||
|
@ -173,7 +274,32 @@ __free_l3_msg(struct l3_msg *l3m, const char *file, int lineno, const char *func
|
|||
m = container_of(l3m, struct mbuffer, l3);
|
||||
__free_mbuffer(m, file, lineno, func);
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_mbuffer(void)
|
||||
{
|
||||
struct mbuffer *m;
|
||||
int ql;
|
||||
|
||||
__mqueue_purge(&free_queue_l2);
|
||||
__mqueue_purge(&free_queue_l3);
|
||||
ql = Amqueue_len(&AllocQueue);
|
||||
iprint("AllocQueue has %d lost mbuffer\n", ql);
|
||||
if (ql) {
|
||||
m = Adequeue(&AllocQueue);
|
||||
while (m) {
|
||||
wprint("Lost mbuffer allocated %s:%d typ=%s len=%d\n",
|
||||
m->d_fn, m->d_ln, m->chead ? "L3" : "L2", m->len);
|
||||
wprint(" H: prim=%s id=%d L3: prim=%s pid=%d\n",
|
||||
_mi_msg_type2str(m->h->prim), m->h->id, _mi_msg_type2str(m->l3.type), m->l3.pid);
|
||||
free_mbuffer(m);
|
||||
m = Adequeue(&AllocQueue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static struct mbuffer *
|
||||
_new_mbuffer(int typ)
|
||||
{
|
||||
|
@ -302,6 +428,13 @@ free_l3_msg(struct l3_msg *l3m)
|
|||
m = container_of(l3m, struct mbuffer, l3);
|
||||
free_mbuffer(m);
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_mbuffer(void)
|
||||
{
|
||||
__mqueue_purge(&free_queue_l2);
|
||||
__mqueue_purge(&free_queue_l3);
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
|
@ -313,22 +446,3 @@ l3_msg_increment_refcnt(struct l3_msg *l3m)
|
|||
m->refcnt++;
|
||||
}
|
||||
|
||||
static void
|
||||
__mqueue_purge(struct mqueue *q) {
|
||||
struct mbuffer *mb;
|
||||
|
||||
while ((mb = mdequeue(q))!=NULL) {
|
||||
if (mb->head)
|
||||
free(mb->head);
|
||||
if (mb->chead)
|
||||
free(mb->chead);
|
||||
free(mb);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
cleanup_mbuffer(void)
|
||||
{
|
||||
__mqueue_purge(&free_queue_l2);
|
||||
__mqueue_purge(&free_queue_l3);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,6 @@ misdn_rename_SOURCES = rename.c
|
|||
misdn_cleanl2_SOURCES = cleanl2.c
|
||||
misdn_E1test_SOURCES = E1test.c
|
||||
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
|
||||
CLEANFILES = *~
|
||||
|
|
|
@ -40,8 +40,10 @@ sbin_PROGRAMS = misdn_rename$(EXEEXT) misdn_cleanl2$(EXEEXT)
|
|||
subdir = tools
|
||||
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
|
||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
||||
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
|
||||
$(top_srcdir)/configure.ac
|
||||
am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
|
||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
||||
$(top_srcdir)/acinclude.m4 $(top_srcdir)/configure.ac
|
||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
||||
$(ACLOCAL_M4)
|
||||
mkinstalldirs = $(install_sh) -d
|
||||
|
@ -214,7 +216,7 @@ misdn_log_SOURCES = loghex.c
|
|||
misdn_rename_SOURCES = rename.c
|
||||
misdn_cleanl2_SOURCES = cleanl2.c
|
||||
misdn_E1test_SOURCES = E1test.c
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/include
|
||||
AM_CPPFLAGS = -Wall -I$(top_srcdir)/include $(_MEMLEAKDEBUG)
|
||||
CLEANFILES = *~
|
||||
all: all-am
|
||||
|
||||
|
|
Loading…
Reference in New Issue