On Thu, May 17, 2018 at 9:56 AM, Juliusz Chroboczek wrote:
>> If you do this in Go, you should use golang.org/x/sys/unix package
>> rather than the syscall package.
>
> What's the advantage? (In this particular case, not in general.)
The advantage in this particular case is likely minimal. The
> If you do this in Go, you should use golang.org/x/sys/unix package
> rather than the syscall package.
What's the advantage? (In this particular case, not in general.)
> But since you have to call C anyhow, I would suggest just doing it in C.
Yeah, I guess it's simpler.
> There isn't any way
On Wed, May 16, 2018 at 8:07 PM, Juliusz Chroboczek wrote:
>
> I'm interfacing with a C library that expects to do its own I/O, but
> wants to be called after a file descriptor is ready for read. My code
> currently looks roughly like this:
>
> var fdset syscall.FdSet
> var bits = unsafe.
I'm interfacing with a C library that expects to do its own I/O, but
wants to be called after a file descriptor is ready for read. My code
currently looks roughly like this:
var fdset syscall.FdSet
var bits = unsafe.Sizeof(fdset.Bits[0]) * 8
fdset.Bits[uintptr(fd)/bits] |= (1 << (fd %