You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by ma...@apache.org on 2017/11/07 19:16:22 UTC
svn commit: r1814532 -
/commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
Author: markt
Date: Tue Nov 7 19:16:22 2017
New Revision: 1814532
URL: http://svn.apache.org/viewvc?rev=1814532&view=rev
Log:
In Java mode, add the Java 9 options to an environment variable only used by Java 9 onwards
Modified:
commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
Modified: commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c?rev=1814532&r1=1814531&r2=1814532&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c (original)
+++ commons/proper/daemon/trunk/src/native/windows/apps/prunsrv/prunsrv.c Tue Nov 7 19:16:22 2017
@@ -24,6 +24,7 @@
/* Force the JNI vprintf functions */
#define _DEBUG_JNI 1
#include "apxwin.h"
+#include "private.h"
#include "prunsrv.h"
#include <stdio.h>
@@ -67,6 +68,7 @@ static LPCWSTR PRSRV_MANUAL = L"ma
static LPCWSTR PRSRV_JBIN = L"\\bin\\java.exe";
static LPCWSTR PRSRV_PBIN = L"\\bin";
static LPCWSTR PRSRV_SIGNAL = L"SIGNAL";
+static LPCWSTR PRSV_JVMOPTS9 = L"JDK_JAVA_OPTIONS=";
static LPCWSTR STYPE_INTERACTIVE = L"interactive";
static LPWSTR _service_name = NULL;
@@ -424,6 +426,42 @@ static void setInprocEnvironment()
}
}
+static void setInprocEnvironment9(LPCWSTR szOptions9)
+{
+ DWORD l, c;
+ LPWSTR e, b;
+ LPCWSTR p;
+
+ l = __apxGetMultiSzLengthW(szOptions9, &c);
+
+ if (!c)
+ return;
+
+ /* environment variable name */
+ l += lstrlen(PRSV_JVMOPTS9);
+
+ b = e = apxPoolCalloc(gPool, (l + 1) * sizeof(WCHAR));
+
+ p = PRSV_JVMOPTS9;
+ while (*p) {
+ *b++ = *p++;
+ }
+
+ p = szOptions9;
+ while (c > 0) {
+ if (*p)
+ *b++ = *p;
+ else {
+ *b++ = L' ';
+ c--;
+ }
+ p++;
+ }
+
+ _wputenv(e);
+ apxFree(e);
+}
+
/* Load the configuration from Registry
* loads only nonspecified items
*/
@@ -1210,6 +1248,7 @@ static DWORD serviceStart()
}
/* Set the environment using putenv, so JVM can use it */
setInprocEnvironment();
+ setInprocEnvironment9(SO_JVMOPTIONS9);
/* Redirect process */
gWorker = apxCreateProcessW(gPool,
0,