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

proposal: x/sys/unix: add RawAccept4 #62655

Open
kolyshkin opened this issue Sep 14, 2023 · 0 comments
Open

proposal: x/sys/unix: add RawAccept4 #62655

kolyshkin opened this issue Sep 14, 2023 · 0 comments
Labels
Milestone

Comments

@kolyshkin
Copy link
Contributor

kolyshkin commented Sep 14, 2023

This is a proposal to add RawAccept4 function to x/sys/unix for Linux. The implementation may look like this:

func RawAccept4(fd int, rsa *RawSockaddrAny, addrlen *uint32, flags int) (int, error) {
	return accept4(fd, rsa, (*_Socklen)(addrlen), flags)
}

Background

I did a small change to (*SockaddrALG).sockaddr (CL 527836) and wasn't quite sure it doesn't break anything. So I wrote a test case for AF_ALG functionality (CL 527837) to make sure it's still working, but found out that it's not possible to use unix.Accept with AF_ALG socket, as it sets the second and the third accept4 syscall arguments to non-nil values, and with AF_ALG those needs to be set to nil.

Alternatives

  1. Use unix.SYSCALL(unix.ACCEPT4, ....
  2. Add AcceptWithoutAddr (https://go-review.googlesource.com/c/sys/+/527837/comment/4d5963aa_e794dbd3/). The implementation can look like this:
func AcceptWithoutAddr(fd int) (int, error) {
	return accept4(fd, 0, 0, 0)
}
@gopherbot gopherbot added this to the Proposal milestone Sep 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Incoming
Development

No branches or pull requests

2 participants