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

Fails to compile on FreeBSD 14: missing function getSendQueueLen #914

Open
hxw opened this issue Mar 28, 2024 · 0 comments
Open

Fails to compile on FreeBSD 14: missing function getSendQueueLen #914

hxw opened this issue Mar 28, 2024 · 0 comments
Labels

Comments

@hxw
Copy link

hxw commented Mar 28, 2024

Quick Fix

There is a sockio_unix.go which shows support for many OSs, but it references a getSendQueueLen function.
Currently this function is only defined for Linux (in sockio_linux.go). A quick fix for FreeBSD is to:

cp sockio_linux.go sockio_bsd.go

Next patch the sockio_bsd.go with the following diff:

--- sockio_linux.go	2024-03-28 14:42:39.901422000 +0800
+++ sockio_freebsd.go	2023-04-13 11:42:33.888702000 +0800
@@ -18,14 +18,13 @@
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.

-//go:build linux
-// +build linux
+//go:build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris
+// +build aix || darwin || dragonfly || freebsd || netbsd || openbsd || solaris

package tchannel

import "golang.org/x/sys/unix"

func getSendQueueLen(fd uintptr) (int, error) {
-	// https://linux.die.net/man/7/tcp
-	return unix.IoctlGetInt(int(fd), unix.SIOCOUTQ)
+	return unix.IoctlGetInt(int(fd), unix.TIOCOUTQ)
}

Better Alternative (perhaps)

Alternatively the function using unix.TIOCOUTQ could just be added to sockio_unix.go and the sockio_linux.go removed. From inspection of the files in go120/src/cmd/vendor/golang.org/x/sys/unix/ - All the OSs supported by sockio_unix.go have the TIOCOUTQ IOCTL and in the various Linux files this has exactly the same as the SIOCOUTQ value.

moonetic added a commit to moonetic/tchannel-go that referenced this issue Oct 31, 2024
This PR fixes compilation fail on FreeBSD 14, described on [issue by hxw](uber#914)
The problem is, that there's no getSendQueueLen function defined for bsd platform, which causes compile failure. The fix adds new, sockio_bsd file with corresponding function implementation and build tags.
moonetic added a commit to moonetic/tchannel-go that referenced this issue Nov 7, 2024
This PR fixes compilation fail on FreeBSD 14, described on [issue by hxw](uber#914)
The problem is, that there's no getSendQueueLen function defined for bsd platform, which causes compile failure. The fix adds new, sockio_bsd file with corresponding function implementation and build tags.
@ibarrajo ibarrajo added the bug label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants