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]

libgo patch committed: More syscall fixes


This patch to libgo provides more fixes to the syscall package to make
it more like the master Go library.  This is based on running the
procedure described at
http://code.google.com/p/go/issues/detail?id=1790#c12 .  Bootstrapped
and ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline
and 4.7 branch.

Ian

diff -r 8d768cdf12ce libgo/configure.ac
--- a/libgo/configure.ac	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/configure.ac	Sun Apr 22 13:05:34 2012 -0700
@@ -453,7 +453,7 @@
   ;;
 esac
 
-AC_CHECK_HEADERS(sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
+AC_CHECK_HEADERS(sys/file.h sys/mman.h syscall.h sys/epoll.h sys/inotify.h sys/ptrace.h sys/syscall.h sys/user.h sys/utsname.h sys/select.h sys/socket.h net/if.h net/if_arp.h net/route.h netpacket/packet.h sys/prctl.h sys/mount.h sys/vfs.h sys/statfs.h sys/timex.h sys/sysinfo.h utime.h linux/ether.h linux/fs.h linux/reboot.h netinet/in_syst.h netinet/ip.h netinet/ip_mroute.h netinet/if_ether.h)
 
 AC_CHECK_HEADERS([linux/filter.h linux/if_addr.h linux/if_ether.h linux/if_tun.h linux/netlink.h linux/rtnetlink.h], [], [],
 [#ifdef HAVE_SYS_SOCKET_H
diff -r 8d768cdf12ce libgo/go/os/stat.go
--- a/libgo/go/os/stat.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/os/stat.go	Sun Apr 22 13:05:34 2012 -0700
@@ -19,7 +19,7 @@
 	fs := &fileStat{
 		name:    basename(name),
 		size:    int64(st.Size),
-		modTime: timespecToTime(st.Mtime),
+		modTime: timespecToTime(st.Mtim),
 		sys:     st,
 	}
 	fs.mode = FileMode(st.Mode & 0777)
@@ -52,5 +52,5 @@
 
 // For testing.
 func atime(fi FileInfo) time.Time {
-	return timespecToTime(fi.Sys().(*syscall.Stat_t).Atime)
+	return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
 }
diff -r 8d768cdf12ce libgo/go/os/stat_solaris.go
--- a/libgo/go/os/stat_solaris.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/os/stat_solaris.go	Sun Apr 22 13:05:34 2012 -0700
@@ -19,7 +19,7 @@
 	fs := &fileStat{
 		name:    basename(name),
 		size:    int64(st.Size),
-		modTime: timestrucToTime(st.Mtime),
+		modTime: timestrucToTime(st.Mtim),
 		sys:     st,
 	}
 	fs.mode = FileMode(st.Mode & 0777)
@@ -52,5 +52,5 @@
 
 // For testing.
 func atime(fi FileInfo) time.Time {
-	return timestrucToTime(fi.(*fileStat).Sys().(*syscall.Stat_t).Atime)
+	return timestrucToTime(fi.(*fileStat).Sys().(*syscall.Stat_t).Atim)
 }
diff -r 8d768cdf12ce libgo/go/syscall/libcall_linux.go
--- a/libgo/go/syscall/libcall_linux.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/syscall/libcall_linux.go	Sun Apr 22 13:05:34 2012 -0700
@@ -335,7 +335,7 @@
 //sys	Tee(rfd int, wfd int, len int, flags int) (n int64, err error)
 //tee(rfd int, wfd int, len Size_t, flags uint) Ssize_t
 
-func Tgkill(tgid, tid int, sig Signal) error {
+func Tgkill(tgid int, tid int, sig Signal) error {
 	r1, _, errno := Syscall(SYS_TGKILL, uintptr(tgid), uintptr(tid), uintptr(sig))
 	if r1 < 0 {
 		return errno
diff -r 8d768cdf12ce libgo/go/syscall/socket.go
--- a/libgo/go/syscall/socket.go	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/go/syscall/socket.go	Sun Apr 22 13:05:34 2012 -0700
@@ -22,7 +22,7 @@
 
 type RawSockaddrAny struct {
 	Addr RawSockaddr
-	Pad  [12]int8
+	Pad  [96]int8
 }
 
 const SizeofSockaddrAny = 0x1c
diff -r 8d768cdf12ce libgo/mksysinfo.sh
--- a/libgo/mksysinfo.sh	Sun Apr 22 12:25:44 2012 -0700
+++ b/libgo/mksysinfo.sh	Sun Apr 22 13:05:34 2012 -0700
@@ -151,6 +151,9 @@
 #if defined(HAVE_LINUX_ETHER_H)
 #include <linux/ether.h>
 #endif
+#if defined(HAVE_LINUX_FS_H)
+#include <linux/fs.h>
+#endif
 #if defined(HAVE_LINUX_REBOOT_H)
 #include <linux/reboot.h>
 #endif
@@ -271,6 +274,10 @@
 grep '^const __PC' gen-sysinfo.go |
   sed -e 's/^\(const \)__\(PC[^= ]*\)\(.*\)$/\1\2 = __\2/' >> ${OUT}
 
+# The PATH_MAX constant.
+grep '^const _PATH_MAX ' gen-sysinfo.go |
+  echo 'const PathMax = _PATH_MAX' >> ${OUT}
+
 # epoll constants.
 grep '^const _EPOLL' gen-sysinfo.go |
   sed -e 's/^\(const \)_\(EPOLL[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
@@ -470,9 +477,9 @@
          -e 's/st_size/Size/' \
          -e 's/st_blksize/Blksize/' \
          -e 's/st_blocks/Blocks/' \
-         -e 's/st_atim/Atime/' \
-         -e 's/st_mtim/Mtime/' \
-         -e 's/st_ctim/Ctime/' \
+         -e 's/st_atim/Atim/' \
+         -e 's/st_mtim/Mtim/' \
+         -e 's/st_ctim/Ctim/' \
          -e 's/\([^a-zA-Z0-9_]\)_timeval\([^a-zA-Z0-9_]\)/\1Timeval\2/g' \
          -e 's/\([^a-zA-Z0-9_]\)_timespec_t\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
          -e 's/\([^a-zA-Z0-9_]\)_timespec\([^a-zA-Z0-9_]\)/\1Timespec\2/g' \
@@ -791,6 +798,7 @@
       -e 's/ipi_ifindex/Ifindex/' \
       -e 's/ipi_spec_dst/Spec_dst/' \
       -e 's/ipi_addr/Addr/' \
+      -e 's/_in_addr/[4]byte/g' \
     >> ${OUT}
 
 # The in6_pktinfo struct.
@@ -826,7 +834,7 @@
     TCSAFLUSH TCIFLUSH TCOFLUSH TCIOFLUSH TCOOFF TCOON TCIOFF TCION B0 B50 \
     B75 B110 B134 B150 B200 B300 B600 B1200 B1800 B2400 B4800 B9600 B19200 \
     B38400 B57600 B115200 B230400 B460800 B500000 B576000 B921600 B1000000 \
-    B1152000 B1500000 B2000000 B2500000 B3000000 B4000000; do
+    B1152000 B1500000 B2000000 B2500000 B3000000 B3500000 B4000000; do
 
     grep "^const _$n " gen-sysinfo.go | \
 	sed -e 's/^\(const \)_\([^=]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
@@ -910,6 +918,8 @@
 # The RLIMIT constants.
 grep '^const _RLIMIT_' gen-sysinfo.go |
     sed -e 's/^\(const \)_\(RLIMIT_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
+grep '^const _RLIM_' gen-sysinfo.go |
+    sed -e 's/^\(const \)_\(RLIM_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
 # The sysinfo struct.
 grep '^type _sysinfo ' gen-sysinfo.go | \
@@ -990,6 +1000,7 @@
     sed -e 's/_nlmsgerr/NlMsgerr/' \
       -e 's/error/Error/' \
       -e 's/msg/Msg/' \
+      -e 's/_nlmsghdr/NlMsghdr/' \
     >> ${OUT}
 
 # The GNU/Linux rtnexthop struct.
@@ -1004,6 +1015,8 @@
 # The GNU/Linux netlink flags.
 grep '^const _NETLINK_' gen-sysinfo.go | \
   sed -e 's/^\(const \)_\(NETLINK_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
+grep '^const _NLA_' gen-sysinfo.go | \
+  sed -e 's/^\(const \)_\(NLA_[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
 
 # The GNU/Linux packet socket flags.
 grep '^const _PACKET_' gen-sysinfo.go | \
@@ -1018,6 +1031,7 @@
       -e 's/len/Len/' \
       -e 's/name/Name/' \
       -e 's/\[\]/[0]/' \
+      -e 's/\[0\]byte/[0]int8/' \
     >> ${OUT}
 
 # The Solaris 11 Update 1 _zone_net_addr_t struct.
@@ -1028,7 +1042,7 @@
 # Struct sizes.
 set cmsghdr Cmsghdr ip_mreq IPMreq ip_mreqn IPMreqn ipv6_mreq IPv6Mreq \
     ifaddrmsg IfAddrmsg ifinfomsg IfInfomsg in_pktinfo Inet4Pktinfo \
-    in6_pktinfo Inet6PktInfo inotify_event InotifyEvent linger Linger \
+    in6_pktinfo Inet6Pktinfo inotify_event InotifyEvent linger Linger \
     msghdr Msghdr nlattr NlAttr nlmsgerr NlMsgerr nlmsghdr NlMsghdr \
     rtattr RtAttr rtgenmsg RtGenmsg rtmsg RtMsg rtnexthop RtNexthop \
     sock_filter SockFilter sock_fprog SockFprog ucred Ucred

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