From 2dbe1df5facb92bac31b5da0ca2e2e8ee6f9b358 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Thu, 21 Feb 2008 10:15:30 +0000 Subject: [PATCH] Added yaz_daemoon for windows. --- src/daemon.c | 22 ++++++++++++++++++++-- win/makefile | 3 ++- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/src/daemon.c b/src/daemon.c index a3a6ab1..f9d663a 100644 --- a/src/daemon.c +++ b/src/daemon.c @@ -2,7 +2,7 @@ * Copyright (C) 1995-2008, Index Data ApS * See the file LICENSE for details. * - * $Id: daemon.c,v 1.1 2008-02-18 17:07:06 adam Exp $ + * $Id: daemon.c,v 1.2 2008-02-21 10:15:30 adam Exp $ */ /** @@ -17,20 +17,32 @@ #include #include #include +#if HAVE_UNISTD_H #include -#include +#endif #include #include +#if HAVE_SYS_WAIT_H #include +#endif + #include + +#if HAVE_SYS_STAT_H #include +#endif + #include + +#if HAVE_PWD_H #include +#endif #include #include #include +#if HAVE_PWD_H static void write_pidfile(int pid_fd) { if (pid_fd != -1) @@ -148,12 +160,14 @@ static void keepalive(void (*work)(void *data), void *data) run++; } } +#endif int yaz_daemon(const char *progname, unsigned int flags, void (*work)(void *data), void *data, const char *pidfile, const char *uid) { +#if HAVE_PWD_H int pid_fd = -1; /* open pidfile .. defer write until in child and after setuid */ @@ -249,6 +263,10 @@ int yaz_daemon(const char *progname, work(data); } return 0; +#else + work(data); + return 0; +#endif } /* diff --git a/win/makefile b/win/makefile index 31527f9..97136b0 100644 --- a/win/makefile +++ b/win/makefile @@ -1,6 +1,6 @@ # Copyright (C) 1995-2008, Index Data ApS # All rights reserved. -# $Id: makefile,v 1.144 2008-01-18 11:47:56 adam Exp $ +# $Id: makefile,v 1.145 2008-02-21 10:15:31 adam Exp $ # # Programmed by # Heikki Levanto & Adam Dickmeiss @@ -479,6 +479,7 @@ MISC_OBJS= \ $(OBJDIR)\http.obj \ $(OBJDIR)\match_glob.obj \ $(OBJDIR)\poll.obj \ + $(OBJDIR)\daemon.obj Z3950_OBJS= \ $(OBJDIR)\z-date.obj\ -- 1.7.10.4