Version 5.14.8
[yaz-moved-to-github.git] / include / yaz / daemon.h
index 3d14c2a..371a21c 100644 (file)
@@ -1,5 +1,5 @@
 /* This file is part of the YAZ toolkit.
- * Copyright (C) 1995-2009 Index Data.
+ * 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:
@@ -41,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.
@@ -59,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,
@@ -68,6 +71,17 @@ 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