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

kqueue support for 32 bit architecture #17

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@ os:
- osx

go:
- 1.8

install:
- go get golang.org/x/sys/unix
- stable
5 changes: 5 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module github.com/mailru/easygo

go 1.13

require golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7 h1:wYqz/tQaWUgGKyx+B/rssSE6wkIKdY5Ee6ryOmzarIg=
golang.org/x/sys v0.0.0-20190913121621-c3b328c6e5a7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
12 changes: 2 additions & 10 deletions netpoll/kqueue.go
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ type Kevent struct {
Filter KeventFilter
Flags KeventFlag
Fflags uint32
Data int64
Data int
}

// Kevents is a fixed number of pairs of event filter and flags which can be
Expand Down Expand Up @@ -378,7 +378,7 @@ func (k *Kqueue) wait(onError func(error)) {
cb(Kevent{
Filter: KeventFilter(e.Filter),
Flags: KeventFlag(e.Flags),
Data: e.Data,
Data: int(e.Data),
Fflags: e.Fflags,
})
cbs[i] = nil
Expand All @@ -391,11 +391,3 @@ func (k *Kqueue) wait(onError func(error)) {
}
}
}

func evGet(fd int, filter KeventFilter, flags KeventFlag) unix.Kevent_t {
return unix.Kevent_t{
Ident: uint64(fd),
Filter: int16(filter),
Flags: uint16(flags),
}
}
14 changes: 14 additions & 0 deletions netpoll/kqueue_32.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build darwin dragonfly freebsd netbsd openbsd
// +build arm 386

package netpoll

import "golang.org/x/sys/unix"

func evGet(fd int, filter KeventFilter, flags KeventFlag) unix.Kevent_t {
return unix.Kevent_t{
Ident: uint32(fd),
Filter: int16(filter),
Flags: uint16(flags),
}
}
14 changes: 14 additions & 0 deletions netpoll/kqueue_64.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// +build darwin dragonfly freebsd netbsd openbsd
// +build arm64 amd64

package netpoll

import "golang.org/x/sys/unix"

func evGet(fd int, filter KeventFilter, flags KeventFlag) unix.Kevent_t {
return unix.Kevent_t{
Ident: uint64(fd),
Filter: int16(filter),
Flags: uint16(flags),
}
}