diff options
author | Paul Eggert <eggert@twinsun.com> | 1999-06-18 05:49:18 +0000 |
---|---|---|
committer | Paul Eggert <eggert@twinsun.com> | 1999-06-18 05:49:18 +0000 |
commit | a48de9b290e29e49080696fae108e66ad811b481 (patch) | |
tree | 3f5f1926b375d927fd8848121583cd8eed3ae5bd /src/filelock.c | |
parent | 6693a99a2c8b3d61f0735ba093d3354276ca4f9d (diff) | |
download | emacs-a48de9b290e29e49080696fae108e66ad811b481.tar.gz |
(BOOT_TIME_FILE): New macro.
(get_boot_time): Use it instead of hardwiring the file name.
Check BOOT_TIME_FILE only after inspecting the kernel directly.
Diffstat (limited to 'src/filelock.c')
-rw-r--r-- | src/filelock.c | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/src/filelock.c b/src/filelock.c index 9217b58f188..b671533161f 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -62,6 +62,12 @@ extern int errno; #include <utmp.h> +/* A file whose last-modified time is just after the most recent boot. + Define this to be NULL to disable checking for this file. */ +#ifndef BOOT_TIME_FILE +#define BOOT_TIME_FILE "/var/run/random-seed" +#endif + #ifndef WTMP_FILE #define WTMP_FILE "/var/log/wtmp" #endif @@ -113,18 +119,11 @@ static time_t get_boot_time () { int counter; - struct stat st; if (boot_time_initialized) return boot_time; boot_time_initialized = 1; - if (stat ("/var/run/random-seed", &st) == 0) - { - boot_time = st.st_mtime; - return boot_time; - } - #if defined (CTL_KERN) && defined (KERN_BOOTTIME) { int mib[2]; @@ -143,6 +142,16 @@ get_boot_time () } #endif /* defined (CTL_KERN) && defined (KERN_BOOTTIME) */ + if (BOOT_TIME_FILE) + { + struct stat st; + if (stat (BOOT_TIME_FILE, &st) == 0) + { + boot_time = st.st_mtime; + return boot_time; + } + } + #if defined (BOOT_TIME) && ! defined (NO_WTMP_FILE) #ifndef CANNOT_DUMP /* The utmp routines maintain static state. |