aboutsummaryrefslogtreecommitdiff
path: root/libgo/Makefile.am
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/Makefile.am')
-rw-r--r--libgo/Makefile.am30
1 files changed, 29 insertions, 1 deletions
diff --git a/libgo/Makefile.am b/libgo/Makefile.am
index e3b33a8..2a68019 100644
--- a/libgo/Makefile.am
+++ b/libgo/Makefile.am
@@ -1498,7 +1498,7 @@ endif # !LIBGO_IS_LINUX
# Define socket sizes and types.
if LIBGO_IS_LINUX
-syscall_socket_file = go/syscall/socket_linux.go
+syscall_socket_file = go/syscall/socket_linux.go epoll.go
else
if LIBGO_IS_SOLARIS
syscall_socket_file = go/syscall/socket_solaris.go
@@ -1582,6 +1582,34 @@ s-sysinfo: $(srcdir)/mksysinfo.sh config.h
$(SHELL) $(srcdir)/../move-if-change tmp-sysinfo.go sysinfo.go
$(STAMP) $@
+# The epoll struct has an embedded union and is packed on x86_64,
+# which is too complicated for mksysinfo.sh. We find the offset of
+# the only field we care about in configure.ac, and generate the
+# struct here.
+epoll.go: s-epoll; @true
+s-epoll: Makefile
+ rm -f epoll.go.tmp
+ echo 'package syscall' > epoll.go.tmp
+ echo 'type EpollEvent struct {' >> epoll.go.tmp
+ echo ' Events uint32' >> epoll.go.tmp
+ case "$(SIZEOF_STRUCT_EPOLL_EVENT),$(STRUCT_EPOLL_EVENT_FD_OFFSET)" in \
+ 0,0) echo 1>&2 "*** struct epoll_event data.fd offset unknown"; \
+ exit 1; ;; \
+ 8,4) echo ' Fd int32' >> epoll.go.tmp; ;; \
+ 12,4) echo ' Fd int32' >> epoll.go.tmp; \
+ echo ' Pad [4]byte' >> epoll.go.tmp; ;; \
+ 12,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
+ echo ' Fd int32' >> epoll.go.tmp; ;; \
+ 16,8) echo ' Pad [4]byte' >> epoll.go.tmp; \
+ echo ' Fd int32' >> epoll.go.tmp; \
+ echo ' Pad2 [4]byte' >> epoll.go.tmp; ;; \
+ *) echo 1>&2 "*** struct epoll_event unsupported"; \
+ exit 1; ;; \
+ esac
+ echo '}' >> epoll.go.tmp
+ $(SHELL) $(srcdir)/../move-if-change epoll.go.tmp epoll.go
+ $(STAMP) $@
+
if LIBGO_IS_LINUX
# os_lib_inotify_lo = os/inotify.lo
os_lib_inotify_lo =