FAQ
Hello,
I am digging into
syscall.EpollCreate()
syscall.EpollCtl()
function calls, but I see some strange types.

For example, EpollCtl() receives a pointer to syscall.EpollEvent struct,
defined as:
type EpollEvent struct {
Events uint32
Fd int32
Pad int32
}

That's nice, but one of the flags is defines as:
zerrors_linux_amd64.go:163: EPOLLET =
-0x80000000
Which go refuses to assing to EpollEvent.Events field.

Another issue..EpollEvent.Fd is int32, but os.File().Fd() returns uintptr
type. Why is this inconsistency? A cast could do the trick, but why?
I will continue digging, thanks for now.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Search Discussions

  • Ian Lance Taylor at Sep 9, 2013 at 4:05 pm

    On Sun, Sep 8, 2013 at 6:57 PM, wrote:
    I am digging into
    syscall.EpollCreate()
    syscall.EpollCtl()
    function calls, but I see some strange types.

    For example, EpollCtl() receives a pointer to syscall.EpollEvent struct,
    defined as:
    type EpollEvent struct {
    Events uint32
    Fd int32
    Pad int32
    }

    That's nice, but one of the flags is defines as:
    zerrors_linux_amd64.go:163: EPOLLET =
    -0x80000000
    Which go refuses to assing to EpollEvent.Events field.
    golang.org/issue/5328

    Another issue..EpollEvent.Fd is int32, but os.File().Fd() returns uintptr
    type. Why is this inconsistency? A cast could do the trick, but why?
    I will continue digging, thanks for now.
    The EpollEvent.Fd field is in the syscall package and must match the
    Linux kernel data structures. The kernel uses int32, not uintptr.
    os.File().Fd() is in the os package, and as such must be OS
    independent; it returns uintptr so that it can return a usable value
    on Windows.

    Ian

    --
    You received this message because you are subscribed to the Google Groups "golang-nuts" group.
    To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/groups/opt_out.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedSep 9, '13 at 1:57a
activeSep 9, '13 at 4:05p
posts2
users2
websitegolang.org

2 users in discussion

Ian Lance Taylor: 1 post Drago Ivanov: 1 post

People

Translate

site design / logo © 2021 Grokbase