From ebad2d1d994ac7f66ef7f1d2107fffda9be3992a Mon Sep 17 00:00:00 2001 From: garden Date: Mon, 7 Jul 2008 08:34:02 +0000 Subject: [PATCH] * Added --enable-profile to configure (for profiling) * Added cleanup() in vdeq on successfull termination (thanks huslu) * Added --mod to new syntax in vdeq man page git-svn-id: https://vde.svn.sourceforge.net/svnroot/vde/trunk@300 d37a7db1-d92d-0410-89df-f68f52f87b57 --- vde-2/configure.ac | 13 +++++++++++++ vde-2/man/vdeq.1 | 24 ++++++++++++++++++------ vde-2/src/Makefile.am | 5 +++++ vde-2/src/common/Makefile.am | 5 +++++ vde-2/src/kvde_switch/Makefile.am | 6 ++++++ vde-2/src/lib/Makefile.am | 11 ++++++++--- vde-2/src/slirpvde/Makefile.am | 5 +++++ vde-2/src/vde_cryptcab/Makefile.am | 6 ++++++ vde-2/src/vde_l3/Makefile.am | 5 +++++ vde-2/src/vde_over_ns/Makefile.am | 6 ++++++ vde-2/src/vde_switch/Makefile.am | 5 +++++ vde-2/src/vdeq.c | 5 +++++ vde-2/src/vdetaplib/Makefile.am | 9 +++++++-- 13 files changed, 94 insertions(+), 11 deletions(-) diff --git a/vde-2/configure.ac b/vde-2/configure.ac index ab3fdd8..68338c7 100644 --- a/vde-2/configure.ac +++ b/vde-2/configure.ac @@ -97,6 +97,12 @@ Linux, Darwin and FreeBSD are supported. Contributions are appreciated! :-)]) ;; esac +# Enable profiling options +AC_ARG_ENABLE([profile], + AS_HELP_STRING([--enable-profile], + [Compile with debugging/profiling options]), + [if test $enableval = "yes"; then enable_profile=yes; fi]) + # Enable experimental features AC_ARG_ENABLE([experimental], AS_HELP_STRING([--enable-experimental], @@ -158,6 +164,7 @@ AM_CONDITIONAL(ENABLE_CRYPTCAB, test "$add_cryptcab_support" = yes) AM_CONDITIONAL(ENABLE_PCAP, test "$add_pcap" = yes) AM_CONDITIONAL(CAN_MAKE_LIBVDETAP, test "$can_make_libvdetap" = yes) AM_CONDITIONAL(ENABLE_EXPERIMENTAL, test "$enable_experimental" = yes) +AM_CONDITIONAL(ENABLE_PROFILE, test "$enable_profile" = yes) AM_CONDITIONAL(DARWIN_GCC, test "$darwin_gcc" = yes) if test "x${prefix}" = "xNONE"; then @@ -220,6 +227,12 @@ else echo " - Experimental features... disabled" fi +if test x$enable_profile = "xyes" ; then + echo " + Profiling options....... enabled" +else + echo " - Profiling options....... disabled" +fi + echo echo if ! test x$add_cryptcab_support = "xyes" ; then diff --git a/vde-2/man/vdeq.1 b/vde-2/man/vdeq.1 index 5360b8b..6f31fba 100644 --- a/vde-2/man/vdeq.1 +++ b/vde-2/man/vdeq.1 @@ -4,20 +4,32 @@ vdeq \- Virtual Distributed Ethernet wrapper for QEMU/KVM virtual machines .SH SYNOPSIS .B vdeq .B qemu -.I ... qemu options ... +[ +.B \-\-mod +.I octalmode +] +.I QEMU_OPTIONS .B -net vde[,vlan=n][,sock=socketpath][,port=n] -.I ... other qemu options ... +.I QEMU_OPTIONS .br .B vdeq .B kvm -.I ... kvm options ... +[ +.B \-\-mod +.I octalmode +] +.I KVM_OPTIONS .B -net vde[,vlan=n][,sock=socketpath][,port=n] -.I ... other kvm options ... +.I KVM_OPTIONS .br .B vde\fP{\fIqemu_name\fP} -.I ... qemu options ... +[ +.B \-\-mod +.I octalmode +] +.I QEMU_OPTIONS .B -net vde[,vlan=n][,sock=socketpath][,port=n] -.I ... other qemu options ... +.I QEMU_OPTIONS .br .SH OLD SYNOPSIS diff --git a/vde-2/src/Makefile.am b/vde-2/src/Makefile.am index 79299f3..41fcf9b 100644 --- a/vde-2/src/Makefile.am +++ b/vde-2/src/Makefile.am @@ -32,6 +32,11 @@ endif AM_CPPFLAGS = -I$(top_srcdir)/include LDADD = common/libvdecommon.la -lm +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + vde_autolink_LDADD = $(LDADD) lib/libvdemgmt.la vde_plug2tap_LDADD =$(LDADD) lib/libvdeplug.la vde_plug_LDADD = $(LDADD) lib/libvdeplug.la diff --git a/vde-2/src/common/Makefile.am b/vde-2/src/common/Makefile.am index 938662b..5d276cd 100644 --- a/vde-2/src/common/Makefile.am +++ b/vde-2/src/common/Makefile.am @@ -1,5 +1,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + noinst_LTLIBRARIES = libvdecommon.la libvdecommon_la_SOURCES = cmdparse.c canonicalize.c diff --git a/vde-2/src/kvde_switch/Makefile.am b/vde-2/src/kvde_switch/Makefile.am index 02e59ec..d298113 100644 --- a/vde-2/src/kvde_switch/Makefile.am +++ b/vde-2/src/kvde_switch/Makefile.am @@ -1,4 +1,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include + +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + bin_PROGRAMS = kvde_switch kvde_switch_SOURCES = consmgmt.c \ consmgmt.h \ diff --git a/vde-2/src/lib/Makefile.am b/vde-2/src/lib/Makefile.am index c258c23..e6d84d9 100644 --- a/vde-2/src/lib/Makefile.am +++ b/vde-2/src/lib/Makefile.am @@ -1,16 +1,21 @@ AM_CPPFLAGS = -I$(top_srcdir)/include LIBADD = $(top_srcdir)/src/common/libvdecommon.la +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + lib_LTLIBRARIES = \ libvdesnmp.la \ libvdemgmt.la \ libvdeplug.la libvdesnmp_la_LIBADD = $(LIBADD) -libvdesnmp_la_LDFLAGS = -version-number 0:0:1 -export-dynamic +libvdesnmp_la_LDFLAGS = $(AM_LDFLAGS) -version-number 0:0:1 -export-dynamic libvdemgmt_la_LIBADD = $(LIBADD) -libvdemgmt_la_LDFLAGS = -version-number 0:0:1 -export-dynamic +libvdemgmt_la_LDFLAGS = $(AM_LDFLAGS) -version-number 0:0:1 -export-dynamic libvdeplug_la_LIBADD = $(LIBADD) -libvdeplug_la_LDFLAGS = -version-number 2:1 -export-dynamic +libvdeplug_la_LDFLAGS = $(AM_LDFLAGS) -version-number 2:1 -export-dynamic diff --git a/vde-2/src/slirpvde/Makefile.am b/vde-2/src/slirpvde/Makefile.am index 8652ea3..85cd70f 100644 --- a/vde-2/src/slirpvde/Makefile.am +++ b/vde-2/src/slirpvde/Makefile.am @@ -1,6 +1,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -DVDE AM_CFLAGS = -g -O2 +if ENABLE_PROFILE + AM_CFLAGS += -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + bin_PROGRAMS = slirpvde slirpvde_SOURCES = \ diff --git a/vde-2/src/vde_cryptcab/Makefile.am b/vde-2/src/vde_cryptcab/Makefile.am index 3337df7..42e9206 100644 --- a/vde-2/src/vde_cryptcab/Makefile.am +++ b/vde-2/src/vde_cryptcab/Makefile.am @@ -1,4 +1,10 @@ AM_CPPFLAGS = -I$(top_srcdir)/include bin_PROGRAMS = vde_cryptcab + +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + vde_cryptcab_SOURCES = crc32.c crc32.h cryptcab.h cryptcab.c vde_cryptcab_server.c vde_cryptcab_client.c vde_cryptcab_LDADD = $(top_srcdir)/src/common/libvdecommon.la -lcrypto $(top_srcdir)/src/lib/libvdeplug.la diff --git a/vde-2/src/vde_l3/Makefile.am b/vde-2/src/vde_l3/Makefile.am index 18b319c..1a6f32d 100644 --- a/vde-2/src/vde_l3/Makefile.am +++ b/vde-2/src/vde_l3/Makefile.am @@ -5,6 +5,11 @@ AM_LDFLAGS = -module -avoid-version -export-dynamic AM_LIBTOOLFLAGS = --tag=disable-static AM_CPPFLAGS = -I$(top_srcdir)/include +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS += -pg --coverage +endif + mod_LTLIBRARIES = pfifo.la tbf.la bfifo.la pfifo_la_SOURCES = pfifo.c vde_buff.h tbf_la_SOURCES = tbf.c vde_buff.h diff --git a/vde-2/src/vde_over_ns/Makefile.am b/vde-2/src/vde_over_ns/Makefile.am index 592ccc5..e4dfe17 100644 --- a/vde-2/src/vde_over_ns/Makefile.am +++ b/vde-2/src/vde_over_ns/Makefile.am @@ -1,5 +1,11 @@ AM_CPPFLAGS = -I$(top_srcdir)/include bin_PROGRAMS = vde_over_ns + +if ENABLE_PROFILE + AM_CFLAGS = -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + vde_over_ns_SOURCES = \ vde_over_ns.c \ dns.c \ diff --git a/vde-2/src/vde_switch/Makefile.am b/vde-2/src/vde_switch/Makefile.am index bbe8245..98b5990 100644 --- a/vde-2/src/vde_switch/Makefile.am +++ b/vde-2/src/vde_switch/Makefile.am @@ -27,6 +27,11 @@ vde_switch_LDADD = $(top_srcdir)/src/common/libvdecommon.la AM_CPPFLAGS = -I$(top_srcdir)/include AM_CFLAGS = -Wall +if ENABLE_PROFILE + AM_CFLAGS += -pg --coverage + AM_LDFLAGS = -pg --coverage +endif + if DARWIN_GCC EXP_CFLAGS = -dynamic else diff --git a/vde-2/src/vdeq.c b/vde-2/src/vdeq.c index dc5f105..5806774 100644 --- a/vde-2/src/vdeq.c +++ b/vde-2/src/vdeq.c @@ -492,7 +492,10 @@ int main(int argc, char **argv) exit(1); } else { if ((exit_value < 256) || !daemonize) + { + cleanup(); exit(exit_value); + } } } else { for (i=0; i