From: Joel Sing Date: Tue, 15 May 2012 02:00:13 +0000 (+1000) Subject: os/syscall: correct netbsd types/names X-Git-Tag: go1.1rc2~3209 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=b554fb912ffc25f88f19bc7985c83496faa98cc8;p=gostls13.git os/syscall: correct netbsd types/names Fix types/names so that these functions work with the generated syscall/z* files. R=golang-dev, m4dh4tt3r CC=golang-dev https://golang.org/cl/6201078 --- diff --git a/src/pkg/os/stat_netbsd.go b/src/pkg/os/stat_netbsd.go index 00506b2b60..6ba84f438a 100644 --- a/src/pkg/os/stat_netbsd.go +++ b/src/pkg/os/stat_netbsd.go @@ -19,7 +19,7 @@ func fileInfoFromStat(st *syscall.Stat_t, name string) FileInfo { fs := &fileStat{ name: basename(name), size: int64(st.Size), - modTime: timespecToTime(st.Mtim), + modTime: timespecToTime(st.Mtimespec), sys: st, } fs.mode = FileMode(st.Mode & 0777) @@ -57,5 +57,5 @@ func timespecToTime(ts syscall.Timespec) time.Time { // For testing. func atime(fi FileInfo) time.Time { - return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim) + return timespecToTime(fi.Sys().(*syscall.Stat_t).Atimespec) } diff --git a/src/pkg/syscall/syscall_netbsd_386.go b/src/pkg/syscall/syscall_netbsd_386.go index 3c4c693c97..2dbff07f1d 100644 --- a/src/pkg/syscall/syscall_netbsd_386.go +++ b/src/pkg/syscall/syscall_netbsd_386.go @@ -9,7 +9,7 @@ func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = int32(nsec / 1e9) + ts.Sec = int64(nsec / 1e9) ts.Nsec = int32(nsec % 1e9) return } @@ -19,14 +19,14 @@ func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec) func NsecToTimeval(nsec int64) (tv Timeval) { nsec += 999 // round up to microsecond tv.Usec = int32(nsec % 1e9 / 1e3) - tv.Sec = int32(nsec / 1e9) + tv.Sec = int64(nsec / 1e9) return } func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Ident = uint32(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) + k.Filter = uint32(mode) + k.Flags = uint32(flags) } func (iov *Iovec) SetLen(length int) { diff --git a/src/pkg/syscall/syscall_netbsd_amd64.go b/src/pkg/syscall/syscall_netbsd_amd64.go index 17485b12c4..5784db99a5 100644 --- a/src/pkg/syscall/syscall_netbsd_amd64.go +++ b/src/pkg/syscall/syscall_netbsd_amd64.go @@ -9,8 +9,8 @@ func Getpagesize() int { return 4096 } func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = int32(nsec / 1e9) - ts.Nsec = nsec % 1e9 + ts.Sec = int64(nsec / 1e9) + ts.Nsec = int64(nsec % 1e9) return } @@ -18,15 +18,15 @@ func TimevalToNsec(tv Timeval) int64 { return int64(tv.Sec)*1e9 + int64(tv.Usec) func NsecToTimeval(nsec int64) (tv Timeval) { nsec += 999 // round up to microsecond - tv.Usec = nsec % 1e9 / 1e3 + tv.Usec = int32(nsec % 1e9 / 1e3) tv.Sec = int64(nsec / 1e9) return } func SetKevent(k *Kevent_t, fd, mode, flags int) { k.Ident = uint64(fd) - k.Filter = int16(mode) - k.Flags = uint16(flags) + k.Filter = uint32(mode) + k.Flags = uint32(flags) } func (iov *Iovec) SetLen(length int) {