]> Cypherpunks repositories - gostls13.git/commitdiff
os/syscall: correct netbsd types/names
authorJoel Sing <jsing@google.com>
Tue, 15 May 2012 02:00:13 +0000 (12:00 +1000)
committerJoel Sing <jsing@google.com>
Tue, 15 May 2012 02:00:13 +0000 (12:00 +1000)
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

src/pkg/os/stat_netbsd.go
src/pkg/syscall/syscall_netbsd_386.go
src/pkg/syscall/syscall_netbsd_amd64.go

index 00506b2b6095dd6e35df7097eb0b451d1c5e8e20..6ba84f438ade358cb1c5ec4a87f7031856b14bbf 100644 (file)
@@ -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)
 }
index 3c4c693c97fee686f0ac407c906447e2f0959d9a..2dbff07f1d957a54a587c35441a505a7c5a436e1 100644 (file)
@@ -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) {
index 17485b12c4577d012354652d6e3cf5b9d7ee68f8..5784db99a5569bf2e4f887fb6fdc167b85d3d270 100644 (file)
@@ -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) {