From d2cf99df7df132d8d90c4f7b438374618793c15a Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Fri, 6 Feb 2004 01:04:28 -0800 Subject: [PATCH] udevd - kill the lockfile --- Makefile | 1 - udev-remove.c | 1 - udevd.c | 29 ----------------------------- 3 files changed, 31 deletions(-) diff --git a/Makefile b/Makefile index 35575806db..d3493f6940 100644 --- a/Makefile +++ b/Makefile @@ -241,7 +241,6 @@ udev_version.h: @echo \#define UDEV_PERMISSION_FILE \"$(configdir)\udev.permissions\" >> $@ @echo \#define UDEV_BIN \"$(DESTDIR)$(sbindir)/udev\" >> $@ @echo \#define UDEVD_BIN \"$(DESTDIR)$(sbindir)/udevd\" >> $@ - @echo \#define UDEVD_LOCK \"$(udevdir)/\.udevd.lock\" >> $@ # config files automatically generated GEN_CONFIGS = $(LOCAL_CFG_DIR)/udev.conf diff --git a/udev-remove.c b/udev-remove.c index 9db63ed93e..c21938fae7 100644 --- a/udev-remove.c +++ b/udev-remove.c @@ -34,7 +34,6 @@ #include "logging.h" #include "namedev.h" #include "udevdb.h" -#include "libsysfs/libsysfs.h" static int delete_path(char *path) { diff --git a/udevd.c b/udevd.c index 10d67f2c35..3ce8c8b07d 100644 --- a/udevd.c +++ b/udevd.c @@ -21,7 +21,6 @@ #include #include -#include #include #include #include @@ -30,7 +29,6 @@ #include #include #include -#include #include #include #include @@ -324,7 +322,6 @@ static void sig_handler(int signum) switch (signum) { case SIGINT: case SIGTERM: - unlink(UDEVD_LOCK); exit(20 + signum); break; default: @@ -332,28 +329,6 @@ static void sig_handler(int signum) } } -static int one_and_only(void) -{ - char string[50]; - int lock_file; - - lock_file = open(UDEVD_LOCK, O_RDWR | O_CREAT, 0x640); - if (lock_file < 0) - return -1; - - /* see if we can lock */ - if (lockf(lock_file, F_TLOCK, 0) < 0) { - dbg("file is already locked, exit"); - close(lock_file); - return -1; - } - - snprintf(string, sizeof(string), "%d\n", getpid()); - write(lock_file, string, strlen(string)); - - return 0; -} - int main(int argc, char *argv[]) { int ssock; @@ -369,10 +344,6 @@ int main(int argc, char *argv[]) init_logging("udevd"); - /* only let one version of the daemon run at any one time */ - if (one_and_only() != 0) - exit(0); - signal(SIGINT, sig_handler); signal(SIGTERM, sig_handler); -- cgit v1.2.3-54-g00ecf