Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
67a4fb91
Unverified
Commit
67a4fb91
authored
May 14, 2020
by
Salvatore Sanfilippo
Committed by
GitHub
May 14, 2020
Browse files
Merge pull request #7244 from devnexen/netbsd_build_fix
NetBSD build update.
parents
0dea1142
4715ce59
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/Makefile
View file @
67a4fb91
...
@@ -128,6 +128,14 @@ else
...
@@ -128,6 +128,14 @@ else
ifeq
($(uname_S),DragonFly)
ifeq
($(uname_S),DragonFly)
# FreeBSD
# FreeBSD
FINAL_LIBS
+=
-lpthread
-lexecinfo
FINAL_LIBS
+=
-lpthread
-lexecinfo
else
ifeq
($(uname_S),OpenBSD)
# OpenBSD
FINAL_LIBS
+=
-lpthread
-lexecinfo
else
ifeq
($(uname_S),NetBSD)
# NetBSD
FINAL_LIBS
+=
-lpthread
-lexecinfo
else
else
# All the other OSes (notably Linux)
# All the other OSes (notably Linux)
FINAL_LDFLAGS
+=
-rdynamic
FINAL_LDFLAGS
+=
-rdynamic
...
@@ -138,6 +146,8 @@ endif
...
@@ -138,6 +146,8 @@ endif
endif
endif
endif
endif
endif
endif
endif
endif
# Include paths to dependencies
# Include paths to dependencies
FINAL_CFLAGS
+=
-I
../deps/hiredis
-I
../deps/linenoise
-I
../deps/lua/src
FINAL_CFLAGS
+=
-I
../deps/hiredis
-I
../deps/linenoise
-I
../deps/lua/src
...
...
src/config.h
View file @
67a4fb91
...
@@ -248,7 +248,7 @@ int pthread_setname_np(const char *name);
...
@@ -248,7 +248,7 @@ int pthread_setname_np(const char *name);
#endif
#endif
/* Check if we can use setcpuaffinity(). */
/* Check if we can use setcpuaffinity(). */
#if (defined __linux || defined __NetBSD__ || defined __FreeBSD__
|| defined __OpenBSD__
)
#if (defined __linux || defined __NetBSD__ || defined __FreeBSD__)
#define USE_SETCPUAFFINITY
#define USE_SETCPUAFFINITY
void
setcpuaffinity
(
const
char
*
cpulist
);
void
setcpuaffinity
(
const
char
*
cpulist
);
#endif
#endif
...
...
src/setcpuaffinity.c
View file @
67a4fb91
...
@@ -36,6 +36,10 @@
...
@@ -36,6 +36,10 @@
#include <sys/param.h>
#include <sys/param.h>
#include <sys/cpuset.h>
#include <sys/cpuset.h>
#endif
#endif
#ifdef __NetBSD__
#include <pthread.h>
#include <sched.h>
#endif
#include "config.h"
#include "config.h"
#ifdef USE_SETCPUAFFINITY
#ifdef USE_SETCPUAFFINITY
...
@@ -71,11 +75,18 @@ void setcpuaffinity(const char *cpulist) {
...
@@ -71,11 +75,18 @@ void setcpuaffinity(const char *cpulist) {
#ifdef __FreeBSD__
#ifdef __FreeBSD__
cpuset_t
cpuset
;
cpuset_t
cpuset
;
#endif
#endif
#ifdef __NetBSD__
cpuset_t
*
cpuset
;
#endif
if
(
!
cpulist
)
if
(
!
cpulist
)
return
;
return
;
#ifndef __NetBSD__
CPU_ZERO
(
&
cpuset
);
CPU_ZERO
(
&
cpuset
);
#else
cpuset
=
cpuset_create
();
#endif
q
=
cpulist
;
q
=
cpulist
;
while
(
p
=
q
,
q
=
next_token
(
q
,
','
),
p
)
{
while
(
p
=
q
,
q
=
next_token
(
q
,
','
),
p
)
{
...
@@ -110,7 +121,11 @@ void setcpuaffinity(const char *cpulist) {
...
@@ -110,7 +121,11 @@ void setcpuaffinity(const char *cpulist) {
return
;
return
;
while
(
a
<=
b
)
{
while
(
a
<=
b
)
{
#ifndef __NetBSD__
CPU_SET
(
a
,
&
cpuset
);
CPU_SET
(
a
,
&
cpuset
);
#else
cpuset_set
(
a
,
cpuset
);
#endif
a
+=
s
;
a
+=
s
;
}
}
}
}
...
@@ -124,6 +139,10 @@ void setcpuaffinity(const char *cpulist) {
...
@@ -124,6 +139,10 @@ void setcpuaffinity(const char *cpulist) {
#ifdef __FreeBSD__
#ifdef __FreeBSD__
cpuset_setaffinity
(
CPU_LEVEL_WHICH
,
CPU_WHICH_TID
,
-
1
,
sizeof
(
cpuset
),
&
cpuset
);
cpuset_setaffinity
(
CPU_LEVEL_WHICH
,
CPU_WHICH_TID
,
-
1
,
sizeof
(
cpuset
),
&
cpuset
);
#endif
#endif
#ifdef __NetBSD__
pthread_setaffinity_np
(
pthread_self
(),
cpuset_size
(
cpuset
),
cpuset
);
cpuset_destroy
(
cpuset
);
#endif
}
}
#endif
/* USE_SETCPUAFFINITY */
#endif
/* USE_SETCPUAFFINITY */
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment