commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r980662 [11/15] - in /commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3: ./ src/ src/assembly/ src/docs/ src/java/ src/java/org/ src/java/org/apache/ src/java/org/apache/commons/ src/java/org/apache/commons/daemon/ src/java/org/apache/com...
Date Fri, 30 Jul 2010 06:50:16 GMT
Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makedefs.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makedefs.in?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makedefs.in (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makedefs.in Fri Jul 30 06:50:12 2010
@@ -0,0 +1,32 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# @author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
+# @version $Id: Makedefs.in 480475 2006-11-29 08:31:47Z bayard $
+
+CC = @CC@
+JAVAC = @JAVAC@
+JAR = @JAR@
+CFLAGS = @CFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+JAVACFLAGS = @JAVACFLAGS@
+RANLIB = @RANLIB@
+LDCMD = @LDCMD@
+
+.c.o:
+	$(CC) $(CFLAGS) -c $< -o $@

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makedefs.in
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makefile.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makefile.in?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makefile.in (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makefile.in Fri Jul 30 06:50:12 2010
@@ -0,0 +1,40 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# @author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
+# @version $Id: Makefile.in 480475 2006-11-29 08:31:47Z bayard $
+
+SUBDIRS = native
+
+all: native/all
+
+native/all:
+	(cd native; $(MAKE)  all)
+
+clean:
+	(cd native; $(MAKE)  clean)
+
+distclean: clean
+	rm -f config.cache
+	rm -f config.log
+	rm -f config.status
+	rm -f native/Makefile
+	rm -f Makefile
+	rm -f Makedefs
+
+realclean: distclean
+	rm -f configure

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/Makefile.in
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/configure.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/configure.in?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/configure.in (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/configure.in Fri Jul 30 06:50:12 2010
@@ -0,0 +1,119 @@
+dnl
+dnl Licensed to the Apache Software Foundation (ASF) under one or more
+dnl contributor license agreements.  See the NOTICE file distributed with
+dnl this work for additional information regarding copyright ownership.
+dnl The ASF licenses this file to You under the Apache License, Version 2.0
+dnl (the "License"); you may not use this file except in compliance with
+dnl the License.  You may obtain a copy of the License at
+dnl
+dnl     http://www.apache.org/licenses/LICENSE-2.0
+dnl
+dnl Unless required by applicable law or agreed to in writing, software
+dnl distributed under the License is distributed on an "AS IS" BASIS,
+dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+dnl See the License for the specific language governing permissions and
+dnl limitations under the License.
+dnl
+
+dnl -------------------------------------------------------------------------
+dnl Author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
+dnl Version $Id: configure.in 980496 2010-07-29 16:10:32Z mturk $
+dnl -------------------------------------------------------------------------
+
+dnl -------------------------------------------------------------------------
+dnl Initialize AutoConf
+dnl -------------------------------------------------------------------------
+
+AC_PREREQ(2.53)
+
+sinclude(./support/apfunctions.m4)dnl
+sinclude(./support/apjava.m4)dnl
+sinclude(./support/apsupport.m4)dnl
+AC_INIT(configure.in)
+AC_CONFIG_AUX_DIR(./support)
+
+dnl -------------------------------------------------------------------------
+dnl Check current host (forget about cross compilation) and validate it
+dnl against the cache (fail if the cache differs)
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([Current host])
+AC_CANONICAL_HOST()
+AP_CANONICAL_HOST_CHECK()
+
+dnl -------------------------------------------------------------------------
+dnl Check C environment
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([C-Language compilation tools])
+AC_PROG_CC()
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+
+dnl -------------------------------------------------------------------------
+dnl Check if this host is supported
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([Host support])
+AP_SUPPORTED_HOST()
+if test "$supported_os" = "darwin"
+then
+  if test -z "$JAVA_HOME" -a -d /System/Library/Frameworks/JavaVM.framework/Home; then
+  	JAVA_HOME=/System/Library/Frameworks/JavaVM.framework/Home
+  fi
+
+  _prevdir=`/bin/pwd`
+  if test -n "$JAVA_HOME" -a -d "$JAVA_HOME/include"; then
+    cd "$JAVA_HOME/include"
+  elif test -n "$JAVA_HOME" -a -d "$JAVA_HOME/../Headers"; then
+    cd "$JAVA_HOME/../Headers"
+  else
+    cd /System/Library/Frameworks/JavaVM.framework/Headers
+  fi
+  CFLAGS="$CFLAGS -I`/bin/pwd -P`"
+  cd $_prevdir
+  unset _prevdir
+fi
+
+dnl -------------------------------------------------------------------------
+dnl Check JAVA environment
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([Java compilation tools])
+AP_JAVA()
+AP_SABLEVM()
+AP_KAFFE()
+AP_PROG_JAVAC()
+AP_PROG_JAR()
+if test "$supported_os" != "darwin"
+then
+  CFLAGS="$CFLAGS -I$JAVA_HOME/include -I$JAVA_HOME/include/$supported_os"
+fi
+
+dnl -------------------------------------------------------------------------
+dnl Add gcc specific CFLAGS.
+dnl -------------------------------------------------------------------------
+if test "$GCC" = "yes"
+then
+   CFLAGS="$CFLAGS -Wall -Wstrict-prototypes"
+   AC_MSG_RESULT([gcc flags added])
+fi
+dnl -------------------------------------------------------------------------
+dnl Add gcc specific CFLAGS.
+dnl -------------------------------------------------------------------------
+if test -z "$LDCMD"
+then
+   LDCMD="$CC"
+fi
+AC_SUBST(LDCMD)
+if test "$supported_os" == "linux"
+then
+AC_CHECK_LIB([cap], [cap_init], [CFLAGS="$CFLAGS -DHAVE_LIBCAP" ; LIBS="$LIBS -lcap"])
+fi
+
+dnl -------------------------------------------------------------------------
+dnl Random programs we need to compile locally
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([Writing output files])
+AC_OUTPUT(Makefile Makedefs native/Makefile)
+
+dnl -------------------------------------------------------------------------
+dnl Done
+dnl -------------------------------------------------------------------------
+AP_MSG_HEADER([All done])
+AC_MSG_RESULT([Now you can issue "make"])

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/configure.in
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/README
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/README?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/README (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/README Fri Jul 30 06:50:12 2010
@@ -0,0 +1,20 @@
+To build it use:
+docbook2man jsvc.1.xml
+
+If your docbook2man uses xalan and you are behind a firewall
+Modify jsvc.1.xml as below:
++++
+Index: jsvc.1.xml
+===================================================================
+--- jsvc.1.xml	(revision 170004)
++++ jsvc.1.xml	(working copy)
+@@ -1,6 +1,6 @@
+ <?xml version="1.0" encoding="utf-8"?>
+ <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+-                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
++                   "docbookx.dtd">
+ <refentry id='jsvc1'>
+   <refmeta>
+     <refentrytitle>JSVC</refentrytitle>
++++
+Use fetch.sh to get docbook files.

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/README
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh Fri Jul 30 06:50:12 2010
@@ -0,0 +1,36 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+mkdir -p ent
+rm -f JSVC.1
+while true
+do
+  FILE=`docbook2man jsvc.1.xml 2>&1 | grep FileNotFoundException | awk -F FileNotFoundException: ' { print $2 } ' | awk ' { print $1 } '`
+  if [ -f JSVC.1 ]
+  then
+    break
+  fi
+  echo "FILE: $FILE"
+  file=`basename $FILE`
+  dir=`dirname $FILE`
+  man=`basename $dir`
+  echo "file: $file dir: $dir man: $man"
+  if [ "$man" = "ent" ]
+  then
+    (cd ent; wget http://www.oasis-open.org/docbook/xml/4.1.2/ent/$file)
+  else
+    wget http://www.oasis-open.org/docbook/xml/4.1.2/$file
+  fi
+done

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/fetch.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/jsvc.1.xml
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/jsvc.1.xml?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/jsvc.1.xml (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/jsvc.1.xml Fri Jul 30 06:50:12 2010
@@ -0,0 +1,188 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements.  See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+                   "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd">
+<refentry id='jsvc1'>
+  <refmeta>
+    <refentrytitle>JSVC</refentrytitle>
+    <manvolnum>1</manvolnum>
+    <refmiscinfo class='date'>May 2005</refmiscinfo>
+    <refmiscinfo class='source'>Jsvc version 1.0.1</refmiscinfo>
+    <refmiscinfo class='manual'>Apache Commons project</refmiscinfo>
+  </refmeta>
+  <refnamediv id='name'>
+    <refname>jsvc</refname>
+    <refpurpose>application to launch java daemon</refpurpose>
+  </refnamediv>
+  <!-- body begins here -->
+  <refsynopsisdiv id='synopsis'>
+    <cmdsynopsis>
+      <command>jsvc</command>
+      <arg choice='opt'>-jvm <replaceable>JVM name</replaceable></arg>
+      <arg choice='opt'>-classpath <replaceable>path</replaceable></arg>
+      <arg choice='opt'>-cp <replaceable>path</replaceable></arg>
+      <arg choice='opt'>-home <replaceable>directory</replaceable></arg>
+      <arg choice='opt'>-version</arg>
+      <arg choice='opt'>-help</arg>
+      <arg choice='opt'>-?</arg>
+      <arg choice='opt'>-nodetach</arg>
+      <arg choice='opt'>-debug</arg>
+      <arg choice='opt'>-check</arg>
+      <arg choice='opt'>-user <replaceable>user</replaceable></arg>
+      <arg choice='opt'>-wait <replaceable>waittime</replaceable></arg>
+      <arg choice='opt'>-stop</arg>
+      <arg choice='opt'>-verbose<replaceable>:class|gc|jni</replaceable></arg>
+      <arg choice='opt'>-outfile <replaceable>/full/path/to/file</replaceable></arg>
+      <arg choice='opt'>-errfile <replaceable>/full/path/to/file</replaceable></arg>
+      <arg choice='opt'>-pidfile <replaceable>/full/path/to/file</replaceable></arg>
+      <arg choice='opt'>-Dproperty=<replaceable>value</replaceable></arg>
+      <arg choice='opt'>-X<replaceable>option</replaceable></arg>
+      <!-- end of the new arguments -->
+    </cmdsynopsis>
+  </refsynopsisdiv>
+  <refsect1 id="description">
+    <title>DESCRIPTION</title>
+    <para><command>jsvc</command> executes <emphasis remap="I">classfile</emphasis>
+    that implements a Daemon interface.</para>
+  </refsect1>
+
+  <refsect1 id="options">
+    <title>OPTIONS</title>
+
+    <variablelist remap="TP">
+      <varlistentry>
+        <term><option>-jvm</option> JVM name</term>
+        <listitem>
+          <para>use a specific Java Virtual Machine.</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-cp/ -classpath</option> directory and zip/jar 
+          files</term>
+        <listitem>
+          <para>set search path for service classes and resouces</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-home</option> directory</term>
+        <listitem>
+          <para>set the path of your JDK or JRE installation (or set
+                the JAVA_HOME environment variable)
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-version</option></term>
+        <listitem>
+          <para>show the current Java environment version (to check
+                correctness of -home and -jvm. Implies -nodetach)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-help</option></term>
+        <listitem>
+          <para>show this help page (implies -nodetach)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-nodetach</option></term>
+        <listitem>
+          <para>don't detach from parent process and become a daemon</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-debug</option></term>
+        <listitem>
+          <para>verbosely print debugging information</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-check</option></term>
+        <listitem>
+          <para>only check service (implies -nodetach)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-stop</option></term>
+        <listitem>
+          <para>stop the service using the file given in the -pidfile option</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-wait</option> waittime</term>
+        <listitem>
+          <para>wait up to waittime seconds for the service to start
+                                       waittime should multiple of 10 (min=10)
+          </para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-user</option> user</term>
+        <listitem>
+          <para>user used to run the daemon (defaults to current user)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-verbose[:class|gc|jni]</option></term>
+        <listitem>
+          <para>enable verbose output</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-outfile</option> /full/path/to/file</term>
+        <listitem>
+          <para>Location for output from stdout (defaults to /dev/null). Use 
+            the value '&amp;2' to simulate '1&gt;&amp;2'</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-errfile</option> /full/path/to/file</term>
+        <listitem>
+          <para>Location for output from stderr (defaults to /dev/null). Use 
+            the value '&amp;1' to simulate '2&gt;&amp;1'</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-pidfile</option> /full/path/to/file</term>
+        <listitem>
+          <para>Location for output from the file containing the pid of jsvc 
+            (defaults to /var/run/jsvc.pid)</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-D</option>&lt;name&gt;=&lt;value&gt;</term>
+        <listitem>
+          <para>set a Java system property</para>
+        </listitem>
+      </varlistentry>
+      <varlistentry>
+        <term><option>-X</option>&lt;option&gt;</term>
+        <listitem>
+          <para>set Virtual Machine specific option</para>
+        </listitem>
+      </varlistentry>
+    </variablelist>
+  </refsect1>
+
+  <refsect1 id='author'><title>AUTHOR</title>
+    <para>JSVC is part of the Apache Commons Daemon project. Authors are 
+      Jean-Frederic Clere, Remy Maucherat, Yoav Shapira, Bill Barker. JSVC is 
+      under the Apache License Version 2.0.</para>
+  </refsect1>
+
+</refentry>

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/man/jsvc.1.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/.indent.pro
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/.indent.pro?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/.indent.pro (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/.indent.pro Fri Jul 30 06:50:12 2010
@@ -0,0 +1,7 @@
+-i4 -npsl -di0 -br -nce -d0 -cli0 -npcs -nfc1 -nut -ncs
+-Tbool
+-Targ_data
+-Thome_data
+-Thome_jvm
+-Tdso_handle
+

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Makefile.in
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Makefile.in?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Makefile.in (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Makefile.in Fri Jul 30 06:50:12 2010
@@ -0,0 +1,45 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+# @author  Pier Fumagalli <mailto:pier.fumagalli@eng.sun.com>
+# @version $Id: Makefile.in 909069 2010-02-11 16:43:36Z mturk $
+
+include ../Makedefs
+
+OBJS =  arguments.o \
+	debug.o \
+	dso-dlfcn.o \
+	dso-dyld.o \
+	help.o \
+	home.o \
+	java.o \
+	location.o \
+	replace.o \
+	locks.o \
+	signals.o
+
+all: jsvc libservice.a
+
+libservice.a: $(OBJS)
+	ar cr libservice.a $(OBJS)
+	$(RANLIB) libservice.a
+
+jsvc: jsvc-unix.o libservice.a
+	$(LDCMD) $(LDFLAGS) jsvc-unix.o libservice.a $(LIBS) -o ../jsvc
+
+clean:
+	rm -f $(OBJS) ../jsvc jsvc-unix.o libservice.a
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Makefile.in
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh Fri Jul 30 06:50:12 2010
@@ -0,0 +1,78 @@
+#!/bin/sh
+##############################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+##############################################################################
+#
+# Small shell script to show how to start/stop Tomcat using jsvc
+# If you want to have Tomcat running on port 80 please modify the server.xml
+# file:
+#
+#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
+#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
+#               port="80" minProcessors="5" maxProcessors="75"
+#               enableLookups="true" redirectPort="8443"
+#               acceptCount="10" debug="0" connectionTimeout="60000"/>
+#
+# This is for of Tomcat-4.1.x (Apache Tomcat/4.1)
+#
+# Adapt the following lines to your configuration
+JAVA_HOME=/usr/java/jdk1.3.1
+CATALINA_HOME=/home1/jakarta/jakarta-tomcat-4.1/build
+DAEMON_HOME=/home1/jakarta/jakarta-commons/daemon
+TOMCAT_USER=jakarta
+TMP_DIR=/var/tmp
+CATALINA_OPTS=
+CLASSPATH=\
+$JAVA_HOME/lib/tools.jar:\
+$DAEMON_HOME/dist/commons-daemon.jar:\
+$CATALINA_HOME/bin/bootstrap.jar
+
+case "$1" in
+  start)
+    #
+    # Start Tomcat
+    #
+    $DAEMON_HOME/src/native/unix/jsvc \
+    -user $TOMCAT_USER \
+    -home $JAVA_HOME \
+    -Dcatalina.home=$CATALINA_HOME \
+    -Djava.io.tmpdir=$TMP_DIR \
+    -outfile $CATALINA_HOME/logs/catalina.out \
+    -errfile '&1' \
+    $CATALINA_OPTS \
+    -cp $CLASSPATH \
+    org.apache.catalina.startup.BootstrapService
+    #
+    # To get a verbose JVM
+    #-verbose \
+    # To get a debug of jsvc.
+    #-debug \
+    ;;
+
+  stop)
+    #
+    # Stop Tomcat
+    #
+    PID=`cat /var/run/jsvc.pid`
+    kill $PID
+    ;;
+
+  *)
+    echo "Usage tomcat.sh start/stop"
+    exit 1;;
+esac

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh Fri Jul 30 06:50:12 2010
@@ -0,0 +1,89 @@
+#!/bin/sh
+##############################################################################
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+##############################################################################
+#
+# Small shell script to show how to start/stop Tomcat using jsvc
+# If you want to have Tomcat running on port 80 please modify the server.xml
+# file:
+#
+#    <!-- Define a non-SSL HTTP/1.1 Connector on port 80 -->
+#    <Connector className="org.apache.catalina.connector.http.HttpConnector"
+#               port="80" minProcessors="5" maxProcessors="75"
+#               enableLookups="true" redirectPort="8443"
+#               acceptCount="10" debug="0" connectionTimeout="60000"/>
+#
+# That is for Tomcat-5.0.x (Apache Tomcat/5.0)
+#
+# Adapt the following lines to your configuration
+JAVA_HOME=/home2/java/j2sdk1.4.2_03
+CATALINA_HOME=/home/tomcat5/tomcat5/jakarta-tomcat-5/build
+DAEMON_HOME=/home/jfclere/daemon
+TOMCAT_USER=tomcat5
+
+# for multi instances adapt those lines.
+TMP_DIR=/var/tmp
+PID_FILE=/var/run/jsvc.pid
+CATALINA_BASE=/home/tomcat5/tomcat5/jakarta-tomcat-5/build
+
+CATALINA_OPTS="-Djava.library.path=/home/jfclere/jakarta-tomcat-connectors/jni/native/.libs"
+CLASSPATH=\
+$JAVA_HOME/lib/tools.jar:\
+$CATALINA_HOME/bin/commons-daemon.jar:\
+$CATALINA_HOME/bin/bootstrap.jar
+
+case "$1" in
+  start)
+    #
+    # Start Tomcat
+    #
+    $DAEMON_HOME/src/native/unix/jsvc \
+    -user $TOMCAT_USER \
+    -home $JAVA_HOME \
+    -Dcatalina.home=$CATALINA_HOME \
+    -Dcatalina.base=$CATALINA_BASE \
+    -Djava.io.tmpdir=$TMP_DIR \
+    -wait 10 \
+    -pidfile $PID_FILE \
+    -outfile $CATALINA_HOME/logs/catalina.out \
+    -errfile '&1' \
+    $CATALINA_OPTS \
+    -cp $CLASSPATH \
+    org.apache.catalina.startup.Bootstrap
+    #
+    # To get a verbose JVM
+    #-verbose \
+    # To get a debug of jsvc.
+    #-debug \
+    exit $?
+    ;;
+
+  stop)
+    #
+    # Stop Tomcat
+    #
+    $DAEMON_HOME/src/native/unix/jsvc \
+    -stop \
+    -pidfile $PID_FILE \
+    org.apache.catalina.startup.Bootstrap
+    exit $?
+    ;;
+
+  *)
+    echo "Usage tomcat.sh start/stop"
+    exit 1;;
+esac

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh
------------------------------------------------------------------------------
    svn:eol-style = LF

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/Tomcat5.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,463 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: arguments.c 967041 2010-07-23 10:59:51Z mturk $ */
+#include "jsvc.h"
+#include <limits.h>
+#include <glob.h>
+
+/* Return the argument of a command line option */
+static char *optional(int argc, char *argv[], int argi)
+{
+
+    argi++;
+    if (argi >= argc)
+        return NULL;
+    if (argv[argi] == NULL)
+        return NULL;
+    if (argv[argi][0] == '-')
+        return NULL;
+    return strdup(argv[argi]);
+}
+
+static char *memstrcat(char *ptr, const char *str, const char *add)
+{
+    size_t nl = 1;
+    int   nas = ptr == NULL;
+    if (ptr)
+        nl += strlen(ptr);
+    if (str)
+        nl += strlen(str);
+    if (add)
+        nl += strlen(add);
+    ptr = (char *)realloc(ptr, nl);
+    if (ptr) {
+        if (nas)
+            *ptr = '\0';
+        if (str)
+            strcat(ptr, str);
+        if (add)
+            strcat(ptr, add);
+    }
+    return ptr;
+}
+
+static char* eval_ppath(char *strcp, const char *pattern)
+{
+    glob_t globbuf;
+    char   jars[PATH_MAX + 1];
+
+    if (strlen(pattern) > (sizeof(jars) - 5)) {
+        return memstrcat(strcp, pattern, NULL);
+    }
+    strcpy(jars, pattern);
+    strcat(jars, ".jar");
+    memset(&globbuf, 0, sizeof(glob_t));
+    if (glob(jars, GLOB_ERR, NULL, &globbuf) == 0) {
+        size_t n;
+        for (n = 0; n < globbuf.gl_pathc - 1; n++) {
+            strcp = memstrcat(strcp, globbuf.gl_pathv[n], ":");
+            if (strcp == NULL) {
+                globfree(&globbuf);
+                return NULL;
+            }
+        }
+        strcp = memstrcat(strcp, globbuf.gl_pathv[n], NULL);
+        globfree(&globbuf);
+    }
+    return strcp;
+}
+
+#define JAVA_CLASSPATH      "-Djava.class.path="
+/**
+ * Call glob on each PATH like string path.
+ * Glob is called only if the part ends with asterisk in which
+ * case asterisk is replaced by *.jar when searching
+ */
+static char* eval_cpath(const char *cp)
+{
+    char *cpy = memstrcat(NULL, JAVA_CLASSPATH, cp);
+    char *gcp = NULL;
+    char *pos;
+    char *ptr;
+
+    if (!cpy)
+        return NULL;
+    ptr = cpy + sizeof(JAVA_CLASSPATH) - 1;;
+    while ((pos = strchr(ptr, ':'))) {
+        *pos = '\0';
+        if (gcp)
+            gcp = memstrcat(gcp, ":", NULL);
+        else
+            gcp = memstrcat(NULL, JAVA_CLASSPATH, NULL);
+        if ((pos > ptr) && (*(pos - 1) == '*')) {
+            if (!(gcp = eval_ppath(gcp, ptr))) {
+                /* Error.
+                * Return the original string processed so far.
+                */
+                return cpy;
+            }
+        }
+        else
+            gcp = memstrcat(gcp, ptr, NULL);
+        ptr = pos + 1;
+    }
+    if (*ptr) {
+        size_t end = strlen(ptr);
+        if (gcp)
+            gcp = memstrcat(gcp, ":", NULL);
+        else
+            gcp = memstrcat(NULL, JAVA_CLASSPATH, NULL);
+        if (end > 0 && ptr[end - 1] == '*') {
+            /* Last path elemet ends with star
+            * Do a globbing.
+            */
+            gcp = eval_ppath(gcp, ptr);
+        }
+        else {
+            /* Just add the part */
+            gcp = memstrcat(gcp, ptr, NULL);
+        }
+    }
+    /* Free the allocated copy */
+    if (gcp) {
+        free(cpy);
+        return gcp;
+    }
+    else
+        return cpy;
+}
+
+/* Parse command line arguments */
+static arg_data *parse(int argc, char *argv[])
+{
+    arg_data *args = NULL;
+    char *temp     = NULL;
+    char *cmnd     = NULL;
+    int x          = 0;
+
+    /* Create the default command line arguments */
+    args = (arg_data *)malloc(sizeof(arg_data));
+    args->pidf = "/var/run/jsvc.pid"; /* The default PID file */
+    args->user    = NULL;         /* No user switching by default */
+    args->dtch    = true;         /* Do detach from parent */
+    args->vers    = false;        /* Don't display version */
+    args->help    = false;        /* Don't display help */
+    args->chck    = false;        /* Don't do a check-only startup */
+    args->stop    = false;        /* Stop a running jsvc */
+    args->wait    = 0;            /* Wait until jsvc has started the JVM */
+    args->install = false;        /* Don't install as a service */
+    args->remove  = false;        /* Don't remove the installed service */
+    args->service = false;        /* Don't run as a service */
+    args->name    = NULL;         /* No VM version name */
+    args->home    = NULL;         /* No default JAVA_HOME */
+    args->onum    = 0;            /* Zero arguments, but let's have some room */
+    args->clas    = NULL;         /* No class predefined */
+    args->anum    = 0;            /* Zero class specific arguments but make room*/
+    args->outfile = "/dev/null";   /* Swallow by default */
+    args->errfile = "/dev/null";   /* Swallow by default */
+    args->redirectstdin = true;    /* Redirect stdin to /dev/null by default */
+    args->procname = "jsvc.exec";
+
+    if (!(args->args = (char **)malloc(argc * sizeof(char *))))
+        return NULL;
+    if (!(args->opts = (char **)malloc(argc * sizeof(char *))))
+        return NULL;
+
+    /* Set up the command name */
+    cmnd = strrchr(argv[0],'/');
+    if (cmnd == NULL)
+        cmnd = argv[0];
+    else
+        cmnd++;
+    log_prog = strdup(cmnd);
+
+    /* Iterate thru command line arguments */
+    for (x = 1; x < argc; x++) {
+
+        if (!strcmp(argv[x], "-cp") ||
+            !strcmp(argv[x], "-classpath")) {
+            temp = optional(argc, argv, x++);
+            if (temp == NULL) {
+                log_error("Invalid classpath specified");
+                return NULL;
+            }
+            args->opts[args->onum] = eval_cpath(temp);
+            if (args->opts[args->onum] == NULL) {
+                log_error("Invalid classpath specified");
+                return NULL;
+            }
+            free(temp);
+            args->onum++;
+
+        }
+        else if (!strcmp(argv[x], "-jvm")) {
+            args->name = optional(argc, argv, x++);
+            if (args->name == NULL) {
+                log_error("Invalid Java VM name specified");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-home")) {
+            args->home = optional(argc, argv, x++);
+            if (args->home == NULL) {
+                log_error("Invalid Java Home specified");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-user")) {
+            args->user = optional(argc, argv, x++);
+            if (args->user == NULL) {
+                log_error("Invalid user name specified");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-version")) {
+            args->vers = true;
+            args->dtch = false;
+        }
+        else if (!strcmp(argv[x], "-showversion")) {
+            args->vershow = true;
+        }
+        else if (!strcmp(argv[x], "-?") ||
+                 !strcmp(argv[x], "-help") ||
+                 !strcmp(argv[x], "--help")) {
+            args->help = true;
+            args->dtch = false;
+            return args;
+        }
+        else if (!strcmp(argv[x], "-X")) {
+            log_error("Option -X currently unsupported");
+            log_error("Please use \"java -X\" to see your extra VM options");
+        }
+        else if (!strcmp(argv[x], "-debug")) {
+            log_debug_flag = true;
+        }
+        else if (!strcmp(argv[x], "-wait")) {
+            temp = optional(argc, argv, x++);
+            if (temp)
+                args->wait = atoi(temp);
+            if (args->wait < 10) {
+                log_error("Invalid wait time specified (min=10)");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-stop")) {
+            args->stop = true;
+        }
+        else if (!strcmp(argv[x], "-check")) {
+            args->chck = true;
+            args->dtch = false;
+        }
+        else if (!strcmp(argv[x], "-nodetach")) {
+            args->dtch = false;
+        }
+        else if (!strcmp(argv[x], "-keepstdin")) {
+           args->redirectstdin = false;
+        }
+        else if (!strcmp(argv[x], "-service")) {
+            args->service = true;
+        }
+        else if (!strcmp(argv[x], "-install")) {
+            args->install = true;
+        }
+        else if (!strcmp(argv[x], "-remove")) {
+            args->remove = true;
+        }
+        else if (!strcmp(argv[x], "-pidfile")) {
+            args->pidf = optional(argc, argv, x++);
+            if (args->pidf == NULL) {
+                log_error("Invalid PID file specified");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-outfile")) {
+            args->outfile = optional(argc, argv, x++);
+            if(args->outfile == NULL) {
+                log_error("Invalid Output File specified");
+                return NULL;
+            }
+        }
+        else if (!strcmp(argv[x], "-errfile")) {
+            args->errfile = optional(argc, argv, x++);
+            if (args->errfile == NULL) {
+                log_error("Invalid Error File specified");
+                return NULL;
+            }
+        }
+        else if (!strncmp(argv[x], "-verbose", 8)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+#ifdef HAVE_KAFFEVM
+        else if (!strncmp(argv[x], "-vmdebug", 8)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+            temp = optional(argc,argv,x++);
+            if (temp == NULL) {
+                log_error("vmdebug option requires a debug flag.");
+                return NULL;
+            }
+            args->opts[args->onum++] = strdup(temp);
+        }
+#endif
+        else if (!strcmp(argv[x], "-D")) {
+            log_error("Parameter -D must be followed by <name>=<value>");
+            return NULL;
+        }
+        else if (!strncmp(argv[x], "-D", 2)) {
+            temp = strchr(argv[x], '=');
+            if (temp == argv[x] + 2) {
+                log_error("A property name must be specified before '='");
+                return NULL;
+            }
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-X", 2)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-ea", 3)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-enableassertions", 17)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-da", 3)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-disableassertions", 18)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-esa")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-enablesystemassertions")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-dsa")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-disablesystemassertions")) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strcmp(argv[x], "-procname")) {
+            args->procname = optional(argc, argv, x++);
+            if (args->procname == NULL) {
+              log_error("Invalid process name specified");
+              return NULL;
+            }
+        }
+        else if (!strncmp(argv[x], "-agentlib:", 10)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-agentpath:", 11)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (!strncmp(argv[x], "-javaagent:", 11)) {
+            args->opts[args->onum++] = strdup(argv[x]);
+        }
+        else if (*argv[x] == '-') {
+            log_error("Invalid option %s",argv[x]);
+            return NULL;
+        }
+        else {
+            args->clas=strdup(argv[x]);
+            break;
+        }
+    }
+
+    if (args->clas == NULL && args->remove == false) {
+        log_error("No class specified");
+        return NULL;
+    }
+
+    x++;
+    while (x < argc) {
+        args->args[args->anum++] = strdup(argv[x++]);
+    }
+    return args;
+}
+static const char *IsYesNo(bool par)
+{
+    switch (par) {
+        case false:
+            return "No";
+        case true:
+            return "Yes";
+    }
+    return "[Error]";
+}
+static const char *IsTrueFalse(bool par)
+{
+    switch (par) {
+        case false:
+            return "False";
+        case true:
+             return "True";
+    }
+    return "[Error]";
+}
+
+static const char *IsEnabledDisabled(bool par)
+{
+    switch (par) {
+        case true:
+            return "Enabled";
+        case false:
+            return "Disabled";
+    }
+    return "[Error]";
+}
+
+/* Main entry point: parse command line arguments and dump them */
+arg_data *arguments(int argc, char *argv[])
+{
+    arg_data *args = parse(argc,argv);
+    int x = 0;
+
+    if (args == NULL) {
+        log_error("Cannot parse command line arguments");
+        return NULL;
+    }
+
+    if (log_debug_flag == true) {
+        log_debug("+-- DUMPING PARSED COMMAND LINE ARGUMENTS --------------");
+        log_debug("| Detach:          %s", IsTrueFalse(args->dtch));
+        log_debug("| Show Version:    %s", IsYesNo(args->vers));
+        log_debug("| Show Help:       %s", IsYesNo(args->help));
+        log_debug("| Check Only:      %s", IsEnabledDisabled(args->chck));
+        log_debug("| Stop:            %s", IsTrueFalse(args->stop));
+        log_debug("| Wait:            %d", args->wait);
+        log_debug("| Run as service:  %s", IsYesNo(args->service));
+        log_debug("| Install service: %s", IsYesNo(args->install));
+        log_debug("| Remove service:  %s", IsYesNo(args->remove));
+        log_debug("| JVM Name:        \"%s\"", PRINT_NULL(args->name));
+        log_debug("| Java Home:       \"%s\"", PRINT_NULL(args->home));
+        log_debug("| PID File:        \"%s\"", PRINT_NULL(args->pidf));
+        log_debug("| User Name:       \"%s\"", PRINT_NULL(args->user));
+        log_debug("| Extra Options:   %d", args->onum);
+        for (x = 0; x < args->onum; x++) {
+            log_debug("|   \"%s\"", args->opts[x]);
+        }
+
+        log_debug("| Class Invoked:   \"%s\"", PRINT_NULL(args->clas));
+        log_debug("| Class Arguments: %d", args->anum);
+        for (x = 0; x < args->anum; x++) {
+            log_debug("|   \"%s\"",args->args[x]);
+        }
+        log_debug("+-------------------------------------------------------");
+    }
+    return args;
+}
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.h?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.h (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.h Fri Jul 30 06:50:12 2010
@@ -0,0 +1,92 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: arguments.h 923078 2010-03-15 06:35:01Z mturk $ */
+#ifndef __JSVC_ARGUMENTS_H__
+#define __JSVC_ARGUMENTS_H__
+
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+/**
+ * The structure holding all parsed command line options.
+ */
+typedef struct {
+    /** The name of the PID file. */
+    char *pidf;
+    /** The name of the user. */
+    char *user;
+    /** The name of the JVM to use. */
+    char *name;
+    /** The JDK or JRE installation path (JAVA_HOME). */
+    char *home;
+    /** Options used to invoke the JVM. */
+    char **opts;
+    /** Number of JVM options. */
+    int onum;
+    /** The name of the class to invoke. */
+    char *clas;
+    /** Command line arguments to the class. */
+    char **args;
+    /** Number of class command line arguments. */
+    int anum;
+    /** Wether to detach from parent process or not. */
+    bool dtch;
+    /** Wether to print the VM version number or not. */
+    bool vers;
+    /** Show the VM version and continue. */
+    bool vershow;
+    /** Wether to display the help page or not. */
+    bool help;
+    /** Only check environment without running the service. */
+    bool chck;
+    /** Stop running jsvc */
+    bool stop;
+    /** number of seconds to until service started */
+    int wait;
+    /** Install as a service (win32) */
+    bool install;
+    /** Remove when installed as a service (win32) */
+    bool remove;
+    /** Run as a service (win32) */
+    bool service;
+    /** Destination for stdout */
+    char *outfile;
+    /** Destination for stderr */
+    char *errfile;
+    /** Program name for Linux **/
+    char *procname;
+    /** Whether to redirect stdin to /dev/null or not. Defaults to true **/
+    bool redirectstdin;
+} arg_data;
+
+/**
+ * Parse command line arguments.
+ *
+ * @param argc The number of command line arguments.
+ * @param argv Pointers to the different arguments.
+ * @return A pointer to a arg_data structure containing the parsed command
+ *         line arguments, or NULL if an error was detected.
+ */
+arg_data *arguments(int argc, char *argv[]);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* ifndef __JSVC_ARGUMENTS_H__ */
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/arguments.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,76 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: debug.c 921765 2010-03-11 10:03:32Z mturk $ */
+#include "jsvc.h"
+#include <sys/types.h>
+#include <unistd.h>
+#include <time.h>
+
+/* Wether debug is enabled or not */
+bool log_debug_flag = false;
+
+/* The name of the jsvc binary. */
+char *log_prog = "jsvc";
+
+/* Dump a debug message to stderr */
+void log_debug(const char *fmt, ...)
+{
+    va_list ap;
+    time_t now;
+    struct tm *nowtm;
+    char buff[80];
+
+    if (log_debug_flag == false)
+        return;
+    if (fmt == NULL)
+        return;
+
+    now   = time(NULL);
+    nowtm = localtime(&now);
+    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
+
+    va_start(ap, fmt);
+    fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog);
+    vfprintf(stderr, fmt, ap);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+    va_end(ap);
+}
+
+/* Dump an error message to stderr */
+void log_error(const char *fmt, ...)
+{
+    va_list ap;
+    time_t now;
+    struct tm *nowtm;
+    char buff[80];
+
+    if (fmt == NULL)
+        return;
+
+    now = time(NULL);
+    nowtm = localtime(&now);
+    strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
+
+    va_start(ap, fmt);
+    fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog);
+    vfprintf(stderr, fmt, ap);
+    fprintf(stderr, "\n");
+    fflush(stderr);
+    va_end(ap);
+}
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.h?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.h (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.h Fri Jul 30 06:50:12 2010
@@ -0,0 +1,59 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: debug.h 921765 2010-03-11 10:03:32Z mturk $ */
+#ifndef __JSVC_DEBUG_H__
+#define __JSVC_DEBUG_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+/**
+ * Wether debugging is enabled or not.
+ */
+extern bool log_debug_flag;
+
+/**
+ * The name of the jsvc binary.
+ */
+extern char *log_prog;
+
+/**
+ * Helper macro to avoid NPEs in printf.
+ */
+#define PRINT_NULL(x) ((x) == NULL ? "null" : (x))
+
+/**
+ * Dump a debug message.
+ *
+ * @param fmt The printf style message format.
+ * @param ... Any optional parameter for the message.
+ */
+void log_debug(const char *fmt, ...);
+
+/**
+ * Dump an error message.
+ *
+ * @param fmt The printf style message format.
+ * @param ... Any optional parameter for the message.
+ */
+void log_error(const char *fmt, ...);
+
+#ifdef __cplusplus
+}
+#endif
+#endif                          /* ifndef __JSVC_DEBUG_H__ */
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/debug.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dlfcn.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dlfcn.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dlfcn.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dlfcn.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,62 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: dso-dlfcn.c 921765 2010-03-11 10:03:32Z mturk $ */
+#include "jsvc.h"
+
+#ifdef DSO_DLFCN
+#include <dlfcn.h>
+#ifdef OS_LINUX
+bool ld_library_path_set = false;
+#endif /* ifdef OS_LINUX */
+
+/* Initialize all DSO stuff */
+bool dso_init(void)
+{
+    return true;
+}
+
+/* Attempt to link a library from a specified filename */
+dso_handle dso_link(const char *path)
+{
+    log_debug("Attemtping to load library %s", path);
+
+    return ((void *)dlopen(path, RTLD_GLOBAL | RTLD_NOW));
+}
+
+/* Attempt to unload a library */
+bool dso_unlink(dso_handle libr)
+{
+    if (dlclose(libr) == 0)
+        return true;
+    else
+        return false;
+}
+
+/* Get the address for a specifed symbol */
+void *dso_symbol(dso_handle hdl, const char *nam)
+{
+    return dlsym(hdl, nam);
+}
+
+/* Return the error message from dlopen */
+char *dso_error(void)
+{
+    return (dlerror());
+}
+
+#endif /* ifdef DSO_DLFCN */
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dlfcn.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dyld.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dyld.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dyld.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dyld.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,153 @@
+/*
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+ 
+       http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+/* @version $Id: dso-dyld.c 921765 2010-03-11 10:03:32Z mturk $ */
+#include "jsvc.h"
+
+#ifdef DSO_DYLD
+
+#include <mach-o/dyld.h>
+
+#ifdef __bool_true_false_are_defined
+/* We define these differently than stdbool.h, so ignore the defs there */
+#undef bool
+#undef true
+#undef false
+#endif
+
+
+/* Print an error message and abort all if a specified symbol wasn't found */
+static void nosymbol(const char *s)
+{
+    log_error("Cannot find symbol '%s' in library", s);
+    abort();
+}
+
+/* We found two symbols for the same name in two different modules */
+static NSModule multiple(NSSymbol s, NSModule om, NSModule nm)
+{
+    NSModule ret = nm;
+
+    log_debug("Symbol \"%s\" found in modules \"%s\" and \"%s\" (using %s)",
+              NSNameOfSymbol(s), NSNameOfModule(om), NSNameOfModule(nm),
+              NSNameOfModule(ret));
+
+    return (ret);
+}
+
+/* We got an error while linking a module, and if it's not a warning we have
+   to abort the whole program */
+static void linkedit(NSLinkEditErrors category, int number, const char *file,
+                     const char *message)
+{
+    log_error("Errors during link edit of file \"%s\" (error=%d): %s", file,
+              number, message);
+    /* Check if this error was only a warning */
+    if (category != NSLinkEditWarningError) {
+        log_error("Cannot continue");
+        abort();
+    }
+}
+
+/* Initialize all DSO stuff */
+bool dso_init()
+{
+    NSLinkEditErrorHandlers h;
+
+    h.undefined = nosymbol;
+    h.multiple = multiple;
+    h.linkEdit = linkedit;
+
+    NSInstallLinkEditErrorHandlers(&h);
+    return (true);
+}
+
+/* Attempt to link a library from a specified filename */
+dso_handle dso_link(const char *path)
+{
+    /* We need to load the library publically as NSModuleFileImage is not
+       yet implemented (at least for non MH_BUNDLE libraries */
+    if (NSAddLibrary(path) != TRUE)
+        return (NULL);
+    /* We need to return a non-null value, even if it has no meaning. One day
+       this whole crap will be fixed */
+    return ((void *)!NULL);
+}
+
+/* Attempt to unload a library */
+bool dso_unlink(dso_handle libr)
+{
+    /* Check the handle */
+    if (libr == NULL) {
+        log_error("Attempting to unload a module without handle");
+        return (false);
+    }
+
+    /* We don't have a module, so, we don't really have to do anything */
+    return (true);
+}
+
+/* Get the address for a specifed symbol */
+void *dso_symbol(dso_handle hdl, const char *nam)
+{
+    NSSymbol sym = NULL;
+    NSModule mod = NULL;
+    char *und = NULL;
+    void *add = NULL;
+    int x = 0;
+
+    /* Check parameters */
+    if (hdl == NULL) {
+        log_error("Invalid library handler specified");
+        return (NULL);
+    }
+
+    if (nam == NULL) {
+        log_error("Invalid symbol name specified");
+        return (NULL);
+    }
+
+    /* Process the correct name (add a _ before the name) */
+    while (nam[x] != '\0')
+        x++;
+    und = (char *)malloc(sizeof(char) * (x + 2));
+    while (x >= 0)
+        und[x + 1] = nam[x--];
+    und[0] = '_';
+
+    /* Find the symbol */
+    sym = NSLookupAndBindSymbol(und);
+    free(und);
+    if (sym == NULL)
+        return (NULL);
+
+    /* Dump some debugging output since this part is shaky */
+    mod = NSModuleForSymbol(sym);
+    add = NSAddressOfSymbol(sym);
+    log_debug("Symbol \"%s\" found in module \"%s\" at address \"0x%08X\"",
+              NSNameOfSymbol(sym), NSNameOfModule(mod), add);
+
+    /* We want to return the address of the symbol */
+    return (add);
+}
+
+/* Return the error message from dlopen: Well we already print it */
+char *dso_error()
+{
+    return ("no additional message");
+}
+
+#endif /* ifdef DSO_DYLD */

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso-dyld.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso.h?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso.h (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso.h Fri Jul 30 06:50:12 2010
@@ -0,0 +1,38 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: dso.h 921765 2010-03-11 10:03:32Z mturk $ */
+#ifndef __JSVC_DSO_H__
+#define __JSVC_DSO_H__
+
+#include "jsvc.h"
+
+/**
+ * A library handle represents a unique pointer to its location in memory.
+ */
+#ifdef DSO_DYLD
+#include <mach-o/dyld.h>
+#endif
+typedef void *dso_handle;
+
+bool dso_init(void);
+dso_handle dso_link(const char *pth);
+bool  dso_unlink(dso_handle lib);
+void *dso_symbol(dso_handle lib, const char *nam);
+char *dso_error(void);
+
+#endif /* __JSVC_DSO_H__ */
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/dso.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,103 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: help.c 923087 2010-03-15 07:00:01Z mturk $ */
+#include "jsvc.h"
+
+void help(home_data *data)
+{
+    int x;
+
+    printf("Usage: %s [-options] class [args...]\n", log_prog);
+    printf("\n");
+    printf("Where options include:\n");
+    printf("\n");
+    printf("    -help | --help | -?\n");
+    printf("        show this help page (implies -nodetach)\n");
+    printf("    -jvm <JVM name>\n");
+    printf("        use a specific Java Virtual Machine. Available JVMs:\n");
+    printf("           ");
+    for (x = 0; x < data->jnum; x++) {
+        printf(" '%s'", PRINT_NULL(data->jvms[x]->name));
+    }
+    printf("\n");
+
+    printf("    -cp / -classpath <directories and zip/jar files>\n");
+    printf("        set search path for service classes and resouces\n");
+    printf("    -home <directory>\n");
+    printf("        set the path of your JDK or JRE installation (or set\n");
+    printf("        the JAVA_HOME environment variable)\n");
+
+    printf("    -version\n");
+    printf("        show the current Java environment version (to check\n");
+    printf("        correctness of -home and -jvm. Implies -nodetach)\n");
+    printf("    -showversion\n");
+    printf("        show the current Java environment version (to check\n");
+    printf("        correctness of -home and -jvm) and continue execution.\n");
+    printf("    -nodetach\n");
+    printf("        don't detach from parent process and become a daemon\n");
+    printf("    -debug\n");
+    printf("        verbosely print debugging information\n");
+    printf("    -check\n");
+    printf("        only check service (implies -nodetach)\n");
+    printf("    -user <user>\n");
+    printf("        user used to run the daemon (defaults to current user)\n");
+    printf("    -verbose[:class|gc|jni]\n");
+    printf("        enable verbose output\n");
+    printf("    -outfile </full/path/to/file>\n");
+    printf("        Location for output from stdout (defaults to /dev/null)\n");
+    printf("        Use the value '&2' to simulate '1>&2'\n");
+    printf("    -errfile </full/path/to/file>\n");
+    printf("        Location for output from stderr (defaults to /dev/null)\n");
+    printf("        Use the value '&1' to simulate '2>&1'\n");
+    printf("    -pidfile </full/path/to/file>\n");
+    printf("        Location for output from the file containing the pid of jsvc\n");
+    printf("        (defaults to /var/run/jsvc.pid)\n");
+    printf("    -D<name>=<value>\n");
+    printf("        set a Java system property\n");
+    printf("    -X<option>\n");
+    printf("        set Virtual Machine specific option\n");
+    printf("    -ea[:<packagename>...|:<classname>]\n");
+    printf("    -enableassertions[:<packagename>...|:<classname>]\n");
+    printf("        enable assertions\n");
+    printf("    -da[:<packagename>...|:<classname>]\n");
+    printf("    -disableassertions[:<packagename>...|:<classname>]\n");
+    printf("        disable assertions\n");
+    printf("    -esa | -enablesystemassertions\n");
+    printf("        enable system assertions\n");
+    printf("    -dsa | -disablesystemassertions\n");
+    printf("        disable system assertions\n");
+    printf("    -agentlib:<libname>[=<options>]\n");
+    printf("        load native agent library <libname>, e.g. -agentlib:hprof\n");
+    printf("    -agentpath:<pathname>[=<options>]\n");
+    printf("        load native agent library by full pathname\n");
+    printf("    -javaagent:<jarpath>[=<options>]\n");
+    printf("        load Java programming language agent, see java.lang.instrument\n");
+    printf("    -procname <procname>\n");
+    printf("        use the specified process name (works only for Linux)\n");
+    printf("    -wait <waittime>\n");
+    printf("        wait waittime seconds for the service to start\n");
+    printf("        waittime should multiple of 10 (min=10)\n");
+    printf("    -stop\n");
+    printf("        stop the service using the file given in the -pidfile option\n");
+    printf("    -keepstdin\n");
+    printf("        does not redirect stdin to /dev/null\n");
+    printf("\njsvc (Apache Commons Daemon) " JSVC_VERSION_STRING "\n");
+    printf("Copyright (c) 1999-2010 Apache Software Foundation.\n");
+
+    printf("\n");
+}
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.h?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.h (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.h Fri Jul 30 06:50:12 2010
@@ -0,0 +1,24 @@
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: help.h 921765 2010-03-11 10:03:32Z mturk $ */
+#ifndef __JSVC_HELP_H__
+#define __JSVC_HELP_H__
+
+void help(home_data *data);
+
+#endif /* __JSVC_HELP_H__ */
+

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/help.h
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.c?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.c (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.c Fri Jul 30 06:50:12 2010
@@ -0,0 +1,265 @@
+/*
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+ 
+       http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+/* @version $Id: home.c 921765 2010-03-11 10:03:32Z mturk $ */
+#include "jsvc.h"
+
+/* Check if a path is a directory */
+static bool checkdir(char *path)
+{
+    struct stat home;
+
+    if (path == NULL)
+        return (false);
+    if (stat(path, &home) != 0)
+        return (false);
+    if (S_ISDIR(home.st_mode))
+        return (true);
+    return (false);
+}
+
+/* Check if a path is a file */
+static bool checkfile(char *path)
+{
+    struct stat home;
+
+    if (path == NULL)
+        return (false);
+    if (stat(path, &home) != 0)
+        return (false);
+    if (S_ISREG(home.st_mode))
+        return (true);
+    return (false);
+}
+
+/* Parse a VM configuration file */
+static bool parse(home_data *data)
+{
+    FILE *cfgf = fopen(data->cfgf, "r");
+    char *ret = NULL, *sp;
+    char buf[1024];
+
+    if (cfgf == NULL) {
+        log_debug("Can't open %s\n", data->cfgf);
+        return (false);
+    }
+
+    data->jvms = (home_jvm **)malloc(256 * sizeof(home_jvm *));
+
+    while ((ret = fgets(buf, 1024, cfgf)) != NULL) {
+        char *tmp = strchr(ret, '#');
+        int pos;
+
+        /* Clear the string at the first occurrence of '#' */
+        if (tmp != NULL)
+            tmp[0] = '\0';
+
+        /* Trim the string (including leading '-' chars */
+        while ((ret[0] == ' ') || (ret[0] == '\t') || (ret[0] == '-'))
+            ret++;
+        pos = strlen(ret);
+        while (pos >= 0) {
+            if ((ret[pos] == '\r') || (ret[pos] == '\n') || (ret[pos] == '\t')
+                || (ret[pos] == '\0') || (ret[pos] == ' ')) {
+                ret[pos--] = '\0';
+            }
+            else
+                break;
+        }
+        /* Format changed for 1.4 JVMs */
+        sp = strchr(ret, ' ');
+        if (sp != NULL)
+            *sp = '\0';
+
+        /* Did we find something significant? */
+        if (strlen(ret) > 0) {
+            char *libf = NULL;
+            int x = 0;
+
+            log_debug("Found VM %s definition in configuration", ret);
+            while (location_jvm_configured[x] != NULL) {
+                char *orig = location_jvm_configured[x];
+                char temp[1024];
+                char repl[1024];
+                int k;
+
+                k = replace(temp, 1024, orig, "$JAVA_HOME", data->path);
+                if (k != 0) {
+                    log_error("Can't replace home in VM library (%d)", k);
+                    return (false);
+                }
+                k = replace(repl, 1024, temp, "$VM_NAME", ret);
+                if (k != 0) {
+                    log_error("Can't replace name in VM library (%d)", k);
+                    return (false);
+                }
+
+                log_debug("Checking library %s", repl);
+                if (checkfile(repl)) {
+                    libf = strdup(repl);
+                    break;
+                }
+                x++;
+            }
+
+            if (libf == NULL) {
+                log_debug("Cannot locate library for VM %s (skipping)", ret);
+            }
+            else {
+                data->jvms[data->jnum] = (home_jvm *)malloc(sizeof(home_jvm));
+                data->jvms[data->jnum]->name = strdup(ret);
+                data->jvms[data->jnum]->libr = libf;
+                data->jnum++;
+                data->jvms[data->jnum] = NULL;
+            }
+        }
+    }
+    return (true);
+}
+
+/* Build a Java Home structure for a path */
+static home_data *build(char *path)
+{
+    home_data *data = NULL;
+    char *cfgf = NULL;
+    char buf[1024];
+    int x = 0;
+    int k = 0;
+
+    if (path == NULL)
+        return (NULL);
+
+    log_debug("Attempting to locate Java Home in %s", path);
+    if (checkdir(path) == false) {
+        log_debug("Path %s is not a directory", path);
+        return (NULL);
+    }
+
+    while (location_jvm_cfg[x] != NULL) {
+        if ((k =
+             replace(buf, 1024, location_jvm_cfg[x], "$JAVA_HOME",
+                     path)) != 0) {
+            log_error("Error replacing values for jvm.cfg (%d)", k);
+            return (NULL);
+        }
+        log_debug("Attempting to locate VM configuration file %s", buf);
+        if (checkfile(buf) == true) {
+            log_debug("Found VM configuration file at %s", buf);
+            cfgf = strdup(buf);
+            break;
+        }
+        x++;
+    }
+
+    data = (home_data *)malloc(sizeof(home_data));
+    data->path = strdup(path);
+    data->cfgf = cfgf;
+    data->jvms = NULL;
+    data->jnum = 0;
+
+    /* We don't have a jvm.cfg configuration file, so all we have to do is
+       trying to locate the "default" Java Virtual Machine library */
+    if (cfgf == NULL) {
+        log_debug("VM configuration file not found");
+        x = 0;
+        while (location_jvm_default[x] != NULL) {
+            char *libr = location_jvm_default[x];
+
+            if ((k = replace(buf, 1024, libr, "$JAVA_HOME", path)) != 0) {
+                log_error("Error replacing values for JVM library (%d)", k);
+                return (NULL);
+            }
+            log_debug("Attempting to locate VM library %s", buf);
+            if (checkfile(buf) == true) {
+                data->jvms = (home_jvm **)malloc(2 * sizeof(home_jvm *));
+                data->jvms[0] = (home_jvm *)malloc(sizeof(home_jvm));
+                data->jvms[0]->name = NULL;
+                data->jvms[0]->libr = strdup(buf);
+                data->jvms[1] = NULL;
+                data->jnum = 1;
+                return (data);
+            }
+            x++;
+        }
+
+        return (data);
+    }
+
+    /* If we got here, we most definitely found a jvm.cfg file */
+    if (parse(data) == false) {
+        log_error("Cannot parse VM configuration file %s", data->cfgf);
+    }
+
+    return (data);
+}
+
+/* Find the Java Home */
+static home_data *find(char *path)
+{
+    home_data *data = NULL;
+    int x = 0;
+
+    if (path == NULL) {
+        log_debug("Home not specified on command line, using environment");
+        path = getenv("JAVA_HOME");
+    }
+
+    if (path == NULL) {
+        log_debug("Home not on command line or in environment, searching");
+        while (location_home[x] != NULL) {
+            if ((data = build(location_home[x])) != NULL) {
+                log_debug("Java Home located in %s", data->path);
+                return (data);
+            }
+            x++;
+        }
+    }
+    else {
+        if ((data = build(path)) != NULL) {
+            log_debug("Java Home located in %s", data->path);
+            return (data);
+        }
+    }
+
+    return (NULL);
+}
+
+/* Main entry point: locate home and dump structure */
+home_data *home(char *path)
+{
+    home_data *data = find(path);
+    int x = 0;
+
+    if (data == NULL) {
+        log_error("Cannot locate Java Home");
+        return (NULL);
+    }
+
+    if (log_debug_flag == true) {
+        log_debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------");
+        log_debug("| Java Home:       \"%s\"", PRINT_NULL(data->path));
+        log_debug("| Java VM Config.: \"%s\"", PRINT_NULL(data->cfgf));
+        log_debug("| Found JVMs:      %d", data->jnum);
+        for (x = 0; x < data->jnum; x++) {
+            home_jvm *jvm = data->jvms[x];
+            log_debug("| JVM Name:        \"%s\"", PRINT_NULL(jvm->name));
+            log_debug("|                  \"%s\"", PRINT_NULL(jvm->libr));
+        }
+        log_debug("+-------------------------------------------------------");
+    }
+
+    return (data);
+}

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.h?rev=980662&view=auto
==============================================================================
--- commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.h (added)
+++ commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.h Fri Jul 30 06:50:12 2010
@@ -0,0 +1,47 @@
+/*
+   Licensed to the Apache Software Foundation (ASF) under one or more
+   contributor license agreements.  See the NOTICE file distributed with
+   this work for additional information regarding copyright ownership.
+   The ASF licenses this file to You under the Apache License, Version 2.0
+   (the "License"); you may not use this file except in compliance with
+   the License.  You may obtain a copy of the License at
+ 
+       http://www.apache.org/licenses/LICENSE-2.0
+ 
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
+*/
+/* @version $Id: home.h 921765 2010-03-11 10:03:32Z mturk $ */
+#ifndef __JSVC_HOME_H__
+#define __JSVC_HOME_H__
+
+typedef struct home_jvm home_jvm;
+typedef struct home_data home_data;
+
+struct home_jvm
+{
+    char *name;
+    char *libr;
+};
+
+struct home_data
+{
+    char *path;
+    char *cfgf;
+    home_jvm **jvms;
+    int jnum;
+};
+
+/**
+ * Attempt to locate a Java Home directory and build its structure.
+ *
+ * @param path The java home path specified on the command line.
+ * @return A home_data structure containing all informations related to
+ *         the Java environment, or NULL if no home was found.
+ */
+home_data *home(char *path);
+
+#endif /* ifndef __JSVC_HOME_H__ */

Propchange: commons/proper/daemon/tags/COMMONS_DAEMON_1_0_3_RC3/src/native/unix/native/home.h
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message