X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fdaemon.h;h=371a21c25c6d2aa433f9712294ee3ee63c63fb9a;hp=34902f94d8add7329e8c81f05759732531873311;hb=bb84694ae5b1951689fe049bef536e5a73deb208;hpb=52d3885223f58cfd722df38adcc8d9a58aba7b51 diff --git a/include/yaz/daemon.h b/include/yaz/daemon.h index 34902f9..371a21c 100644 --- a/include/yaz/daemon.h +++ b/include/yaz/daemon.h @@ -1,5 +1,5 @@ -/* - * Copyright (c) 1995-2008, Index Data +/* This file is part of the YAZ toolkit. + * Copyright (C) Index Data. * All rights reserved. * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: @@ -24,7 +24,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -/* $Id: daemon.h,v 1.3 2008-02-21 10:44:43 adam Exp $ */ /** * \file daemon.h @@ -42,6 +41,7 @@ YAZ_BEGIN_CDECL #define YAZ_DAEMON_FORK 1 #define YAZ_DAEMON_DEBUG 2 #define YAZ_DAEMON_KEEPALIVE 4 +#define YAZ_DAEMON_LOG_REOPEN 8 /** \brief daemon utility. \param progname program name for logging purposes. @@ -60,8 +60,10 @@ YAZ_BEGIN_CDECL Flag YAZ_DAEMON_DEBUG: Puts the service in debug mode (no fork at all). - Flag YAZ_DAEMON_KEEPALIVE: Repeatedly calls work handler if it makes a + Flag YAZ_DAEMON_KEEPALIVE: Repeatedly calls work handler if it makes a "fatal" error. + + Flag YAZ_DAEMON_KEEPALIVE: Re-opens yaz log if SIGHUP is received */ YAZ_EXPORT int yaz_daemon(const char *progname, @@ -69,12 +71,24 @@ int yaz_daemon(const char *progname, void (*work)(void *data), void *data, const char *pidfile, const char *uid); +/** \brief stop daemon - stop parent process + + This function sends a signal to the parent keepalive process that + makes it exit immediately - without waiting. If there's no parent + keepalive process, this function does nothing. SHould be called + when the child process has freed resources, such as listening socket. + But the child process may continue running. +*/ +YAZ_EXPORT +void yaz_daemon_stop(void); + YAZ_END_CDECL #endif /* * Local variables: * c-basic-offset: 4 + * c-file-style: "Stroustrup" * indent-tabs-mode: nil * End: * vim: shiftwidth=4 tabstop=8 expandtab