FreeBSD fixes - proper affinity setting, don't use SO_REUSEPORT

This commit is contained in:
Witold Krecicki
2018-11-13 19:03:10 +00:00
committed by Witold Kręcicki
parent d00d2dddb3
commit ef5cc6f9d6
2 changed files with 7 additions and 4 deletions
+1 -1
View File
@@ -110,7 +110,7 @@ isc_thread_setaffinity(int cpu) {
CPU_ZERO(&cpuset);
CPU_SET(cpu, &cpuset);
if (cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1,
&cpuset, sizeof(cpuset)) != 0) {
sizeof(cpuset), &cpuset) != 0) {
return (ISC_R_FAILURE);
}
#elif defined(HAVE_PTHREAD_SETAFFINITY_NP)
+6 -3
View File
@@ -3275,8 +3275,6 @@ process_fds(isc__socketthread_t *thread, struct kevent *events,
bool readable, writable;
bool done = false;
bool have_ctlevent = false;
INSIST(thread->threadid == 0);
if (nevents == thread->nevents) {
/*
* This is not an error, but something unexpected. If this
@@ -5450,7 +5448,12 @@ static bool hasreuseport = false;
static void
init_hasreuseport() {
#ifdef SO_REUSEPORT
/*
* SO_REUSEPORT works very differently on *BSD and on Linux (because why not).
* We only want to use it on Linux, if it's available. On BSD we want to dup()
* sockets instead of re-binding them.
*/
#if defined(SO_REUSEPORT) && defined(__linux__)
int sock, yes = 1;
sock = socket(AF_INET, SOCK_DGRAM, 0);
if (sock < 0) {