-
-
Notifications
You must be signed in to change notification settings - Fork 239
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify solaris implementation. (#120)
Remove golang.org/x/sys/unix dependency for solaris Add new go build tag directives
- Loading branch information
Showing
41 changed files
with
318 additions
and
252 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Copyright 2014 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. | ||
|
||
//go:build gc | ||
//+build gc | ||
|
||
#include "textflag.h" | ||
|
||
// | ||
// System calls for amd64, Solaris are implemented in runtime/syscall_solaris.go | ||
// | ||
|
||
TEXT ·sysvicall6(SB),NOSPLIT,$0-88 | ||
JMP syscall·sysvicall6(SB) | ||
|
||
TEXT ·rawSysvicall6(SB),NOSPLIT,$0-88 | ||
JMP syscall·rawSysvicall6(SB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
module github.com/creack/pty | ||
|
||
go 1.13 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,48 @@ | ||
//go:build solaris | ||
//+build solaris | ||
|
||
package pty | ||
|
||
import ( | ||
"syscall" | ||
"unsafe" | ||
|
||
"golang.org/x/sys/unix" | ||
) | ||
|
||
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so" | ||
//go:linkname procioctl libc_ioctl | ||
var procioctl uintptr | ||
|
||
const ( | ||
// see /usr/include/sys/stropts.h | ||
I_PUSH = uintptr((int32('S')<<8 | 002)) | ||
I_STR = uintptr((int32('S')<<8 | 010)) | ||
I_FIND = uintptr((int32('S')<<8 | 013)) | ||
|
||
// see /usr/include/sys/ptms.h | ||
ISPTM = (int32('P') << 8) | 1 | ||
UNLKPT = (int32('P') << 8) | 2 | ||
PTSSTTY = (int32('P') << 8) | 3 | ||
ZONEPT = (int32('P') << 8) | 4 | ||
OWNERPT = (int32('P') << 8) | 5 | ||
|
||
// see /usr/include/sys/termios.h | ||
TIOCSWINSZ = (uint32('T') << 8) | 103 | ||
TIOCGWINSZ = (uint32('T') << 8) | 104 | ||
) | ||
|
||
type strioctl struct { | ||
ic_cmd int32 | ||
ic_timout int32 | ||
ic_len int32 | ||
ic_dp unsafe.Pointer | ||
icCmd int32 | ||
icTimeout int32 | ||
icLen int32 | ||
icDP unsafe.Pointer | ||
} | ||
|
||
// Defined in asm_solaris_amd64.s. | ||
func sysvicall6(trap, nargs, a1, a2, a3, a4, a5, a6 uintptr) (r1, r2 uintptr, err syscall.Errno) | ||
|
||
func ioctl(fd, cmd, ptr uintptr) error { | ||
return unix.IoctlSetInt(int(fd), uint(cmd), int(ptr)) | ||
if _, _, errno := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, fd, cmd, ptr, 0, 0, 0); errno != 0 { | ||
return errno | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build darwin | ||
//+build darwin | ||
|
||
package pty | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build dragonfly | ||
//+build dragonfly | ||
|
||
package pty | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build freebsd | ||
//+build freebsd | ||
|
||
package pty | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build netbsd | ||
//+build netbsd | ||
|
||
package pty | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
//go:build openbsd | ||
//+build openbsd | ||
|
||
package pty | ||
|
||
import ( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.