Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x/sys: the IoctlSetPointerInt function should be available on macOS and BSD platforms #40986

Closed
krader1961 opened this issue Aug 23, 2020 · 3 comments

Comments

@krader1961
Copy link

krader1961 commented Aug 23, 2020

Function unix.IoctlSetPointerInt should be available on all supported UNIX like systems.

I've been contributing to the Elvish shell project and recently attempted to replace it's custom Ioctl() function (because it had no unit tests) with functionality provided by golang.org/x/sys. However, one of the ioctl's Elvish uses is unix.TIOCSPGRP which requires using unix.IoctlSetPointerInt(). That transformation works fine on Linux but fails to build on macOS and FreeBSD with "undefined: unix.IoctlSetPointerInt". This is because unix.IoctlSetPointerInt is only implemented in syscall_linux.go. -- something that is not obvious from looking at the public documentation. I can't see any reason why this particular function can't be implemented generically for every UNIX like OS.

@gopherbot
Copy link

Change https://golang.org/cl/250001 mentions this issue: unix: make IoctlSetPointerInt available on all platforms

@tklauser
Copy link
Member

Thanks, I think this makes sense to expose on all platforms and sent https://golang.org/cl/250001 with a fix.

Regarding the pkg.go.dev documentation: by default this is rendered for GOOS=linux, GOARCH=amd64 as indicated at the very bottom of the page, see https://pkg.go.dev/golang.org/x/sys@v0.0.0-20200821140526-fda516888d29/unix?tab=doc#XDPUmemReg:

Documentation was rendered with GOOS=linux and GOARCH=amd64.

FWIW, there is #37232 which requests support for different GOOS/GOARCH pairs on pkg.go.dev

@krader1961
Copy link
Author

FWIW, I've confirmed the updated golang.org/x/sys package works for me on macOS, FreeBSD and Linux. Much thanks for the quick resolution.

@golang golang locked and limited conversation to collaborators Aug 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants