diff options
author | Lennart Poettering <lennart@poettering.net> | 2003-10-20 21:53:46 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2003-10-20 21:53:46 +0000 |
commit | ce36dd0994ffa833ff0ce18e57a8776ff1103d8d (patch) | |
tree | b0685edee04c84b0fd1a2593c1afffaa18da0448 | |
parent | df2e940cfd540ea46dd95da77ebacc35ae58423e (diff) |
commit release 0.3
git-svn-id: file:///home/lennart/svn/public/libdaemon/trunk@41 153bfa13-eec0-0310-be40-b0cb6a0e1b4b
-rw-r--r-- | Makefile.am | 5 | ||||
-rwxr-xr-x | bootstrap.sh | 4 | ||||
-rw-r--r-- | configure.ac | 10 | ||||
-rw-r--r-- | doc/Makefile.am | 3 | ||||
-rw-r--r-- | doc/README.html.in | 21 | ||||
-rw-r--r-- | doc/style.css | 19 | ||||
-rw-r--r-- | examples/testd.c | 7 | ||||
-rw-r--r-- | src/Makefile.am | 1 | ||||
-rw-r--r-- | src/dpid.c | 31 | ||||
-rw-r--r-- | src/dpid.h | 14 |
10 files changed, 97 insertions, 18 deletions
diff --git a/Makefile.am b/Makefile.am index 63b1d96..05b43a6 100644 --- a/Makefile.am +++ b/Makefile.am @@ -35,4 +35,7 @@ homepage: cp $$HOME/homepage/lennart/projects/libdaemon/README.html $$HOME/homepage/lennart/projects/libdaemon/index.html cp -av doc/reference/ $$HOME/homepage/lennart/projects/libdaemon/ -.PHONY: homepage +distcleancheck: + @: + +.PHONY: homepage distcleancheck diff --git a/bootstrap.sh b/bootstrap.sh index 203f27b..a520e21 100755 --- a/bootstrap.sh +++ b/bootstrap.sh @@ -24,8 +24,6 @@ if [ "x$1" = "xam" ] ; then else set -ex - #make maintainer-clean || true - rm -rf autom4te.cache rm -f config.cache @@ -35,6 +33,6 @@ else automake -a -c autoconf -Wall - ./configure "$@" + ./configure --sysconfdir=/etc "$@" fi diff --git a/configure.ac b/configure.ac index 884d8d0..7deb5d8 100644 --- a/configure.ac +++ b/configure.ac @@ -20,23 +20,27 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. AC_PREREQ(2.57) -AC_INIT([libdaemon], [0.3], [mzqnrzba@itaparica.org]) +AC_INIT([libdaemon], [0.3], [mzqnrzba (at) 0pointer (dot) de]) AC_CONFIG_SRCDIR([src/dfork.c]) AC_CONFIG_HEADERS([config.h]) AM_INIT_AUTOMAKE([foreign -Wall]) -AM_MAINTAINER_MODE # Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_LIBTOOL +AC_SUBST(PACKAGE_URL, [http://0pointer.de/lennart/projects/libdaemon/]) + # If using GCC specifiy some additional parameters if test "x$GCC" = "xyes" ; then CFLAGS="$CFLAGS -pipe -Wall" fi -# Checks for libraries. +if type -p stow > /dev/null && test -d /usr/local/stow ; then + AC_MSG_NOTICE([*** Found /usr/local/stow: installing to /usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION} ***]) + AC_PREFIX_DEFAULT([/usr/local/stow/${PACKAGE_NAME}-${PACKAGE_VERSION}]) +fi # Checks for header files. AC_HEADER_STDC diff --git a/doc/Makefile.am b/doc/Makefile.am index c9f5c50..fe60314 100644 --- a/doc/Makefile.am +++ b/doc/Makefile.am @@ -17,8 +17,9 @@ # Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. noinst_DATA = README.html README reference +EXTRA_DIST = $(noinst_DATA) style.css README.html.in reference + MAINTAINERCLEANFILES = README README.html -EXTRA_DIST = style.css README README.html README.html.in reference CLEANFILES = if USE_DOXYGEN diff --git a/doc/README.html.in b/doc/README.html.in index 0ca5307..1d5ee03 100644 --- a/doc/README.html.in +++ b/doc/README.html.in @@ -42,14 +42,14 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.</p> <h2><a name="news">News</a></h2> -<div class="news-date">Thu July 10 2003: </div> -<p class="news-text"><a href="http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/libdaemon-0.3.tar.gz">Version 0.3</a> released; changes include: documentation update, build fixes, RPM spec file added</p> +<div class="news-date">Mon Oct 20 2003: </div> +<p class="news-text"><a href="@PACKAGE_URL@libdaemon-0.3.tar.gz">Version 0.3</a> released; changes include: documentation update, build fixes, RPM spec file added, added new function int <tt>daemon_pid_file_kill_wait()</tt>.</p> <div class="news-date">Thu July 10 2003: </div> -<p class="news-text"><a href="http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/libdaemon-0.2.tar.gz">Version 0.2</a> released; changes include: ugly umask error fix, documentation update</p> +<p class="news-text"><a href="@PACKAGE_URL@libdaemon-0.2.tar.gz">Version 0.2</a> released; changes include: ugly umask error fix, documentation update</p> <div class="news-date">Mon July 7 2003: </div> -<p class="news-text"><a href="http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/libdaemon-0.1.tar.gz">Version 0.1</a> released</p> +<p class="news-text"><a href="@PACKAGE_URL@libdaemon-0.1.tar.gz">Version 0.1</a> released</p> <h2><a name="overview">Overview</a></h2> @@ -73,12 +73,11 @@ daemons. It consists of the following parts:</p> available. It is not that simple to get it done right and code duplication cannot be a goal.</p> -<p><tt>libdaemon</tt> is currently used by <a -href="http://www.stud.uni-hamburg.de/~lennart/projects/ifplugd/"><tt>ifplugd</tt></a>.</p> +<p><tt>libdaemon</tt> is currently used by <a href="http://0pointer.de/lennart/projects/ifplugd/"><tt>ifplugd</tt></a>, <a href="http://0pointer.de/lennart/projects/waproamd/"><tt>waproamd</tt></a> and <a href="http://0pointer.de/lennart/projects/aeswepd/"><tt>aeswepd</tt></a>.</p> <h2><a name="status">Status</a></h2> -<p>Version 0.1 is feature complete.</p> +<p>Version @PACKAGE_VERSION@ is feature complete.</p> <h2><a name="documentation">Documentation</a></h2> @@ -107,12 +106,14 @@ compilation and <tt>make install</tt> (as root) for installation of <h2><a name="download">Download</a></h2> -<p>The newest release is always available from <a href="http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/">http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/</a></p> +<p>The newest release is always available from <a href="@PACKAGE_URL@">@PACKAGE_URL@</a></p> + +<p>The current release is <a href="@PACKAGE_URL@libdaemon-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p> -<p>The current release is <a href="http://www.stud.uni-hamburg.de/~lennart/projects/libdaemon/libdaemon-@PACKAGE_VERSION@.tar.gz">@PACKAGE_VERSION@</a></p> +<p>Get <tt>libdaemon</tt>'s development sources from the <a href="http://subversion.tigris.org/">Subversion</a> <a href="https://seth.intheinter.net:8081/svn/libdaemon/">repository</a>.</p> <hr/> -<address>Lennart Poettering <mzyvoqnrzba [at] itaparica.org>, July 2003</address> +<address>Lennart Poettering <mzyvoqnrzba [at] itaparica.org>, October 2003</address> <div><i>$Id$</i></div> </body> diff --git a/doc/style.css b/doc/style.css index 2535ff1..e14ba7c 100644 --- a/doc/style.css +++ b/doc/style.css @@ -1,4 +1,23 @@ /* $Id$ */ + +/*** + * This file is part of libdaemon. + * + * libdaemon is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * libdaemon is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with libdaemon; if not, write to the Free Software Foundation, + * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. + ***/ + body { color: black; background-color: white; margin: 0.5cm; } a:link, a:visited { color: #900000; } p { margin-left: 0.5cm; margin-right: 0.5cm; } diff --git a/examples/testd.c b/examples/testd.c index 12b2940..ec5f690 100644 --- a/examples/testd.c +++ b/examples/testd.c @@ -38,7 +38,13 @@ int main(int argc, char *argv[]) { int ret; /* Kill daemon with SIGINT */ + + /* Check if the new function daemon_pid_file_kill_wait() is available, if it is, use it. */ +#ifdef DAEMON_PID_FILE_KILL_WAIT_AVAILABLE + if ((ret = daemon_pid_file_kill_wait(SIGINT, 5)) < 0) +#else if ((ret = daemon_pid_file_kill(SIGINT)) < 0) +#endif daemon_log(LOG_WARNING, "Failed to kill daemon"); return ret < 0 ? 1 : 0; @@ -70,6 +76,7 @@ int main(int argc, char *argv[]) { return 255; } + daemon_log(ret != 0 ? LOG_ERR : LOG_INFO, "Daemon returned %i as return value.", ret); return ret; } else { /* The daemon */ diff --git a/src/Makefile.am b/src/Makefile.am index 129660f..c2719ed 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,3 +27,4 @@ libdaemon_la_SOURCES = \ dnonblock.c dnonblock.h \ dpid.c dpid.h +libdaemon_la_LDFLAGS = -version-info 1:0:1 @@ -25,6 +25,7 @@ #include <errno.h> #include <sys/types.h> #include <sys/stat.h> +#include <time.h> #include "dpid.h" #include "dlog.h" @@ -89,6 +90,36 @@ int daemon_pid_file_kill(int s) { return 0; } +int daemon_pid_file_kill_wait(int s, int m) { + pid_t pid; + time_t t; + + if ((pid = daemon_pid_file_is_running()) < 0) + return -1; + + if (kill(pid, s) < 0) + return -1; + + t = time(NULL) + m; + + for (;;) { + int r; + struct timeval tv = { 0, 100000 }; + + if (time(NULL) > t) + return -1; + + if ((r = kill(pid, 0)) < 0 && errno != ESRCH) + return -1; + + if (r) + return 0; + + if (select(0, NULL, NULL, NULL, &tv) < 0) + return -1; + } +} + int daemon_pid_file_create(void) { const char *fn; FILE *f; @@ -70,4 +70,18 @@ pid_t daemon_pid_file_is_running(void); */ int daemon_pid_file_kill(int s); +/** If this variable is defined to 1 iff daemon_pid_file_kill_wait() is supported.*/ +#define DAEMON_PID_FILE_KILL_WAIT_AVAILABLE 1 + +/** Similar to daemon_pid_file_kill() but waits until the process + * died. This functions is new in libdaemon 0.3. The macro + * DAEMON_PID_FILE_KILL_WAIT_AVAILABLE is defined iff libdaemon + * supports this function. + * + * @param s The signal to send + * @param m Seconds to wait at maximum + * @return zero on success, nonzero on failure (timeout condition is considered a failure) + */ +int daemon_pid_file_kill_wait(int s, int m); + #endif |