/*
* $Log$
+ * Revision 1.9 2008/02/15 23:52:12 james
+ * *** empty log message ***
+ *
* Revision 1.8 2008/02/15 20:52:36 james
* *** empty log message ***
*
#define LOCK_ASCII
#undef LOCK_BINARY
+#define STALE_CHECK_INTERVAL 10
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <dirent.h>
#include <errno.h>
+#include <time.h>
+#include <sys/time.h>
#include "lockfile.h"
char *lock_dirs[] =
{ "/var/lock/uucp", "/var/spool/lock", "/var/spool/uucp", "/etc/locks",
"/usr/spool/uucp", "/var/spool/locks", "/usr/spool/lock",
- "/usr/spool/locks", "/usr/spool/uucp/LCK"
+ "/usr/spool/locks", "/usr/spool/uucp/LCK", "/var/lock"
};
int i;
if (l->mode == SERIAL_LOCK_ACTIVE)
return 0;
- for (fle = l->locks_to_check; fle; fle = fle->next)
+ for (fle = l->locks_to_check->head; fle; fle = fle->next)
{
if (!stat (fle->name, &buf))
locks_found++;
if (!locks_found)
return 0;
- getimeofday (&now, NULL);
+ gettimeofday (&now, NULL);
timersub (&now, &l->last_stale_purge, &dif);
if (dif.tv_sec > STALE_CHECK_INTERVAL)
serial_lock_new (char *dev, int mode)
{
Filelist *fl = lockfile_make_list (dev);
+ Serial_lock *l;
if (!fl)
return NULL;
+ l = (Serial_lock *) malloc (sizeof (Serial_lock));
+
l->mode = mode;
l->locks_to_check = fl;
l->locks_held = NULL;
}
-#if 1
+#if 0
int
main (int argc, char *argv[])
{