[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#324051: Bogus free space display on Alpha

I think the attached patch, courtesy of Gentoo, should finally fix the
statvfs problem on Alpha.  Without the patch eglibc 2.13 causes major
problems on Alpha such as recent versions of apt-get failing to
establish the correct free space on the disk and refusing to install any
packages.  I have been using the patch since eglibc 2.13-4 up to 2.13-8
and everything works dandy.  Even the test program by Martin Loewis
gives the same answer with and without -D_FILE_OFFSET_BITS=64 when
running a libc with this patch.

>From cd96467fcfa0b2a9be52dfc4e013d8051a827edc Mon Sep 17 00:00:00 2001
From: Mike Frysinger <vapier@gentoo.org>
Date: Sun, 3 Apr 2011 16:54:50 -0400
Subject: [PATCH] alpha: do not assume statfs64 support

In the past, the alpha port used the wordsize-64/statfs64.c stub which
allowed the statfs64() func to alias to statfs().  But after the move
to the ports tree, some shuffling happened and now alpha's statfs64.c
will pull in the standard 32bit linux statfs64.c file.  The problem
with this is that the code expands into a stub function if the 64bit
syscall is not defined and __ASSUME_STATFS64 is defined (which is
currently the case for alpha).

Since the alpha port has never had a statfs64 func, but has always had
only a 32bit struct version with the kernel ABI, it is wrong to alias
statfs64 to statfs.  So rather than restore the stub statfs64.c file,
undef __ASSUME_STATFS64 in the alpha kernel-features.h.  This way the
common code will do the right thing -- use the 32bit statfs syscall
and translate the result in userspace from the 32bit struct to the
64bit struct.

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
 sysdeps/unix/sysv/linux/alpha/kernel-features.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h b/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h
index 9c640f9..5217ca8 100644
--- a/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h
+++ b/ports/sysdeps/unix/sysv/linux/alpha/kernel-features.h
@@ -70,6 +70,9 @@
 #undef __ASSUME_ST_INO_64_BIT
+/* Alpha does not have a 64bit syscall, and its native syscall is 32bits.  */
+#undef __ASSUME_STATFS64
 /* pselect/ppoll were introduced on alpha just after 2.6.22-rc1.  */
 #if __LINUX_KERNEL_VERSION < 0x020617

Reply to: