Updated some debug logging, fixed JAM lock error.

This commit is contained in:
Michiel Broek
2001-08-30 21:28:06 +00:00
parent 34cd3f6bf6
commit ff3deb5d20
21 changed files with 4813 additions and 2550 deletions

View File

@@ -1,4 +1,4 @@
# Makefile.in generated automatically by automake 1.4 from Makefile.am
# Makefile.in generated automatically by automake 1.4-p4 from Makefile.am
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
@@ -323,7 +323,7 @@ distdir: $(DISTFILES)
@for file in $(DISTFILES); do \
d=$(srcdir); \
if test -d $$d/$$file; then \
cp -pr $$/$$file $(distdir)/$$file; \
cp -pr $$d/$$file $(distdir)/$$file; \
else \
test -f $(distdir)/$$file \
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \

View File

@@ -2,7 +2,7 @@
*
* File ..................: jammsg.c
* Purpose ...............: JAM message base functions
* Last modification date : 03-Aug-2001
* Last modification date : 30-Aug-2001
*
*****************************************************************************
*
@@ -363,16 +363,16 @@ unsigned long JAM_Highest(void)
int JAM_Lock(unsigned long ulTimeout)
{
int Tries = 0;
int rc, Tries = 0;
struct flock fl;
fl.l_type = F_WRLCK;
fl.l_whence = 0;
fl.l_whence = SEEK_SET;
fl.l_start = 0L;
fl.l_len = 1L; /* GoldED locks 1 byte as well */
fl.l_pid = getpid();
while (fcntl(fdHdr, F_SETLK, &fl) && ((errno == EACCES) || (errno == EAGAIN))) {
while ((rc = fcntl(fdHdr, F_SETLK, &fl)) && ((errno == EACCES) || (errno == EAGAIN))) {
if (++Tries >= (ulTimeout * 4)) {
fcntl(fdHdr, F_GETLK, &fl);
WriteError("JAM messagebase is locked by pid %d", fl.l_pid);
@@ -381,6 +381,11 @@ int JAM_Lock(unsigned long ulTimeout)
usleep(250000);
Syslog('m', "JAM messagebase lock attempt %d", Tries);
}
if (rc) {
WriteError("$%s lock error", BaseName);
return FALSE;
}
return TRUE;
}
@@ -1274,13 +1279,13 @@ void JAM_UnLock(void)
struct flock fl;
fl.l_type = F_UNLCK;
fl.l_whence = 0;
fl.l_whence = SEEK_SET;
fl.l_start = 0L;
fl.l_len = 1L; /* GoldED locks 1 byte as well */
fl.l_pid = getpid();
if (fcntl(fdHdr, F_SETLK, &fl)) {
WriteError("$Can't unlock JAM message base");
WriteError("$Can't unlock JAM message base %s", BaseName);
}
}