archive/tar: support stat and device numbers on AIX
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 17 Jan 2018 18:33:50 +0000 (18:33 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 17 Jan 2018 18:33:50 +0000 (18:33 +0000)
    Reviewed-on: https://go-review.googlesource.com/87198

From-SVN: r256810

gcc/go/gofrontend/MERGE
libgo/go/archive/tar/stat_actime1.go
libgo/go/archive/tar/stat_unix.go

index b6f59a63860a000003c2d286d447a23a3caf354d..fb7da45eda06937eb8a9444eee94509866c16e8b 100644 (file)
@@ -1,4 +1,4 @@
-ca805b704fc141d7ad61f8fcd3badbaa04b7e363
+3ea7fc3b918210e7248dbc51d90af20639dc4167
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
index cf9cc79c5915bace0af0e81fa4df961f3a68553c..1bdd1c9dcb24cfbf5cf33c9ffef36ff9a0b25da1 100644 (file)
@@ -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
 
index 868105f338efdc109b77cda051c06247da28d56a..c37a57a84c001e00d24ced9de4dc9b8340d89435 100644 (file)
@@ -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)