You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by jf...@apache.org on 2002/03/21 00:39:32 UTC
cvs commit: jakarta-commons-sandbox/daemon/src/native/unix/native arguments.h
jfclere 02/03/20 15:39:32
Modified: daemon/src/native/nt/lib moni_inst.h
daemon/src/native/nt/moni Makefile vdmonisvc.c
daemon/src/native/nt/service instmain.c
daemon/src/native/nt/supcalls_nt vdenv.c
daemon/src/native/unix INSTALL.txt
daemon/src/native/unix/native arguments.h
Log:
Arrange the win32 code so that the parameters given at install are used
when starting the jsvc.exe program.
Revision Changes Path
1.2 +1 -0 jakarta-commons-sandbox/daemon/src/native/nt/lib/moni_inst.h
Index: moni_inst.h
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/lib/moni_inst.h,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- moni_inst.h 18 Feb 2002 21:15:40 -0000 1.1
+++ moni_inst.h 20 Mar 2002 23:39:32 -0000 1.2
@@ -6,6 +6,7 @@
#define SZDEPENDENCIES ""
#define SZSERVICEDISPLAYNAME "Java Service" // name to display
#define SZKEY_ONSERVE "SOFTWARE\\apache\\jakarta\\1.0"
+#define SZKEY_ONSERVEARG "SOFTWARE\\apache\\jakarta\\1.0\\arguments"
#define SZKEY_F_DIR "F_DIR"
#define SZDEFMONISVCPATH "c:\\home\\jakarta\\bin\\vdmonisvc.exe"
#define SZCYGWINPATH "c:\\gnu"
1.2 +6 -9 jakarta-commons-sandbox/daemon/src/native/nt/moni/Makefile
Index: Makefile
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/moni/Makefile,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Makefile 18 Feb 2002 21:15:40 -0000 1.1
+++ Makefile 20 Mar 2002 23:39:32 -0000 1.2
@@ -1,18 +1,15 @@
INCLUDE=-I../lib
-all: ../bin/vdmoniadm ../bin/vdmonisvc
+BIN=../../../../dist
+all: $(BIN)/vdmoniadm $(BIN)/vdmonisvc
-../bin/vdmoniadm: vdmoniadm.c
+$(BIN)/vdmoniadm: vdmoniadm.c
gcc $(INCLUDE) -I../executables/vdmoniadm vdmoniadm.c \
- -o ../bin/vdmoniadm -lgdi32
-../bin/vdmonisvc: vdmonisvc.c vdenv.o kills.o
+ -o $(BIN)/vdmoniadm -lgdi32
+$(BIN)/vdmonisvc: vdmonisvc.c vdenv.o kills.o
gcc -mno-cygwin -I/usr/include $(INCLUDE) -I../executables/vdmonisvc \
-DCYGWIN vdmonisvc.c \
- -o ../bin/vdmonisvc vdenv.o kills.o
+ -o $(BIN)/vdmonisvc vdenv.o kills.o
vdenv.o: ../supcalls_nt/vdenv.c
gcc $(INCLUDE) -c ../supcalls_nt/vdenv.c
kills.o: ../signals/kills.c
gcc $(INCLUDE) -c ../signals/kills.c
-
-install:
- cp ../bin/vdmoniadm c:/home/jakarta/bin
- cp ../bin/vdmonisvc c:/home/jakarta/bin
1.2 +6 -6 jakarta-commons-sandbox/daemon/src/native/nt/moni/vdmonisvc.c
Index: vdmonisvc.c
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/moni/vdmonisvc.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vdmonisvc.c 18 Feb 2002 21:15:40 -0000 1.1
+++ vdmonisvc.c 20 Mar 2002 23:39:32 -0000 1.2
@@ -4,7 +4,7 @@
// MODULE: vdmonisvc.c
//
// PURPOSE: Implements the body of the service.
-// It reads the register entry and starts the OnServe.
+// It reads the register entry and starts the jsvc.
//
// FUNCTIONS:
// ServiceStart(DWORD dwArgc, LPTSTR *lpszArgv);
@@ -393,7 +393,7 @@
//
VOID ServiceStart (DWORD dwArgc, LPTSTR *lpszArgv)
{
-char Data[256];
+char Data[512];
DWORD qreturn;
STARTUPINFO StartupInfo;
PROCESS_INFORMATION ProcessInformation;
@@ -444,11 +444,11 @@
AddToMessageLog(TEXT("ServiceStart: read JAKARTA_HOME failed"));
goto cleanup;
}
+
+ // Build the start jsvc command according to the registry information.
strcpy(Data,qptr);
- strcat(Data,"\\bin\\jsvc.exe -nodetach");
- strcat(Data," -cp ");
- strcat(Data,qptr);
- strcat(Data,"/lib/service.jar org.apache.service.support.SimpleService");
+ BuildCommand(Data);
+ AddToMessageLog(TEXT(Data));
// create the jsvc process.
AddToMessageLog(TEXT("ServiceStart: start jsvc"));
1.2 +6 -1 jakarta-commons-sandbox/daemon/src/native/nt/service/instmain.c
Index: instmain.c
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/service/instmain.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- instmain.c 13 Mar 2002 23:07:31 -0000 1.1
+++ instmain.c 20 Mar 2002 23:39:32 -0000 1.2
@@ -373,7 +373,12 @@
/* install the environment variable in registry */
/* should get it from szPath */
- InstallEnv("JAKARTA_HOME",SZJAKARTA_HOME);
+ for(i=strlen(szPath);i>0;i--)
+ if (szPath[i]=='\\') {
+ szPath[i]='\0';
+ break;
+ }
+ InstallEnv("JAKARTA_HOME",szPath);
InstallEnv("CYGWIN",SZCYGWINPATH); /* need APR to get ride of it */
1.2 +63 -16 jakarta-commons-sandbox/daemon/src/native/nt/supcalls_nt/vdenv.c
Index: vdenv.c
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/supcalls_nt/vdenv.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- vdenv.c 18 Feb 2002 21:15:41 -0000 1.1
+++ vdenv.c 20 Mar 2002 23:39:32 -0000 1.2
@@ -77,27 +77,13 @@
// JAVA_HOME
LData = sizeof(Data);
- if (RegQueryValueEx(hKey,"JAVA_HOME",NULL,&Type,Data,&LData)==ERROR_SUCCESS) {
+ if (RegQueryValueEx(hKey,"JAVA_HOME",NULL,&Type,Data,&LData)
+ ==ERROR_SUCCESS) {
MySetEnvironmentVariable("JAVA_HOME",Data);
}
else
qreturn = -4;
- // HOSTNAME (Where the OnServe Monitor is running).
- LData = sizeof(Data);
- if (RegQueryValueEx(hKey,"HOSTNAME",NULL,&Type,Data,&LData)==ERROR_SUCCESS)
- MySetEnvironmentVariable("HOSTNAME",Data);
- else
- qreturn = -5;
-
- // HOSTPORT (Where the OnServe Monitor is listening)
- LData = sizeof(Data);
- if (RegQueryValueEx(hKey,"HOSTPORT",NULL,&Type,Data,&LData)==ERROR_SUCCESS)
- MySetEnvironmentVariable("HOSTPORT",Data);
- else
- qreturn = -6;
-
-
RegCloseKey(hKey);
hKey = NULL;
@@ -119,4 +105,65 @@
MySetEnvironmentVariable("PATH",Data);
return(qreturn);
+}
+
+/*
+ * Build the jsvc.exe command using the registry information.
+ */
+int BuildCommand(char *data)
+{
+ int i;
+ LONG lRet;
+ DWORD dwIndex;
+ char name[128];
+ DWORD lname;
+ char value[256];
+ DWORD lvalue;
+ DWORD nvalue;
+ DWORD Type;
+ HKEY hKey=NULL;
+
+
+ strcat(data,"\\jsvc.exe -nodetach ");
+
+ // Read the registry and set environment.
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZKEY_ONSERVEARG,
+ 0, KEY_READ,&hKey) != ERROR_SUCCESS)
+ return(-1);
+ if (RegQueryInfoKey(hKey, NULL, NULL, NULL, NULL, NULL, NULL,
+ &nvalue,NULL, NULL, NULL, NULL) != ERROR_SUCCESS)
+ return(-2);
+
+ // Read the arguments
+ for (i=0;i<nvalue;i++) {
+ lname = sizeof(name);
+ lvalue = sizeof(value);
+
+ lRet = RegEnumValue (hKey, i, name, &lname, NULL, NULL,
+ value, &lvalue);
+ if (lRet != ERROR_SUCCESS) {
+ RegCloseKey(hKey);
+ return(-3);
+ }
+
+ strncat(data,value,lvalue);
+ strcat(data," ");
+ }
+ RegCloseKey(hKey);
+
+ // Read the start class.
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, SZKEY_ONSERVE,
+ 0, KEY_READ,&hKey) != ERROR_SUCCESS)
+ return(-4);
+ lvalue = sizeof(value);
+ if (RegQueryValueEx(hKey,"STARTCLASS",NULL,&Type,value,&lvalue)
+ !=ERROR_SUCCESS) {
+ RegCloseKey(hKey);
+ return(-5);
+ }
+ RegCloseKey(hKey);
+
+ strncat(data,value,lvalue);
+
+ return(0);
}
1.2 +2 -1 jakarta-commons-sandbox/daemon/src/native/unix/INSTALL.txt
Index: INSTALL.txt
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/INSTALL.txt,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- INSTALL.txt 18 Feb 2002 21:15:41 -0000 1.1
+++ INSTALL.txt 20 Mar 2002 23:39:32 -0000 1.2
@@ -7,7 +7,8 @@
First of all you need to build the "configure" program with:
- ./support/buildconf.sh
+ sh support/buildconf.sh
+(Note it is possible to replace sh by any compatible shell like bash, ksh).
Once the configure script is generated, run it (remember to specify
either the --with-java=<dir> parameter or set the JAVA_HOME environment
1.3 +5 -5 jakarta-commons-sandbox/daemon/src/native/unix/native/arguments.h
Index: arguments.h
===================================================================
RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/unix/native/arguments.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- arguments.h 9 Mar 2002 18:40:26 -0000 1.2
+++ arguments.h 20 Mar 2002 23:39:32 -0000 1.3
@@ -55,10 +55,14 @@
* *
* ========================================================================= */
-/* @version $Id: arguments.h,v 1.2 2002/03/09 18:40:26 jfclere Exp $ */
+/* @version $Id: arguments.h,v 1.3 2002/03/20 23:39:32 jfclere Exp $ */
#ifndef __JSVC_ARGUMENTS_H__
#define __JSVC_ARGUMENTS_H__
+#ifdef __cplusplus
+extern "C" {
+#endif
+
/**
* The structure holding all parsed command line options.
*/
@@ -105,10 +109,6 @@
* @return A pointer to a arg_data structure containing the parsed command
* line arguments, or NULL if an error was detected.
*/
-#ifdef __cplusplus
-extern "C" {
-#endif
-
arg_data *arguments(int argc, char *argv[]);
#ifdef __cplusplus
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>