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

syscall: Expose cmsgData #17527

Closed
vincentbernat opened this issue Oct 20, 2016 · 3 comments
Closed

syscall: Expose cmsgData #17527

vincentbernat opened this issue Oct 20, 2016 · 3 comments

Comments

@vincentbernat
Copy link

@vincentbernat vincentbernat commented Oct 20, 2016

Hey!

When working with ancillary data, it is difficult to not use cmsgData from the syscall package. The package implements FD passing but everything else will need access to the data. A previous proposition was made to make the function public but was rejected due to returning unsafe.Pointer.

I would propose to use the following signature for the public function:

func CmsgData(h *Cmsghdr, len int) []byte

It could still panic if len is incorrect. Is that admissible?

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 20, 2016

Why can't you use syscall.ParseSocketControlMessage?

@vincentbernat
Copy link
Author

@vincentbernat vincentbernat commented Oct 20, 2016

Oooh, terribly sorry. You are right. I just need the "reverse" function (SocketControlMessage?) taking []SocketControlMessage and returning []byte.

@ianlancetaylor
Copy link
Contributor

@ianlancetaylor ianlancetaylor commented Oct 20, 2016

Closing since I don't think there is anything to do in the syscall package, which is more or less frozen anyhow.

@mikioh mikioh changed the title Expose cmsgData syscall: Expose cmsgData Oct 21, 2016
@golang golang locked and limited conversation to collaborators Oct 21, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.