From: Sebastian Harl Date: Sun, 11 Oct 2009 17:18:45 +0000 (+0200) Subject: patches: Removed java-fix-jvm-start.dpatch. X-Git-Tag: collectd-4.8.1-1~12 X-Git-Url: https://git.tokkee.org/?p=pkg-collectd.git;a=commitdiff_plain;h=30bea3532340626edf1be0c5e4fab7644e10721d patches: Removed java-fix-jvm-start.dpatch. This patch has been included upstream. --- diff --git a/debian/changelog b/debian/changelog index 52a71a5..378e5fd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,8 +19,9 @@ collectd (4.8.1-1) unstable; urgency=low - Removed bts535787-powerdns-fix-localsocket.dpatch - included upstream. - Removed bts541953-curl-followlocation.dpatch - included upstream. - Removed bts542859-df-fix-ignorelist.dpatch - included upstream. + - Removed java-fix-jvm-start.dpatch - included upstream. - -- Sebastian Harl Sun, 11 Oct 2009 19:15:33 +0200 + -- Sebastian Harl Sun, 11 Oct 2009 19:18:29 +0200 collectd (4.7.2-1) unstable; urgency=low diff --git a/debian/patches/00list b/debian/patches/00list index 7297c98..680577a 100644 --- a/debian/patches/00list +++ b/debian/patches/00list @@ -3,5 +3,4 @@ collection_conf_path.dpatch network-fix-cacheflush.dpatch libvirt-reconnect.dpatch plugin-fix-unregister.dpatch -java-fix-jvm-start.dpatch diff --git a/debian/patches/java-fix-jvm-start.dpatch b/debian/patches/java-fix-jvm-start.dpatch deleted file mode 100755 index b21629d..0000000 --- a/debian/patches/java-fix-jvm-start.dpatch +++ /dev/null @@ -1,127 +0,0 @@ -#! /bin/sh /usr/share/dpatch/dpatch-run -## java-fix-jvm-start.dpatch by Florian Forster -## -## DP: java plugin: Wait with the configuration until the daemon has forked. -## DP -## DP: Passing the configuration to Java-based plugins requires the JVM to be -## DP: active and running. However, the JVM starts some threads that are lost -## DP: when the daemon forks to the background. -## DP: -## DP: This patch changes the behavior of the Java plugin to copy the -## DP: configuration blocks found to a local variable and run the configuration -## DP: of the Java-based plugins from the `init' callback, because it is -## DP: invoked after the daemon has forked to the background. - -@DPATCH@ - -diff a/src/java.c b/src/java.c ---- a/src/java.c -+++ b/src/java.c -@@ -93,6 +93,8 @@ static cjni_callback_info_t *java_callbacks = NULL; - static size_t java_callbacks_num = 0; - static pthread_mutex_t java_callbacks_lock = PTHREAD_MUTEX_INITIALIZER; - -+static oconfig_item_t *config_block = NULL; -+ - /* - * Prototypes - * -@@ -2304,7 +2306,7 @@ static int cjni_config_plugin_block (oconfig_item_t *ci) /* {{{ */ - return (0); - } /* }}} int cjni_config_plugin_block */ - --static int cjni_config (oconfig_item_t *ci) /* {{{ */ -+static int cjni_config_perform (oconfig_item_t *ci) /* {{{ */ - { - int success; - int errors; -@@ -2359,7 +2361,56 @@ static int cjni_config (oconfig_item_t *ci) /* {{{ */ - } - - return (0); --} /* }}} int cjni_config */ -+} /* }}} int cjni_config_perform */ -+ -+/* Copy the children of `ci' to the global `config_block' variable. */ -+static int cjni_config_callback (oconfig_item_t *ci) /* {{{ */ -+{ -+ oconfig_item_t *ci_copy; -+ oconfig_item_t *tmp; -+ -+ assert (ci != NULL); -+ if (ci->children_num == 0) -+ return (0); /* nothing to do */ -+ -+ ci_copy = oconfig_clone (ci); -+ if (ci_copy == NULL) -+ { -+ ERROR ("java plugin: oconfig_clone failed."); -+ return (-1); -+ } -+ -+ if (config_block == NULL) -+ { -+ config_block = ci_copy; -+ return (0); -+ } -+ -+ tmp = realloc (config_block->children, -+ (config_block->children_num + ci_copy->children_num) * sizeof (*tmp)); -+ if (tmp == NULL) -+ { -+ ERROR ("java plugin: realloc failed."); -+ oconfig_free (ci_copy); -+ return (-1); -+ } -+ config_block->children = tmp; -+ -+ /* Copy the pointers */ -+ memcpy (config_block->children + config_block->children_num, -+ ci_copy->children, -+ ci_copy->children_num * sizeof (*ci_copy->children)); -+ config_block->children_num += ci_copy->children_num; -+ -+ /* Delete the pointers from the copy, so `oconfig_free' can't free them. */ -+ memset (ci_copy->children, 0, -+ ci_copy->children_num * sizeof (*ci_copy->children)); -+ ci_copy->children_num = 0; -+ -+ oconfig_free (ci_copy); -+ -+ return (0); -+} /* }}} int cjni_config_callback */ - - /* Free the data contained in the `user_data_t' pointer passed to `cjni_read' - * and `cjni_write'. In particular, delete the global reference to the Java -@@ -2995,6 +3046,22 @@ static int cjni_init (void) /* {{{ */ - { - JNIEnv *jvm_env; - -+ if ((config_block == NULL) && (jvm == NULL)) -+ { -+ ERROR ("java plugin: cjni_init: No configuration block for " -+ "the java plugin was found."); -+ return (-1); -+ } -+ -+ if (config_block != NULL) -+ { -+ int status; -+ -+ status = cjni_config_perform (config_block); -+ oconfig_free (config_block); -+ config_block = NULL; -+ } -+ - if (jvm == NULL) - { - ERROR ("java plugin: cjni_init: jvm == NULL"); -@@ -3013,7 +3080,7 @@ static int cjni_init (void) /* {{{ */ - - void module_register (void) - { -- plugin_register_complex_config ("java", cjni_config); -+ plugin_register_complex_config ("java", cjni_config_callback); - plugin_register_init ("java", cjni_init); - plugin_register_shutdown ("java", cjni_shutdown); - } /* void module_register (void) */