panjf2000 / gnet

🚀 gnet is a high-performance, lightweight, non-blocking, event-driven networking framework written in pure Go.
https://gnet.host
Apache License 2.0
9.71k stars 1.04k forks source link

[Bug]: Compilation error on bsd 32 bit (kqueue) #432

Closed pnx closed 1 year ago

pnx commented 1 year ago

Actions I've taken before I'm here

What happened?

Compilation fails when building kqueue on 32 bit. Only tested while cross-compiling for freebsd-arm.

Look like unix.Kevent_t.Ident is uint32 on 32 bit and therefore the cast fails.

Major version of gnet

v2

Specific version of gnet

2.2.2

Operating system

BSD

Relevant log output

go version: go1.17 linux/amd64

# github.com/panjf2000/gnet/v2/internal/netpoll
internal/netpoll/kqueue_default_poller.go:197:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value
internal/netpoll/kqueue_default_poller.go:198:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value
internal/netpoll/kqueue_default_poller.go:206:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value
internal/netpoll/kqueue_default_poller.go:214:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value
internal/netpoll/kqueue_default_poller.go:222:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value
internal/netpoll/kqueue_default_poller.go:230:4: cannot use uint64(pa.FD) (type uint64) as type uint32 in field value

Code snippets (optional)

No response

How to Reproduce

Steps to reproduce the behavior:

  1. run GOOS=freebsd GOARCH=arm go1.17 test -c

Does this issue reproduce with the latest release?

It can reproduce with the latest release

panjf2000 commented 1 year ago

Thanks for the bug report.