Patchwork libgo patch committed: Fill out syscall package for GNU/Linux

login
register
mail settings
Submitter Rainer Orth
Date March 2, 2012, 10:04 a.m.
Message ID <yddy5rjxqsv.fsf@manam.CeBiTec.Uni-Bielefeld.DE>
Download mbox | patch
Permalink /patch/144190/
State New
Headers show

Comments

Rainer Orth - March 2, 2012, 10:04 a.m.
Ian Lance Taylor <iant@google.com> writes:

> This patch to libgo fills out the syscall package for GNU/Linux to match
> all the functions in the syscall package in the master Go library.
> There is a test case for this patch at
> http://code.google.com/p/go/issues/detail?id=3071 .  Bootstrapped and
> ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Unfortunately, this broke Solaris bootstrap:

/usr/include/sys/ustat.h:31:2: error: #error "Cannot use ustat in the large files compilation environment"
make[4]: *** No rule to make target `s-sysinfo', needed by `sysinfo.go'.  Stop.
make[4]: *** Waiting for unfinished jobs....

<sys/ustat.h> has

#if !defined(_LP64) && _FILE_OFFSET_BITS == 64
#error	"Cannot use ustat in the large files compilation environment"
#endif

I've used the hack below to restore bootstrap, but suppose a cleaner
solution would be to run the configure tests with the same flags as used
for the actual compilations (i.e. OSCFLAGS).

Alternatively, one could restrict the use of <ustat.h> to Linux since
it's only used in go/syscall/libcall_linux.go anyway.

	Rainer
Rainer Orth - March 2, 2012, 7:10 p.m.
Rainer Orth <ro@CeBiTec.Uni-Bielefeld.DE> writes:

> Ian Lance Taylor <iant@google.com> writes:
>
>> This patch to libgo fills out the syscall package for GNU/Linux to match
>> all the functions in the syscall package in the master Go library.
>> There is a test case for this patch at
>> http://code.google.com/p/go/issues/detail?id=3071 .  Bootstrapped and
>> ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.
>
> Unfortunately, this broke Solaris bootstrap:

It also broke Linux/x86_64 bootstrap (CentOS 5.6):

In file included from /usr/include/sys/ustat.h:30:0,
                 from /usr/include/ustat.h:1,
                 from sysinfo.c:91:
/usr/include/bits/ustat.h:25:8: error: redefinition of 'struct ustat'
In file included from /usr/include/linux/filter.h:8:0,
                 from sysinfo.c:61:
/usr/include/linux/types.h:156:8: note: originally defined here

	Rainer

Patch

# HG changeset patch
# Parent d7ca4c137cbff062787505281b123c22dfc72019
Don't use <ustat.h> on 32-bit Solaris

diff --git a/libgo/mksysinfo.sh b/libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh
+++ b/libgo/mksysinfo.sh
@@ -110,8 +110,12 @@  cat > sysinfo.c <<EOF
 #include <sys/sysinfo.h>
 #endif
 #if defined(HAVE_USTAT_H)
+#if defined(__sun__) && defined(__svr4__) && !defined(_LP64) && _FILE_OFFSET_BITS == 64
+/* Solaris <ustat.h> is incompatible with largefiles.  */
+#else
 #include <ustat.h>
 #endif
+#endif
 #if defined(HAVE_UTIME_H)
 #include <utime.h>
 #endif