Commit 8f746af6 authored by Mikio Hara's avatar Mikio Hara

runtime: drop EV_RECEIPT support from network pollster on kqueue

Currently Darwin and FreeBSD support and NetBSD and OpenBSD do not
support EV_RECEIPT flag. We will drop use of EV_RECEIPT for now.

Also enables to build runtime-integrated network pollster on
freebsd/amd64,386 and openbsd/amd64,386. It just does build but never
runs pollster stuff.

This is in preparation for runtime-integrated network pollster for BSD
variants.

Update #5199

R=dvyukov, minux.ma
CC=golang-dev
https://golang.org/cl/11759044
parent 9c6fecc2
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin linux windows // +build darwin freebsd,amd64 freebsd,386 linux openbsd windows
package net package net
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build darwin // +build darwin freebsd,amd64 freebsd,386 openbsd
#include "runtime.h" #include "runtime.h"
#include "defs_GOOS_GOARCH.h" #include "defs_GOOS_GOARCH.h"
...@@ -37,23 +37,15 @@ runtime·netpollopen(uintptr fd, PollDesc *pd) ...@@ -37,23 +37,15 @@ runtime·netpollopen(uintptr fd, PollDesc *pd)
// when fd is closed. // when fd is closed.
ev[0].ident = (uint32)fd; ev[0].ident = (uint32)fd;
ev[0].filter = EVFILT_READ; ev[0].filter = EVFILT_READ;
ev[0].flags = EV_ADD|EV_RECEIPT|EV_CLEAR; ev[0].flags = EV_ADD|EV_CLEAR;
ev[0].fflags = 0; ev[0].fflags = 0;
ev[0].data = 0; ev[0].data = 0;
ev[0].udata = (byte*)pd; ev[0].udata = (byte*)pd;
ev[1] = ev[0]; ev[1] = ev[0];
ev[1].filter = EVFILT_WRITE; ev[1].filter = EVFILT_WRITE;
n = runtime·kevent(kq, ev, 2, ev, 2, nil); n = runtime·kevent(kq, ev, 2, nil, 0, nil);
if(n < 0) if(n < 0)
return -n; return -n;
if(n != 2 ||
(ev[0].flags&EV_ERROR) == 0 || ev[0].ident != (uint32)fd || ev[0].filter != EVFILT_READ ||
(ev[1].flags&EV_ERROR) == 0 || ev[1].ident != (uint32)fd || ev[1].filter != EVFILT_WRITE)
return EFAULT; // just to mark out from other errors
if(ev[0].data != 0)
return ev[0].data;
if(ev[1].data != 0)
return ev[1].data;
return 0; return 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style // Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file. // license that can be found in the LICENSE file.
// +build freebsd netbsd openbsd plan9 // +build freebsd,arm netbsd plan9
#include "runtime.h" #include "runtime.h"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment