trinidad_init_services 1.1.3 → 1.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/Gemfile +3 -0
- data/History.txt +6 -0
- data/README.md +95 -0
- data/Rakefile +9 -58
- data/bin/trinidad_init_service +3 -4
- data/init.d/trinidad.erb +33 -12
- data/jsvc-unix-src/CHANGES.txt +62 -0
- data/jsvc-unix-src/INSTALL.txt +81 -0
- data/jsvc-unix-src/Makedefs.in +32 -0
- data/jsvc-unix-src/Makefile.in +42 -0
- data/jsvc-unix-src/configure +4417 -0
- data/jsvc-unix-src/configure.in +141 -0
- data/jsvc-unix-src/man/README +20 -0
- data/jsvc-unix-src/man/fetch.sh +36 -0
- data/jsvc-unix-src/man/jsvc.1.xml +214 -0
- data/jsvc-unix-src/native/.indent.pro +7 -0
- data/jsvc-unix-src/native/Makefile.in +46 -0
- data/jsvc-unix-src/native/arguments.c +476 -0
- data/jsvc-unix-src/native/arguments.h +94 -0
- data/jsvc-unix-src/native/debug.c +87 -0
- data/jsvc-unix-src/native/debug.h +65 -0
- data/jsvc-unix-src/native/dso-dlfcn.c +62 -0
- data/jsvc-unix-src/native/dso-dyld.c +153 -0
- data/jsvc-unix-src/native/dso.h +38 -0
- data/jsvc-unix-src/native/help.c +106 -0
- data/jsvc-unix-src/native/help.h +24 -0
- data/jsvc-unix-src/native/home.c +265 -0
- data/jsvc-unix-src/native/home.h +47 -0
- data/jsvc-unix-src/native/java.c +608 -0
- data/jsvc-unix-src/native/java.h +35 -0
- data/jsvc-unix-src/native/jsvc-unix.c +1267 -0
- data/jsvc-unix-src/native/jsvc.h +55 -0
- data/jsvc-unix-src/native/location.c +151 -0
- data/jsvc-unix-src/native/location.h +29 -0
- data/jsvc-unix-src/native/locks.c +52 -0
- data/jsvc-unix-src/native/locks.h +40 -0
- data/jsvc-unix-src/native/replace.c +121 -0
- data/jsvc-unix-src/native/replace.h +39 -0
- data/jsvc-unix-src/native/signals.c +105 -0
- data/jsvc-unix-src/native/signals.h +34 -0
- data/jsvc-unix-src/native/version.h +63 -0
- data/jsvc-unix-src/support/apfunctions.m4 +110 -0
- data/jsvc-unix-src/support/apjava.m4 +94 -0
- data/jsvc-unix-src/support/apsupport.m4 +155 -0
- data/jsvc-unix-src/support/buildconf.sh +33 -0
- data/jsvc-unix-src/support/config.guess +1371 -0
- data/jsvc-unix-src/support/config.sub +1760 -0
- data/jsvc-unix-src/support/install.sh +128 -0
- data/jsvc-unix-src/support/mkdist.sh +104 -0
- data/lib/trinidad/daemon.rb +31 -0
- data/lib/trinidad_init_services.rb +2 -30
- data/lib/trinidad_init_services/configuration.rb +91 -14
- data/lib/trinidad_init_services/version.rb +5 -0
- data/spec/spec_helper.rb +5 -6
- data/spec/trinidad_daemon_spec.rb +0 -1
- data/spec/trinidad_init_services/configuration_spec.rb +34 -1
- data/trinidad_init_services.gemspec +14 -51
- metadata +146 -87
- data/README +0 -63
- data/trinidad-libs/jsvc_linux +0 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
3
|
+
* this work for additional information regarding copyright ownership.
|
4
|
+
* The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/* @version $Id: dso.h 921765 2010-03-11 10:03:32Z mturk $ */
|
18
|
+
#ifndef __JSVC_DSO_H__
|
19
|
+
#define __JSVC_DSO_H__
|
20
|
+
|
21
|
+
#include "jsvc.h"
|
22
|
+
|
23
|
+
/**
|
24
|
+
* A library handle represents a unique pointer to its location in memory.
|
25
|
+
*/
|
26
|
+
#ifdef DSO_DYLD
|
27
|
+
#include <mach-o/dyld.h>
|
28
|
+
#endif
|
29
|
+
typedef void *dso_handle;
|
30
|
+
|
31
|
+
bool dso_init(void);
|
32
|
+
dso_handle dso_link(const char *pth);
|
33
|
+
bool dso_unlink(dso_handle lib);
|
34
|
+
void *dso_symbol(dso_handle lib, const char *nam);
|
35
|
+
char *dso_error(void);
|
36
|
+
|
37
|
+
#endif /* __JSVC_DSO_H__ */
|
38
|
+
|
@@ -0,0 +1,106 @@
|
|
1
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
3
|
+
* this work for additional information regarding copyright ownership.
|
4
|
+
* The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/* @version $Id: help.c 1196265 2011-11-01 20:43:52Z mturk $ */
|
18
|
+
#include "jsvc.h"
|
19
|
+
|
20
|
+
void help(home_data *data)
|
21
|
+
{
|
22
|
+
int x;
|
23
|
+
|
24
|
+
printf("Usage: %s [-options] class [args...]\n", log_prog);
|
25
|
+
printf("\n");
|
26
|
+
printf("Where options include:\n");
|
27
|
+
printf("\n");
|
28
|
+
printf(" -help | --help | -?\n");
|
29
|
+
printf(" show this help page (implies -nodetach)\n");
|
30
|
+
printf(" -jvm <JVM name>\n");
|
31
|
+
printf(" use a specific Java Virtual Machine. Available JVMs:\n");
|
32
|
+
printf(" ");
|
33
|
+
for (x = 0; x < data->jnum; x++) {
|
34
|
+
printf(" '%s'", PRINT_NULL(data->jvms[x]->name));
|
35
|
+
}
|
36
|
+
printf("\n");
|
37
|
+
printf(" -client\n");
|
38
|
+
printf(" use a client Java Virtual Machine.\n");
|
39
|
+
printf(" -server\n");
|
40
|
+
printf(" use a server Java Virtual Machine.\n");
|
41
|
+
printf(" -cp | -classpath <directories and zip/jar files>\n");
|
42
|
+
printf(" set search path for service classes and resouces\n");
|
43
|
+
printf(" -java-home | -home <directory>\n");
|
44
|
+
printf(" set the path of your JDK or JRE installation (or set\n");
|
45
|
+
printf(" the JAVA_HOME environment variable)\n");
|
46
|
+
|
47
|
+
printf(" -version\n");
|
48
|
+
printf(" show the current Java environment version (to check\n");
|
49
|
+
printf(" correctness of -home and -jvm. Implies -nodetach)\n");
|
50
|
+
printf(" -showversion\n");
|
51
|
+
printf(" show the current Java environment version (to check\n");
|
52
|
+
printf(" correctness of -home and -jvm) and continue execution.\n");
|
53
|
+
printf(" -nodetach\n");
|
54
|
+
printf(" don't detach from parent process and become a daemon\n");
|
55
|
+
printf(" -debug\n");
|
56
|
+
printf(" verbosely print debugging information\n");
|
57
|
+
printf(" -check\n");
|
58
|
+
printf(" only check service (implies -nodetach)\n");
|
59
|
+
printf(" -user <user>\n");
|
60
|
+
printf(" user used to run the daemon (defaults to current user)\n");
|
61
|
+
printf(" -verbose[:class|gc|jni]\n");
|
62
|
+
printf(" enable verbose output\n");
|
63
|
+
printf(" -outfile </full/path/to/file>\n");
|
64
|
+
printf(" Location for output from stdout (defaults to /dev/null)\n");
|
65
|
+
printf(" Use the value '&2' to simulate '1>&2'\n");
|
66
|
+
printf(" -errfile </full/path/to/file>\n");
|
67
|
+
printf(" Location for output from stderr (defaults to /dev/null)\n");
|
68
|
+
printf(" Use the value '&1' to simulate '2>&1'\n");
|
69
|
+
printf(" -pidfile </full/path/to/file>\n");
|
70
|
+
printf(" Location for output from the file containing the pid of jsvc\n");
|
71
|
+
printf(" (defaults to /var/run/jsvc.pid)\n");
|
72
|
+
printf(" -D<name>=<value>\n");
|
73
|
+
printf(" set a Java system property\n");
|
74
|
+
printf(" -X<option>\n");
|
75
|
+
printf(" set Virtual Machine specific option\n");
|
76
|
+
printf(" -ea[:<packagename>...|:<classname>]\n");
|
77
|
+
printf(" -enableassertions[:<packagename>...|:<classname>]\n");
|
78
|
+
printf(" enable assertions\n");
|
79
|
+
printf(" -da[:<packagename>...|:<classname>]\n");
|
80
|
+
printf(" -disableassertions[:<packagename>...|:<classname>]\n");
|
81
|
+
printf(" disable assertions\n");
|
82
|
+
printf(" -esa | -enablesystemassertions\n");
|
83
|
+
printf(" enable system assertions\n");
|
84
|
+
printf(" -dsa | -disablesystemassertions\n");
|
85
|
+
printf(" disable system assertions\n");
|
86
|
+
printf(" -agentlib:<libname>[=<options>]\n");
|
87
|
+
printf(" load native agent library <libname>, e.g. -agentlib:hprof\n");
|
88
|
+
printf(" -agentpath:<pathname>[=<options>]\n");
|
89
|
+
printf(" load native agent library by full pathname\n");
|
90
|
+
printf(" -javaagent:<jarpath>[=<options>]\n");
|
91
|
+
printf(" load Java programming language agent, see java.lang.instrument\n");
|
92
|
+
printf(" -procname <procname>\n");
|
93
|
+
printf(" use the specified process name\n");
|
94
|
+
printf(" -wait <waittime>\n");
|
95
|
+
printf(" wait waittime seconds for the service to start\n");
|
96
|
+
printf(" waittime should multiple of 10 (min=10)\n");
|
97
|
+
printf(" -stop\n");
|
98
|
+
printf(" stop the service using the file given in the -pidfile option\n");
|
99
|
+
printf(" -keepstdin\n");
|
100
|
+
printf(" does not redirect stdin to /dev/null\n");
|
101
|
+
printf("\njsvc (Apache Commons Daemon) " JSVC_VERSION_STRING "\n");
|
102
|
+
printf("Copyright (c) 1999-2011 Apache Software Foundation.\n");
|
103
|
+
|
104
|
+
printf("\n");
|
105
|
+
}
|
106
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
/* Licensed to the Apache Software Foundation (ASF) under one or more
|
2
|
+
* contributor license agreements. See the NOTICE file distributed with
|
3
|
+
* this work for additional information regarding copyright ownership.
|
4
|
+
* The ASF licenses this file to You under the Apache License, Version 2.0
|
5
|
+
* (the "License"); you may not use this file except in compliance with
|
6
|
+
* the License. You may obtain a copy of the License at
|
7
|
+
*
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
*
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
* See the License for the specific language governing permissions and
|
14
|
+
* limitations under the License.
|
15
|
+
*/
|
16
|
+
|
17
|
+
/* @version $Id: help.h 921765 2010-03-11 10:03:32Z mturk $ */
|
18
|
+
#ifndef __JSVC_HELP_H__
|
19
|
+
#define __JSVC_HELP_H__
|
20
|
+
|
21
|
+
void help(home_data *data);
|
22
|
+
|
23
|
+
#endif /* __JSVC_HELP_H__ */
|
24
|
+
|
@@ -0,0 +1,265 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
*/
|
17
|
+
/* @version $Id: home.c 1000002 2010-09-22 14:48:37Z mturk $ */
|
18
|
+
#include "jsvc.h"
|
19
|
+
|
20
|
+
/* Check if a path is a directory */
|
21
|
+
static bool checkdir(char *path)
|
22
|
+
{
|
23
|
+
struct stat home;
|
24
|
+
|
25
|
+
if (path == NULL)
|
26
|
+
return (false);
|
27
|
+
if (stat(path, &home) != 0)
|
28
|
+
return (false);
|
29
|
+
if (S_ISDIR(home.st_mode))
|
30
|
+
return (true);
|
31
|
+
return (false);
|
32
|
+
}
|
33
|
+
|
34
|
+
/* Check if a path is a file */
|
35
|
+
static bool checkfile(char *path)
|
36
|
+
{
|
37
|
+
struct stat home;
|
38
|
+
|
39
|
+
if (path == NULL)
|
40
|
+
return (false);
|
41
|
+
if (stat(path, &home) != 0)
|
42
|
+
return (false);
|
43
|
+
if (S_ISREG(home.st_mode))
|
44
|
+
return (true);
|
45
|
+
return (false);
|
46
|
+
}
|
47
|
+
|
48
|
+
/* Parse a VM configuration file */
|
49
|
+
static bool parse(home_data *data)
|
50
|
+
{
|
51
|
+
FILE *cfgf = fopen(data->cfgf, "r");
|
52
|
+
char *ret = NULL, *sp;
|
53
|
+
char buf[1024];
|
54
|
+
|
55
|
+
if (cfgf == NULL) {
|
56
|
+
log_debug("Can't open %s\n", data->cfgf);
|
57
|
+
return (false);
|
58
|
+
}
|
59
|
+
|
60
|
+
data->jvms = (home_jvm **)malloc(256 * sizeof(home_jvm *));
|
61
|
+
|
62
|
+
while ((ret = fgets(buf, 1024, cfgf)) != NULL) {
|
63
|
+
char *tmp = strchr(ret, '#');
|
64
|
+
int pos;
|
65
|
+
|
66
|
+
/* Clear the string at the first occurrence of '#' */
|
67
|
+
if (tmp != NULL)
|
68
|
+
tmp[0] = '\0';
|
69
|
+
|
70
|
+
/* Trim the string (including leading '-' chars */
|
71
|
+
while ((ret[0] == ' ') || (ret[0] == '\t') || (ret[0] == '-'))
|
72
|
+
ret++;
|
73
|
+
pos = strlen(ret);
|
74
|
+
while (pos >= 0) {
|
75
|
+
if ((ret[pos] == '\r') || (ret[pos] == '\n') || (ret[pos] == '\t')
|
76
|
+
|| (ret[pos] == '\0') || (ret[pos] == ' ')) {
|
77
|
+
ret[pos--] = '\0';
|
78
|
+
}
|
79
|
+
else
|
80
|
+
break;
|
81
|
+
}
|
82
|
+
/* Format changed for 1.4 JVMs */
|
83
|
+
sp = strchr(ret, ' ');
|
84
|
+
if (sp != NULL)
|
85
|
+
*sp = '\0';
|
86
|
+
|
87
|
+
/* Did we find something significant? */
|
88
|
+
if (strlen(ret) > 0) {
|
89
|
+
char *libf = NULL;
|
90
|
+
int x = 0;
|
91
|
+
|
92
|
+
log_debug("Found VM %s definition in configuration", ret);
|
93
|
+
while (location_jvm_configured[x] != NULL) {
|
94
|
+
char *orig = location_jvm_configured[x];
|
95
|
+
char temp[1024];
|
96
|
+
char repl[1024];
|
97
|
+
int k;
|
98
|
+
|
99
|
+
k = replace(temp, 1024, orig, "$JAVA_HOME", data->path);
|
100
|
+
if (k != 0) {
|
101
|
+
log_error("Can't replace home in VM library (%d)", k);
|
102
|
+
return (false);
|
103
|
+
}
|
104
|
+
k = replace(repl, 1024, temp, "$VM_NAME", ret);
|
105
|
+
if (k != 0) {
|
106
|
+
log_error("Can't replace name in VM library (%d)", k);
|
107
|
+
return (false);
|
108
|
+
}
|
109
|
+
|
110
|
+
log_debug("Checking library %s", repl);
|
111
|
+
if (checkfile(repl)) {
|
112
|
+
libf = strdup(repl);
|
113
|
+
break;
|
114
|
+
}
|
115
|
+
x++;
|
116
|
+
}
|
117
|
+
|
118
|
+
if (libf == NULL) {
|
119
|
+
log_debug("Cannot locate library for VM %s (skipping)", ret);
|
120
|
+
}
|
121
|
+
else {
|
122
|
+
data->jvms[data->jnum] = (home_jvm *)malloc(sizeof(home_jvm));
|
123
|
+
data->jvms[data->jnum]->name = strdup(ret);
|
124
|
+
data->jvms[data->jnum]->libr = libf;
|
125
|
+
data->jnum++;
|
126
|
+
data->jvms[data->jnum] = NULL;
|
127
|
+
}
|
128
|
+
}
|
129
|
+
}
|
130
|
+
return (true);
|
131
|
+
}
|
132
|
+
|
133
|
+
/* Build a Java Home structure for a path */
|
134
|
+
static home_data *build(char *path)
|
135
|
+
{
|
136
|
+
home_data *data = NULL;
|
137
|
+
char *cfgf = NULL;
|
138
|
+
char buf[1024];
|
139
|
+
int x = 0;
|
140
|
+
int k = 0;
|
141
|
+
|
142
|
+
if (path == NULL)
|
143
|
+
return (NULL);
|
144
|
+
|
145
|
+
log_debug("Attempting to locate Java Home in %s", path);
|
146
|
+
if (checkdir(path) == false) {
|
147
|
+
log_debug("Path %s is not a directory", path);
|
148
|
+
return (NULL);
|
149
|
+
}
|
150
|
+
|
151
|
+
while (location_jvm_cfg[x] != NULL) {
|
152
|
+
if ((k =
|
153
|
+
replace(buf, 1024, location_jvm_cfg[x], "$JAVA_HOME",
|
154
|
+
path)) != 0) {
|
155
|
+
log_error("Error replacing values for jvm.cfg (%d)", k);
|
156
|
+
return (NULL);
|
157
|
+
}
|
158
|
+
log_debug("Attempting to locate VM configuration file %s", buf);
|
159
|
+
if (checkfile(buf) == true) {
|
160
|
+
log_debug("Found VM configuration file at %s", buf);
|
161
|
+
cfgf = strdup(buf);
|
162
|
+
break;
|
163
|
+
}
|
164
|
+
x++;
|
165
|
+
}
|
166
|
+
|
167
|
+
data = (home_data *)malloc(sizeof(home_data));
|
168
|
+
data->path = strdup(path);
|
169
|
+
data->cfgf = cfgf;
|
170
|
+
data->jvms = NULL;
|
171
|
+
data->jnum = 0;
|
172
|
+
|
173
|
+
/* We don't have a jvm.cfg configuration file, so all we have to do is
|
174
|
+
trying to locate the "default" Java Virtual Machine library */
|
175
|
+
if (cfgf == NULL) {
|
176
|
+
log_debug("VM configuration file not found");
|
177
|
+
x = 0;
|
178
|
+
while (location_jvm_default[x] != NULL) {
|
179
|
+
char *libr = location_jvm_default[x];
|
180
|
+
|
181
|
+
if ((k = replace(buf, 1024, libr, "$JAVA_HOME", path)) != 0) {
|
182
|
+
log_error("Error replacing values for JVM library (%d)", k);
|
183
|
+
return (NULL);
|
184
|
+
}
|
185
|
+
log_debug("Attempting to locate VM library %s", buf);
|
186
|
+
if (checkfile(buf) == true) {
|
187
|
+
data->jvms = (home_jvm **)malloc(2 * sizeof(home_jvm *));
|
188
|
+
data->jvms[0] = (home_jvm *)malloc(sizeof(home_jvm));
|
189
|
+
data->jvms[0]->name = NULL;
|
190
|
+
data->jvms[0]->libr = strdup(buf);
|
191
|
+
data->jvms[1] = NULL;
|
192
|
+
data->jnum = 1;
|
193
|
+
return (data);
|
194
|
+
}
|
195
|
+
x++;
|
196
|
+
}
|
197
|
+
|
198
|
+
return (data);
|
199
|
+
}
|
200
|
+
|
201
|
+
/* If we got here, we most definitely found a jvm.cfg file */
|
202
|
+
if (parse(data) == false) {
|
203
|
+
log_error("Cannot parse VM configuration file %s", data->cfgf);
|
204
|
+
}
|
205
|
+
|
206
|
+
return (data);
|
207
|
+
}
|
208
|
+
|
209
|
+
/* Find the Java Home */
|
210
|
+
static home_data *find(char *path)
|
211
|
+
{
|
212
|
+
home_data *data = NULL;
|
213
|
+
int x = 0;
|
214
|
+
|
215
|
+
if (path == NULL) {
|
216
|
+
log_debug("Home not specified on command line, using environment");
|
217
|
+
path = getenv("JAVA_HOME");
|
218
|
+
}
|
219
|
+
|
220
|
+
if (path == NULL) {
|
221
|
+
log_debug("Home not on command line or in environment, searching");
|
222
|
+
while (location_home[x] != NULL) {
|
223
|
+
if ((data = build(location_home[x])) != NULL) {
|
224
|
+
log_debug("Java Home located in %s", data->path);
|
225
|
+
return (data);
|
226
|
+
}
|
227
|
+
x++;
|
228
|
+
}
|
229
|
+
}
|
230
|
+
else {
|
231
|
+
if ((data = build(path)) != NULL) {
|
232
|
+
log_debug("Java Home located in %s", data->path);
|
233
|
+
return (data);
|
234
|
+
}
|
235
|
+
}
|
236
|
+
|
237
|
+
return (NULL);
|
238
|
+
}
|
239
|
+
|
240
|
+
/* Main entry point: locate home and dump structure */
|
241
|
+
home_data *home(char *path)
|
242
|
+
{
|
243
|
+
home_data *data = find(path);
|
244
|
+
int x = 0;
|
245
|
+
|
246
|
+
if (data == NULL) {
|
247
|
+
log_error("Cannot locate Java Home");
|
248
|
+
return (NULL);
|
249
|
+
}
|
250
|
+
|
251
|
+
if (log_debug_flag == true) {
|
252
|
+
log_debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------");
|
253
|
+
log_debug("| Java Home: \"%s\"", PRINT_NULL(data->path));
|
254
|
+
log_debug("| Java VM Config.: \"%s\"", PRINT_NULL(data->cfgf));
|
255
|
+
log_debug("| Found JVMs: %d", data->jnum);
|
256
|
+
for (x = 0; x < data->jnum; x++) {
|
257
|
+
home_jvm *jvm = data->jvms[x];
|
258
|
+
log_debug("| JVM Name: \"%s\"", PRINT_NULL(jvm->name));
|
259
|
+
log_debug("| \"%s\"", PRINT_NULL(jvm->libr));
|
260
|
+
}
|
261
|
+
log_debug("+-------------------------------------------------------");
|
262
|
+
}
|
263
|
+
|
264
|
+
return (data);
|
265
|
+
}
|
@@ -0,0 +1,47 @@
|
|
1
|
+
/*
|
2
|
+
Licensed to the Apache Software Foundation (ASF) under one or more
|
3
|
+
contributor license agreements. See the NOTICE file distributed with
|
4
|
+
this work for additional information regarding copyright ownership.
|
5
|
+
The ASF licenses this file to You under the Apache License, Version 2.0
|
6
|
+
(the "License"); you may not use this file except in compliance with
|
7
|
+
the License. You may obtain a copy of the License at
|
8
|
+
|
9
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
10
|
+
|
11
|
+
Unless required by applicable law or agreed to in writing, software
|
12
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
+
See the License for the specific language governing permissions and
|
15
|
+
limitations under the License.
|
16
|
+
*/
|
17
|
+
/* @version $Id: home.h 921765 2010-03-11 10:03:32Z mturk $ */
|
18
|
+
#ifndef __JSVC_HOME_H__
|
19
|
+
#define __JSVC_HOME_H__
|
20
|
+
|
21
|
+
typedef struct home_jvm home_jvm;
|
22
|
+
typedef struct home_data home_data;
|
23
|
+
|
24
|
+
struct home_jvm
|
25
|
+
{
|
26
|
+
char *name;
|
27
|
+
char *libr;
|
28
|
+
};
|
29
|
+
|
30
|
+
struct home_data
|
31
|
+
{
|
32
|
+
char *path;
|
33
|
+
char *cfgf;
|
34
|
+
home_jvm **jvms;
|
35
|
+
int jnum;
|
36
|
+
};
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Attempt to locate a Java Home directory and build its structure.
|
40
|
+
*
|
41
|
+
* @param path The java home path specified on the command line.
|
42
|
+
* @return A home_data structure containing all informations related to
|
43
|
+
* the Java environment, or NULL if no home was found.
|
44
|
+
*/
|
45
|
+
home_data *home(char *path);
|
46
|
+
|
47
|
+
#endif /* ifndef __JSVC_HOME_H__ */
|