...
Run Format

Source file src/archive/tar/stat_unix.go

     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.
     4	
     5	// +build linux darwin dragonfly freebsd openbsd netbsd solaris
     6	
     7	package tar
     8	
     9	import (
    10		"os"
    11		"syscall"
    12	)
    13	
    14	func init() {
    15		sysStat = statUnix
    16	}
    17	
    18	func statUnix(fi os.FileInfo, h *Header) error {
    19		sys, ok := fi.Sys().(*syscall.Stat_t)
    20		if !ok {
    21			return nil
    22		}
    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
    32	}
    33	

View as plain text