Re: scatter/gather I/O?

367 views
Skip to first unread message

Albert Strasheim

unread,
Apr 20, 2013, 1:12:04 PM4/20/13
to golan...@googlegroups.com, dop...@gmail.com
Hello

On Saturday, April 20, 2013 4:30:53 PM UTC+2, dop...@gmail.com wrote:
Hi guys,
Is there any reason why scatter/gather I/O functionality is not available in go? Even syscall.Sendmsg() accepts a single []byte, from which it creates a single Iovec and sends it using the wrapped syscall.

The Go syscall package doesn't aim to cover every system call available on every operating system that Go runs on.

It's relatively easy to build an your own "syscall" package to include the extra ones you need. Start here:


Cheers

Albert

brainman

unread,
Apr 20, 2013, 6:57:55 PM4/20/13
to golan...@googlegroups.com

Albert Strasheim

unread,
Apr 21, 2013, 4:07:23 AM4/21/13
to golan...@googlegroups.com, dop...@gmail.com
Hello

On Saturday, April 20, 2013 9:40:15 PM UTC+2, dop...@gmail.com wrote:
Also, by looking at the source code for the "net" package I realised that just implementing a syscall is not enough. The ultimate goal is to have an equivalent of netFD's WriteMsg() which would accept [][]byte or ...[]byte. However doing so requires either modifying the "net" package or having my own implementation because some of the functionality (like pollServer) is not exported.

Ah, yes. It's a bit unfortunate that the design of the net package makes this kind of extension difficult. But that's probably the price one pays for not exposing all the internals in the standard library API.

The way forward is probably to design an API (you might also want to think about how sendmmsg would be incorporated), discuss the API on golang-dev and prepare a patch for inclusion after Go 1.1 is released.

Cheers

Albert
Reply all
Reply to author
Forward
0 new messages