mirror of
https://github.com/rwinkhart/sys.git
synced 2026-08-28 04:46:44 -04:00
x/sys/unix: add type specific ioctl functions for termios on solaris
The existing code has no way to manipulate termios or winsize structures on solaris. This change adds IoctlGetXXX and IoctlSetXXX functions for int, termios, termio, and winsize. The embedded awk script in mkerrors.sh has additional patterns to generate the needed ioctl constants for these calls. Fixes golang/go#12574 Change-Id: Ic62a8c698d42c8ca379c90f71e9f27635e7d03b5 Reviewed-on: https://go-review.googlesource.com/14587 Reviewed-by: Ian Lance Taylor <iant@golang.org> Reviewed-by: Aram Hăvărneanu <aram@mgk.ro>
This commit is contained in:
committed by
Aram Hăvărneanu
parent
68a71b6be5
commit
584c5fee74
@@ -22,6 +22,7 @@ import (
|
||||
//go:cgo_import_dynamic libc_recvmsg recvmsg "libsocket.so"
|
||||
//go:cgo_import_dynamic libc_sendmsg sendmsg "libsocket.so"
|
||||
//go:cgo_import_dynamic libc_acct acct "libc.so"
|
||||
//go:cgo_import_dynamic libc_ioctl ioctl "libc.so"
|
||||
//go:cgo_import_dynamic libc_access access "libc.so"
|
||||
//go:cgo_import_dynamic libc_adjtime adjtime "libc.so"
|
||||
//go:cgo_import_dynamic libc_chdir chdir "libc.so"
|
||||
@@ -136,6 +137,7 @@ import (
|
||||
//go:linkname procrecvmsg libc_recvmsg
|
||||
//go:linkname procsendmsg libc_sendmsg
|
||||
//go:linkname procacct libc_acct
|
||||
//go:linkname procioctl libc_ioctl
|
||||
//go:linkname procAccess libc_access
|
||||
//go:linkname procAdjtime libc_adjtime
|
||||
//go:linkname procChdir libc_chdir
|
||||
@@ -251,6 +253,7 @@ var (
|
||||
procrecvmsg,
|
||||
procsendmsg,
|
||||
procacct,
|
||||
procioctl,
|
||||
procAccess,
|
||||
procAdjtime,
|
||||
procChdir,
|
||||
@@ -472,6 +475,14 @@ func acct(path *byte) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func ioctl(fd int, req int, arg uintptr) (err error) {
|
||||
_, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&procioctl)), 3, uintptr(fd), uintptr(req), uintptr(arg), 0, 0, 0)
|
||||
if e1 != 0 {
|
||||
err = e1
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func Access(path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
||||
Reference in New Issue
Block a user