summaryrefslogtreecommitdiff
path: root/libgo/go/archive
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-01-17 18:33:50 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-01-17 18:33:50 +0000
commitc1fa27707a4542803c1c04fba57eeee46c214f09 (patch)
treed8566779fe5525243834c21aadda6df88685b1ce /libgo/go/archive
parent4436a3ce496abccfc405ade7fb8b575ea55a64ee (diff)
downloadgcc-c1fa27707a4542803c1c04fba57eeee46c214f09.tar.gz
archive/tar: support stat and device numbers on AIX
Reviewed-on: https://go-review.googlesource.com/87198 From-SVN: r256810
Diffstat (limited to 'libgo/go/archive')
-rw-r--r--libgo/go/archive/tar/stat_actime1.go2
-rw-r--r--libgo/go/archive/tar/stat_unix.go12
2 files changed, 12 insertions, 2 deletions
diff --git a/libgo/go/archive/tar/stat_actime1.go b/libgo/go/archive/tar/stat_actime1.go
index cf9cc79c591..1bdd1c9dcb2 100644
--- a/libgo/go/archive/tar/stat_actime1.go
+++ b/libgo/go/archive/tar/stat_actime1.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux dragonfly openbsd solaris
+// +build aix linux dragonfly openbsd solaris
package tar
diff --git a/libgo/go/archive/tar/stat_unix.go b/libgo/go/archive/tar/stat_unix.go
index 868105f338e..c37a57a84c0 100644
--- a/libgo/go/archive/tar/stat_unix.go
+++ b/libgo/go/archive/tar/stat_unix.go
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
-// +build linux darwin dragonfly freebsd openbsd netbsd solaris
+// +build aix linux darwin dragonfly freebsd openbsd netbsd solaris
package tar
@@ -54,6 +54,16 @@ func statUnix(fi os.FileInfo, h *Header) error {
if h.Typeflag == TypeChar || h.Typeflag == TypeBlock {
dev := uint64(sys.Rdev) // May be int32 or uint32
switch runtime.GOOS {
+ case "aix":
+ var major, minor uint32
+ if runtime.GOARCH == "ppc64" {
+ major = uint32((dev & 0x3fffffff00000000) >> 32)
+ minor = uint32((dev & 0x00000000ffffffff) >> 0)
+ } else {
+ major = uint32((dev >> 16) & 0xffff)
+ minor = uint32(dev & 0xffff)
+ }
+ h.Devmajor, h.Devminor = int64(major), int64(minor)
case "linux":
// Copied from golang.org/x/sys/unix/dev_linux.go.
major := uint32((dev & 0x00000000000fff00) >> 8)