This is an automated email from the git hooks/post-receive script. tmancill pushed a commit to branch master in repository commons-daemon.
commit 63a18548f1c58a21d8de3b1b4d4ae62f8dc56bef Merge: b2e13cb 934a7a9 Author: Damien Raude-Morvan <[email protected]> Date: Thu Aug 5 18:00:06 2010 +0200 Imported Debian patch 1.0.3-1 README | 13 +- RELEASE-NOTES.txt | 39 +- build.xml | 12 +- debian/changelog | 12 + debian/control | 3 +- debian/patches/hurd_support.diff | 17 + debian/patches/libgcj_PR31700.diff | 14 +- debian/patches/old_capabilities.diff | 27 - debian/patches/series | 2 +- debian/patches/syslog.diff | 217 +- pom.xml | 8 +- src/assembly/native-src.xml | 11 +- src/assembly/src.xml | 22 + src/java/org/apache/commons/daemon/Daemon.java | 18 +- .../org/apache/commons/daemon/DaemonContext.java | 6 +- .../apache/commons/daemon/DaemonController.java | 33 +- .../org/apache/commons/daemon/DaemonListener.java | 7 +- .../apache/commons/daemon/DaemonPermission.java | 209 +- .../commons/daemon/support/DaemonLoader.java | 312 +- src/media/logo.xcf | Bin 22934 -> 0 bytes src/native/nt/Makefile | 6 - src/native/nt/README | 68 - src/native/nt/executables/vdmoniadm/icon1.ico | Bin 766 -> 0 bytes src/native/nt/executables/vdmoniadm/resource.h | 42 - src/native/nt/executables/vdmoniadm/vdmoniadm.dsp | 121 - src/native/nt/executables/vdmoniadm/vdmoniadm.dsw | 29 - src/native/nt/executables/vdmoniadm/vdmoniadm.rc | 344 -- src/native/nt/executables/vdmonisvc/resource.h | 29 - src/native/nt/executables/vdmonisvc/vdmonisvc.dsp | 122 - src/native/nt/executables/vdmonisvc/vdmonisvc.dsw | 29 - src/native/nt/executables/vdmonisvc/vdmonisvc.rc | 105 - src/native/nt/lib/moni_inst.h | 31 - src/native/nt/moni/Makefile | 17 - src/native/nt/moni/vdmoniadm.c | 595 --- src/native/nt/moni/vdmonisvc.c | 708 ---- src/native/nt/procrun/README.dev | 25 + src/native/nt/procrun/apps/prunmgr/Makefile | 87 + src/native/nt/procrun/apps/prunmgr/prunmgr.amd64 | 110 - src/native/nt/procrun/apps/prunmgr/prunmgr.c | 19 +- src/native/nt/procrun/apps/prunmgr/prunmgr.dsp | 189 - src/native/nt/procrun/apps/prunmgr/prunmgr.h | 11 +- src/native/nt/procrun/apps/prunmgr/prunmgr.ia64 | 110 - src/native/nt/procrun/apps/prunmgr/prunmgr.rc | 21 +- src/native/nt/procrun/apps/prunmgr/prunmgr.vcproj | 402 -- src/native/nt/procrun/apps/prunmgr/prunmgr.x86 | 110 - src/native/nt/procrun/apps/prunsrv/Makefile | 91 + src/native/nt/procrun/apps/prunsrv/prunsrv.amd64 | 109 - src/native/nt/procrun/apps/prunsrv/prunsrv.c | 284 +- src/native/nt/procrun/apps/prunsrv/prunsrv.dsp | 166 - src/native/nt/procrun/apps/prunsrv/prunsrv.h | 2 +- src/native/nt/procrun/apps/prunsrv/prunsrv.ia64 | 109 - src/native/nt/procrun/apps/prunsrv/prunsrv.rc | 4 +- src/native/nt/procrun/apps/prunsrv/prunsrv.vcproj | 400 -- src/native/nt/procrun/apps/prunsrv/prunsrv.x86 | 109 - src/native/nt/procrun/include/Makefile.inc | 346 ++ src/native/nt/procrun/include/apxwin.h | 6 +- src/native/nt/procrun/include/javajni.h | 2 +- src/native/nt/procrun/include/log.h | 7 +- src/native/nt/procrun/include/rprocess.h | 3 +- src/native/nt/procrun/libprocrun.amd64 | 158 - src/native/nt/procrun/libprocrun.dsp | 234 -- src/native/nt/procrun/libprocrun.ia64 | 158 - src/native/nt/procrun/libprocrun.vcproj | 388 -- src/native/nt/procrun/libprocrun.x86 | 158 - src/native/nt/procrun/procrun.dsw | 74 - src/native/nt/procrun/procrun.sln | 64 - src/native/nt/procrun/src/cmdline.c | 40 +- src/native/nt/procrun/src/javajni.c | 196 +- src/native/nt/procrun/src/log.c | 103 +- src/native/nt/procrun/src/private.h | 5 - src/native/nt/procrun/src/registry.c | 20 +- src/native/nt/procrun/src/rprocess.c | 175 +- src/native/nt/procrun/src/service.c | 121 +- src/native/nt/procrun/src/utils.c | 37 +- src/native/nt/service/Makefile | 9 - src/native/nt/service/instmain.c | 437 -- src/native/nt/service/instsvc.dsp | 104 - src/native/nt/service/instsvc.dsw | 29 - src/native/nt/signals/kills.c | 48 - src/native/nt/supcalls_nt/vdenv.c | 179 - src/native/unix/CHANGES.txt | 8 +- src/native/unix/Makedefs | 32 - src/native/unix/Makefile | 40 - src/native/unix/config.log | 264 -- src/native/unix/config.status | 866 ---- src/native/unix/configure | 4175 ++++++++------------ src/native/unix/configure.in | 6 +- src/native/unix/man/fetch.sh | 0 src/native/unix/man/jsvc.1.xml | 6 +- src/native/unix/native/.indent.pro | 7 + src/native/unix/native/Makefile | 45 - src/native/unix/native/arguments.c | 609 +-- src/native/unix/native/arguments.h | 42 +- src/native/unix/native/arguments.o | Bin 20372 -> 0 bytes src/native/unix/native/debug.c | 69 +- src/native/unix/native/debug.h | 42 +- src/native/unix/native/debug.o | Bin 6956 -> 0 bytes src/native/unix/native/dso-dlfcn.c | 70 +- src/native/unix/native/dso-dlfcn.o | Bin 5616 -> 0 bytes src/native/unix/native/dso-dyld.c | 105 +- src/native/unix/native/dso-dyld.o | Bin 3388 -> 0 bytes src/native/unix/native/dso.h | 36 +- src/native/unix/native/help.c | 84 +- src/native/unix/native/help.h | 34 +- src/native/unix/native/help.o | Bin 8512 -> 0 bytes src/native/unix/native/home.c | 271 +- src/native/unix/native/home.h | 8 +- src/native/unix/native/home.o | Bin 14068 -> 0 bytes src/native/unix/native/java.c | 536 +-- src/native/unix/native/java.h | 34 +- src/native/unix/native/java.o | Bin 39660 -> 0 bytes src/native/unix/native/jsvc-unix.c | 876 ++-- src/native/unix/native/jsvc-unix.o | Bin 30668 -> 0 bytes src/native/unix/native/jsvc.h | 36 +- src/native/unix/native/libservice.a | Bin 113450 -> 0 bytes src/native/unix/native/location.c | 113 +- src/native/unix/native/location.h | 34 +- src/native/unix/native/location.o | Bin 5980 -> 0 bytes src/native/unix/native/locks.c | 44 +- src/native/unix/native/locks.h | 35 +- src/native/unix/native/locks.o | Bin 857 -> 0 bytes src/native/unix/native/replace.c | 129 +- src/native/unix/native/replace.h | 35 +- src/native/unix/native/replace.o | Bin 6004 -> 0 bytes src/native/unix/native/signals.c | 123 +- src/native/unix/native/signals.h | 2 +- src/native/unix/native/signals.o | Bin 859 -> 0 bytes src/native/unix/native/version.h | 34 +- src/samples/AloneService.java | 18 +- src/samples/Native.sh | 0 src/samples/ProcrunService.java | 173 + src/samples/ProcrunServiceInstall.cmd | 65 + src/samples/ProcrunServiceRemove.cmd | 42 + src/samples/README.txt | 34 +- src/samples/ServiceDaemon.java | 19 +- src/samples/ServiceDaemon.sh | 1 - src/samples/SimpleDaemon.java | 32 +- src/samples/build.xml | 57 +- src/site/resources/images/logo.gif | Bin 4540 -> 0 bytes src/site/resources/images/logo.png | Bin 13595 -> 0 bytes src/site/site.xml | 45 - src/site/xdoc/binaries.xml | 65 - src/site/xdoc/download_daemon.xml | 145 - src/site/xdoc/faq.xml | 100 - src/site/xdoc/index.xml | 115 - src/site/xdoc/issue-tracking.xml | 102 - src/site/xdoc/jsvc.xml | 269 -- src/site/xdoc/procrun.xml | 374 -- 148 files changed, 5861 insertions(+), 13332 deletions(-) diff --cc debian/changelog index 2226a28,0000000..8572931 mode 100644,000000..100644 --- a/debian/changelog +++ b/debian/changelog @@@ -1,205 -1,0 +1,217 @@@ ++commons-daemon (1.0.3-1) unstable; urgency=low ++ ++ * New upstream release. ++ - debian/patches/old_capabilities.diff: merged upstream. ++ - no more prebuilt ELF objects in source tarball. ++ * d/pacthes/syslog.diff: Updated to keep timestamp when SYSLOG support ++ is not enabled. ++ * d/patches/hurd_support.diff: tentative support for GNU/Hurd OS. ++ * d/control: B-D on libcap-dev for all Linux OS. ++ ++ -- Damien Raude-Morvan <[email protected]> Thu, 05 Aug 2010 18:00:06 +0200 ++ +commons-daemon (1.0.2-2) unstable; urgency=low + + * Re-add missing patches (lost during merge of new upstream release): + - debian/patches/syslog.diff: Support for logging to syslog. + - debian/patches/old_capabilities.diff: Work with older Linux capabilities. + - debian/patches/libgcj_PR31700.diff: Bug in GCJ handling of -X options. + - debian/patches/*_support.diff: Support for other Debian architectures. + + -- Damien Raude-Morvan <[email protected]> Wed, 28 Jul 2010 14:59:18 +0200 + +commons-daemon (1.0.2-1) unstable; urgency=low + + [ Thierry Carrez ] + * debian/control, debian/rules: Build with default-jdk + * debian/rules: Depend on -headless runtimes + * debian/rules: Set java source/target to 1.4 to match depends + + [ Torsten Werner ] + * Re-add changes made by Emmanuel Bourg: + - Update of the URLs + - Rename Jakarta Commons to Apache Commons + + [ Damien Raude-Morvan ] + * New upstream stable release (Closes: #578661). + - d/watch: Update URL for new upstream release. + * d/patches/sh4-support.diff: Add support for sh4 arch (Closes: #564166). + * d/control: Remove Arnaud and add myself from Uploaders. + * Updated to Standards-Version 3.9.1: + - d/control: Add recommended get-orig-source target. + * d/control: Add ${misc:Depends} to Depends. + * Switch to 3.0 (quilt) format. + * Use Debhelper 7: + - d/rules: Use dh 7 and cleanup our rules file. + - d/*.dirs: Removed not needed anymore. + * d/libcommons-daemon-java.doc-base and d/rules: Install API Javadoc to + /usr/share/doc/libcommons-daemon-java/api. + + -- Damien Raude-Morvan <[email protected]> Tue, 27 Jul 2010 21:39:41 +0200 + +commons-daemon (1.0.2~svn20061127-10) unstable; urgency=low + + * Build-Depends on libcap2-dev (Closes: #506548). + * Added kfreebsd-* support to src/native/unix/support/apsupport.m4 + (Closes: #498376). + * Point stdout and stderr to /dev/null for the daemon process + (Closes: #491500, #507968). + * Build-Depends on debhelper >= 7. + * Replace dh_clean -k with dh_prep. + * Moved package to section 'java'. + * Rewrote debian/copyright to refer to + /usr/share/common-licenses/Apache-2.0. + * Updated to Standards-Version 3.8.3. + + -- Michael Koch <[email protected]> Thu, 17 Sep 2009 22:54:55 +0200 + +commons-daemon (1.0.2~svn20061127-9) unstable; urgency=low + + * Added patch to handle old capabilities version in jsvc-unix.c. + Closes: #412690 + + -- Michael Koch <[email protected]> Wed, 07 May 2008 20:03:55 +0200 + +commons-daemon (1.0.2~svn20061127-8) unstable; urgency=low + + * Clean src/native/unix/configure. Closes: #478503 + * Put jsvc into section utils. + + -- Michael Koch <[email protected]> Wed, 30 Apr 2008 05:12:17 -0100 + +commons-daemon (1.0.2~svn20061127-7) unstable; urgency=low + + * Updated watch file. + * Updated Standards-Version to 3.7.3. + * Remove bashism in debian/rules. (Closes: #478365). + * Build-Depend on default-jdk-builddep. (Closes: #477853). + * Renamed XS-Vcs-* fields to Vcs-*. + * Added Homepage field. + + -- Michael Koch <[email protected]> Tue, 29 Apr 2008 04:40:33 -0100 + +commons-daemon (1.0.2~svn20061127-6) unstable; urgency=low + + * Applied a workaround for a JNI bug in libgcj (see + http://gcc.gnu.org/PR31700). + + -- Marcus Better <[email protected]> Wed, 25 Apr 2007 15:11:01 +0200 + +commons-daemon (1.0.2~svn20061127-5) unstable; urgency=low + + * jsvc can now redirect daemon output to syslog. (Closes: #402878) + * Added support for the ppc64 architecture. Thanks to Andreas + Jochens. (Closes: #404704) + * Print a useful error message if the capabilities module is + missing. Thanks to Adrian Bridgett. (Closes: #412478) + * Don't use included config.sub and config.guess. + + -- Marcus Better <[email protected]> Wed, 13 Dec 2006 15:09:58 +0100 + +commons-daemon (1.0.2~svn20061127-4) unstable; urgency=low + + * Apparently buildds don't grok Build-Depends-Indep. Moved to + Build-Depends as a workaround. + + -- Marcus Better <[email protected]> Mon, 4 Dec 2006 14:29:08 +0100 + +commons-daemon (1.0.2~svn20061127-3) unstable; urgency=low + + * Build-depend on java-gcj-compat-dev instead of Build-depend-indep. + + -- Marcus Better <[email protected]> Mon, 4 Dec 2006 12:50:35 +0100 + +commons-daemon (1.0.2~svn20061127-2) unstable; urgency=low + + * Build-depend on autoconf instead of Build-depend-indep. + + -- Marcus Better <[email protected]> Thu, 30 Nov 2006 09:39:54 +0100 + +commons-daemon (1.0.2~svn20061127-1) unstable; urgency=low + + * Support the arm, hppa, ia64, m68k, mipsel, and s390 + architectures. (Closes: #307853) + * Don't include irrelevant README. (Closes: #394169) + * The jsvc-dev package is no longer built as it's not useful. + * debian/control: + - Fix build deps: remove libxerces2-java and libjaxp1.2-java, add autoconf + and docbook-to-man. + - Clean up package descriptions. + * debian/rules: + - Get rid of CDBS. + - Pass correct host options to autoconf. + + -- Marcus Better <[email protected]> Tue, 28 Nov 2006 13:49:20 +0100 + +commons-daemon (1.0.1-3) unstable; urgency=low + + * Apply a patch to support ppc64 arch, thanks to Andreas Jochens + (closes: #361831) + + -- Arnaud Vandyck <[email protected]> Mon, 3 Jul 2006 11:04:55 +0200 + +commons-daemon (1.0.1-2) unstable; urgency=low + + * (Builds-)Depends on java-gcj-compat(-dev) instead of kaffe(-dev) + (Closes: #358343). + * Update Standards-Version to 3.7.2. + + -- Michael Koch <[email protected]> Sat, 1 Jul 2006 15:56:17 +0000 + +commons-daemon (1.0.1-1) unstable; urgency=low + + * New upstream release + + updated manpage for new options + + amd64 now supported + (I will leave 307853 open until all debian platforms are supported) + * Patch from upstream CVS to fix invalid execve() usage (closes: #314937) + * libant1.6-java to ant transition (closes: #326436) + * Added autotools-dev to let cdbs update the config.guess/sub + * Standards-Version 3.6.2 (no changes) + + * Upload sponsored by XXX + + -- Wolfgang Baer <[email protected]> Sat, 10 Sep 2005 17:45:46 +0200 + +commons-daemon (1.0-5) unstable; urgency=low + + * upload with the sources. + * Build with free tools now, therefore buildable on all + architectures and a jsvc binary should be provided (closes: #286871) + * Move to main as built with free tools + * Shortened and clarified description (closes: #279752) + + -- Arnaud Vandyck <[email protected]> Sun, 10 Apr 2005 23:31:38 +0200 + +commons-daemon (1.0-4) unstable; urgency=low + + * Build with free tools now, therefore buildable on all + architectures and a jsvc binary should be provided (closes: #286871) + * Moved configure/build of jsvc binary from install/jsvc target to the + common-configure-arch and common-build-arch targets + * Move to main as built with free tools + * Shortened and clarified description (closes: #279752) + * Build javadoc api and include daemons.html into documentation + (Removed patch 01_dist_without_javadoc.patch) + * avdyk: added Wolfgang to the uploaders + + -- Wolfgang Baer <[email protected]> Fri, 12 Nov 2004 17:48:04 +0100 + +commons-daemon (1.0-3) unstable; urgency=low + + * changed build-dep-indep to build-dep (closes: #280933). + + -- Arnaud Vandyck <[email protected]> Fri, 12 Nov 2004 17:48:04 +0100 + +commons-daemon (1.0-2) unstable; urgency=low + + * improved description for jsvc-dev. + + -- Arnaud Vandyck <[email protected]> Fri, 29 Oct 2004 11:57:53 +0200 + +commons-daemon (1.0-1) unstable; urgency=low + + * Initial Release. + + -- Arnaud Vandyck <[email protected]> Sat, 9 Oct 2004 17:51:44 +0200 + diff --cc debian/control index 43807cf,0000000..c8aaee4 mode 100644,000000..100644 --- a/debian/control +++ b/debian/control @@@ -1,36 -1,0 +1,37 @@@ +Source: commons-daemon +Section: java +Priority: optional +Maintainer: Debian Java Maintainers <[email protected]> +Uploaders: Michael Koch <[email protected]>, Marcus Better <[email protected]>, + Damien Raude-Morvan <[email protected]> - Build-Depends: debhelper (>= 7.0.50~), autoconf, autotools-dev, default-jdk, xsltproc, docbook-xsl, ant ++Build-Depends: debhelper (>= 7.0.50~), autoconf, autotools-dev, default-jdk, ++ xsltproc, docbook-xsl, ant, libcap-dev [linux-any] +Build-Conflicts: autoconf2.13 +Standards-Version: 3.9.1 +Homepage: http://commons.apache.org/daemon/ +Vcs-Svn: svn://svn.debian.org/pkg-java/trunk/commons-daemon/ +Vcs-Browser: http://svn.debian.org/wsvn/pkg-java/trunk/commons-daemon/ + +Package: libcommons-daemon-java +Architecture: all +Depends: ${misc:Depends}, default-jre-headless | java2-runtime-headless +Suggests: java-virtual-machine +Recommends: jsvc +Description: library to launch Java applications as daemons + The Daemon package from Apache Commons can be used to implement Java + applications which can be launched as daemons. For example the + program will be notified about a shutdown so that it can perform + cleanup tasks before its process of execution is destroyed by the + operation system. + . + This package contains the java library. You will also need the actual + binary for your architecture which is provided by the jsvc package. + +Package: jsvc +Section: utils +Architecture: any +Depends: ${misc:Depends}, ${shlibs:Depends}, libcommons-daemon-java +Description: wrapper to launch Java applications as daemons + This is the native application for launching Java applications + implementing certain interfaces from the libcommons-daemon-java + package as daemons. diff --cc debian/patches/hurd_support.diff index 0000000,0000000..6e11bcf new file mode 100644 --- /dev/null +++ b/debian/patches/hurd_support.diff @@@ -1,0 -1,0 +1,17 @@@ ++Description: Add support for Hurd OS ++Last-Update: 2010-08-03 ++ ++--- a/src/native/unix/support/apsupport.m4 +++++ b/src/native/unix/support/apsupport.m4 ++@@ -74,6 +74,11 @@ ++ supported_os="kfreebsd-gnu" ++ LIBS="$LIBS -ldl -lpthread" ++ ;; +++ hurd*) +++ CFLAGS="$CFLAGS -pthread" +++ supported_os="hurd-gnu" +++ LIBS="$LIBS -ldl -lpthread" +++ ;; ++ *) ++ AC_MSG_RESULT([failed]) ++ AC_MSG_ERROR([Unsupported operating system "$host_os"]) diff --cc debian/patches/libgcj_PR31700.diff index 36942a6,0000000..553851b mode 100644,000000..100644 --- a/debian/patches/libgcj_PR31700.diff +++ b/debian/patches/libgcj_PR31700.diff @@@ -1,15 -1,0 +1,15 @@@ +Description: Workaround for libgcj/PR31700 in handling -X options. +Bug: vendor, http://gcc.gnu.org/PR31700 +Author: Marcus Better <[email protected]> +Last-Update: 2010-07-28 +--- a/src/native/unix/native/java.c ++++ b/src/native/unix/native/java.c - @@ -201,7 +201,7 @@ - return(false); ++@@ -224,7 +224,7 @@ ++ return false; + } + #endif - - arg.ignoreUnrecognized=FALSE; - + arg.ignoreUnrecognized=JNI_TRUE; - arg.nOptions=args->onum; - arg.nOptions++; /* Add abort code */ - opt=(JavaVMOption *)malloc(arg.nOptions*sizeof(JavaVMOption)); ++- arg.ignoreUnrecognized = FALSE; +++ arg.ignoreUnrecognized = JNI_TRUE; ++ arg.nOptions = args->onum; ++ arg.nOptions++; /* Add abort code */ ++ opt = (JavaVMOption *) malloc(arg.nOptions * sizeof(JavaVMOption)); diff --cc debian/patches/series index 56d307c,0000000..5143647 mode 100644,000000..100644 --- a/debian/patches/series +++ b/debian/patches/series @@@ -1,8 -1,0 +1,8 @@@ - old_capabilities.diff +libgcj_PR31700.diff +sh4_support.diff +kfreebsd_support.diff +powerpcspe_support.diff +hppa_support.diff +arm_support.diff ++hurd_support.diff +syslog.diff diff --cc debian/patches/syslog.diff index 4e8dd43,0000000..fdc69da mode 100644,000000..100644 --- a/debian/patches/syslog.diff +++ b/debian/patches/syslog.diff @@@ -1,334 -1,0 +1,313 @@@ +Description: support for redirecting stdout to syslog + Unclutter debug and error output by not + including timestamp and PID. This is superfluous for syslog logging, and + can be readily added by an external filter otherwise. + Document SYSLOG usage +Bug: http://bugs.debian.org/402878 +Author: Marcus Better <[email protected]> +Last-Update: 2010-07-28 - Forwared: no ++Forwared: yes, https://issues.apache.org/jira/browse/DAEMON-80 +--- a/src/native/unix/native/debug.c ++++ b/src/native/unix/native/debug.c - @@ -15,10 +15,8 @@ - limitations under the License. - */ - /* @version $Id: debug.c 480469 2006-11-29 08:22:04Z bayard $ */ - +#include <stdio.h> - #include "jsvc.h" - -#include <sys/types.h> - -#include <unistd.h> - -#include <time.h> - ++@@ -23,6 +23,12 @@ + /* Wether debug is enabled or not */ + bool log_debug_flag = false; - @@ -29,19 +27,9 @@ - /* Dump a debug message to stderr */ - void log_debug(const char *fmt, ...) { - va_list ap; - - time_t now; - - struct tm *nowtm; - - char buff[80]; + - if (log_debug_flag==false) return; - - if (fmt==NULL) return; - - - - now = time(NULL); +++/* Wether SYSLOG logging (for stderr) is enable or not. */ +++bool log_stderr_syslog_flag; +++ +++/* Wether SYSLOG logging (for stdout) is enable or not. */ +++bool log_stdout_syslog_flag; +++ ++ /* The name of the jsvc binary. */ ++ char *log_prog = "jsvc"; ++ ++@@ -39,12 +45,13 @@ ++ if (fmt == NULL) ++ return; ++ ++- now = time(NULL); +- nowtm = localtime(&now); +- strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm); +- - va_start(ap,fmt); - - fprintf(stderr,"%s %d %s debug: ", buff, getpid(), log_prog); - vfprintf(stderr,fmt,ap); - fprintf(stderr,"\n"); ++ va_start(ap, fmt); ++- fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog); +++ if (log_stderr_syslog_flag != false) { +++ now = time(NULL); +++ nowtm = localtime(&now); +++ strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm); +++ fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog); +++ } ++ vfprintf(stderr, fmt, ap); ++ fprintf(stderr, "\n"); + fflush(stderr); - @@ -51,21 +39,11 @@ - /* Dump an error message to stderr */ - void log_error(const char *fmt, ...) { - va_list ap; - - time_t now; - - struct tm *nowtm; - - char buff[80]; ++@@ -62,12 +69,13 @@ ++ if (fmt == NULL) ++ return; + - if (fmt==NULL) return; - - +- now = time(NULL); +- nowtm = localtime(&now); +- strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm); +- - va_start(ap,fmt); - - fprintf(stderr,"%s %d %s error: ", buff, getpid(), log_prog); - vfprintf(stderr,fmt,ap); - fprintf(stderr,"\n"); ++ va_start(ap, fmt); ++- fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog); +++ if (log_stderr_syslog_flag != false) { +++ now = time(NULL); +++ nowtm = localtime(&now); +++ strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm); +++ fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog); +++ } ++ vfprintf(stderr, fmt, ap); ++ fprintf(stderr, "\n"); + fflush(stderr); - va_end(ap); - } - - +--- a/src/native/unix/native/jsvc-unix.c ++++ b/src/native/unix/native/jsvc-unix.c +@@ -24,8 +24,11 @@ + #include <sys/wait.h> + #include <fcntl.h> + #include <stdio.h> ++#include <string.h> + #include <pwd.h> + #include <grp.h> ++#include <syslog.h> ++#include <errno.h> + #ifdef OS_LINUX + #include <sys/prctl.h> + #include <sys/syscall.h> - @@ -45,12 +48,17 @@ - static mode_t envmask; /* mask to create the files */ ++@@ -48,12 +51,16 @@ ++ static mode_t envmask; /* mask to create the files */ + - pid_t controlled=0; /* the child process pid */ ++ pid_t controlled = 0; /* the child process pid */ ++pid_t logger_pid=0; /* the logger process pid */ - static bool stopping=false; - static bool doreload=false; - static void (*handler_int)(int)=NULL; - static void (*handler_hup)(int)=NULL; - static void (*handler_trm)(int)=NULL; ++ static bool stopping = false; ++ static bool doreload = false; ++ static void (*handler_int) (int) = NULL; ++ static void (*handler_hup) (int) = NULL; ++ static void (*handler_trm) (int) = NULL; + ++static int run_controller(arg_data *args, home_data *data, uid_t uid, ++ gid_t gid); ++ - + + #ifdef OS_CYGWIN + /* + * File locking routine - @@ -625,10 +633,62 @@ - return(freopen(outfile,mode,stream)); ++@@ -741,11 +748,63 @@ ++ return freopen(outfile, mode, stream); + } + ++#define LOGBUF_SIZE 1024 ++ ++/* Read from file descriptors. Log to syslog. */ ++static int logger_child(int out_fd, int err_fd, char *procname) ++{ ++ fd_set rfds; ++ struct timeval tv; ++ int retval, n; ++ char buf[LOGBUF_SIZE]; ++ ++ if (out_fd > err_fd) { ++ n = out_fd + 1; ++ } else { ++ n = err_fd + 1; ++ } ++ ++ openlog(procname, LOG_PID, LOG_DAEMON); ++ ++ while (1) { ++ FD_ZERO(&rfds); ++ FD_SET(out_fd, &rfds); ++ FD_SET(err_fd, &rfds); ++ tv.tv_sec = 60; ++ tv.tv_usec = 0; ++ retval = select(n, &rfds, NULL, NULL, &tv); ++ if (retval == -1) ++ syslog(LOG_ERR, "select: %s", strerror(errno)); ++ else if (retval) { ++ if (FD_ISSET(out_fd, &rfds)) { ++ ssize_t n = read(out_fd, buf, LOGBUF_SIZE-1); ++ if (n < 0) { ++ syslog(LOG_ERR, "read: %s", strerror(errno)); ++ } else if (n > 0 && buf[0] != '\n') { ++ buf[n] = 0; ++ syslog(LOG_INFO, "%s", buf); ++ } ++ } ++ if (FD_ISSET(err_fd, &rfds)) { ++ ssize_t n = read(err_fd, buf, LOGBUF_SIZE-1); ++ if (n < 0) { ++ syslog(LOG_ERR, "read: %s", strerror(errno)); ++ } else if (n > 0 && buf[0] != '\n') { ++ buf[n] = 0; ++ syslog(LOG_ERR, "%s", buf); ++ } ++ } ++ } ++ } ++} ++ + /** + * Redirect stdin, stdout, stderr. + */ - -static void set_output(char *outfile, char *errfile, bool redirectstdin) { - +static void set_output(char *outfile, char *errfile, bool redirectstdin, char *procname) { ++-static void set_output(char *outfile, char *errfile, bool redirectstdin) +++static void set_output(char *outfile, char *errfile, bool redirectstdin, char *procname) ++ { ++ int out_pipe[2] = {0, 0}, err_pipe[2] = {0, 0}, fork_needed = 0; ++ - if (redirectstdin==true) { ++ if (redirectstdin == true) { + freopen("/dev/null", "r", stdin); + } - @@ -643,12 +703,30 @@ - if(strcmp(outfile, "&2") == 0 && strcmp(errfile,"&1") == 0) { - outfile="/dev/null"; ++@@ -760,11 +819,31 @@ ++ if (strcmp(outfile, "&2") == 0 && strcmp(errfile, "&1") == 0) { ++ outfile = "/dev/null"; + } - - if(strcmp(outfile, "&2") != 0) { - - loc_freopen(outfile, "a", stdout); ++- if (strcmp(outfile, "&2") != 0) { ++ if (strcmp(outfile, "SYSLOG") == 0) { ++ freopen("/dev/null", "a", stdout); ++ /* Send stdout to syslog through a logger process */ ++ if (pipe(out_pipe) == -1) { ++ log_error("cannot create stdout pipe: %s", ++ strerror(errno)); ++ } else { ++ fork_needed = 1; +++ log_stdout_syslog_flag = true; ++ } ++ } else if (strcmp(outfile, "&2") != 0) { - + loc_freopen(outfile, "a", stdout); ++ loc_freopen(outfile, "a", stdout); + } + - - if(strcmp(errfile,"&1") != 0) { - - loc_freopen(errfile, "a", stderr); ++- if (strcmp(errfile, "&1") != 0) { ++ if (strcmp(errfile, "SYSLOG") == 0) { ++ freopen("/dev/null", "a", stderr); ++ /* Send stderr to syslog through a logger process */ ++ if (pipe(err_pipe) == -1) { ++ log_error("cannot create stderr pipe: %s", ++ strerror(errno)); ++ } else { ++ fork_needed = 1; +++ log_stderr_syslog_flag = true; ++ } ++ } else if (strcmp(errfile, "&1") != 0) { - + loc_freopen(errfile, "a", stderr); - } else { - close(2); - dup(1); - @@ -657,16 +735,42 @@ - close(1); - dup(2); ++ loc_freopen(errfile, "a", stderr); ++ } ++ else { ++@@ -775,17 +854,43 @@ ++ close(1); ++ dup(2); + } ++ ++ if (fork_needed) { ++ pid_t pid = fork(); ++ if (pid == -1) { ++ log_error("cannot create logger process: %s", strerror(errno)); ++ } else { ++ if (pid) { ++ logger_pid = pid; ++ if (out_pipe[0] != 0) { ++ close(out_pipe[0]); ++ if (dup2(out_pipe[1], 1) == -1) { ++ log_error("cannot redirect stdout to pipe for syslog: %s", ++ strerror(errno)); ++ } ++ } ++ if (err_pipe[0] != 0) { ++ close(err_pipe[0]); ++ if (dup2(err_pipe[1], 2) == -1) { ++ log_error("cannot redirect stderr to pipe for syslog: %s", ++ strerror(errno)); ++ } ++ } ++ } else { ++ exit(logger_child(out_pipe[0], err_pipe[0], procname)); ++ } ++ } ++ } + } + - int main(int argc, char *argv[]) { - arg_data *args=NULL; - home_data *data=NULL; - - int status=0; - pid_t pid=0; - uid_t uid=0; - gid_t gid=0; ++ int main(int argc, char *argv[]) ++ { ++ arg_data *args = NULL; ++ home_data *data = NULL; ++- int status = 0; ++ pid_t pid = 0; ++ uid_t uid = 0; ++ gid_t gid = 0; +- time_t laststart; ++ int res; + + /* Parse command line arguments */ - args=arguments(argc,argv); - @@ -689,7 +793,7 @@ - return(0); - } - - -#ifdef OS_LINUX - +#if OS_LINUX - /* On some UNIX operating systems, we need to REPLACE this current - process image with another one (thru execve) to allow the correct - loading of VMs (notably this is for Linux). Set, replace, and go. */ - @@ -763,24 +867,39 @@ ++ args = arguments(argc, argv); ++@@ -890,11 +995,27 @@ + } + + envmask = umask(0077); +- set_output(args->outfile, args->errfile, args->redirectstdin); ++ set_output(args->outfile, args->errfile, args->redirectstdin, args->procname); ++ ++ res = run_controller(args, data, uid, gid); ++ if (logger_pid != 0) { ++ kill(logger_pid, SIGTERM); ++ } ++ ++ return res; ++} ++ ++static int run_controller(arg_data *args, home_data *data, uid_t uid, ++ gid_t gid) ++{ ++ pid_t pid=0; +++ + + /* We have to fork: this process will become the controller and the other + will be the child */ - while ((pid=fork())!=-1) { ++ while ((pid = fork()) != -1) { ++ time_t laststart; ++ int status=0; + /* We forked (again), if this is the child, we go on normally */ - if (pid==0) exit(child(args,data,uid,gid)); - laststart = time(NULL); - - /* We are in the controller, we have to forward all interesting signals - to the child, and wait for it to die */ - - controlled=pid; - + controlled = pid; - #ifdef OS_CYGWIN - SetTerm(cygwincontroller); - #endif - - signal(SIGHUP,controller); - - signal(SIGTERM,controller); - - signal(SIGINT,controller); - + signal(SIGHUP, controller); - + signal(SIGTERM, controller); - + signal(SIGINT, controller); - - while (waitpid(pid,&status,0)!=pid); - - @@ -830,7 +949,6 @@ - /* Got out of the loop? A fork() failed then. */ - log_error("Cannot decouple controller/child processes"); - return(1); - - - } - - void main_reload(void) { - @@ -842,4 +960,3 @@ ++ if (pid == 0) ++ exit(child(args, data, uid, gid)); ++@@ -975,4 +1096,3 @@ + log_debug("Killing self with TERM signal"); - kill(controlled,SIGTERM); ++ kill(controlled, SIGTERM); + } +- +--- a/src/native/unix/man/jsvc.1.xml ++++ b/src/native/unix/man/jsvc.1.xml +@@ -146,15 +146,19 @@ + <varlistentry> + <term><option>-outfile</option> /full/path/to/file</term> + <listitem> +- <para>Location for output from stdout (defaults to /dev/null). Use +- the value '&2' to simulate '1>&2'</para> ++ <para>Location for output from stdout (defaults to ++ /dev/null). Use the value '&2' to simulate ++ '1>&2', or 'SYSLOG' to send output to the system ++ log.</para> + </listitem> + </varlistentry> + <varlistentry> + <term><option>-errfile</option> /full/path/to/file</term> + <listitem> +- <para>Location for output from stderr (defaults to /dev/null). Use +- the value '&1' to simulate '2>&1'</para> ++ <para>Location for output from stderr (defaults to ++ /dev/null). Use the value '&1' to simulate ++ '2>&1', or 'SYSLOG' to send output to the system ++ log.</para> + </listitem> + </varlistentry> + <varlistentry> ++--- a/src/native/unix/native/debug.h +++++ b/src/native/unix/native/debug.h ++@@ -26,6 +26,12 @@ ++ */ ++ extern bool log_debug_flag; ++ +++/* Wether SYSLOG logging (for stderr) is enable or not. */ +++extern bool log_stderr_syslog_flag; +++ +++/* Wether SYSLOG logging (for stdout) is enable or not. */ +++extern bool log_stdout_syslog_flag; +++ ++ /** ++ * The name of the jsvc binary. ++ */ -- 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

