This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[gccgo] Add syscall.Uname


This patch from Chris Wedgewood adds syscall.Uname to libgo.  Committed
to gccgo branch.

Ian

diff -r 30b9cf404951 libgo/configure.ac
--- a/libgo/configure.ac	Tue Nov 23 09:23:31 2010 -0800
+++ b/libgo/configure.ac	Tue Nov 23 14:52:14 2010 -0800
@@ -191,7 +191,7 @@
 
 GCC_CHECK_UNWIND_GETIPINFO
 
-AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h)
+AC_CHECK_HEADERS(sys/mman.h syscall.h sys/epoll.h sys/ptrace.h sys/user.h sys/utsname.h)
 AM_CONDITIONAL(HAVE_SYS_MMAN_H, test "$ac_cv_header_sys_mman_h" = yes)
 AC_CHECK_FUNCS(srandom random strsignal)
 
diff -r 30b9cf404951 libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Tue Nov 23 09:23:31 2010 -0800
+++ b/libgo/mksysinfo.sh	Tue Nov 23 14:52:14 2010 -0800
@@ -51,6 +51,9 @@
 #if defined(HAVE_SYS_USER_H)
 #include <sys/user.h>
 #endif
+#if defined(HAVE_SYS_UTSNAME_H)
+#include <sys/utsname.h>
+#endif
 #include <unistd.h>
 EOF
 
@@ -286,5 +289,16 @@
       -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
     >> ${OUT}
 
+# The utsname struct.
+grep '^type _utsname ' gen-sysinfo.go | \
+    sed -e 's/_utsname/Utsname/' \
+      -e 's/sysname/Sysname/' \
+      -e 's/nodename/Nodename/' \
+      -e 's/release/Release/' \
+      -e 's/version/Version/' \
+      -e 's/machine/Machine/' \
+      -e 's/domainname/Domainname/' \
+    >> ${OUT}
+
 mv -f ${OUT} sysinfo.go
 exit $?
diff -r 30b9cf404951 libgo/syscalls/syscall_unix.go
--- a/libgo/syscalls/syscall_unix.go	Tue Nov 23 09:23:31 2010 -0800
+++ b/libgo/syscalls/syscall_unix.go	Tue Nov 23 14:52:14 2010 -0800
@@ -9,3 +9,13 @@
 	Stdout = 1
 	Stderr = 2
 )
+
+func libc_uname(buf *Utsname) (errno int) __asm__("uname")
+
+func Uname(buf *Utsname) (errno int) {
+	r := libc_uname(buf)
+	if r < 0 {
+		errno = GetErrno()
+	}
+	return
+}

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]