Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(58)

Side by Side Diff: src/pkg/os/stat_solaris.go

Issue 36020043: code review 36020043: os, os/exec, os/user: add support for GOOS=solaris
Patch Set: diff -r 1e52bf0c539c https://code.google.com/p/go Created 11 years, 3 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/pkg/os/signal/signal_unix.go ('k') | src/pkg/os/sys_solaris.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2013 The Go Authors. All rights reserved.
jsing 2014/01/08 10:38:35 Copyright years are not updated - please revert th
aram 2014/01/09 15:09:17 Done.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 package os 5 package os
6 6
7 import ( 7 import (
8 "syscall" 8 "syscall"
9 "time" 9 "time"
10 ) 10 )
11 11
12 func sameFile(fs1, fs2 *fileStat) bool { 12 func sameFile(fs1, fs2 *fileStat) bool {
13 stat1 := fs1.sys.(*syscall.Stat_t) 13 stat1 := fs1.sys.(*syscall.Stat_t)
14 stat2 := fs2.sys.(*syscall.Stat_t) 14 stat2 := fs2.sys.(*syscall.Stat_t)
15 return stat1.Dev == stat2.Dev && stat1.Ino == stat2.Ino 15 return stat1.Dev == stat2.Dev && stat1.Ino == stat2.Ino
16 } 16 }
17 17
18 func fileInfoFromStat(st *syscall.Stat_t, name string) FileInfo { 18 func fileInfoFromStat(st *syscall.Stat_t, name string) FileInfo {
19 fs := &fileStat{ 19 fs := &fileStat{
20 name: basename(name), 20 name: basename(name),
21 size: int64(st.Size), 21 size: int64(st.Size),
22 » » modTime: timespecToTime(st.Mtimespec), 22 » » modTime: timespecToTime(st.Mtim),
23 sys: st, 23 sys: st,
24 } 24 }
25 fs.mode = FileMode(st.Mode & 0777) 25 fs.mode = FileMode(st.Mode & 0777)
26 switch st.Mode & syscall.S_IFMT { 26 switch st.Mode & syscall.S_IFMT {
27 case syscall.S_IFBLK: 27 case syscall.S_IFBLK:
28 fs.mode |= ModeDevice 28 fs.mode |= ModeDevice
29 case syscall.S_IFCHR: 29 case syscall.S_IFCHR:
30 fs.mode |= ModeDevice | ModeCharDevice 30 fs.mode |= ModeDevice | ModeCharDevice
31 case syscall.S_IFDIR: 31 case syscall.S_IFDIR:
32 fs.mode |= ModeDir 32 fs.mode |= ModeDir
(...skipping 17 matching lines...) Expand all
50 } 50 }
51 return fs 51 return fs
52 } 52 }
53 53
54 func timespecToTime(ts syscall.Timespec) time.Time { 54 func timespecToTime(ts syscall.Timespec) time.Time {
55 return time.Unix(int64(ts.Sec), int64(ts.Nsec)) 55 return time.Unix(int64(ts.Sec), int64(ts.Nsec))
56 } 56 }
57 57
58 // For testing. 58 // For testing.
59 func atime(fi FileInfo) time.Time { 59 func atime(fi FileInfo) time.Time {
60 » return timespecToTime(fi.Sys().(*syscall.Stat_t).Atimespec) 60 » return timespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
61 } 61 }
OLDNEW
« no previous file with comments | « src/pkg/os/signal/signal_unix.go ('k') | src/pkg/os/sys_solaris.go » ('j') | no next file with comments »

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b