From: Adam Dickmeiss Date: Thu, 21 Aug 2003 10:30:03 +0000 (+0000) Subject: Write zebrasrv.pid to lockDir. X-Git-Tag: ZEBRA.1.3.12~15 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=10c319371a218dd827d746634d23ac2d33f15461 Write zebrasrv.pid to lockDir. --- diff --git a/CHANGELOG b/CHANGELOG index 2b0aeb0..76b15c7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,8 @@ +New filter grs.marcxml which works like grs.marc but produces MARCXML. + +Write zebrasrv.pid to lockdir. + Bug fix: result sets were not recovered correctly. Had to add ODR handle for zebra_search_RPN in order to make it work. diff --git a/include/zebraapi.h b/include/zebraapi.h index 9818c4c..203a73a 100644 --- a/include/zebraapi.h +++ b/include/zebraapi.h @@ -1,4 +1,4 @@ -/* $Id: zebraapi.h,v 1.9 2003-06-30 19:37:12 adam Exp $ +/* $Id: zebraapi.h,v 1.10 2003-08-21 10:30:04 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -259,5 +259,7 @@ const char *zebra_get_resource(ZebraHandle zh, const char *name, const char *defaultvalue); +YAZ_EXPORT void zebra_pidfname(ZebraService zs, char *path); + YAZ_END_CDECL #endif diff --git a/index/zebraapi.c b/index/zebraapi.c index 9f5886c..c3cf7f5 100644 --- a/index/zebraapi.c +++ b/index/zebraapi.c @@ -1,4 +1,4 @@ -/* $Id: zebraapi.c,v 1.112 2003-07-07 14:56:04 heikki Exp $ +/* $Id: zebraapi.c,v 1.113 2003-08-21 10:30:04 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -186,6 +186,13 @@ ZebraService zebra_start (const char *configName) return 0; } + +void zebra_pidfname(ZebraService zs, char *path) +{ + zebra_lock_prefix (zs->global_res, path); + strcat(path, "zebrasrv.pid"); +} + static struct zebra_register *zebra_register_open (ZebraService zs, const char *name, int rw, int useshadow, Res res, diff --git a/index/zserver.c b/index/zserver.c index f187c17..8889dad 100644 --- a/index/zserver.c +++ b/index/zserver.c @@ -1,4 +1,4 @@ -/* $Id: zserver.c,v 1.109 2003-07-02 22:00:06 adam Exp $ +/* $Id: zserver.c,v 1.110 2003-08-21 10:30:04 adam Exp $ Copyright (C) 1995,1996,1997,1998,1999,2000,2001,2002,2003 Index Data Aps @@ -657,20 +657,24 @@ static void bend_start (struct statserv_options_block *sob) #else if (!sob->inetd) { + char pidfname[4096]; struct flock area; - char *pidfile = "zebrasrv.pid"; - int fd = open (pidfile, O_EXCL|O_WRONLY|O_CREAT, 0666); + int fd; + + zebra_pidfname(sob->handle, pidfname); + + fd = open (pidfname, O_EXCL|O_WRONLY|O_CREAT, 0666); if (fd == -1) { if (errno != EEXIST) { - yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfile); + yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname); exit(1); } - fd = open(pidfile, O_RDWR, 0666); + fd = open(pidfname, O_RDWR, 0666); if (fd == -1) { - yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfile); + yaz_log(LOG_FATAL|LOG_ERRNO, "lock file %s", pidfname); exit(1); } } @@ -699,7 +703,11 @@ static void bend_stop(struct statserv_options_block *sob) #else if (!sob->inetd) - unlink ("zebrasrv.pid"); + { + char pidfname[4096]; + zebra_pidfname(sob->handle, pidfname); + unlink (pidfname); + } #endif if (sob->handle) {