[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with boot-time on Cygwin
From: |
Bruno Haible |
Subject: |
Re: Problem with boot-time on Cygwin |
Date: |
Thu, 02 May 2024 00:52:45 +0200 |
Hi Ken,
Thanks for the report.
> > First, there is a comment
> > saying that /var/run/utmp is empty on Cygwin. This is not true, at
> > least on my system. I'm running Cygwin 3.5.3, the latest stable
> > release.
In my Cygwin 3.5.3 installation, /var/run/utmp is empty. But anyway,
since you already found the answer:
> Specifically, in
> boot-time.c:113, ut->ut_type != BOOT_TIME. As a result, get_boot_time
> ends up calling get_windows_boot_time, which fails on my system because
> of the cygdrive problem described in the next paragraph.
OK, nothing to do here.
> > Second, and more serious, is the use of /cygdrive/c to refer to the C:
> > drive. In fact, users can set the "cygdrive prefix" to anything they
> > want in /etc/fstab. For example, I use /mnt as the cygdrive prefix, so
> > I would use /mnt/c for the C: drive. The correct way to use the
> > cygdrive prefix is to use /proc/cygdrive. For example, /proc/cygdrive
> > is a symlink to /mnt/ on my system.
I did not know about /proc/cygdrive; thanks for teaching us. I guess it can be
assumed that /proc/cygdrive exists, because unlike in Linux, there are no
Docker containers and unlike in FreeBSD, there are no jails?
I'm committing this patch:
2024-05-01 Bruno Haible <bruno@clisp.org>
readutmp, boot-time: Improve for some Cygwin installations.
Reported by Ken Brown <kbrown@cornell.edu> in
<https://lists.gnu.org/archive/html/bug-gnulib/2024-05/msg00008.html>.
* lib/boot-time-aux.h (get_windows_boot_time): Use /proc/cygdrive/
instead of /cygdrive/.
diff --git a/lib/boot-time-aux.h b/lib/boot-time-aux.h
index 8b966fe691..a94cdb3f30 100644
--- a/lib/boot-time-aux.h
+++ b/lib/boot-time-aux.h
@@ -306,7 +306,8 @@ get_windows_boot_time (struct timespec *p_boot_time)
process, namely C:\pagefile.sys. */
const char * const boot_touched_file =
#if defined __CYGWIN__ && !defined _WIN32
- "/cygdrive/c/pagefile.sys"
+ /* It is more portable to use /proc/cygdrive/c than /cygdrive/c. */
+ "/proc/cygdrive/c/pagefile.sys"
#else
"C:\\pagefile.sys"
#endif
- Problem with boot-time on Cygwin, Ken Brown, 2024/05/01
- Re: Problem with boot-time on Cygwin, Ken Brown, 2024/05/01
- Re: Problem with boot-time on Cygwin,
Bruno Haible <=
- Re: Problem with boot-time on Cygwin, Ken Brown, 2024/05/02
- Re: Problem with boot-time on Cygwin, Bruno Haible, 2024/05/02
- Re: Problem with boot-time on Cygwin, Ken Brown, 2024/05/02
- Re: Problem with boot-time on Cygwin, Bruno Haible, 2024/05/02
- Re: Problem with boot-time on Cygwin, Bruno Haible, 2024/05/04
- Re: Problem with boot-time on Cygwin, Ken Brown, 2024/05/04