From 519725bb3c075ee2462c929f5997cb068e18466a Mon Sep 17 00:00:00 2001 From: Ondřej Surý Date: Mon, 26 Mar 2012 16:50:58 +0200 Subject: Imported Upstream version 2012.03.22 --- misc/dist/stat_darwin.go | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 misc/dist/stat_darwin.go (limited to 'misc/dist/stat_darwin.go') diff --git a/misc/dist/stat_darwin.go b/misc/dist/stat_darwin.go new file mode 100644 index 000000000..eb3f76a27 --- /dev/null +++ b/misc/dist/stat_darwin.go @@ -0,0 +1,32 @@ +// Copyright 2012 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// +build darwin + +package main + +import ( + "archive/tar" + "os" + "syscall" + "time" +) + +func init() { + sysStat = func(fi os.FileInfo, h *tar.Header) error { + sys, ok := fi.Sys().(*syscall.Stat_t) + if !ok { + return nil + } + h.Uid = int(sys.Uid) + h.Gid = int(sys.Gid) + // TODO(bradfitz): populate username & group. os/user + // doesn't cache LookupId lookups, and lacks group + // lookup functions. + h.AccessTime = time.Unix(sys.Atimespec.Unix()) + h.ChangeTime = time.Unix(sys.Ctimespec.Unix()) + // TODO(bradfitz): major/minor device numbers? + return nil + } +} -- cgit v1.2.3