Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions console_other.go
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
//go:build !darwin && !freebsd && !linux && !netbsd && !openbsd && !windows && !zos
// +build !darwin,!freebsd,!linux,!netbsd,!openbsd,!windows,!zos
//go:build !aix && !darwin && !freebsd && !linux && !netbsd && !openbsd && !windows && !zos
// +build !aix,!darwin,!freebsd,!linux,!netbsd,!openbsd,!windows,!zos

/*
Copyright The containerd Authors.
Expand Down
4 changes: 2 additions & 2 deletions console_test.go
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
//go:build linux || zos || freebsd
// +build linux zos freebsd
//go:build aix || linux || zos || freebsd
// +build aix linux zos freebsd

/*
Copyright The containerd Authors.
Expand Down
4 changes: 2 additions & 2 deletions console_unix.go
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
//go:build darwin || freebsd || linux || netbsd || openbsd || zos
// +build darwin freebsd linux netbsd openbsd zos
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || zos
// +build aix darwin freebsd linux netbsd openbsd zos

/*
Copyright The containerd Authors.
Expand Down
31 changes: 31 additions & 0 deletions pty_aix.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
//go:build aix
// +build aix

/*
Copyright The containerd Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package console

import (
"os"

"golang.org/x/sys/unix"
)

// openpt allocates a new pseudo-terminal by opening the /dev/ptmx device
func openpt() (*os.File, error) {
return os.OpenFile("/dev/ptc", unix.O_RDWR|unix.O_NOCTTY|unix.O_CLOEXEC, 0)
}
50 changes: 50 additions & 0 deletions tc_aix_cgo.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
//go:build aix && cgo
// +build aix,cgo

/*
Copyright The containerd Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package console

import (
"golang.org/x/sys/unix"
)

//#include <stdlib.h>
import "C"

const (
cmdTcGet = unix.TCGETS
cmdTcSet = unix.TCSETS
)

// ptsname retrieves the name of the first available pts for the given master.
func ptsname(f File) (string, error) {
ptspath, err := C.ptsname(C.int(f.Fd()))
if err != nil {
return "", err
}
return C.GoString(ptspath), nil
}

// unlockpt unlocks the slave pseudoterminal device corresponding to the master pseudoterminal referred to by f.
// unlockpt should be called before opening the slave side of a pty.
func unlockpt(f File) error {
if _, err := C.grantpt(C.int(f.Fd())); err != nil {
return err
}
return nil
}
46 changes: 46 additions & 0 deletions tc_aix_nocgo.go
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
//go:build aix && !cgo
// +build aix,!cgo

/*
Copyright The containerd Authors.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

//
// Implementing the functions below requires cgo support. Non-cgo stubs
// versions are defined below to enable cross-compilation of source code
// that depends on these functions, but the resultant cross-compiled
// binaries cannot actually be used. If the stub function(s) below are
// actually invoked they will display an error message and cause the
// calling process to exit.
//

package console

import (
"golang.org/x/sys/unix"
)

const (
cmdTcGet = unix.TCGETS
cmdTcSet = unix.TCSETS
)

func ptsname(f File) (string, error) {
panic("ptsname() support requires cgo.")
}

func unlockpt(f File) error {
panic("unlockpt() support requires cgo.")
}
4 changes: 2 additions & 2 deletions tc_unix.go
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
//go:build darwin || freebsd || linux || netbsd || openbsd || zos
// +build darwin freebsd linux netbsd openbsd zos
//go:build aix || darwin || freebsd || linux || netbsd || openbsd || zos
// +build aix darwin freebsd linux netbsd openbsd zos

/*
Copyright The containerd Authors.
Expand Down
Loading