# HG changeset patch # User Karl Heuer # Date 920260234 0 # Node ID 520e8f39c1f8fb050a765698b6f88f83f91ce9e7 # Parent 230bace6a57a0e7d4939ad75885cbf84dc0e6a6d (get_boot_time): Support FreeBSD way to read boot-time. diff -r 230bace6a57a -r 520e8f39c1f8 src/filelock.c --- a/src/filelock.c Mon Mar 01 03:50:00 1999 +0000 +++ b/src/filelock.c Mon Mar 01 03:50:34 1999 +0000 @@ -39,6 +39,12 @@ #include #endif +#ifdef __FreeBSD__ +#include +#include +#include +#endif /* __FreeBSD__ */ + #include "lisp.h" #include "buffer.h" #include "charset.h" @@ -142,6 +148,23 @@ /* Otherwise, try again to read the uptime. */ time_before = after; } +#if defined (CTL_KERN) && defined (KERN_BOOTTIME) + { + int mib[2]; + size_t size; + struct timeval boottime_val; + + mib[0] = CTL_KERN; + mib[1] = KERN_BOOTTIME; + size = sizeof (boottime_val); + + if (sysctl (mib, 2, &boottime_val, &size, NULL, 0) >= 0) + { + boot_time = boottime_val.tv_sec; + return boot_time; + } + } +#endif /* defined (CTL_KERN) && defined (KERN_BOOTTIME) */ /* Try to get boot time from the current wtmp file. */ get_boot_time_1 (WTMP_FILE);