libgo: Merge to master revision 19184.
[official-gcc.git] / libgo / go / archive / tar / stat_unix.go
blobcb843db4cfd65815830128cc0aa285dee36f7123
1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // +build linux darwin dragonfly freebsd openbsd netbsd solaris
7 package tar
9 import (
10 "os"
11 "syscall"
14 func init() {
15 sysStat = statUnix
18 func statUnix(fi os.FileInfo, h *Header) error {
19 sys, ok := fi.Sys().(*syscall.Stat_t)
20 if !ok {
21 return nil
23 h.Uid = int(sys.Uid)
24 h.Gid = int(sys.Gid)
25 // TODO(bradfitz): populate username & group. os/user
26 // doesn't cache LookupId lookups, and lacks group
27 // lookup functions.
28 h.AccessTime = statAtime(sys)
29 h.ChangeTime = statCtime(sys)
30 // TODO(bradfitz): major/minor device numbers?
31 return nil