mirror of
https://github.com/golang/go
synced 2024-11-12 04:30:22 -07:00
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
This commit is contained in:
parent
b42ebb6fbf
commit
b554fb912f
@ -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)
|
||||
}
|
||||
|
@ -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) {
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user