Closed burgerrg closed 8 months ago
Is ioctl
is a varargs function, so you'd need to use __varargs_after
?
Yes, that fixed it! Thank you!
Unrelated, but that case expression for loading the C runtime library is getting out of hand. :)
(define ioctl (foreign-procedure (__varargs_after 2) "ioctl" (int int (* win-size)) int))
Summary: The foreign-procedure call to ioctl in arm64osx returns -1 and errno = 14 (Bad address). Under a6osx, it returns 0 as expected. I suspect there is a bug in the way the foreign arguments are passed to ioctl, because the equivalent C code returns 0 as expected on both platforms.
Details:
The C code above shows the number of rows and columns in the tty associated with file descriptor 0. It runs as expected in ARM64 macOS and well as Intel macOS.
The FFI version of this code (see https://stackoverflow.com/questions/77389839/chez-scheme-ffi-procedure-doesnt-work-after-change-to-apple-silicon for the original report) returns -1 from ioctl.