Commit 29849c91 by Ian Lance Taylor

runtime, syscall: force EPOLLET to be positive

    
    The C definition is 1U << 31.  Reportedly on some systems GCC's
    -fgo-dump-spec can print this as -2147483648.
    
    Reviewed-on: https://go-review.googlesource.com/31448

From-SVN: r241347
parent b70f0b0c
68bb6a9875499037d3eccb79a1f92e1c7a476d58 5346c7d15362a16efa0defaaeca63b1fce1c1523
The first line of this file holds the git revision number of the last The first line of this file holds the git revision number of the last
merge done from the gofrontend repository. merge done from the gofrontend repository.
...@@ -49,7 +49,7 @@ func netpollinit() { ...@@ -49,7 +49,7 @@ func netpollinit() {
func netpollopen(fd uintptr, pd *pollDesc) int32 { func netpollopen(fd uintptr, pd *pollDesc) int32 {
var ev epollevent var ev epollevent
ev.events = _EPOLLIN | _EPOLLOUT | _EPOLLRDHUP | _EPOLLET ev.events = _EPOLLIN | _EPOLLOUT | _EPOLLRDHUP | _EPOLLETpos
*(**pollDesc)(unsafe.Pointer(&ev.data)) = pd *(**pollDesc)(unsafe.Pointer(&ev.data)) = pd
if epollctl(epfd, _EPOLL_CTL_ADD, int32(fd), &ev) < 0 { if epollctl(epfd, _EPOLL_CTL_ADD, int32(fd), &ev) < 0 {
return int32(errno()) return int32(errno())
......
...@@ -77,6 +77,12 @@ if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then ...@@ -77,6 +77,12 @@ if grep '^const _epoll_data_offset ' ${OUT} >/dev/null 2>&1; then
exit 1 exit 1
fi fi
fi fi
# Make sure EPOLLET is positive.
if grep '^const _EPOLLET = [0-9]' gen-sysinfo.go; then
echo "const _EPOLLETpos = _EPOLLET" >> ${OUT}
else
echo "const _EPOLLETpos = 0x80000000" >> ${OUT}
fi
# Make sure EPOLLRDHUP and EPOLL_CLOEXEC are defined. # Make sure EPOLLRDHUP and EPOLL_CLOEXEC are defined.
if ! grep '^const _EPOLLRDHUP' ${OUT} >/dev/null 2>&1; then if ! grep '^const _EPOLLRDHUP' ${OUT} >/dev/null 2>&1; then
echo "const _EPOLLRDHUP = 0x2000" >> ${OUT} echo "const _EPOLLRDHUP = 0x2000" >> ${OUT}
......
...@@ -185,7 +185,15 @@ fi ...@@ -185,7 +185,15 @@ fi
# epoll constants. # epoll constants.
grep '^const _EPOLL' gen-sysinfo.go | grep '^const _EPOLL' gen-sysinfo.go |
grep -v EPOLLET |
sed -e 's/^\(const \)_\(EPOLL[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT} sed -e 's/^\(const \)_\(EPOLL[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
# Make sure EPOLLET is positive.
if grep '^const _EPOLLET = [0-9]' gen-sysinfo.go; then
grep '^const _EPOLLET ' gen-sysinfo.go |
sed -e 's/^\(const \)_\(EPOLL[^= ]*\)\(.*\)$/\1\2 = _\2/' >> ${OUT}
else
echo "const EPOLLET = 0x80000000" >> ${OUT}
fi
# Make sure EPOLLRDHUP and EPOLL_CLOEXEC are defined. # Make sure EPOLLRDHUP and EPOLL_CLOEXEC are defined.
if ! grep '^const EPOLLRDHUP' ${OUT} >/dev/null 2>&1; then if ! grep '^const EPOLLRDHUP' ${OUT} >/dev/null 2>&1; then
echo "const EPOLLRDHUP = 0x2000" >> ${OUT} echo "const EPOLLRDHUP = 0x2000" >> ${OUT}
......
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