mirror of
https://github.com/golang/go.git
synced 2025-11-08 04:31:01 +00:00
os: add AIX operating system
This commit adds AIX operating system to os package for ppc64 architecture. Updates: #25893 Change-Id: Ieb9a2b3ac5b9abd3b5ab68eb732c17b6256d624d Reviewed-on: https://go-review.googlesource.com/c/138725 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
parent
69c5830c2b
commit
835f983da6
28 changed files with 104 additions and 27 deletions
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package os_test
|
package os_test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os_test
|
package os_test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package exec_test
|
package exec_test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package exec
|
package exec
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package exec
|
package exec
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build openbsd
|
// +build aix openbsd
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package os_test
|
package os_test
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly js,wasm nacl solaris
|
// +build aix darwin dragonfly js,wasm nacl solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux,!android netbsd openbsd
|
// +build aix darwin dragonfly freebsd linux,!android netbsd openbsd
|
||||||
// +build cgo
|
// +build cgo
|
||||||
|
|
||||||
// Package pty is a simple pseudo-terminal package for Unix systems,
|
// Package pty is a simple pseudo-terminal package for Unix systems,
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package signal
|
package signal
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris windows
|
||||||
|
|
||||||
package signal
|
package signal
|
||||||
|
|
||||||
|
|
|
||||||
51
src/os/stat_aix.go
Normal file
51
src/os/stat_aix.go
Normal file
|
|
@ -0,0 +1,51 @@
|
||||||
|
// Copyright 2018 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.
|
||||||
|
|
||||||
|
package os
|
||||||
|
|
||||||
|
import (
|
||||||
|
"syscall"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
|
func fillFileStatFromSys(fs *fileStat, name string) {
|
||||||
|
fs.name = basename(name)
|
||||||
|
fs.size = int64(fs.sys.Size)
|
||||||
|
fs.modTime = stTimespecToTime(fs.sys.Mtim)
|
||||||
|
fs.mode = FileMode(fs.sys.Mode & 0777)
|
||||||
|
switch fs.sys.Mode & syscall.S_IFMT {
|
||||||
|
case syscall.S_IFBLK:
|
||||||
|
fs.mode |= ModeDevice
|
||||||
|
case syscall.S_IFCHR:
|
||||||
|
fs.mode |= ModeDevice | ModeCharDevice
|
||||||
|
case syscall.S_IFDIR:
|
||||||
|
fs.mode |= ModeDir
|
||||||
|
case syscall.S_IFIFO:
|
||||||
|
fs.mode |= ModeNamedPipe
|
||||||
|
case syscall.S_IFLNK:
|
||||||
|
fs.mode |= ModeSymlink
|
||||||
|
case syscall.S_IFREG:
|
||||||
|
// nothing to do
|
||||||
|
case syscall.S_IFSOCK:
|
||||||
|
fs.mode |= ModeSocket
|
||||||
|
}
|
||||||
|
if fs.sys.Mode&syscall.S_ISGID != 0 {
|
||||||
|
fs.mode |= ModeSetgid
|
||||||
|
}
|
||||||
|
if fs.sys.Mode&syscall.S_ISUID != 0 {
|
||||||
|
fs.mode |= ModeSetuid
|
||||||
|
}
|
||||||
|
if fs.sys.Mode&syscall.S_ISVTX != 0 {
|
||||||
|
fs.mode |= ModeSticky
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func stTimespecToTime(ts syscall.StTimespec_t) time.Time {
|
||||||
|
return time.Unix(int64(ts.Sec), int64(ts.Nsec))
|
||||||
|
}
|
||||||
|
|
||||||
|
// For testing.
|
||||||
|
func atime(fi FileInfo) time.Time {
|
||||||
|
return stTimespecToTime(fi.Sys().(*syscall.Stat_t).Atim)
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm linux nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
26
src/os/sys_aix.go
Normal file
26
src/os/sys_aix.go
Normal file
|
|
@ -0,0 +1,26 @@
|
||||||
|
// Copyright 2018 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.
|
||||||
|
|
||||||
|
package os
|
||||||
|
|
||||||
|
import "syscall"
|
||||||
|
|
||||||
|
// gethostname syscall cannot be used because it also returns the domain.
|
||||||
|
// Therefore, hostname is retrieve with uname syscall and the Nodename field.
|
||||||
|
|
||||||
|
func hostname() (name string, err error) {
|
||||||
|
var u syscall.Utsname
|
||||||
|
if errno := syscall.Uname(&u); errno != nil {
|
||||||
|
return "", NewSyscallError("uname", errno)
|
||||||
|
}
|
||||||
|
b := make([]byte, len(u.Nodename))
|
||||||
|
i := 0
|
||||||
|
for ; i < len(u.Nodename); i++ {
|
||||||
|
if u.Nodename[i] == 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
b[i] = byte(u.Nodename[i])
|
||||||
|
}
|
||||||
|
return string(b[:i]), nil
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd !android,linux netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd !android,linux netbsd openbsd solaris
|
||||||
// +build cgo,!osusergo
|
// +build cgo,!osusergo
|
||||||
|
|
||||||
package user
|
package user
|
||||||
|
|
|
||||||
|
|
@ -65,8 +65,8 @@ func current() (*User, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func listGroups(*User) ([]string, error) {
|
func listGroups(*User) ([]string, error) {
|
||||||
if runtime.GOOS == "android" {
|
if runtime.GOOS == "android" || runtime.GOOS == "aix" {
|
||||||
return nil, errors.New("user: GroupIds not implemented on Android")
|
return nil, errors.New(fmt.Sprintf("user: GroupIds not implemented on %s", runtime.GOOS))
|
||||||
}
|
}
|
||||||
return nil, errors.New("user: GroupIds requires cgo")
|
return nil, errors.New("user: GroupIds requires cgo")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd js,wasm !android,linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd js,wasm !android,linux nacl netbsd openbsd solaris
|
||||||
// +build !cgo osusergo
|
// +build !cgo osusergo
|
||||||
|
|
||||||
package user
|
package user
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly freebsd !android,linux nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly freebsd !android,linux nacl netbsd openbsd solaris
|
||||||
// +build !cgo
|
// +build !cgo
|
||||||
|
|
||||||
package user
|
package user
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
// Use of this source code is governed by a BSD-style
|
// Use of this source code is governed by a BSD-style
|
||||||
// license that can be found in the LICENSE file.
|
// license that can be found in the LICENSE file.
|
||||||
|
|
||||||
// +build darwin dragonfly js,wasm nacl netbsd openbsd solaris
|
// +build aix darwin dragonfly js,wasm nacl netbsd openbsd solaris
|
||||||
|
|
||||||
package os
|
package os
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue