Closed maddie closed 3 years ago
The golang.org/x/sys/unix
package provides the following ioctl syscall methods for various platforms since a long time ago (earliest commits found circa 2017):
func IoctlSetInt(fd int, req uint, value int) error
func IoctlSetPointerInt(fd int, req uint, value int) error
func IoctlSetWinsize(fd int, req uint, value *Winsize) error
func IoctlSetTermios(fd int, req uint, value *Termios) error
func IoctlGetInt(fd int, req uint) (int, error)
func IoctlGetWinsize(fd int, req uint) (*Winsize, error)
func IoctlGetTermios(fd int, req uint) (*Termios, error)
Are they sufficient to replace the ioctl
wrapper functions for different platforms in this package?
I compiled yesterday night in a Mac for a Mac without problems.
@rnicolas the project I'm working on depends on a newer version of golang/x/sys/unix
, which already has the direct syscalls removed, so it fails. It does compile fine if the project doesn't depend on it.
And the problem here is that direct syscalls are not recommended in Darwin and the supports are being dropped in the later commits in golang/x/sys/unix
, so I think it's a good move to migrate to a supported way of doing this.
@maddie I understand now the problem because at the beginning I understood it didn't compile at all.
Since
golang.org/x/sys/unix
was being updated regularly, the following error occurs when compiling under macOS:This is due to golang/sys@6fcdbc0 removing all the
SYS_*
constants, the reason being that direct syscalls under Darwin are no longer supported.Is there a fix for this?
EDIT: The temporary workaround for this problem is adding this line to the project's
go.mod
to use an older version ofgolang.org/x/sys/unix
:But this is not a long-term solution.