Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
27f4c212
Unverified
Commit
27f4c212
authored
Oct 25, 2020
by
David CARLIER
Committed by
GitHub
Oct 25, 2020
Browse files
cpu affinity: DragonFlyBSD support (#7956)
parent
ebfa7699
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/config.h
View file @
27f4c212
...
...
@@ -253,7 +253,7 @@ int pthread_setname_np(const char *name);
#endif
/* Check if we can use setcpuaffinity(). */
#if (defined __linux || defined __NetBSD__ || defined __FreeBSD__)
#if (defined __linux || defined __NetBSD__ || defined __FreeBSD__
|| defined __DragonFly__
)
#define USE_SETCPUAFFINITY
void
setcpuaffinity
(
const
char
*
cpulist
);
#endif
...
...
src/setcpuaffinity.c
View file @
27f4c212
...
...
@@ -36,6 +36,10 @@
#include <sys/param.h>
#include <sys/cpuset.h>
#endif
#ifdef __DragonFly__
#include <pthread.h>
#include <pthread_np.h>
#endif
#ifdef __NetBSD__
#include <pthread.h>
#include <sched.h>
...
...
@@ -72,7 +76,7 @@ void setcpuaffinity(const char *cpulist) {
#ifdef __linux__
cpu_set_t
cpuset
;
#endif
#ifdef
__FreeBSD__
#if
def
ined (
__FreeBSD__
) || defined(__DragonFly__)
cpuset_t
cpuset
;
#endif
#ifdef __NetBSD__
...
...
@@ -139,6 +143,9 @@ void setcpuaffinity(const char *cpulist) {
#ifdef __FreeBSD__
cpuset_setaffinity
(
CPU_LEVEL_WHICH
,
CPU_WHICH_TID
,
-
1
,
sizeof
(
cpuset
),
&
cpuset
);
#endif
#ifdef __DragonFly__
pthread_setaffinity_np
(
pthread_self
(),
sizeof
(
cpuset
),
&
cpuset
);
#endif
#ifdef __NetBSD__
pthread_setaffinity_np
(
pthread_self
(),
cpuset_size
(
cpuset
),
cpuset
);
cpuset_destroy
(
cpuset
);
...
...
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