From 7a05a617f6a68875b4ab56db0012086151684685 Mon Sep 17 00:00:00 2001 From: Norman Maurer Date: Wed, 2 Jul 2014 09:36:58 +0200 Subject: [PATCH] [#2558] Define SO_REUSEPORT if not defined Motivation: Currently it is impossible to build netty on linux system that not define SO_REUSEPORT even if it is supported. Modification: Define SO_REUSEPORT if not defined. Result: Possible to build on more linux dists. --- .../src/main/c/io_netty_channel_epoll_Native.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.h b/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.h index 296d24a4f1..558b1c5551 100644 --- a/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.h +++ b/transport-native-epoll/src/main/c/io_netty_channel_epoll_Native.h @@ -21,6 +21,12 @@ #define EPOLL_ACCEPT 0x04 #define EPOLL_RDHUP 0x08 +// Define SO_REUSEPORT if not found to fix build issues. +// See https://github.com/netty/netty/issues/2558 +#ifndef SO_REUSEPORT +#define SO_REUSEPORT 15 +#endif /* SO_REUSEPORT */ + jint Java_io_netty_channel_epoll_Native_eventFd(JNIEnv * env, jclass clazz); void Java_io_netty_channel_epoll_Native_eventFdWrite(JNIEnv * env, jclass clazz, jint fd, jlong value); void Java_io_netty_channel_epoll_Native_eventFdRead(JNIEnv * env, jclass clazz, jint fd);