Skip to content

Commit

Permalink
host/fs: arm64 EpollCreate (google#369)
Browse files Browse the repository at this point in the history
Use EpollCreate(1) if supported.
If not fall back to EpollCreate1(0).
  • Loading branch information
NeuralSpaz authored and maruel committed Jan 4, 2019
1 parent b880e41 commit 3909312
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions host/fs/fs_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,15 @@ type event struct {
// syscall.EpollCtl: http://man7.org/linux/man-pages/man2/epoll_ctl.2.html
func (e *event) makeEvent(fd uintptr) error {
epollFd, err := syscall.EpollCreate(1)
if err != nil {
switch {
case err == nil:
break
case err.Error() == "function not implemented":
// Some arch (arm64) do not implement EpollCreate().
if epollFd, err = syscall.EpollCreate1(0); err != nil {
return err
}
default:
return err
}
e.epollFd = epollFd
Expand Down Expand Up @@ -150,7 +158,15 @@ func (e *eventsListener) init() error {
e.closing = false
var err error
e.epollFd, err = syscall.EpollCreate(1)
if err != nil {
switch {
case err == nil:
break
case err.Error() == "function not implemented":
// Some arch (arm64) do not implement EpollCreate().
if e.epollFd, err = syscall.EpollCreate1(0); err != nil {
return err
}
default:
return err
}
e.r, e.w, err = os.Pipe()
Expand Down

0 comments on commit 3909312

Please sign in to comment.