This is an automated email from the git hooks/post-receive script. tmancill pushed a commit to branch master in repository commons-daemon.
commit 281cdb031791f41395c09b9c8b8216a88e634ac2 Author: tony mancill <[email protected]> Date: Fri Nov 7 07:59:37 2014 -0800 Imported Upstream version 1.0.10 --- NOTICE.txt | 2 +- RELEASE-NOTES.txt | 27 +- build.xml | 6 +- pom.xml | 7 +- src/main/assembly/src.xml | 2 + src/main/assembly/{src.xml => win.xml} | 37 +- .../java/org/apache/commons/daemon/Daemon.java | 12 +- .../org/apache/commons/daemon/DaemonContext.java | 2 +- .../apache/commons/daemon/DaemonController.java | 16 +- .../apache/commons/daemon/DaemonInitException.java | 1 + .../org/apache/commons/daemon/DaemonListener.java | 2 +- .../apache/commons/daemon/DaemonPermission.java | 26 +- .../apache/commons/daemon/DaemonUserSignal.java | 5 +- .../daemon/support/DaemonConfiguration.java | 9 +- .../commons/daemon/support/DaemonLoader.java | 4 +- .../commons/daemon/support/DaemonWrapper.java | 4 +- src/media/logo.xcf | Bin 0 -> 23803 bytes src/native/unix/CHANGES.txt | 9 +- src/native/unix/configure | 661 +++++++++++++++++++- src/native/unix/configure.in | 6 +- src/native/unix/native/jsvc-unix.c | 170 +++-- src/native/unix/native/version.h | 2 +- src/native/windows/README | 70 ++- src/native/windows/README.dev | 63 -- src/native/windows/apps/prunmgr/Makefile | 9 +- src/native/windows/apps/prunmgr/prunmgr.h | 2 +- src/native/windows/apps/prunmgr/prunmgr.rc | 10 +- src/native/windows/apps/prunsrv/Makefile | 9 +- src/native/windows/apps/prunsrv/prunsrv.c | 8 +- src/native/windows/apps/prunsrv/prunsrv.h | 2 +- src/native/windows/apps/prunsrv/prunsrv.rc | 6 +- src/native/windows/include/cmdline.h | 4 +- src/native/windows/src/cmdline.c | 17 +- src/native/windows/src/utils.c | 6 +- src/samples/AloneDaemon.sh | 2 +- src/samples/Native.sh | 32 +- src/site/resources/images/logo.gif | Bin 0 -> 4540 bytes src/site/resources/images/logo.png | Bin 0 -> 14782 bytes src/site/site.xml | 45 ++ src/site/xdoc/binaries.xml | 83 +++ src/site/xdoc/download_daemon.xml | 154 +++++ src/site/xdoc/faq.xml | 100 +++ src/site/xdoc/index.xml | 115 ++++ src/site/xdoc/issue-tracking.xml | 102 +++ src/site/xdoc/jsvc.xml | 314 ++++++++++ src/site/xdoc/mail-lists.xml | 202 ++++++ src/site/xdoc/procrun.xml | 688 +++++++++++++++++++++ .../org/apache/commons/daemon/SimpleDaemon.java | 5 +- 48 files changed, 2767 insertions(+), 291 deletions(-) diff --git a/NOTICE.txt b/NOTICE.txt index 8dc87b0..ec34bbc 100644 --- a/NOTICE.txt +++ b/NOTICE.txt @@ -1,5 +1,5 @@ Apache Commons Daemon -Copyright 1999-2011 The Apache Software Foundation +Copyright 1999-2012 The Apache Software Foundation This product includes software developed by The Apache Software Foundation (http://www.apache.org/). diff --git a/RELEASE-NOTES.txt b/RELEASE-NOTES.txt index 4910ae0..8dcd917 100644 --- a/RELEASE-NOTES.txt +++ b/RELEASE-NOTES.txt @@ -1,21 +1,20 @@ -$Id: RELEASE-NOTES.txt 1202656 2011-11-16 12:17:56Z mturk $ - - Commons Daemon Package - Version 1.0.8 - Release Notes + Apache Commons Daemon + Version 1.0.10 + Release Notes INTRODUCTION: -Commons Daemon is a set of utilities and Java support classes for running -Java applications as server processes. +Apache Commons Daemon is a set of utilities and Java support classes +for running Java applications as server processes. Commonly known as 'daemon' processes in Unix terminology (hence the name), on Windows they are called 'services'. -This document contains the release notes for this version of the Commons -Daemon package, and highlights changes since the previous version. The -current release adds new features and bug fixes, and is being done now to -follow the release early/release often mentality. +This document contains the release notes for this version of the +Apache Commons Daemon package, and highlights changes since +the previous version. +The current release adds new features and bug fixes, and is being done now +to follow the release early/release often mentality. Compatibility with 1.0.3 @@ -80,6 +79,10 @@ NEW FEATURES: BUG FIXES: +1.0.10: DAEMON-241, DAEMON-242 + +1.0.9: DAEMON-232, DAEMON-233, DAEMON-234, DAEMON-237, DAEMON-240 + 1.0.8: DAEMON-195, DAEMON-215, DAEMON-216, DAEMON-218, DAEMON-219, DAEMON-220, DAEMON-222, DAEMON-223, DAEMON-224, DAEMON-227, DAEMON-228 @@ -118,4 +121,4 @@ https://issues.apache.org/jira/browse/DAEMON Or subscribe to the commons-user mailing list (prefix emails by [daemon]) http://commons.apache.org/mail-lists.html -The Commons-DAEMON Team \ No newline at end of file +The Apache Commons Daemon Team diff --git a/build.xml b/build.xml index f1e5cde..3127393 100644 --- a/build.xml +++ b/build.xml @@ -19,7 +19,7 @@ <!-- "Daemon" component of the Apache Commons Subproject - $Id: build.xml 1202070 2011-11-15 07:01:42Z mturk $ + $Id: build.xml 1292700 2012-02-23 08:28:00Z mturk $ --> @@ -59,7 +59,7 @@ <property name="component.title" value="Java Daemons"/> <!-- The current version number of this component --> - <property name="component.version" value="1.0.8"/> + <property name="component.version" value="1.0.10"/> <!-- The base directory for compilation targets --> <property name="build.home" value="target"/> @@ -214,7 +214,7 @@ version="true" doctitle="<h1>${component.title}</h1>" windowtitle="${component.title} (Version ${component.version})" - bottom="Copyright (c) 2002-2011 - Apache Software Foundation"> + bottom="Copyright (c) 2002-2012 - Apache Software Foundation"> <classpath refid="compile.classpath"/> <classpath location="${ant.lib}/ant.jar"/> </javadoc> diff --git a/pom.xml b/pom.xml index 8ee9c1b..99c48d5 100644 --- a/pom.xml +++ b/pom.xml @@ -22,12 +22,12 @@ <parent> <groupId>org.apache.commons</groupId> <artifactId>commons-parent</artifactId> - <version>21</version> + <version>23</version> </parent> <modelVersion>4.0.0</modelVersion> <groupId>commons-daemon</groupId> <artifactId>commons-daemon</artifactId> - <version>1.0.8</version> + <version>1.0.10</version> <name>Commons Daemon</name> <!-- Daemon started in Commons in 2002 with an import of code from Tomcat, which is why the NOTICE file has an earlier date than the inceptionYear --> @@ -92,7 +92,7 @@ <maven.compile.source>1.3</maven.compile.source> <maven.compile.target>1.3</maven.compile.target> <commons.componentid>daemon</commons.componentid> - <commons.release.version>1.0.8</commons.release.version> + <commons.release.version>1.0.10</commons.release.version> <commons.jira.id>DAEMON</commons.jira.id> <commons.jira.pid>12310468</commons.jira.pid> </properties> @@ -120,6 +120,7 @@ <descriptor>src/main/assembly/native-src.xml</descriptor> <descriptor>src/main/assembly/bin.xml</descriptor> <descriptor>src/main/assembly/src.xml</descriptor> + <descriptor>src/main/assembly/win.xml</descriptor> </descriptors> <tarLongFileMode>gnu</tarLongFileMode> </configuration> diff --git a/src/main/assembly/src.xml b/src/main/assembly/src.xml index 0861f60..e6be6f5 100644 --- a/src/main/assembly/src.xml +++ b/src/main/assembly/src.xml @@ -41,8 +41,10 @@ <exclude>native/unix/configure</exclude> <exclude>native/unix/autom4te.cache/**</exclude> <exclude>native/windows/**</exclude> + <!-- <exclude>media/**</exclude> <exclude>site/**</exclude> + --> </excludes> </fileSet> <fileSet> diff --git a/src/main/assembly/src.xml b/src/main/assembly/win.xml similarity index 51% copy from src/main/assembly/src.xml copy to src/main/assembly/win.xml index 0861f60..4511ae9 100644 --- a/src/main/assembly/src.xml +++ b/src/main/assembly/win.xml @@ -15,48 +15,27 @@ limitations under the License. --> <assembly> - <id>src</id> + <id>bin-windows</id> <formats> - <format>tar.gz</format> <format>zip</format> </formats> - <baseDirectory>${project.artifactId}-${project.version}-src</baseDirectory> + <baseDirectory></baseDirectory> + <includeSiteDirectory>false</includeSiteDirectory> <fileSets> <fileSet> <includes> - <include>build.properties.sample</include> - <include>build.xml</include> <include>LICENSE.txt</include> <include>NOTICE.txt</include> - <include>pom.xml</include> - <include>PROPOSAL.html</include> - <include>README</include> <include>RELEASE-NOTES.txt</include> </includes> </fileSet> <fileSet> - <directory>src</directory> - <excludes> - <exclude>**/*.sh</exclude> - <exclude>native/unix/configure</exclude> - <exclude>native/unix/autom4te.cache/**</exclude> - <exclude>native/windows/**</exclude> - <exclude>media/**</exclude> - <exclude>site/**</exclude> - </excludes> - </fileSet> - <fileSet> - <directory>src</directory> - <includes> - <include>native/windows/**</include> - </includes> - </fileSet> - <fileSet> - <directory>src</directory> - <fileMode>775</fileMode> + <directory>target</directory> + <outputDirectory></outputDirectory> <includes> - <include>**/*.sh</include> - <include>native/unix/configure</include> + <include>*.exe</include> + <include>amd64/*.exe</include> + <include>ia64/*.exe</include> </includes> </fileSet> </fileSets> diff --git a/src/main/java/org/apache/commons/daemon/Daemon.java b/src/main/java/org/apache/commons/daemon/Daemon.java index 14b8f3c..f849799 100644 --- a/src/main/java/org/apache/commons/daemon/Daemon.java +++ b/src/main/java/org/apache/commons/daemon/Daemon.java @@ -18,7 +18,7 @@ package org.apache.commons.daemon; /** - * This interface provides support for native daemon invocation. Using + * Provides support for native daemon invocation. Using * a platform dependant helper program, classes that implement the * <code>Daemon</code> interface can be initialized, started and * stopped according to the conventions of the underlying operating @@ -29,13 +29,13 @@ package org.apache.commons.daemon; * fashion. * </p> * @author Pier Fumagalli - * @version 1.0 <i>(CVS $Revision: 1023303 $)</i> + * @version $Id: Daemon.java 1204010 2011-11-19 16:15:23Z ggregory $ */ public interface Daemon { /** - * Initialize this <code>Daemon</code> instance. + * Initializes this <code>Daemon</code> instance. * <p> * This method gets called once the JVM process is created and the * <code>Daemon</code> instance is created thru its empty public @@ -73,7 +73,7 @@ public interface Daemon throws DaemonInitException, Exception; /** - * Start the operation of this <code>Daemon</code> instance. This + * Starts the operation of this <code>Daemon</code> instance. This * method is to be invoked by the environment after the init() * method has been successfully invoked and possibly the security * level of the JVM has been dropped. Implementors of this @@ -85,7 +85,7 @@ public interface Daemon throws Exception; /** - * Stop the operation of this <code>Daemon</code> instance. Note + * Stops the operation of this <code>Daemon</code> instance. Note * that the proper place to free any allocated resources such as * sockets or file descriptors is in the destroy method, as the * container may restart the Daemon by calling start() after @@ -95,7 +95,7 @@ public interface Daemon throws Exception; /** - * Free any resources allocated by this daemon such as file + * Frees any resources allocated by this daemon such as file * descriptors or sockets. This method gets called by the container * after stop() has been called, before the JVM exits. The Daemon * can not be restarted after this method has been called without a diff --git a/src/main/java/org/apache/commons/daemon/DaemonContext.java b/src/main/java/org/apache/commons/daemon/DaemonContext.java index 1679a3b..cf749ef 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonContext.java +++ b/src/main/java/org/apache/commons/daemon/DaemonContext.java @@ -23,7 +23,7 @@ package org.apache.commons.daemon; * communicate with the Daemon container. * * @author Pier Fumagalli - * @version 1.0 <i>(SVN $Revision: 923123 $)</i> + * @version $Id: DaemonContext.java 1204006 2011-11-19 16:09:15Z ggregory $ */ public interface DaemonContext { diff --git a/src/main/java/org/apache/commons/daemon/DaemonController.java b/src/main/java/org/apache/commons/daemon/DaemonController.java index e6e0ae5..7a37ee4 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonController.java +++ b/src/main/java/org/apache/commons/daemon/DaemonController.java @@ -19,46 +19,46 @@ package org.apache.commons.daemon; /** - * Interface which defines methods needed by the DaemonLoader. + * Defines methods needed by the DaemonLoader. * * @author Pier Fumagalli - * @version 1.0 <i>(SVN $Revision: 925054 $)</i> + * @version $Id: DaemonController.java 1204010 2011-11-19 16:15:23Z ggregory $ */ public interface DaemonController { /** - * Shutdown the daemon. + * Shuts down the daemon. */ public void shutdown() throws IllegalStateException; /** - * Reload daemon + * Reloads daemon */ public void reload() throws IllegalStateException; /** - * Shudown daemon and log failed message. + * Shuts down daemon and logs failed message. */ public void fail() throws IllegalStateException; /** - * Shudown daemon and log failed message. + * Shuts down daemon and logs failed message. */ public void fail(String message) throws IllegalStateException; /** - * Shudown daemon and log failed message. + * Shuts down daemon and logs failed message. */ public void fail(Exception exception) throws IllegalStateException; /** - * Shudown daemon and log failed message. + * Shuts down daemon and logs failed message. */ public void fail(String message, Exception exception) throws IllegalStateException; diff --git a/src/main/java/org/apache/commons/daemon/DaemonInitException.java b/src/main/java/org/apache/commons/daemon/DaemonInitException.java index ddc29ac..74716b7 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonInitException.java +++ b/src/main/java/org/apache/commons/daemon/DaemonInitException.java @@ -21,6 +21,7 @@ package org.apache.commons.daemon; * reason. Using this exception will cause the exception's message to come out * on stdout, rather than a dirty great stacktrace. * @author Nick Griffiths ([email protected]) + * @version $Id: DaemonInitException.java 1204007 2011-11-19 16:10:29Z ggregory $ */ public class DaemonInitException extends Exception { diff --git a/src/main/java/org/apache/commons/daemon/DaemonListener.java b/src/main/java/org/apache/commons/daemon/DaemonListener.java index 6fa38de..206ad3b 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonListener.java +++ b/src/main/java/org/apache/commons/daemon/DaemonListener.java @@ -21,7 +21,7 @@ import java.util.EventListener; /** * EvenListener type wrapper. - * @version 1.0 <i>(SVN $Revision: 923123 $)</i> + * @version $Id: DaemonListener.java 1204006 2011-11-19 16:09:15Z ggregory $ */ public interface DaemonListener extends EventListener { diff --git a/src/main/java/org/apache/commons/daemon/DaemonPermission.java b/src/main/java/org/apache/commons/daemon/DaemonPermission.java index c3531b9..63e8280 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonPermission.java +++ b/src/main/java/org/apache/commons/daemon/DaemonPermission.java @@ -21,7 +21,7 @@ import java.security.Permission; import java.util.StringTokenizer; /** - * This class represents the permissions to control and query the status of + * Represents the permissions to control and query the status of * a <code>Daemon</code>. A <code>DaemonPermission</code> consists of a * target name and a list of actions associated with it. * <p> @@ -83,7 +83,7 @@ import java.util.StringTokenizer; * </p> * * @author Pier Fumagalli - * @version 1.0 <i>(SVN $Revision: 937348 $)</i> + * @version $Id: DaemonPermission.java 1204010 2011-11-19 16:15:23Z ggregory $ */ public final class DaemonPermission extends Permission { @@ -173,7 +173,7 @@ public final class DaemonPermission extends Permission */ /** - * Create a new <code>DaemonPermission</code> instance with a specified + * Creates a new <code>DaemonPermission</code> instance with a specified * permission name. * <p> * This constructor will create a new <code>DaemonPermission</code> @@ -205,7 +205,7 @@ public final class DaemonPermission extends Permission } /** - * Create a new <code>DaemonPermission</code> instance with a specified + * Creates a new <code>DaemonPermission</code> instance with a specified * permission name and a specified list of actions. * <p> * </p> @@ -234,7 +234,7 @@ public final class DaemonPermission extends Permission */ /** - * Return the list of actions permitted by this instance of + * Returns the list of actions permitted by this instance of * <code>DaemonPermission</code> in its canonical form. * * @return The canonicalized list of actions. @@ -248,7 +248,7 @@ public final class DaemonPermission extends Permission } /** - * Return the hash code for this <code>DaemonPermission</code> instance. + * Returns the hash code for this <code>DaemonPermission</code> instance. * * @return An hash code value. */ @@ -259,7 +259,7 @@ public final class DaemonPermission extends Permission } /** - * Check if a specified object equals <code>DaemonPermission</code>. + * Checks if a specified object equals <code>DaemonPermission</code>. * * @return <b>true</b> or <b>false</b> wether the specified object equals * this <code>DaemonPermission</code> instance or not. @@ -280,7 +280,7 @@ public final class DaemonPermission extends Permission } /** - * Check if this <code>DaemonPermission</code> implies another + * Checks if this <code>DaemonPermission</code> implies another * <code>Permission</code>. * * @return <b>true</b> or <b>false</b> wether the specified permission @@ -303,7 +303,7 @@ public final class DaemonPermission extends Permission } /** - * Return a <code>String</code> representation of this instance. + * Returns a <code>String</code> representation of this instance. * * @return A <code>String</code> representing this * <code>DaemonPermission</code> instance. @@ -318,7 +318,8 @@ public final class DaemonPermission extends Permission * Private methods */ - /** Create a String description for this permission instance. + /** + * Creates a String description for this permission instance. */ private void setupDescription() { @@ -343,7 +344,8 @@ public final class DaemonPermission extends Permission this.desc = buf.toString(); } - /** Create a permission mask for a given control actions string. + /** + * Creates a permission mask for a given control actions string. */ private int createControlMask(String actions) throws IllegalArgumentException @@ -381,7 +383,7 @@ public final class DaemonPermission extends Permission return mask; } - /** Create a actions list for a given control permission mask. */ + /** Creates a actions list for a given control permission mask. */ private String createControlActions(int mask) { StringBuffer buf = new StringBuffer(); diff --git a/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java b/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java index e0ed152..b678c5c 100644 --- a/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java +++ b/src/main/java/org/apache/commons/daemon/DaemonUserSignal.java @@ -18,7 +18,7 @@ package org.apache.commons.daemon; /** - * This interface tags a Daemon as supporting some kind of + * Tags a Daemon as supporting some kind of * signaling method that allows the java application to * perform a custom action. * <p> @@ -27,12 +27,13 @@ package org.apache.commons.daemon; * </p> * @author Nick Griffiths <[email protected]> * @author Mladen Turk <[email protected]> + * @version $Id: DaemonUserSignal.java 1204010 2011-11-19 16:15:23Z ggregory $ */ public interface DaemonUserSignal { /** - * Perform a custom action on received user signal. + * Performs a custom action on received user signal. */ void signal(); diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java b/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java index d7f5a4f..014b0c0 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonConfiguration.java @@ -45,7 +45,7 @@ import java.text.ParseException; * value will be <code>${foo}</code>. * </p> * - * @version 1.0 <i>(SVN $Revision: 925053 $)</i> + * @version $Id: DaemonConfiguration.java 1204010 2011-11-19 16:15:23Z ggregory $ * @author Mladen Turk */ public final class DaemonConfiguration @@ -75,7 +75,7 @@ public final class DaemonConfiguration } /** - * Load the configuration properties file. + * Loads the configuration properties file. * * @param fileName The properties file to load. * @return <code>true</code> if the file was loaded. @@ -155,7 +155,8 @@ public final class DaemonConfiguration } /** - * Get the configuration property. + * Gets the configuration property. + * * @param name The name of the property to get. * * @throws ParseException if the property is wrongly formatted. @@ -170,7 +171,7 @@ public final class DaemonConfiguration } /** - * Get the configuration property array. + * Gets the configuration property array. * <p> * Property array is constructed form the lsit of properties * which end with <code>[index]</code> diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java b/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java index 1823fd5..6b498bd 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonLoader.java @@ -24,10 +24,10 @@ import org.apache.commons.daemon.DaemonInitException; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; -/* +/** * Used by jsvc for Daemon management. * - * @version 1.0 <i>(SVN $Revision: 1130635 $)</i> + * @version $Id: DaemonLoader.java 1204006 2011-11-19 16:09:15Z ggregory $ */ public final class DaemonLoader { diff --git a/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java b/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java index b7e1cc0..6ee4291 100644 --- a/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java +++ b/src/main/java/org/apache/commons/daemon/support/DaemonWrapper.java @@ -15,7 +15,7 @@ * limitations under the License. */ -/* @version $Id: Main.java 937350 2010-04-23 16:03:39Z mturk $ */ +/* @version $Id: DaemonWrapper.java 1204007 2011-11-19 16:10:29Z ggregory $ */ package org.apache.commons.daemon.support; @@ -31,7 +31,7 @@ import org.apache.commons.daemon.DaemonContext; * The applications must have the mechanism to manage * the application lifecycle. * - * @version 1.0 <i>(SVN $Revision: 925053 $)</i> + * @version $Id: DaemonWrapper.java 1204007 2011-11-19 16:10:29Z ggregory $ * @author Mladen Turk */ public class DaemonWrapper implements Daemon diff --git a/src/media/logo.xcf b/src/media/logo.xcf new file mode 100644 index 0000000..8ff7654 Binary files /dev/null and b/src/media/logo.xcf differ diff --git a/src/native/unix/CHANGES.txt b/src/native/unix/CHANGES.txt index bda92f6..6329de1 100644 --- a/src/native/unix/CHANGES.txt +++ b/src/native/unix/CHANGES.txt @@ -1,5 +1,10 @@ -APACHE COMMONS DAEMON (UNIX) CHANGELOG: -Last modified at [$Date: 2011-11-01 21:43:52 +0100 (Tue, 01 Nov 2011) $] + APACHE COMMONS DAEMON (UNIX) CHANGELOG: + +Changes with 1.0.10 + * Fix dynamic libcap loading for some linux ditributions (DAEMON-242) + +Changes with 1.0.9 + * Dynamically load libcap on linux (DAEMON-234) Changes with 1.0.8 * Better detection of JDK (DAEMON-220) diff --git a/src/native/unix/configure b/src/native/unix/configure index a1f55fd..824bf31 100755 --- a/src/native/unix/configure +++ b/src/native/unix/configure @@ -272,7 +272,44 @@ PACKAGE_STRING= PACKAGE_BUGREPORT= ac_unique_file="configure.in" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB STRIP [...] +# Factoring default headers for most tests. +ac_includes_default="\ +#include <stdio.h> +#if HAVE_SYS_TYPES_H +# include <sys/types.h> +#endif +#if HAVE_SYS_STAT_H +# include <sys/stat.h> +#endif +#if STDC_HEADERS +# include <stdlib.h> +# include <stddef.h> +#else +# if HAVE_STDLIB_H +# include <stdlib.h> +# endif +#endif +#if HAVE_STRING_H +# if !STDC_HEADERS && HAVE_MEMORY_H +# include <memory.h> +# endif +# include <string.h> +#endif +#if HAVE_STRINGS_H +# include <strings.h> +#endif +#if HAVE_INTTYPES_H +# include <inttypes.h> +#else +# if HAVE_STDINT_H +# include <stdint.h> +# endif +#endif +#if HAVE_UNISTD_H +# include <unistd.h> +#endif" + +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS build build_cpu build_vendor build_os host host_cpu host_vendor host_os CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT RANLIB ac_ct_RANLIB STRIP [...] ac_subst_files='' # Initialize some variables set by options. @@ -729,6 +766,10 @@ ac_env_CPPFLAGS_set=${CPPFLAGS+set} ac_env_CPPFLAGS_value=$CPPFLAGS ac_cv_env_CPPFLAGS_set=${CPPFLAGS+set} ac_cv_env_CPPFLAGS_value=$CPPFLAGS +ac_env_CPP_set=${CPP+set} +ac_env_CPP_value=$CPP +ac_cv_env_CPP_set=${CPP+set} +ac_cv_env_CPP_value=$CPP # # Report the --help message. @@ -813,6 +854,7 @@ Some influential environment variables: nonstandard directory <lib dir> CPPFLAGS C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> + CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. @@ -2793,38 +2835,454 @@ fi if test "$supported_os" = "linux" then -echo "$as_me:$LINENO: checking for cap_init in -lcap" >&5 -echo $ECHO_N "checking for cap_init in -lcap... $ECHO_C" >&6 -if test "${ac_cv_lib_cap_cap_init+set}" = set; then +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 +echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcap $LIBS" -cat >conftest.$ac_ext <<_ACEOF + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> +#endif + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + break +fi + + done + ac_cv_prog_CPP=$CPP -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +echo "$as_me:$LINENO: result: $CPP" >&5 +echo "${ECHO_T}$CPP" >&6 +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since + # <limits.h> exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef __STDC__ +# include <limits.h> +#else +# include <assert.h> #endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char cap_init (); + Syntax error +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + : +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.$ac_ext + + # OK, works on sane cases. Now check whether non-existent headers + # can be detected and how. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ac_nonexistent.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + # Broken: success on invalid input. +continue +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.err conftest.$ac_ext +if $ac_preproc_ok; then + : +else + { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&5 +echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details." >&2;} + { (exit 1); exit 1; }; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +echo "$as_me:$LINENO: checking for egrep" >&5 +echo $ECHO_N "checking for egrep... $ECHO_C" >&6 +if test "${ac_cv_prog_egrep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + if echo a | (grep -E '(a|b)') >/dev/null 2>&1 + then ac_cv_prog_egrep='grep -E' + else ac_cv_prog_egrep='egrep' + fi +fi +echo "$as_me:$LINENO: result: $ac_cv_prog_egrep" >&5 +echo "${ECHO_T}$ac_cv_prog_egrep" >&6 + EGREP=$ac_cv_prog_egrep + + +echo "$as_me:$LINENO: checking for ANSI C header files" >&5 +echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 +if test "${ac_cv_header_stdc+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> +#include <stdarg.h> +#include <string.h> +#include <float.h> + int main () { -cap_init (); + ; return 0; } _ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_header_stdc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_header_stdc=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <string.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <stdlib.h> + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then + : +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then + : +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <ctype.h> +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + exit(2); + exit (0); +} +_ACEOF +rm -f conftest$ac_exeext if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 - (eval $ac_link) 2>conftest.er1 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +( exit $ac_status ) +ac_cv_header_stdc=no +fi +rm -f core *.core gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +fi +echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 +echo "${ECHO_T}$ac_cv_header_stdc" >&6 +if test $ac_cv_header_stdc = yes; then + +cat >>confdefs.h <<\_ACEOF +#define STDC_HEADERS 1 +_ACEOF + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. + + + + + + + + + +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 +if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default + +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 @@ -2838,28 +3296,177 @@ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_cap_cap_init=yes + eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 -ac_cv_lib_cap_cap_init=no +eval "$as_ac_Header=no" +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS +echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + fi -echo "$as_me:$LINENO: result: $ac_cv_lib_cap_cap_init" >&5 -echo "${ECHO_T}$ac_cv_lib_cap_cap_init" >&6 -if test $ac_cv_lib_cap_cap_init = yes; then - CFLAGS="$CFLAGS -DHAVE_LIBCAP" ; LIBS="$LIBS -lcap" + +done + + +if test "${ac_cv_header_sys_capability_h+set}" = set; then + echo "$as_me:$LINENO: checking for sys/capability.h" >&5 +echo $ECHO_N "checking for sys/capability.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_capability_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_capability_h" >&6 +else + # Is the header compilable? +echo "$as_me:$LINENO: checking sys/capability.h usability" >&5 +echo $ECHO_N "checking sys/capability.h usability... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <sys/capability.h> +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" + || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_header_compiler=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6 + +# Is the header present? +echo "$as_me:$LINENO: checking sys/capability.h presence" >&5 +echo $ECHO_N "checking sys/capability.h presence... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <sys/capability.h> +_ACEOF +if { (eval echo "$as_me:$LINENO: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + ac_cpp_err=$ac_cpp_err$ac_c_werror_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi +rm -f conftest.err conftest.$ac_ext +echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6 + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: sys/capability.h: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: sys/capability.h: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: sys/capability.h: present but cannot be compiled" >&5 +echo "$as_me: WARNING: sys/capability.h: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: sys/capability.h: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: sys/capability.h: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: sys/capability.h: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: sys/capability.h: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: sys/capability.h: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: sys/capability.h: in the future, the compiler will take precedence" >&2;} + ( + cat <<\_ASBOX +## ------------------------------------------ ## +## Report this to the AC_PACKAGE_NAME lists. ## +## ------------------------------------------ ## +_ASBOX + ) | + sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +echo "$as_me:$LINENO: checking for sys/capability.h" >&5 +echo $ECHO_N "checking for sys/capability.h... $ECHO_C" >&6 +if test "${ac_cv_header_sys_capability_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_header_sys_capability_h=$ac_header_preproc +fi +echo "$as_me:$LINENO: result: $ac_cv_header_sys_capability_h" >&5 +echo "${ECHO_T}$ac_cv_header_sys_capability_h" >&6 + +fi +if test $ac_cv_header_sys_capability_h = yes; then + CFLAGS="$CFLAGS -DHAVE_LIBCAP" +else + { echo "$as_me:$LINENO: WARNING: cannot find headers for libcap" >&5 +echo "$as_me: WARNING: cannot find headers for libcap" >&2;} +fi + fi @@ -3533,6 +4140,8 @@ s,@STRIP@,$STRIP,;t t s,@ac_ct_STRIP@,$ac_ct_STRIP,;t t s,@JAVA_HOME@,$JAVA_HOME,;t t s,@LDCMD@,$LDCMD,;t t +s,@CPP@,$CPP,;t t +s,@EGREP@,$EGREP,;t t s,@INCLUDES@,$INCLUDES,;t t s,@LIBOBJS@,$LIBOBJS,;t t s,@LTLIBOBJS@,$LTLIBOBJS,;t t diff --git a/src/native/unix/configure.in b/src/native/unix/configure.in index 831af80..2ec623d 100644 --- a/src/native/unix/configure.in +++ b/src/native/unix/configure.in @@ -17,7 +17,7 @@ dnl dnl ------------------------------------------------------------------------- dnl Author Pier Fumagalli <mailto:[email protected]> -dnl Version $Id: configure.in 1194902 2011-10-29 15:19:18Z mturk $ +dnl Version $Id: configure.in 1292683 2012-02-23 07:37:10Z mturk $ dnl ------------------------------------------------------------------------- dnl ------------------------------------------------------------------------- @@ -115,7 +115,9 @@ fi AC_SUBST(LDCMD) if test "$supported_os" = "linux" then -AC_CHECK_LIB([cap], [cap_init], [CFLAGS="$CFLAGS -DHAVE_LIBCAP" ; LIBS="$LIBS -lcap"]) +AC_CHECK_HEADER([sys/capability.h], + [CFLAGS="$CFLAGS -DHAVE_LIBCAP"], + AC_MSG_WARN([cannot find headers for libcap])) fi if test -z "$STRIPFLAGS" diff --git a/src/native/unix/native/jsvc-unix.c b/src/native/unix/native/jsvc-unix.c index 83ce771..835f075 100644 --- a/src/native/unix/native/jsvc-unix.c +++ b/src/native/unix/native/jsvc-unix.c @@ -14,7 +14,7 @@ * limitations under the License. */ -/* @version $Id: jsvc-unix.c 1198399 2011-11-06 16:20:44Z mturk $ */ +/* @version $Id: jsvc-unix.c 1293002 2012-02-23 22:48:24Z mturk $ */ #include "jsvc.h" #include <signal.h> @@ -172,6 +172,48 @@ static int set_user_group(const char *user, int uid, int gid) /* Set linux capability, user and group */ #ifdef OS_LINUX +/* CAPSALL is to allow to read/write at any location */ +#define LEGACY_CAPSALL (1 << CAP_NET_BIND_SERVICE) + \ + (1 << CAP_SETUID) + \ + (1 << CAP_SETGID) + \ + (1 << CAP_DAC_READ_SEARCH) + \ + (1 << CAP_DAC_OVERRIDE) + +#define LEGACY_CAPSMAX (1 << CAP_NET_BIND_SERVICE) + \ + (1 << CAP_DAC_READ_SEARCH) + \ + (1 << CAP_DAC_OVERRIDE) + +/* That a more reasonable configuration */ +#define LEGACY_CAPS (1 << CAP_NET_BIND_SERVICE) + \ + (1 << CAP_DAC_READ_SEARCH) + \ + (1 << CAP_SETUID) + \ + (1 << CAP_SETGID) + +/* probably the only one Java could use */ +#define LEGACY_CAPSMIN (1 << CAP_NET_BIND_SERVICE) + \ + (1 << CAP_DAC_READ_SEARCH) + +#define LEGACY_CAP_VERSION 0x19980330 +static int set_legacy_caps(int caps) +{ + struct __user_cap_header_struct caphead; + struct __user_cap_data_struct cap; + + memset(&caphead, 0, sizeof caphead); + caphead.version = LEGACY_CAP_VERSION; + caphead.pid = 0; + memset(&cap, 0, sizeof cap); + cap.effective = caps; + cap.permitted = caps; + cap.inheritable = caps; + if (syscall(__NR_capset, &caphead, &cap) < 0) { + log_error("set_caps: failed to set capabilities"); + log_error("check that your kernel supports capabilities"); + return -1; + } + return 0; +} + #ifdef HAVE_LIBCAP static cap_value_t caps_std[] = { CAP_NET_BIND_SERVICE, @@ -188,6 +230,66 @@ static cap_value_t caps_min[] = { #define CAPS 1 #define CAPSMIN 2 + +typedef int (*fd_cap_free)(void *); +typedef cap_t (*fd_cap_init)(void); +typedef int (*fd_cap_clear)(cap_t); +typedef int (*fd_cap_get_flag)(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *); +typedef int (*fd_cap_set_flag)(cap_t, cap_flag_t, int, const cap_value_t *, cap_flag_value_t); +typedef int (*fd_cap_set_proc)(cap_t); + +static dso_handle hlibcap = NULL; +static fd_cap_free fp_cap_free; +static fd_cap_init fp_cap_init; +static fd_cap_clear fp_cap_clear; +static fd_cap_get_flag fp_cap_get_flag; +static fd_cap_set_flag fp_cap_set_flag; +static fd_cap_set_proc fp_cap_set_proc; + +static const char *libcap_locs[] = { + "/lib/libcap.so.2", + "/lib/libcap.so.1", + "/lib/libcap.so", + "/usr/lib/libcap.so.2", + "/usr/lib/libcap.so.1", + "/usr/lib/libcap.so", + NULL +}; + +static int ld_libcap(void) +{ + int i = 0; + dso_handle dso = NULL; +#define CAP_LDD(name) \ + if ((fp_##name = dso_symbol(dso, #name)) == NULL) { \ + log_error("cannot locate " #name " in libcap.so -- %s", dso_error()); \ + dso_unlink(dso); \ + return -1; \ + } else log_debug("loaded " #name " from libcap.") + + if (hlibcap != NULL) + return 0; + while (libcap_locs[i] && dso == NULL) { + if ((dso = dso_link(libcap_locs[i++]))) + break; + }; + if (dso == NULL) { + log_error("failed loading capabilities library -- %s.", dso_error()); + return -1; + } + CAP_LDD(cap_free); + CAP_LDD(cap_init); + CAP_LDD(cap_clear); + + CAP_LDD(cap_get_flag); + CAP_LDD(cap_set_flag); + CAP_LDD(cap_set_proc); + hlibcap = dso; +#undef CAP_LDD + return 0; +} + + static int set_caps(int cap_type) { cap_t c; @@ -196,6 +298,9 @@ static int set_caps(int cap_type) cap_value_t *caps; const char *type; + if (ld_libcap()) { + return set_legacy_caps(cap_type); + } if (cap_type == CAPS) { ncap = sizeof(caps_std)/sizeof(cap_value_t); caps = caps_std; @@ -212,16 +317,16 @@ static int set_caps(int cap_type) type = "null"; flag = CAP_CLEAR; } - c = cap_init(); - cap_clear(c); - cap_set_flag(c, CAP_EFFECTIVE, ncap, caps, flag); - cap_set_flag(c, CAP_INHERITABLE, ncap, caps, flag); - cap_set_flag(c, CAP_PERMITTED, ncap, caps, flag); - if (cap_set_proc(c) != 0) { + c = (*fp_cap_init)(); + (*fp_cap_clear)(c); + (*fp_cap_set_flag)(c, CAP_EFFECTIVE, ncap, caps, flag); + (*fp_cap_set_flag)(c, CAP_INHERITABLE, ncap, caps, flag); + (*fp_cap_set_flag)(c, CAP_PERMITTED, ncap, caps, flag); + if ((*fp_cap_set_proc)(c) != 0) { log_error("failed setting %s capabilities.", type); return -1; } - cap_free(c); + (*fp_cap_free)(c); if (cap_type == CAPS) log_debug("increased capability set."); else if (cap_type == CAPSMIN) @@ -233,45 +338,13 @@ static int set_caps(int cap_type) #else /* !HAVE_LIBCAP */ /* CAPSALL is to allow to read/write at any location */ -#define CAPSALL (1 << CAP_NET_BIND_SERVICE) + \ - (1 << CAP_SETUID) + \ - (1 << CAP_SETGID) + \ - (1 << CAP_DAC_READ_SEARCH) + \ - (1 << CAP_DAC_OVERRIDE) - -#define CAPSMAX (1 << CAP_NET_BIND_SERVICE) + \ - (1 << CAP_DAC_READ_SEARCH) + \ - (1 << CAP_DAC_OVERRIDE) - -/* That a more reasonable configuration */ -#define CAPS (1 << CAP_NET_BIND_SERVICE) + \ - (1 << CAP_DAC_READ_SEARCH) + \ - (1 << CAP_SETUID) + \ - (1 << CAP_SETGID) - -/* probably the only one Java could use */ -#define CAPSMIN (1 << CAP_NET_BIND_SERVICE) + \ - (1 << CAP_DAC_READ_SEARCH) - -#define LEGACY_CAP_VERSION 0x19980330 +#define CAPSALL LEGACY_CAPSALL +#define CAPSMAX LEGACY_CAPSMAX +#define CAPS LEGACY_CAPS +#define CAPSMIN LEGACY_CAPSMIN static int set_caps(int caps) { - struct __user_cap_header_struct caphead; - struct __user_cap_data_struct cap; - - memset(&caphead, 0, sizeof caphead); - caphead.version = LEGACY_CAP_VERSION; - caphead.pid = 0; - memset(&cap, 0, sizeof cap); - cap.effective = caps; - cap.permitted = caps; - cap.inheritable = caps; - if (syscall(__NR_capset, &caphead, &cap) < 0) { - log_error("set_caps: failed to set capabilities"); - log_error("check that your kernel supports capabilities"); - return -1; - } - return 0; + return set_legacy_caps(caps); } #endif @@ -650,13 +723,6 @@ static int child(arg_data *args, home_data *data, uid_t uid, gid_t gid) return ret; } - /* create a new process group to prevent kill 0 killing the monitor process */ -#if defined(OS_FREEBSD) || defined(OS_DARWIN) - setpgid(0, 0); -#else - setpgrp(); -#endif - #ifdef OS_LINUX /* setuid()/setgid() only apply the current thread so we must do it now */ if (linuxset_user_group(args->user, uid, gid) != 0) diff --git a/src/native/unix/native/version.h b/src/native/unix/native/version.h index 03b9962..35f9778 100644 --- a/src/native/unix/native/version.h +++ b/src/native/unix/native/version.h @@ -31,7 +31,7 @@ #define JSVC_MINOR_VERSION 0 /** patch level */ -#define JSVC_PATCH_VERSION 8 +#define JSVC_PATCH_VERSION 10 /** * This symbol is defined for internal, "development" copies of JSVC. diff --git a/src/native/windows/README b/src/native/windows/README index 28612cb..239d209 100644 --- a/src/native/windows/README +++ b/src/native/windows/README @@ -1,25 +1,59 @@ -Note: MAKE SURE you first build the java part (using Ant) otherwise the dist -directory is not created). +Configuring and Building Commons Daemon on Windows +================================================== -To build the service utilities for windows you will need: -- MS Visual C++ (I have used version 5.0). -- CYGWIN to build the jsvc.exe. -- A Java Platform 2 compliant SDK to run the service. +Using Visual Studio, you can build the Commons Daemon. +The Makefile make file has a bunch of documentation about its +options, but a trivial build is simply; -The Windows applications are found in: + nmake CPU=X86 + nmake CPU=X86 PREFIX=c:\desired\path\of\daemon install -apps/prunmgr -apps/prunsrv -The common source files are in +Needed Tools +============ -src -include -resources +Commons Daemon needs the Microsoft Visual C 6/SP5 to +build the x86 binaries. This is because this compiler +doesn't create MSVCRTnn.DLL dependencies which will +be loaded inside running JVM if used. +For building AMD64/EMT64 binaries use the Platform SDK +for Windows Server 2003R2. -The Makefiles in the apps/ directories can be used with MS Visual C++ 5.0. -They will not work with earlier versions of nmake -Note that later versions of Visual C++ can be set up to build the applications, -however they may generate executables linked with a later version of the MS "C" -runtime library (MSVCRTL), and may not work properly with all versions of Java. +Step by Step +============ + +0. These were written for 64-bit XP. YMMV. + +1. Install the pre-requisites: + - Microsoft Visual C 6 + - Microsoft Visual C 6 Service Pack 5 + - Platform SDK for Windows Server 2003 R2 + +2. Open a new command prompt (to ensure the environment is clean) + You'll need to do this for each different platform you want to build + +3. Configure the Visual C environment variables + Not necessary if the option to add them to the user's environment was + selected on install + %VC6_DIR%\Bin\VCVARS32.BAT + (e.g. "c:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT") + +4. Configure the Platform SDK environment (optional for X86?) + - win32 + <PlatformSdkDir>\SetEnv /SRV32 /RETAIL + - x64 + <PlatformSdkDir>\SetEnv /X64 /RETAIL + - i64 + <PlatformSdkDir>\SetEnv /SRV64 /RETAIL + +5. On 64-bit platforms set the following environment variable + set EXTRA_CFLAGS=/GS- + +6. Build the binary + - win32 + nmake CPU=X86 + - x64 + nmake CPU=X64 + - ia64 + nmake CPU=I64 diff --git a/src/native/windows/README.dev b/src/native/windows/README.dev deleted file mode 100644 index 55fddc3..0000000 --- a/src/native/windows/README.dev +++ /dev/null @@ -1,63 +0,0 @@ -Apache Commons Daemon -===================== - - -Configuring and Building Commons Daemon on Windows -================================================== - -Using Visual Studio, you can build the Commons Daemon. -The Makefile make file has a bunch of documentation about its -options, but a trivial build is simply; - - nmake CPU=X86 - nmake CPU=X86 PREFIX=c:\desired\path\of\daemon install - - -Needed Tools -============ - -Commons Daemon needs the Microsoft Visual C 6/SP5 to -build the x86 binaries. This is because this compiler -doesn't create MSVCRTnn.DLL dependencies which will -be loaded inside running JVM if used. -For building AMD64/EMT64 binaries use the Platform SDK -for Windows Server 2003R2. - - -Step by Step -============ - -0. These were written for 64-bit XP. YMMV. - -1. Install the pre-requisites: - - Microsoft Visual C 6 - - Microsoft Visual C 6 Service Pack 5 - - Platform SDK for Windows Server 2003 R2 - -2. Open a new command prompt (to ensure the environment is clean) - You'll need to do this for each different platform you want to build - -3. Configure the Visual C environment variables - Not necessary if the option to add them to the user's environment was - selected on install - %VC6_DIR%\Bin\VCVARS32.BAT - (e.g. "c:\Program Files (x86)\Microsoft Visual Studio\VC98\Bin\VCVARS32.BAT") - -4. Configure the Platform SDK environment (optional for X86?) - - win32 - <PlatformSdkDir>\SetEnv /SRV32 /RETAIL - - x64 - <PlatformSdkDir>\SetEnv /X64 /RETAIL - - i64 - <PlatformSdkDir>\SetEnv /SRV64 /RETAIL - -5. On 64-bit platforms set the following environment variable - set EXTRA_CFLAGS=/GS- - -6. Build the binary - - win32 - nmake CPU=X86 - - x64 - nmake CPU=X64 - - ia64 - nmake CPU=I64 diff --git a/src/native/windows/apps/prunmgr/Makefile b/src/native/windows/apps/prunmgr/Makefile index 0c6e14a..f9a2ee8 100644 --- a/src/native/windows/apps/prunmgr/Makefile +++ b/src/native/windows/apps/prunmgr/Makefile @@ -22,12 +22,19 @@ UNICODE = 1 !include <..\..\include\Makefile.inc> !IF !DEFINED(PREFIX) || "$(PREFIX)" == "" -PREFIX = .\..\..\dist +PREFIX = .\..\..\..\..\..\target !ENDIF !IF !DEFINED(SRCDIR) || "$(SRCDIR)" == "" SRCDIR = .\..\.. !ENDIF +!IF "$(CPU)" == "X64" +PREFIX = $(PREFIX)\amd64 +!ENDIF +!IF "$(CPU)" == "I64" +PREFIX = $(PREFIX)\ia64 +!ENDIF + LFLAGS = $(LFLAGS) /version:1.0 LIBS = $(LIBS) user32.lib gdi32.lib winspool.lib comdlg32.lib comctl32.lib shlwapi.lib netapi32.lib INCLUDES = -I$(SRCDIR)\include -I$(SRCDIR)\src $(JAVA_INCLUDES) diff --git a/src/native/windows/apps/prunmgr/prunmgr.h b/src/native/windows/apps/prunmgr/prunmgr.h index eec2470..140cc0f 100644 --- a/src/native/windows/apps/prunmgr/prunmgr.h +++ b/src/native/windows/apps/prunmgr/prunmgr.h @@ -24,7 +24,7 @@ #define _PRUNMGR_H #undef PRG_VERSION -#define PRG_VERSION "1.0.8.0" +#define PRG_VERSION "1.0.10.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #define IDM_TM_EXIT 2000 diff --git a/src/native/windows/apps/prunmgr/prunmgr.rc b/src/native/windows/apps/prunmgr/prunmgr.rc index a8228fc..26775e5 100644 --- a/src/native/windows/apps/prunmgr/prunmgr.rc +++ b/src/native/windows/apps/prunmgr/prunmgr.rc @@ -228,9 +228,9 @@ END STRINGTABLE BEGIN IDS_APPLICATION RSTR_PSM - IDS_APPVERSION "Version 1.0.8" + IDS_APPVERSION "Version 1.0.10" IDS_APPFULLNAME RSTR_PSM " Version " PRG_VERSION - IDS_APPCOPYRIGHT "Copyright (c) 2000-2011 The Apache Software Foundation" + IDS_APPCOPYRIGHT "Copyright (c) 2000-2012 The Apache Software Foundation" IDS_APPDESCRIPTION "Apache Commons Daemon Service Management Tool" IDS_ALREAY_RUNING "An instance of '%S' application is already running" IDS_ERRORCMD "Unknown command line option '%s'\nSee the manual for command line usage." @@ -259,8 +259,8 @@ BEGIN END 1 VERSIONINFO - FILEVERSION 1,0,8,0 - PRODUCTVERSION 1,0,8,0 + FILEVERSION 1,0,10,0 + PRODUCTVERSION 1,0,10,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L @@ -280,7 +280,7 @@ BEGIN VALUE "FileDescription", RSTR_PSM "\0" VALUE "FileVersion", PRG_VERSION VALUE "InternalName", RSTR_PSM "\0" - VALUE "LegalCopyright", "Copyright (c) 2000-2011 The Apache Software Foundation.\0" + VALUE "LegalCopyright", "Copyright (c) 2000-2012 The Apache Software Foundation.\0" VALUE "OriginalFilename", "prunmgr.exe\0" VALUE "ProductName", RSTR_PSM "\0" VALUE "ProductVersion", PRG_VERSION diff --git a/src/native/windows/apps/prunsrv/Makefile b/src/native/windows/apps/prunsrv/Makefile index 6f300a8..2add62b 100644 --- a/src/native/windows/apps/prunsrv/Makefile +++ b/src/native/windows/apps/prunsrv/Makefile @@ -22,7 +22,7 @@ UNICODE = 1 !include <..\..\include\Makefile.inc> !IF !DEFINED(PREFIX) || "$(PREFIX)" == "" -PREFIX = .\..\..\dist +PREFIX = .\..\..\..\..\..\target !ENDIF !IF !DEFINED(SRCDIR) || "$(SRCDIR)" == "" SRCDIR = .\..\.. @@ -32,6 +32,13 @@ SRCDIR = .\..\.. LFLAGS = $(LFLAGS) /stack:0x64000 !ENDIF +!IF "$(CPU)" == "X64" +PREFIX = $(PREFIX)\amd64 +!ENDIF +!IF "$(CPU)" == "I64" +PREFIX = $(PREFIX)\ia64 +!ENDIF + LFLAGS = $(LFLAGS) /version:1.0 LIBS = $(LIBS) user32.lib gdi32.lib winspool.lib comdlg32.lib comctl32.lib shlwapi.lib netapi32.lib INCLUDES = -I$(SRCDIR)\include -I$(SRCDIR)\src $(JAVA_INCLUDES) diff --git a/src/native/windows/apps/prunsrv/prunsrv.c b/src/native/windows/apps/prunsrv/prunsrv.c index 6e3bf37..334e549 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.c +++ b/src/native/windows/apps/prunsrv/prunsrv.c @@ -87,7 +87,7 @@ static LPCWSTR _commands[] = { static LPCWSTR _altcmds[] = { L"run", /* 1 Run Service as console application (default)*/ L"service", /* 2 Run Service */ - L"start", /* 3 Version */ + L"start", /* 3 Start Service */ L"stop", /* 4 Stop Service */ L"update", /* 5 Update Service parameters */ L"install", /* 6 Install Service */ @@ -382,7 +382,7 @@ static void printVersion(void) { fwprintf(stderr, L"Commons Daemon Service Runner version %S/Win%d (%S)\n", PRG_VERSION, PRG_BITS, __DATE__); - fwprintf(stderr, L"Copyright (c) 2000-2011 The Apache Software Foundation.\n\n" + fwprintf(stderr, L"Copyright (c) 2000-2012 The Apache Software Foundation.\n\n" L"For bug reporting instructions, please see:\n" L"<URL:https://issues.apache.org/jira/browse/DAEMON>."); } @@ -1630,9 +1630,9 @@ void __cdecl main(int argc, char **argv) goto cleanup; } apxCmdlineLoadEnvVars(lpCmdline); - if (lpCmdline->dwCmdIndex < 5) { + if (lpCmdline->dwCmdIndex < 6) { if (!loadConfiguration(lpCmdline) && - lpCmdline->dwCmdIndex < 4) { + lpCmdline->dwCmdIndex < 5) { apxLogWrite(APXLOG_MARK_ERROR "Load configuration failed"); rv = 2; goto cleanup; diff --git a/src/native/windows/apps/prunsrv/prunsrv.h b/src/native/windows/apps/prunsrv/prunsrv.h index d862eb7..0d7c8b6 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.h +++ b/src/native/windows/apps/prunsrv/prunsrv.h @@ -25,7 +25,7 @@ #define _PRUNSRV_H #undef PRG_VERSION -#define PRG_VERSION "1.0.8.0" +#define PRG_VERSION "1.0.10.0" #define PRG_REGROOT L"Apache Software Foundation\\Procrun 2.0" #endif /* _PRUNSRV_H */ diff --git a/src/native/windows/apps/prunsrv/prunsrv.rc b/src/native/windows/apps/prunsrv/prunsrv.rc index 399aa83..6e666cf 100644 --- a/src/native/windows/apps/prunsrv/prunsrv.rc +++ b/src/native/windows/apps/prunsrv/prunsrv.rc @@ -22,8 +22,8 @@ IDI_MAINICON ICON "../../resources/procrunw.ico" 1 VERSIONINFO - FILEVERSION 1,0,8,0 - PRODUCTVERSION 1,0,8,0 + FILEVERSION 1,0,10,0 + PRODUCTVERSION 1,0,10,0 FILEFLAGSMASK 0x3fL #if defined(_DEBUG) FILEFLAGS 0x03L @@ -43,7 +43,7 @@ BEGIN VALUE "FileDescription", RSTR_PRUNSRV "\0" VALUE "FileVersion", PRG_VERSION VALUE "InternalName", RSTR_PRUNSRV "\0" - VALUE "LegalCopyright", "Copyright (c) 2000-2011 The Apache Software Foundation.\0" + VALUE "LegalCopyright", "Copyright (c) 2000-2012 The Apache Software Foundation.\0" VALUE "OriginalFilename", "prunsrv.exe\0" VALUE "ProductName", RSTR_PRUNSRV "\0" VALUE "ProductVersion", PRG_VERSION diff --git a/src/native/windows/include/cmdline.h b/src/native/windows/include/cmdline.h index 57629bb..0d5af19 100644 --- a/src/native/windows/include/cmdline.h +++ b/src/native/windows/include/cmdline.h @@ -30,8 +30,8 @@ __APXBEGIN_DECLS #define APXCMDOPT_SRV 0x00000200 /* Save to service registry */ #define APXCMDOPT_USR 0x00000400 /* Save to user registry */ -#define APXCMDOPT_FOUND 0x00001000 /* The option is present in cmdline */ -#define APXCMDOPT_ADD 0x00002000 /* The option is present in cmdline as ++*/ +#define APXCMDOPT_FOUND 0x00001000 /* The option is present in cmdline as -- */ +#define APXCMDOPT_ADD 0x00002000 /* The option is present in cmdline as ++ */ typedef struct APXCMDLINEOPT APXCMDLINEOPT; diff --git a/src/native/windows/src/cmdline.c b/src/native/windows/src/cmdline.c index cbd88ed..53d7868 100644 --- a/src/native/windows/src/cmdline.c +++ b/src/native/windows/src/cmdline.c @@ -179,6 +179,21 @@ LPAPXCMDLINE apxCmdlineParse( lpOptions[l].dwType |= APXCMDOPT_FOUND; break; } + if (add) { + if (!(lpOptions[l].dwType & APXCMDOPT_FOUND)) { + /* Only set add flag in case there was no --option + */ + lpOptions[l].dwType |= APXCMDOPT_ADD; + } + } + else if (lpOptions[l].dwType & APXCMDOPT_ADD) { + /* We have ++option --option ... + * Discard earlier values and go over. + */ + lpOptions[l].dwType &= ~APXCMDOPT_ADD; + lpOptions[l].dwValue = 0; + lpOptions[l].szValue = 0; + } if (lpOptions[l].dwType & APXCMDOPT_STR) lpOptions[l].szValue = val; else if (lpOptions[l].dwType & APXCMDOPT_INT) @@ -214,8 +229,6 @@ LPAPXCMDLINE apxCmdlineParse( } } lpOptions[l].dwType |= APXCMDOPT_FOUND; - if (add) - lpOptions[l].dwType |= APXCMDOPT_ADD; match = l + 1; break; } diff --git a/src/native/windows/src/utils.c b/src/native/windows/src/utils.c index f0fd49e..b0819d5 100644 --- a/src/native/windows/src/utils.c +++ b/src/native/windows/src/utils.c @@ -298,7 +298,7 @@ apxSetEnvironmentVariable(APXHANDLE hPool, LPCTSTR szName, LPCTSTR szValue, } -/** Convert null separated double null terimated string to LPTSTR array) +/** Convert null separated double null terminated string to LPTSTR array) * returns array size */ DWORD @@ -318,7 +318,7 @@ apxMultiSzToArrayW(APXHANDLE hPool, LPCWSTR lpString, LPWSTR **lppArray) *lppArray = (LPWSTR *)buff; p = (LPWSTR)(buff + (n + 2) * sizeof(LPWSTR)); - AplCopyMemory(p, lpString, (l + 1) * sizeof(WCHAR) + sizeof(WCHAR)); + AplCopyMemory(p, lpString, (l + 1) * sizeof(WCHAR)); for (i = 0; i < n; i++) { (*lppArray)[i] = p; while (*p) @@ -347,7 +347,7 @@ apxMultiSzToArrayA(APXHANDLE hPool, LPCSTR lpString, LPSTR **lppArray) *lppArray = (LPSTR *)buff; p = (LPSTR)(buff + (n + 2) * sizeof(LPSTR)); - AplCopyMemory(p, lpString, (l + 1) * sizeof(CHAR) + sizeof(CHAR)); + AplCopyMemory(p, lpString, (l + 1) * sizeof(CHAR)); for (i = 0; i < n; i++) { (*lppArray)[i] = p; while (*p) diff --git a/src/samples/AloneDaemon.sh b/src/samples/AloneDaemon.sh index d0ba86e..37865fc 100755 --- a/src/samples/AloneDaemon.sh +++ b/src/samples/AloneDaemon.sh @@ -1,5 +1,5 @@ #!/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. diff --git a/src/samples/Native.sh b/src/samples/Native.sh index 79eb3ec..bc3795a 100755 --- a/src/samples/Native.sh +++ b/src/samples/Native.sh @@ -1,18 +1,20 @@ -## 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. -## +#!/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. +# # for linux ;-) and Mac OS X case `uname -s` in Darwin) diff --git a/src/site/resources/images/logo.gif b/src/site/resources/images/logo.gif new file mode 100644 index 0000000..115dbe5 Binary files /dev/null and b/src/site/resources/images/logo.gif differ diff --git a/src/site/resources/images/logo.png b/src/site/resources/images/logo.png new file mode 100644 index 0000000..ce6049b Binary files /dev/null and b/src/site/resources/images/logo.png differ diff --git a/src/site/site.xml b/src/site/site.xml new file mode 100644 index 0000000..b17d327 --- /dev/null +++ b/src/site/site.xml @@ -0,0 +1,45 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + 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. +--> +<project name="Daemon"> + <bannerRight> + <name>Commons Daemon</name> + <src>/images/logo.png</src> + <href>/index.html</href> + </bannerRight> + + <body> + <menu name="Daemon"> + <item name="Overview" href="/index.html"/> + <item name="Download" href="/download_daemon.cgi"/> + <item name="Procrun" href="/procrun.html"/> + <item name="Jsvc" href="/jsvc.html"/> + <item name="Native binaries" href="/binaries.html"/> + <item name="FAQ" href="/faq.html"/> + <item name="Wiki" href="http://wiki.apache.org/commons/Daemon"/> + </menu> + + <menu name="Development"> + <item name="Mailing Lists" href="/mail-lists.html"/> + <item name="Issue Tracking" href="/issue-tracking.html"/> + <item name="Source Repository" href="/source-repository.html"/> + <item name="Javadoc (SVN latest)" href="apidocs/index.html"/> + </menu> + + </body> + +</project> diff --git a/src/site/xdoc/binaries.xml b/src/site/xdoc/binaries.xml new file mode 100644 index 0000000..83854bd --- /dev/null +++ b/src/site/xdoc/binaries.xml @@ -0,0 +1,83 @@ +<?xml version="1.0"?> +<!-- + 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. +--> + +<document> + + <properties> + <title>Daemon : binaries</title> + <author email="[email protected]">Jean-Frederic Clere</author> + </properties> + +<body> +<section name="What to download?"> +<p> +In the directory +<a href="http://www.apache.org/dist/commons/daemon/binaries/">binaries</a> +you will find subdirectories containing archives +corresponding to your operating system. If your machine is not in the list, +please mail us and we will try to make it available, or you can try to build it on your own. +The non-Windows files are compressed tar files. They are named <code>commons-daemon-m.n.p-bin-os-hw.tar.gz</code>. +For example: In the directory <code>linux</code> we have <code>commons-daemon-1.0.10-bin-linux-i686.tar.gz</code> +That is a file suitable for a Linux system running on Intel hardware. +Windows builds are provided as a zip file. +</p> +</section> + +<section name="How do I get the executable?"> +<subsection name="jsvc"> +<p> +Do the following: +<ul> + <li>Find the tar.gz file corresponding to your configuration.</li> + <li>Download it.</li> + <li>Uncompress the tar file and extract the contents (better with gnu tar). + There should be an executable file called <code>jsvc</code> and some text files</li> + <li>Copy the executable to the location where you want to run it.</li> + <li>Write a suitable shell script + (see in <code>src/samples</code> and <code>src/native/unix/native/Tomcat.sh</code>) + to get your Java application started as a daemon. + </li> +</ul> +</p> +</subsection> +<subsection name="procrun"> +<p> +The Windows archive (e.g. commons-daemon-1.0.10-bin-windows.zip) contains 2 different executables: +<ul> +<li>prunsrv.exe - service application for running applications as services.</li> +<li>prunmgr.exe - the GUI manager application used to monitor and configure installed services.</li> +</ul> +There is only one <code>prunmgr.exe</code> application for all architectures. +The <code>prunsrv.exe</code> executable is available in 3 different versions for different architectures. +The version in the top-level directory is for 32-bit (x86) architectures. +The lower level directories are for 64-bit systems: +<ul> +<li>amd64 - AMD/EMT 64-bit</li> +<li>ia64 - Intel Itanium 64-bit</li> +</ul> +The Windows application <code>prunsrv.exe</code> is used to install an application as a service. +Once installed, <code>prunmgr.exe</code> can be used to monitor and reconfigure the service. +(see <a href="procrun.html">procrun</a> for more information). +The Windows binary zip archive should be unpacked into the location from which you wish to run it, for example: +<code>%ProgramFiles%\Apache Commons Daemon</code> +</p> +</subsection> +</section> + +</body> +</document> diff --git a/src/site/xdoc/download_daemon.xml b/src/site/xdoc/download_daemon.xml new file mode 100644 index 0000000..b3f9cec --- /dev/null +++ b/src/site/xdoc/download_daemon.xml @@ -0,0 +1,154 @@ +<?xml version="1.0"?> +<!-- +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. +--> +<!-- + +======================================================================+ + |**** ****| + |**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****| + |**** DO NOT EDIT DIRECTLY ****| + |**** ****| + +======================================================================+ + | TEMPLATE FILE: download-page-template.xml | + | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates | + +======================================================================+ + | | + | 1) Re-generate using: mvn commons:download-page | + | | + | 2) Set the following properties in the component's pom: | + | - commons.componentid (required, alphabetic, lower case) | + | - commons.release.version (required) | + | - commons.binary.suffix (optional) | + | (defaults to "-bin", set to "" for pre-maven2 releases) | + | | + | 3) Example Properties | + | | + | <properties> | + | <commons.componentid>math</commons.componentid> | + | <commons.release.version>1.2</commons.release.version> | + | </properties> | + | | + +======================================================================+ +--> +<document> + <properties> + <title>Download Commons Daemon</title> + <author email="[email protected]">Commons Documentation Team</author> + </properties> + <body> + <section name="Download Commons Daemon"> + <subsection name="Using a Mirror"> + <p> + We recommend you use a mirror to download our release + builds, but you <strong>must</strong> verify the integrity of + the downloaded files using signatures downloaded from our main + distribution directories. Recent releases (48 hours) may not yet + be available from the mirrors. + </p> + + <p> + You are currently using <b>[preferred]</b>. If you + encounter a problem with this mirror, please select another + mirror. If all mirrors are failing, there are <i>backup</i> + mirrors (at the end of the mirrors list) that should be + available. + <br></br> + [if-any logo]<a href="[link]"><img align="right" src="[logo]" border="0"></img></a>[end] + </p> + + <form action="[location]" method="get" id="SelectMirror"> + <p> + Other mirrors: + <select name="Preferred"> + [if-any http] + [for http]<option value="[http]">[http]</option>[end] + [end] + [if-any ftp] + [for ftp]<option value="[ftp]">[ftp]</option>[end] + [end] + [if-any backup] + [for backup]<option value="[backup]">[backup] (backup)</option>[end] + [end] + </select> + <input type="submit" value="Change"></input> + </p> + </form> + + <p> + The <a href="http://www.apache.org/dist/commons/KEYS">KEYS</a> + link links to the code signing keys used to sign the product. + The <code>PGP</code> link downloads the OpenPGP compatible signature from our main site. + The <code>MD5</code> link downloads the checksum from the main site. + </p> + </subsection> + </section> + <section name="Commons Daemon 1.0.10"> + <subsection name="Binaries"> + <table> + <tr> + <td><a href="[preferred]/commons/daemon/binaries/commons-daemon-1.0.10-bin.tar.gz">commons-daemon-1.0.10-bin.tar.gz</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/binaries/commons-daemon-1.0.10-bin.tar.gz.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/binaries/commons-daemon-1.0.10-bin.tar.gz.asc">pgp</a></td> + </tr> + <tr> + <td><a href="[preferred]/commons/daemon/binaries/commons-daemon-1.0.10-bin.zip">commons-daemon-1.0.10-bin.zip</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/binaries/commons-daemon-1.0.10-bin.zip.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/binaries/commons-daemon-1.0.10-bin.zip.asc">pgp</a></td> + </tr> + <tr> + <td><a href="[preferred]/commons/daemon/binaries/">Browse native binaries download area...</a></td> + <td></td> + <td></td> + </tr> + </table> + </subsection> + <subsection name="Source"> + <table> + <tr> + <td><a href="[preferred]/commons/daemon/source/commons-daemon-1.0.10-src.tar.gz">commons-daemon-1.0.10-src.tar.gz</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-src.tar.gz.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-src.tar.gz.asc">pgp</a></td> + </tr> + <tr> + <td><a href="[preferred]/commons/daemon/source/commons-daemon-1.0.10-src.zip">commons-daemon-1.0.10-src.zip</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-src.zip.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-src.zip.asc">pgp</a></td> + </tr> + <tr> + <td><a href="[preferred]/commons/daemon/source/commons-daemon-1.0.10-native-src.tar.gz">commons-daemon-1.0.10-native-src.tar.gz</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-native-src.tar.gz.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-native-src.tar.gz.asc">pgp</a></td> + </tr> + <tr> + <td><a href="[preferred]/commons/daemon/source/commons-daemon-1.0.10-native-src.zip">commons-daemon-1.0.10-native-src.zip</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-native-src.zip.md5">md5</a></td> + <td><a href="http://www.apache.org/dist/commons/daemon/source/commons-daemon-1.0.10-native-src.zip.asc">pgp</a></td> + </tr> + </table> + </subsection> + </section> + <section name="Archives"> + <p> + Older releases can be obtained from the archives. + </p> + <ul> + <li class="download"><a href="[preferred]/commons/daemon/">Browse download area...</a></li> + <li><a href="http://archive.apache.org/dist/commons/daemon/">Archives...</a></li> + </ul> + </section> + </body> +</document> + diff --git a/src/site/xdoc/faq.xml b/src/site/xdoc/faq.xml new file mode 100644 index 0000000..9583d3e --- /dev/null +++ b/src/site/xdoc/faq.xml @@ -0,0 +1,100 @@ +<?xml version="1.0"?> +<!-- + 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. +--> + +<document> + + <properties> + <title>Daemon : FAQ</title> + <author email="[email protected]">Jean-Frederic Clere</author> + </properties> + +<body> +<section name="Buildconf problems"> +<p> +<source> +$ sh support/buildconf.sh +autoconf: Undefined macros: +***BUG in Autoconf--please report*** AC_PATH +***BUG in Autoconf--please report*** AC_PATH +***BUG in Autoconf--please report*** AC_PATH +</source> +Your version of autoconf is to old, upgrade your autoconf and retry. +Or run support/buildconf.sh in another machine and copy the daemon tree in +the machine where you want to compile jsvc. +</p> +</section> + +<section name="Configure problems"> +<p> +<source> +configure: creating ./config.status +config.status: creating Makefile +mv: Makefile: set owner/group (was: 1670/0): Operation not permitted +config.status: creating Makedefs +mv: Makedefs: set owner/group (was: 1670/0): Operation not permitted +config.status: creating native/Makefile +mv: native/Makefile: set owner/group (was: 1670/0): Operation not permitted +*** All done *** +Now you can issue "make" +</source> +You should ignore those error messages they are normal in FreeBSD. +config.status creates files in /tmp and move them in the current directory. +When FreeBSD creates files it sets the group of the files to +the group of the directory where the files are created. +So if /tmp is group "wheel" the files are "wheel". When moving the files in +the current directory (if you are not member of group "wheel") +the group "wheel" cannot be set on the moved files. +</p> +</section> +<section name="Runtime problems"> +<p> +On Linux 2.6.x jsvc does not start and write the following error: +<source> +jsvc.exec error: syscall failed in set_caps +jsvc.exec error: Service exit with a return value of 4 +</source> +CONFIG_SECURITY_CAPABILITIES in missing in your kernel try the following in the kernel sources: +<ul> +<li> +Configure the kernel with "Default Linux Capabilities" and reboot + (by make gconfig or make xconfig under "security options" and "Enable different security models") +</li> +<li> +Insert the module "capability": +<source> +modprobe capability +</source> +</li> +</ul> +</p> +</section> + +<section name="Cygwin configuration problems"> +<p> +The configure of jsvc does not like spaces in directory name. +To configure with java installed in directory whose name contains a space, +use the 8 characters name of the directory. +For example for java in installed in <code>c:\Archivos de programa\java\jdk1.5.0_06</code>: +<source> +./configure --with-java=/cygdrive/c/Archiv~1/java/jdk1.5.0_06 +</source> +</p> +</section> + +</body> +</document> diff --git a/src/site/xdoc/index.xml b/src/site/xdoc/index.xml new file mode 100644 index 0000000..a0884af --- /dev/null +++ b/src/site/xdoc/index.xml @@ -0,0 +1,115 @@ +<?xml version="1.0"?> +<!-- + 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. +--> + +<document> + + <properties> + <title>Daemon : Java based daemons or services</title> + <author email="[email protected]">Jean-Frederic Clere</author> + </properties> + +<body> +<section name="Introduction"> +<p> + Since 1994, the Java programming language evolved and became a + valid tool to develop reliable and performant server applications as + opposed to just applets and client applications. The major disadvantage of + the Java platform is that still today the only portable way to + start a Java application relies on a single point of entry: the + <CODE><EM CLASS="key">public static void</EM> + main(<EM CLASS="ref">String</EM>[])</CODE> method. +</p> +<p> + Having a single-point of entry is a valid solution for client + applications, where interactively a user can command to the application + to quit (which can terminate the Virtual Machine process at calling the + <CODE><EM CLASS="ref">System</EM>.exit(<EM CLASS="key">int</EM>)</CODE> + method), but in those cases where the application is not interactive + (server applications) there is currently no portable way to notify + the Virtual Machine of its imminent shutdown. +</p> +<p> + A server application written in Java might have to perform several tasks + before being able to shutdown the Virtual Machine process. For example + in the case of a Servlet container, before the VM process is shut down, + sessions might need to be serialized to disk, and web applications need + to be destroyed. +</p> +<p> + One common solution to this problem is to create (for example) a + <CODE><EM CLASS="ref">ServerSocket</EM></CODE> and wait for a particular + message to be issued. When the message is received, all operations + required to shut down the server applications are performed and at the + end the <CODE><EM CLASS="ref">System</EM>.exit</CODE> method is called + to terminate the Virtual Machine process. This method however, has + several disadvantages and risks: + <ul> + <li> + In case of a system-wide shutdown, the Virtual Machine process may be + shut down directly by the operating system without notifying the running + server application. + </li> + <li> + If an attacker finds out the shutdown message to send to the server + and discovers a way to send this message, he can easily interrupt + the server's operation, bypassing all the security restrictions + implemented in the operating system. + </li> + </ul> +</p> +<p> + Most multi-user operating systems already have a way in which server + applications are started and stopped. Under Unix based operating systems + non interactive server applications are called <em>daemons</em> and are + controlled by the operating system with a set of specified + <em>signals</em>. Under Windows such programs are called <em>services</em> + and are controlled by appropriate calls to specific functions defined in + the application binary, but although the ways of dealing with the problem + are different, in both cases the operating system can notify a server + application of its imminent shutdown, and the application has the + ability to perform certain tasks before its process of execution is + destroyed. +</p> +</section> + +<section name="Structure"> +<p> + Daemon is made of 2 parts. One written in C that makes the interface to + the operating system and the other in Java that provides the + Daemon API. +</p> +</section> + +<section name="Platforms"> +<p> + Both Win32 and UNIX like platforms are supported. + For Win32 platforms use <a href="procrun.html">procrun</a>. + For UNIX like platforms use <a href="jsvc.html">jsvc</a>. +</p> +</section> +<section name="Initial Source of the Package"> + +<p>The original Java classes came from the Jakarta Tomcat 4.0 project.</p> + +<p>The package name for the Daemon component is +<code>org.apache.commons.daemon</code>. +</p> +</section> + +</body> +</document> diff --git a/src/site/xdoc/issue-tracking.xml b/src/site/xdoc/issue-tracking.xml new file mode 100644 index 0000000..2ad9465 --- /dev/null +++ b/src/site/xdoc/issue-tracking.xml @@ -0,0 +1,102 @@ +<?xml version="1.0"?> +<!-- +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. +--> +<!-- + +======================================================================+ + |**** ****| + |**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****| + |**** DO NOT EDIT DIRECTLY ****| + |**** ****| + +======================================================================+ + | TEMPLATE FILE: issue-tracking-template.xml | + | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates | + +======================================================================+ + | | + | 1) Re-generate using: mvn commons:jira-page | + | | + | 2) Set the following properties in the component's pom: | + | - commons.jira.id (required, alphabetic, upper case) | + | - commons.jira.pid (required, numeric) | + | | + | 3) Example Properties | + | | + | <properties> | + | <commons.jira.id>MATH</commons.jira.id> | + | <commons.jira.pid>12310485</commons.jira.pid> | + | </properties> | + | | + +======================================================================+ +--> +<document> + <properties> + <title>Commons Daemon Issue tracking</title> + <author email="[email protected]">Commons Documentation Team</author> + </properties> + <body> + + <section name="Commons Daemon Issue tracking"> + <p> + Commons Daemon uses <a href="http://issues.apache.org/jira/">ASF JIRA</a> for tracking issues. + See the <a href="http://issues.apache.org/jira/browse/DAEMON">Commons Daemon JIRA project page</a>. + </p> + + <p> + To use JIRA you may need to <a href="http://issues.apache.org/jira/secure/Signup!default.jspa">create an account</a> + (if you have previously created/updated Commons issues using Bugzilla an account will have been automatically + created and you can use the <a href="http://issues.apache.org/jira/secure/ForgotPassword!default.jspa">Forgot Password</a> + page to get a new password). + </p> + + <p> + If you would like to report a bug, or raise an enhancement request with + Commons Daemon please do the following: + <ol> + <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&pid=12310468&sorter/field=issuekey&sorter/order=DESC&status=1&status=3&status=4">Search existing open bugs</a>. + If you find your issue listed then please add a comment with your details.</li> + <li><a href="mail-lists.html">Search the mailing list archive(s)</a>. + You may find your issue or idea has already been discussed.</li> + <li>Decide if your issue is a bug or an enhancement.</li> + <li>Submit either a <a href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310468&issuetype=1&priority=4&assignee=-1">bug report</a> + or <a href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310468&issuetype=4&priority=4&assignee=-1">enhancement request</a>.</li> + </ol> + </p> + + <p> + Please also remember these points: + <ul> + <li>the more information you provide, the better we can help you</li> + <li>test cases are vital, particularly for any proposed enhancements</li> + <li>the developers of Commons Daemon are all unpaid volunteers</li> + </ul> + </p> + + <p> + For more information on subversion and creating patches see the + <a href="http://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>. + </p> + + <p> + You may also find these links useful: + <ul> + <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&pid=12310468&sorter/field=issuekey&sorter/order=DESC&status=1&status=3&status=4">All Open Commons Daemon bugs</a></li> + <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&pid=12310468&sorter/field=issuekey&sorter/order=DESC&status=5&status=6">All Resolved Commons Daemon bugs</a></li> + <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&pid=12310468&sorter/field=issuekey&sorter/order=DESC">All Commons Daemon bugs</a></li> + </ul> + </p> + </section> + </body> +</document> diff --git a/src/site/xdoc/jsvc.xml b/src/site/xdoc/jsvc.xml new file mode 100644 index 0000000..14c2841 --- /dev/null +++ b/src/site/xdoc/jsvc.xml @@ -0,0 +1,314 @@ +<?xml version="1.0"?> +<!-- + 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. +--> + +<document> + + <properties> + <title>Daemon : Java Service</title> + <author email="[email protected]">Jean-Frederic Clere</author> + </properties> + +<body> +<section name="Introduction"> +<p> + Jsvc is a set of libraries and applications for making Java + applications run on UNIX more easily. + <br/> + Jsvc allows the application (e.g. Tomcat) to perform some privileged operations as root + (e.g. bind to a port < 1024), and then switch identity to a non-privileged user. + <br/> + It can run on Win32 via the Cygwin emulation layer (see + <a href="http://www.cygwin.com/"> Cygwin</a> for more information), + however Win32 users may prefer to use <a href="procrun.html"> procrun</a> + instead, which allows the application to run as a Windows Service. +</p> +<p> + The sources are located in the src/native/unix subdirectory. +</p> +<p> + In the future <a href="http://apr.apache.org/"> APR </a> may be used + to provide more portable platform support. +</p> +</section> + +<section name="Building from source"> +<p> +To build under a UNIX operating system you will need: +<ul> + <li>GNU AutoConf (at least version 2.53)</li> + <li>An ANSI-C compliant compiler (GCC is good)</li> + <li>GNU Make</li> + <li>A Java Platform 2 compliant SDK</li> +</ul> + + +You need to build the "configure" program with: + +<source> +sh support/buildconf.sh +</source> + +(Note it is possible to replace sh by any compatible shell like bash, ksh). + +The result should be something like: +<source> +support/buildconf.sh +support/buildconf.sh: configure script generated successfully +</source> +Once the configure script is generated, follow the next section. +</p> +</section> + +<section name="Building from a release tarball"> +<p> +To build the binary under a UNIX operating system you will need: +<ul> + <li>An ANSI-C compliant compiler (GCC is good)</li> + <li>GNU Make</li> + <li>A Java Platform 2 compliant SDK</li> +</ul> + +You have to specify the <code>JAVA_HOME</code> of the SDK +either with the <code>--with-java=<dir></code> parameter or set the <code>JAVA_HOME</code> environment +to point to your SDK installation. For example: +<source> +./configure --with-java=/usr/java +</source> +or +<source> +export JAVA_HOME +./configure +</source> + +If your operating system is supported, configure will go through cleanly, +otherwise it will report an error (please send us the details of your +OS/JDK, or a patch against the sources). To build the binaries and +libraries simply do: +<source> +make +</source> +This will generate the executable file <code>jsvc</code>. +</p> +</section> + +<section name="Starting jsvc"> +<p> +To check the allowed parameters for the jsvc binary simply do: +<source> +./jsvc -help +Usage: jsvc [-options] class [args...] + +Where options include: + + -help | --help | -? + show this help page (implies -nodetach) + -jvm <JVM name> + use a specific Java Virtual Machine. Available JVMs: + 'client' 'server' + -client + use a client Java Virtual Machine. + -server + use a server Java Virtual Machine. + -cp / -classpath <directories and zip/jar files> + set search path for service classes and resouces + -home <directory> + set the path of your JDK or JRE installation (or set + the JAVA_HOME environment variable) + -version + show the current Java environment version (to check + correctness of -home and -jvm. Implies -nodetach) + -showversion + show the current Java environment version (to check + correctness of -home and -jvm) and continue execution. + -nodetach + don't detach from parent process and become a daemon + -debug + verbosely print debugging information + -check + only check service (implies -nodetach) + -user <user> + user used to run the daemon (defaults to current user) + -verbose[:class|gc|jni] + enable verbose output + -outfile </full/path/to/file> + Location for output from stdout (defaults to /dev/null) + Use the value '&2' to simulate '1>&2' + -errfile </full/path/to/file> + Location for output from stderr (defaults to /dev/null) + Use the value '&1' to simulate '2>&1' + -pidfile </full/path/to/file> + Location for output from the file containing the pid of jsvc + (defaults to /var/run/jsvc.pid) + -D<name>=<value> + set a Java system property + -X<option> + set Virtual Machine specific option + -ea[:<packagename>...|:<classname>] + -enableassertions[:<packagename>...|:<classname>] + enable assertions + -da[:<packagename>...|:<classname>] + -disableassertions[:<packagename>...|:<classname>] + disable assertions + -esa | -enablesystemassertions + enable system assertions + -dsa | -disablesystemassertions + disable system assertions + -agentlib:<libname>[=<options>] + load native agent library <libname>, e.g. -agentlib:hprof + -agentpath:<pathname>[=<options>] + load native agent library by full pathname + -javaagent:<jarpath>[=<options>] + load Java programming language agent, see java.lang.instrument + -procname <procname> + use the specified process name (works only for Linux) + -wait <waittime> + wait waittime seconds for the service to start + waittime should multiple of 10 (min=10) + -stop + stop the service using the file given in the -pidfile option + -keepstdin + does not redirect stdin to /dev/null + +</source> +</p> +<subsection name="Mac OS X universal binaries"> +<p> +If jsvc was build with universal binary support the proper way of +starting <code>jsvc</code> is by using Mac OS X <code>arch</code> command: +</p> +<source> + arch -arch i386 ./jsvc -jvm server <original jsvc parameters> + + for running 64-bit JVM use the: + arch -arch x86_64 ./jsvc -jvm server <original jsvc parameters> + +</source> +<p> +Use <code>-jvm server</code> because default <code>client</code> JVM is +not present for all architectures. +</p> +</subsection> +</section> +<section name="Using jsvc"> +<p> +There two ways to use jsvc: via a Class that implements the Daemon interface or +via calling a Class that has the required methods. +For example Tomcat-4.1.x uses the Daemon interface +whereas Tomcat-5.0.x provides a Class whose methods are called by jsvc directly. +</p> +<subsection name="Via Daemon interface"> +<p> +Do the following: +<ul> + <li>Write a Class that implements the Daemon interface (MyClass).</li> + <li>Put it in a jarfile (my.jar).</li> + <li>Call jsvc like: + <source> +./jsvc -cp commons-daemon.jar:my.jar MyClass + </source> + </li> +</ul> +</p> +</subsection> +<subsection name="Directly"> +<p> +Write a Class (MyClass) that implements the following methods: +<ul> + <li>void init(String[] arguments): Here open configuration files, create a trace file, create + ServerSockets, Threads</li> + <li>void start(): Start the Thread, accept incoming connections</li> + <li>void stop(): Inform the Thread to terminate the run(), close the ServerSockets</li> + <li><code>void destroy()</code>: Destroy any object created in init()</li> +</ul> +Store it in a jarfile and use as above: +<source> +./jsvc -cp my.jar MyClass +</source> +</p> +</subsection> +</section> +<section name="How jsvc works"> +<p> +Jsvc uses 3 processes: a launcher process, a controller process and a controlled process. +The controlled process is also the main java thread, if the JVM crashes +the controller will restart it in the next minute. +Jsvc is a daemon process so it should be started as root and the <code>-user</code> parameter +allows to downgrade to an unprivilegded user. +When the <code>-wait</code> parameter is used, the launcher process waits until the controller says +"I am ready", otherwise it returns after creating the controller process. +</p> + +<subsection name="Forks in commons-daemon"> +<p> +Launcher process: +<source> +main() +{ + fork() + parent: wait_child(), wait until JAVA service started when the child says "I am ready". + child: controller process. +} +</source> + +Controller process: +<source> + while (fork()) { + parent: wait_for_child. + if exited and restart needed continue + else exit. + child: exit(child()). controlled process. + } +</source> + +Controlled process: +<source> +In child(): controlled process. + init_JVM(). + load_service(). + start_service(). + say "I am ready" + wait for signal or poll for stop + stop_service(). + destroy_service(). + destroy_JVM(). + exit (with different codes so that parent knows if it has to restart us). +</source> +Note: The controller process uses signals to stop the controlled process. +</p> +</subsection> + +<subsection name="Downgrading user"> +<p> +On Linux <code>setuid()</code>/<code>setgid()</code> + capabilities are used. On other unix <code>setgid</code>/<code>initgroups</code> are used. + +We have something like: +<source> +/* as root */ +init_JVM(). +load_service. /* java_load() calls the load method */ +downgrade user (set_caps() or set_user_group()) +/* as the user $USER (from -user $USER parameter) */ +umask() +start_service. /* java_start() calls the start method */ +</source> +</p> +</subsection> +</section> + +</body> +</document> diff --git a/src/site/xdoc/mail-lists.xml b/src/site/xdoc/mail-lists.xml new file mode 100644 index 0000000..8ba0706 --- /dev/null +++ b/src/site/xdoc/mail-lists.xml @@ -0,0 +1,202 @@ +<?xml version="1.0"?> +<!-- +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. +--> +<!-- + +======================================================================+ + |**** ****| + |**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****| + |**** DO NOT EDIT DIRECTLY ****| + |**** ****| + +======================================================================+ + | TEMPLATE FILE: mail-lists-template.xml | + | commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates | + +======================================================================+ + | | + | 1) Re-generate using: mvn commons:mail-page | + | | + | 2) Set the following properties in the component's pom: | + | - commons.componentid (required, alphabetic, lower case) | + | | + | 3) Example Properties | + | | + | <properties> | + | <commons.componentid>math</commons.componentid> | + | </properties> | + | | + +======================================================================+ +--> +<document> + <properties> + <title>Commons Daemon Mailing Lists</title> + <author email="[email protected]">Commons Documentation Team</author> + </properties> + <body> + + <section name="Overview"> + <p> + <a href="index.html">Commons Daemon</a> shares mailing lists with all the other + <a href="http://commons.apache.org/components.html">Commons Components</a>. + To make it easier for people to only read messages related to components they are interested in, + the convention in Commons is to prefix the subject line of messages with the component's name, + for example: + <ul> + <li>[daemon] Problem with the ...</li> + </ul> + </p> + <p> + Questions related to the usage of Commons Daemon should be posted to the + <a href="http://mail-archives.apache.org/mod_mbox/commons-user/">User List</a>. + <br /> + The <a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">Developer List</a> + is for questions and discussion related to the development of Commons Daemon. + <br /> + Please do not cross-post; developers are also subscribed to the user list. + </p> + <p> + <strong>Note:</strong> please don't send patches or attachments to any of the mailing lists. + Patches are best handled via the <a href="issue-tracking.html">Issue Tracking</a> system. + Otherwise, please upload the file to a public server and include the URL in the mail. + </p> + </section> + + <section name="Commons Daemon Mailing Lists"> + <p> + <strong>Please prefix the subject line of any messages for <a href="index.html">Commons Daemon</a> + with <i>[daemon]</i></strong> - <i>thanks!</i> + <br /> + <br /> + </p> + + <table> + <tr> + <th>Name</th> + <th>Subscribe</th> + <th>Unsubscribe</th> + <th>Post</th> + <th>Archive</th> + <th>Other Archives</th> + </tr> + + + <tr> + <td> + <strong>Commons User List</strong> + <br /><br /> + Questions on using Commons Daemon. + <br /><br /> + </td> + <td><a href="mailto:[email protected]">Subscribe</a></td> + <td><a href="mailto:[email protected]">Unsubscribe</a></td> + <td><a href="mailto:[email protected]?subject=[daemon]">Post</a></td> + <td><a href="http://mail-archives.apache.org/mod_mbox/commons-user/">mail-archives.apache.org</a></td> + <td><a href="http://markmail.org/list/org.apache.commons.users/">markmail.org</a><br /> + <a href="http://www.mail-archive.com/[email protected]/">www.mail-archive.com</a><br /> + <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a> + </td> + </tr> + + + <tr> + <td> + <strong>Commons Developer List</strong> + <br /><br /> + Discussion of development of Commons Daemon. + <br /><br /> + </td> + <td><a href="mailto:[email protected]">Subscribe</a></td> + <td><a href="mailto:[email protected]">Unsubscribe</a></td> + <td><a href="mailto:[email protected]?subject=[daemon]">Post</a></td> + <td><a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">mail-archives.apache.org</a></td> + <td><a href="http://markmail.org/list/org.apache.commons.dev/">markmail.org</a><br /> + <a href="http://www.mail-archive.com/[email protected]/">www.mail-archive.com</a><br /> + <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a> + </td> + </tr> + + + <tr> + <td> + <strong>Commons Issues List</strong> + <br /><br /> + Only for e-mails automatically generated by the <a href="issue-tracking.html">issue tracking</a> system. + <br /><br /> + </td> + <td><a href="mailto:[email protected]">Subscribe</a></td> + <td><a href="mailto:[email protected]">Unsubscribe</a></td> + <td><i>read only</i></td> + <td><a href="http://mail-archives.apache.org/mod_mbox/commons-issues/">mail-archives.apache.org</a></td> + <td><a href="http://markmail.org/list/org.apache.commons.issues/">markmail.org</a><br /> + <a href="http://www.mail-archive.com/[email protected]/">www.mail-archive.com</a> + </td> + </tr> + + + <tr> + <td> + <strong>Commons Commits List</strong> + <br /><br /> + Only for e-mails automatically generated by the <a href="source-repository.html">source control</a> sytem. + <br /><br /> + </td> + <td><a href="mailto:[email protected]">Subscribe</a></td> + <td><a href="mailto:[email protected]">Unsubscribe</a></td> + <td><i>read only</i></td> + <td><a href="http://mail-archives.apache.org/mod_mbox/commons-commits/">mail-archives.apache.org</a></td> + <td><a href="http://markmail.org/list/org.apache.commons.commits/">markmail.org</a><br /> + <a href="http://www.mail-archive.com/[email protected]/">www.mail-archive.com</a> + </td> + </tr> + + </table> + + </section> + <section name="Apache Mailing Lists"> + <p> + Other mailing lists which you may find useful include: + </p> + + <table> + <tr> + <th>Name</th> + <th>Subscribe</th> + <th>Unsubscribe</th> + <th>Post</th> + <th>Archive</th> + <th>Other Archives</th> + </tr> + <tr> + <td> + <strong>Apache Announce List</strong> + <br /><br /> + General announcements of Apache project releases. + <br /><br /> + </td> + <td><a class="externalLink" href="mailto:[email protected]">Subscribe</a></td> + <td><a class="externalLink" href="mailto:[email protected]">Unsubscribe</a></td> + <td><i>read only</i></td> + <td><a class="externalLink" href="http://mail-archives.apache.org/mod_mbox/www-announce/">mail-archives.apache.org</a></td> + <td><a class="externalLink" href="http://markmail.org/list/org.apache.announce/">markmail.org</a><br /> + <a class="externalLink" href="http://old.nabble.com/Apache-News-and-Announce-f109.html">old.nabble.com</a><br /> + <a class="externalLink" href="http://www.mail-archive.com/[email protected]/">www.mail-archive.com</a><br /> + <a class="externalLink" href="http://news.gmane.org/gmane.comp.apache.announce">news.gmane.org</a> + </td> + </tr> + </table> + + </section> + </body> +</document> diff --git a/src/site/xdoc/procrun.xml b/src/site/xdoc/procrun.xml new file mode 100644 index 0000000..7e90ce8 --- /dev/null +++ b/src/site/xdoc/procrun.xml @@ -0,0 +1,688 @@ +<?xml version="1.0"?> +<!-- + 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. +--> + +<document> + <properties> + <title>Daemon : Procrun</title> + <author email="[email protected]">Mladen Turk</author> + </properties> + +<body> +<section name="Introduction"> +<p> + Procrun is a set of applications that allow Windows users to wrap + (mostly) Java applications (e.g. Tomcat) as a Windows service. + <br></br> + The service can be set to automatically start when the machine boots + and will continue to run with no user logged onto the machine. +</p> +</section> + +<section name="Procrun monitor application"> +<p> + <b>Prunmgr</b> is a GUI application for monitoring and configuring procrun + services. +</p> +<p> + Each command line directive is in the form of <b>//XX[//ServiceName]</b> +</p> +<p> + If the <code>//ServiceName</code> parameter is omitted, then the service name is + assumed to be the name of the file. + <br/> + The Prunsrv application behaves in the same way, + so to allow both applications to reside in the same directory, the Prunmgr application + will remove a trailing <b>w</b> (lower-case w) from the name. + <br/> + For example if the Prunmgr application is renamed as <code>TestService.exe</code> + - or as <code>TestServicew.exe</code> - + then the default service name is <code>TestService</code>. +</p> + <p>The available command line options are:</p> +<p> + <table> + <tr><th>//ES</th> + <td>Edit service configuration</td> + <td>This is the default operation. It is called if the no option is + provided. + Starts the GUI application which allows the service configuration + to be modified, started and stopped. + </td> + </tr> + <tr><th>//MS</th> + <td>Monitor service</td> + <td>Starts the GUI application and minimizes it to the system tray. + </td> + </tr> + <tr><th>//MR</th> + <td>Monitor & run service</td> + <td>Starts the GUI application and minimizes it to the system tray. + Start the service if it is not currently running. + </td> + </tr> + <tr><th>//MQ</th> + <td>Monitor Quit</td> + <td>Stop any running monitor for the service. + </td> + </tr> + </table> +</p> +</section> + +<section name="Procrun service application"> +<p> + <b>Prunsrv</b> is a service application for running applications as services. + It can convert any application (not just Java applications) to run as a service. +</p> + +<subsection name="Command line arguments"> +<p> + Each command line directive is in the form of <b>//XX[//ServiceName]</b>. +</p> +<p> + If the <code>//ServiceName</code> parameter is omitted, then the service name is + assumed to be the name of the file. + <br/> + For example if the application is renamed as <code>TestService.exe</code>, + then the default service name is <code>TestService</code>. +</p> + <p>The available command line options are:</p> +<p> + <table> + <tr><th>//TS</th> + <td>Run the service as a console application</td> + <td>This is the default operation. It is called if the no option is provided. + </td> + </tr> + <tr><th>//RS</th> + <td>Run the service</td> + <td>Called only from ServiceManager</td> + </tr> + <tr><th>//ES</th> + <td>Start (execute) the service</td> + <td></td> + </tr> + <tr><th>//SS</th> + <td>Stop the service</td> + <td></td> + </tr> + <tr><th>//US</th> + <td>Update service parameters</td> + <td></td> + </tr> + <tr><th>//IS</th> + <td>Install service</td> + <td></td> + </tr> + <tr><th>//DS</th> + <td>Delete service</td> + <td>Stops the service first if it is currently running</td> + </tr> + <tr><th>//PP[//seconds]</th> + <td>Pause</td> + <td>Default is 60 seconds</td> + </tr> + <tr><th>//VS</th> + <td>Version</td> + <td>Print version and exit (since version 1.0.3)</td> + </tr> + <tr><th>//?</th> + <td>Help</td> + <td>Print usage and exit (since version 1.0.3)</td> + </tr> + </table> +</p> + <p>Starting with version <b>1.0.8</b> a more traditional command line can + be used in the form: <b>command [ServiceName]</b>. +</p> +<p> + <table> + <tr><th>run</th> + <td>Run the service as a console application</td> + <td>This is the default operation. It is called if the no option is provided + and has the same effect as calling <b>//TS</b>. + </td> + </tr> + <tr><th>service</th> + <td>Run the service</td> + <td>Called only from ServiceManager</td> + </tr> + <tr><th>start</th> + <td>Start the service</td> + <td>Synonym for <b>//ES</b></td> + </tr> + <tr><th>stop</th> + <td>Stop the service</td> + <td>Synonym for <b>//SS</b></td> + </tr> + <tr><th>update</th> + <td>Update service parameters</td> + <td>Synonym for <b>//US</b></td> + </tr> + <tr><th>install</th> + <td>Install service</td> + <td>Synonym for <b>//IS</b></td> + </tr> + <tr><th>delete</th> + <td>Delete service</td> + <td>Stops the service first if it is currently running</td> + </tr> + <tr><th>pause [seconds]</th> + <td>Pause</td> + <td>Default is 60 seconds</td> + </tr> + <tr><th>version</th> + <td>Version</td> + <td>Print version and exit</td> + </tr> + <tr><th>help</th> + <td>Help</td> + <td>Print usage and exit</td> + </tr> + </table> +</p> +</subsection> +<subsection name="Command line parameters"> +<p> + Each command parameter is prefixed with <b>--</b> (or <b>++</b>, see below). + <br/> + If an environment variable exists with the same name as a command line parameter but + prefixed with <code>PR_</code> it will <b>override</b> the equivalent command line parameter. + <br/> + For example: +<source>set PR_CLASSPATH=xx.jar</source> +</p> +<p>is equivalent to providing +<source>--Classpath=xx.jar</source> +</p> +<p> as a command line parameter.</p> +<p> +If a parameter is repeated, then normally the last value takes precedence. +However some parameters can take multiple values - for example StartParams and JvmOptions. +If these parameters are prefixed with <b>++</b>, then the value will be appended to the existing value. +For example: +<source> +--Startup=manual --Startup=auto --JvmOptions=-Done=1 ++JvmOptions=-Dtwo=2 +</source> +will result in the following values being used: +<source> +Startup: +auto + +JvmOptions: +-Done=1 +-Dtwo=2 +</source> +<br/> +Only multi-valued parameters support this; they are indicated in the table below by <b><code>++</code></b>. +<br></br> +If <b><code>++</code></b> is used for a parameter that does not support multiple values, +then it is treated the same as <b><code>--</code></b>. No error is reported. +<br/> +Configuration is overwritten in case <b><code>--</code></b> is used. +For example: +<source> +--JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=4 +</source> +will always overwrite the JvmOptions. The resulting configuration will be: +<source> +Startup: +auto + +JvmOptions: +-Dthree=3 +-Dfour=4 +</source> +However if on <b><code>++</code></b> is used the values will be appended. For example calling the +following after the first example +<source> +++JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=2 +</source> +will result in the following values being used: +<source> +Startup: +auto + +JvmOptions: +-Done=1 +-Dtwo=2 +-Dthree=3 +-Dfour=4 +</source> +<br/> +In case you intermix the <b><code>++</code></b> and <b><code>--</code></b> options, the +last <b><code>--</code></b> parameter will cause option reset. For example: +<source> +--Startup=manual --Startup=auto --JvmOptions=-Done=1 ++JvmOptions=-Dtwo=2 --JvmOptions=-Dthree=3 ++JvmOptions=-Dfour=2 +</source> +will result in the following values being used: +<source> +Startup: +auto + +JvmOptions: +-Dthree=3 +-Dfour=4 +</source> +</p> +<p> +When updating a service (//US or update command), using <b><code>--</code></b> +will replace any existing parameter with the new setting. +<br/> +For multi-valued parameters, using the <b><code>++</code></b> option qualifier +will add the new value(s) to any existing value(s). +</p> +<p> + <table> + <tr> + <th>Parameter Name </th> + <th>Default</th> + <th>Description</th> + </tr> + <tr> + <td>--Description</td> + <td></td> + <td>Service name description (maximum 1024 characters)</td> + </tr> + <tr> + <td>--DisplayName</td> + <td>ServiceName</td> + <td>Service display name</td> + </tr> + <tr> + <td>--Install</td> + <td>procrun.exe //RS//ServiceName</td> + <td>Install image</td> + </tr> + <tr> + <td>--Startup</td> + <td>manual</td> + <td>Service startup mode can be either <b>auto</b> or <b>manual</b></td> + </tr> + <tr> + <td>--Type</td> + <td></td> + <td>Service type can be <b>interactive</b> to allow the service to interact with the desktop. + Use this option only with Local system accounts.</td> + </tr> + <tr> + <td>++DependsOn</td> + <td></td> + <td>List of services that this service depends on. Dependent services + are separated using either <b>#</b> or <b>;</b> characters</td> + </tr> + <tr> + <td>++Environment</td> + <td></td> + <td>List of environment variables that will be provided to the service + in the form <b>key=value</b>. They are separated using either + <b>#</b> or <b>;</b> characters. + If you need to embed either # or ; character within a value put them inside single quotes. + </td> + </tr> + <tr> + <td>--User</td> + <td></td> + <td>User account used for running executable. It is used only for + StartMode <b>Java</b> or <b>exe</b> and enables running applications + as a service under an account without the LogonAsService privilege.</td> + </tr> + <tr> + <td>--Password</td> + <td></td> + <td>Password for user account set by --User parameter</td> + </tr> + <tr> + <td>--ServiceUser</td> + <td></td> + <td>Specifies the name of the account under which the service should run. + Use an account name in the form <i>DomainName\UserName</i>. + The service process will be logged on as this user. + if the account belongs to the built-in domain, you can specify <i>.\UserName</i> + </td> + </tr> + <tr> + <td>--ServicePassword</td> + <td></td> + <td>Password for user account set by --ServiceUser parameter</td> + </tr> + <tr> + <td>--LibraryPath</td> + <td></td> + <td>Directory added to the search path used to locate the DLLs for the JVM. + This directory is added both in front of the <b>PATH</b> environment variable + and as a parameter to the <b>SetDLLDirectory</b> function. + </td> + </tr> + <tr> + <td>--JavaHome</td> + <td>JAVA_HOME</td> + <td>Set a different JAVA_HOME than defined by JAVA_HOME environment + variable</td> + </tr> + <tr> + <td>--Jvm</td> + <td>auto</td> + <td>Use either <b>auto</b> (i.e. find the JVM from the Windows registry) or specify the full path to the <b>jvm.dll</b>. + You can use environment variable expansion here.</td> + </tr> + <tr> + <td>++JvmOptions</td> + <td>-Xrs</td> + <td>List of options in the form of <b>-D</b> or <b>-X</b> that will be + passed to the JVM. The options are separated using either + <b>#</b> or <b>;</b> characters. if you need to embed either # or ; + character put them inside single quotes. (Not used in <b>exe</b> mode.)</td> + </tr> + <tr> + <td>--Classpath</td> + <td></td> + <td>Set the Java classpath. (Not used in <b>exe</b> mode.)</td> + </tr> + <tr> + <td>--JvmMs</td> + <td></td> + <td>Initial memory pool size in MB. (Not used in <b>exe</b> mode.)</td> + </tr> + <tr> + <td>--JvmMx</td> + <td></td> + <td>Maximum memory pool size in MB. (Not used in <b>exe</b> mode.)</td> + </tr> + <tr> + <td>--JvmSs</td> + <td></td> + <td>Thread stack size in KB. (Not used in <b>exe</b> mode.)</td> + </tr> + <tr> + <td>--StartMode</td> + <td></td> + <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. + The modes are: + <ul> + <li>jvm - start Java in-process. Depends on jvm.dll, see <b>--Jvm</b>.</li> + <li>Java - same as exe, but automatically uses the default Java executable, i.e. %JAVA_HOME%\bin\java.exe. + Make sure JAVA_HOME is set correctly, or use --JavaHome to provide the correct location. + If neither is set, procrun will try to find the default JDK (not JRE) from the Windows registry.</li> + <li>exe - run the image as a separate process</li> + </ul> + </td> + </tr> + <tr> + <tr> + <td>--StartImage</td> + <td></td> + <td>Executable that will be run. Only applies to <b>exe</b> mode.</td> + </tr> + <tr> + <td>--StartPath</td> + <td></td> + <td>Working path for the start image executable.</td> + </tr> + <tr> + <td>--StartClass</td> + <td>Main</td> + <td>Class that contains the startup method. + Applies to the <b>jvm</b> and <b>Java</b> modes. (Not used in <b>exe</b> mode.) + </td> + </tr> + <tr> + <td>--StartMethod</td> + <td>main</td> + <td>Name of method to be called when service is started. + It must be <code>static void</code> and have argument <code>(String args[])</code>. + Only applies to <b>jvm</b> mode - in <b>Java</b> mode, the <b>main</b> method is always used. + <br /> + <b>Note:</b> in <code>jvm</code> mode, the start method should not return until the stop method + has been called. + </td> + </tr> + <tr> + <td>++StartParams</td> + <td></td> + <td>List of parameters that will be passed to either StartImage or + StartClass. Parameters are separated using either <b>#</b> or + <b>;</b> character.</td> + </tr> + <tr> + <td>--StopMode</td> + <td></td> + <td>One of <b>jvm</b>, <b>Java</b> or <b>exe</b>. + See <b>--StartMode</b> for further details. + </td> + </tr> + <td>--StopImage</td> + <td></td> + <td>Executable that will be run on Stop service signal. Only applies to <b>exe</b> mode.</td> + </tr> + <tr> + <td>--StopPath</td> + <td></td> + <td>Working path for the stop image executable. Does not apply to <b>jvm</b> mode.</td> + </tr> + <tr> + <td>--StopClass</td> + <td>Main</td> + <td>Class that will be used on Stop service signal. + Applies to the <b>jvm</b> and <b>Java</b> modes. + </td> + </tr> + <tr> + <td>--StopMethod</td> + <td>main</td> + <td>Name of method to be called when service is stopped. + It must be <code>static void</code> and have argument <code>(String args[])</code>. + Only applies to <b>jvm</b> mode. + In <b>Java</b> mode, the <b>main</b> method is always used. + </td> + </tr> + <tr> + <td>++StopParams</td> + <td></td> + <td>List of parameters that will be passed to either StopImage or + StopClass. Parameters are separated using either <b>#</b> or + <b>;</b> character.</td> + </tr> + <tr> + <td>--StopTimeout</td> + <td>No Timeout</td> + <td>Defines the timeout in seconds that procrun waits for service to + exit gracefully.</td> + </tr> + <tr> + <td>--LogPath</td> + <td>%SystemRoot%\System32\LogFiles\Apache</td> + <td>Defines the path for logging. Creates the directory if necessary.</td> + </tr> + <tr> + <td>--LogPrefix</td> + <td>commons-daemon</td> + <td>Defines the service log filename prefix. The log file is created in the LogPath directory with + <code>.YEAR-MONTH-DAY.log</code> suffix</td> + </tr> + <tr> + <td>--LogLevel</td> + <td>Info</td> + <td>Defines the logging level and can be either <b>Error</b>, + <b>Info</b>, <b>Warn</b> or <b>Debug</b>. (Case insensitive). + </td> + </tr> + <tr> + <td>--LogJniMessages</td> + <td>0</td> + <td>Set this non-zero (e.g. 1) to capture JVM jni debug messages in the procrun log file. + Is not needed if stdout/stderr redirection is being used. + <!-- TODO: what if only one of stdout/stderr is being redirected? --> + Only applies to <b>jvm</b> mode. + </td> + </tr> + <tr> + <td>--StdOutput</td> + <td></td> + <td>Redirected stdout filename. If named <b>auto</b> file is created + inside <b>LogPath</b> with the name <b>service-stdout.YEAR-MONTH-DAY.log</b>.</td> + </tr> + <tr> + <td>--StdError</td> + <td></td> + <td>Redirected stderr filename. If named <b>auto</b> file is created + in the <b>LogPath</b> directory with the name <b>service-stderr.YEAR-MONTH-DAY.log</b>.</td> + </tr> + <tr> + <td>--PidFile</td> + <td></td> + <td>Defines the file name for storing the running process id. + Actual file is created in the <b>LogPath</b> directory</td> + </tr> + </table> +</p> +</subsection> +<subsection name="Installing services"> +<p> +To install the service, you need to use the <b>//IS</b> parameter. +</p> +<p> +<screen> +<h4>Install the service named 'TestService'</h4> +<source> +prunsrv //IS//TestService --DisplayName="Test Service" \ + --Install=prunsrv.exe --Jvm=auto --StartMode=jvm --StopMode=jvm \ + --StartClass=org.apache.SomeStartClass --StartParams=arg1;arg2;arg3 \ + --StopClass=org.apache.SomeStopClass --StopParams=arg1#arg2 +</source> +</screen> +</p> +</subsection> +<subsection name="Updating services"> +<p> +To update the service parameters, you need to use the <b>//US</b> parameter. +</p> +<p> +<screen> +<h4>Update the service named 'TestService'</h4> +<source> +prunsrv //US//TestService --Description="Some Dummy Test Service" \ + --Startup=auto --Classpath=%CLASSPATH%;test.jar +</source> +</screen> +</p> +</subsection> +<subsection name="Removing services"> +<p> +To remove the service, you need to use the <b>//DS</b> parameter. +If the service is running it will be stopped and then deleted. +</p> +<p> +<screen> +<h4>Remove the service named 'TestService'</h4> +<source>prunsrv //DS//TestService</source> +</screen> +</p> +</subsection> + +<subsection name="Debugging services"> +<p> +To run the service in console mode, you need to use the <b>//TS</b> parameter. +The service shutdown can be initiated by pressing <b>CTRL+C</b> or +<b>CTRL+BREAK</b>. +If you rename the prunsrv.exe to testservice.exe then you can just execute the +testservice.exe and this command mode will be executed by default. +</p> +<p> +<screen> +<h4>Run the service named 'TestService' in console mode</h4> +<source>prunsrv //TS//TestService [additional arguments]</source> +</screen> +</p> +</subsection> + +</section> + +<section name="Using Procrun in jvm mode"> +<p> +To interface with the Procrun service application (prunsrv) using the <b>jvm</b> mode, +you need to create a class with the appropriate method(s). +For example: +<source> +class MyClass; +// N.B. error handling not shown +static void main(String [] args){ + String mode = args[0]; + if ("start".equals(mode){ + // process service start function + } + etc. +} +</source> +This should be configured as follows: +<source> +--Classpath MyClass.jar +--StartMode jvm --StartClass MyClass --StartParams start +--StopMode jvm --StopClass MyClass --StopParams stop +</source> +The above example uses a single 'main' method, and uses a string parameter to specify whether the service function +is start or stop. +<br></br> +Alternatively, you can use different method names for the service start and stop functions: +<source> +class MyClass; +// N.B. error handling not shown +static void start(String [] args){ + // process service start function + } +static void stop(String [] args){ + // process service stop function + } +} +</source> +This should be configured as follows: +<source> +--Classpath MyClass.jar +--StartMode jvm --StartClass MyClass --StartMethod start +--StopMode jvm --StopClass MyClass --StopMethod stop +</source> +Note that the method handling service start should create and start a separate thread +to carry out the processing, and then return. +The start and stop methods are called from different threads. +</p> +</section> + +<section name="Using Procrun in Java or exe mode"> +<p> +When using the <b>Java</b> or <b>exe</b> modes, the Procrun service application (prunsrv) +launches the target application in a separate process. +The "stop" application needs to communicate somehow with the "start" application to tell it to stop. +For example, using RPC. +</p> +</section> + +<section name="Windows Registry Usage"> +<p> +The basic Service definitions are maintained under the registry key: +<source>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\<ServiceName></source> +Additional parameters are stored in the registry at: +<source>HKEY_LOCAL_MACHINE\SOFTWARE\Apache Software Foundation\ProcRun 2.0\<ServiceName>\Parameters</source> +</p> +<p> +On 64-bit Windows procrun always uses 32-bit registry view for storing the configuration. +This means that parameters will be stored inside: +<source>HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Apache Software Foundation\ProcRun 2.0\<ServiceName></source> +</p> +</section> +</body> +</document> diff --git a/src/test/java/org/apache/commons/daemon/SimpleDaemon.java b/src/test/java/org/apache/commons/daemon/SimpleDaemon.java index 0acea37..d7069d3 100644 --- a/src/test/java/org/apache/commons/daemon/SimpleDaemon.java +++ b/src/test/java/org/apache/commons/daemon/SimpleDaemon.java @@ -15,8 +15,6 @@ * limitations under the License. */ -/* @version $Id: SimpleDaemon.java 1130635 2011-06-02 16:29:44Z mturk $ */ - package org.apache.commons.daemon; import java.io.*; @@ -29,6 +27,9 @@ import org.apache.commons.daemon.Daemon; import org.apache.commons.daemon.DaemonController; import org.apache.commons.daemon.DaemonContext; +/** + * @version $Id: SimpleDaemon.java 1204006 2011-11-19 16:09:15Z ggregory $ + */ public class SimpleDaemon implements Daemon, Runnable, DaemonUserSignal { private ServerSocket server=null; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/commons-daemon.git _______________________________________________ pkg-java-commits mailing list [email protected] http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-java-commits

