X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=include%2Fyaz%2Fdaemon.h;h=22de18fa6d6963fc403fef4e892aa8eddf001b06;hp=9cd8c50495575e582365c556dd4b174af9c63f39;hb=83ba04bfd14a9089745f91ed45d8817339794e5e;hpb=b2e784850fc85ca61e06610756ebc54b19c59895 diff --git a/include/yaz/daemon.h b/include/yaz/daemon.h index 9cd8c50..22de18f 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) 1995-2008 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.2 2008-02-21 10:15:12 adam Exp $ */ /** * \file daemon.h @@ -43,6 +42,26 @@ YAZ_BEGIN_CDECL #define YAZ_DAEMON_DEBUG 2 #define YAZ_DAEMON_KEEPALIVE 4 +/** \brief daemon utility. + \param progname program name for logging purposes. + \param flags flags which is a bit-wise combination of YAZ_DAEMON_.. + \param work working handler (which may be running in different process) + \param data opaque data to be passed to work handler + \param pidfile filename with Process-ID (NULL for no file) + \param uid effective user ID for handler (NULL for no same as caller) + \returns 0 for success, non-zero for failure. + + This function puts calls work handler which is supposed to carry + out a daemon service with a possible changed User ID and in a + child process. + + Flag YAZ_DAEMON_FORK: Puts the service in the background on Unix. + + 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 + "fatal" error. +*/ YAZ_EXPORT int yaz_daemon(const char *progname, unsigned int flags,