Sunday, April 07, 2024

Re: [editor/micro] stopped working

On Sun, 7 Apr 2024 15:57:26 +0200
Rob Schmersel <rob.schmersel@bahnhof.se> wrote:

> I tracked it down to the use of syscall in the tcell package file
> tscreen_bsd.go (line 46)
>
>
> > fd = uintptr(t.out.(*os.File).Fd())
> > if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc,
> > tios, 0, 0, 0); e1 != 0 { e = e1
> > goto failed
> > }

Joel Sing patched our lang/go to allow SYS_IOCTL in Syscall, but not
in Syscall6. I tried changing Syscall6 to Syscall in tscreen_bsd.go.
The "function not implemented" error stopped appearing, but

- micro got stuck on a black screen; I needed to close the terminal.
- I can't add my patch to the port, because "make update-patches"
doesn't see it. The file is outside WRKSRC, in
WRKDIR/go/pkg/mod/github.com/zyedidia/tcell/v2@v2.0.10

--- tscreen_bsd.go.orig.port Sun Apr 7 11:53:03 2024
+++ tscreen_bsd.go Sun Apr 7 11:57:57 2024
@@ -43,7 +43,7 @@
tios = uintptr(unsafe.Pointer(t.tiosp))
ioc = uintptr(syscall.TIOCGETA)
fd = uintptr(t.out.(*os.File).Fd())
- if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 {
+ if _, _, e1 := syscall.Syscall(syscall.SYS_IOCTL, fd, ioc, tios); e1 != 0 {
e = e1
goto failed
}
@@ -61,7 +61,7 @@
tios = uintptr(unsafe.Pointer(&newtios))

ioc = uintptr(syscall.TIOCSETA)
- if _, _, e1 := syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0); e1 != 0 {
+ if _, _, e1 := syscall.Syscall(syscall.SYS_IOCTL, fd, ioc, tios); e1 != 0 {
e = e1
goto failed
}
@@ -94,7 +94,7 @@
fd := uintptr(t.out.(*os.File).Fd())
ioc := uintptr(syscall.TIOCSETAF)
tios := uintptr(unsafe.Pointer(t.tiosp))
- syscall.Syscall6(syscall.SYS_IOCTL, fd, ioc, tios, 0, 0, 0)
+ syscall.Syscall(syscall.SYS_IOCTL, fd, ioc, tios)
t.out.(*os.File).Close()
}
if t.in != nil {
@@ -108,8 +108,8 @@
dim := [4]uint16{}
dimp := uintptr(unsafe.Pointer(&dim))
ioc := uintptr(syscall.TIOCGWINSZ)
- if _, _, err := syscall.Syscall6(syscall.SYS_IOCTL,
- fd, ioc, dimp, 0, 0, 0); err != 0 {
+ if _, _, err := syscall.Syscall(syscall.SYS_IOCTL,
+ fd, ioc, dimp); err != 0 {
return -1, -1, err
}
return int(dim[1]), int(dim[0]), nil

No comments:

Post a Comment