aboutsummaryrefslogtreecommitdiff
path: root/src/afl-gotcpu.c
diff options
context:
space:
mode:
authorDominik Maier <domenukk@gmail.com>2020-06-23 15:08:49 +0200
committerDominik Maier <domenukk@gmail.com>2020-06-23 15:08:49 +0200
commitaad433e11efa4a8350a264313c66db8ef6d17088 (patch)
treea8249027f61f17e259e4a4ef6f2339e0394b1e35 /src/afl-gotcpu.c
parentc1eb2bccaae8f5b31546e6af3b00583e46bd842b (diff)
parent59e1a18197b08b08ad9e75b23fb6a5c740a0b9dd (diff)
downloadafl++-aad433e11efa4a8350a264313c66db8ef6d17088.tar.gz
Merge branch 'dev' of github.com:vanhauser-thc/AFLplusplus into dev
Diffstat (limited to 'src/afl-gotcpu.c')
-rw-r--r--src/afl-gotcpu.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/afl-gotcpu.c b/src/afl-gotcpu.c
index 43b3196b..bd0f7de6 100644
--- a/src/afl-gotcpu.c
+++ b/src/afl-gotcpu.c
@@ -54,7 +54,7 @@
#include "common.h"
#if defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
- defined(__APPLE__) || defined(__DragonFly__)
+ defined(__APPLE__) || defined(__DragonFly__) || defined(__sun)
#define HAVE_AFFINITY 1
#if defined(__FreeBSD__) || defined(__DragonFly__)
#include <pthread.h>
@@ -70,6 +70,8 @@
#include <pthread.h>
#include <mach/thread_act.h>
#include <mach/thread_policy.h>
+ #elif defined(__sun)
+ #include <sys/pset.h>
#endif
#endif /* __linux__ || __FreeBSD__ || __NetBSD__ || __APPLE__ */
@@ -181,6 +183,12 @@ int main(int argc, char **argv) {
if (thread_policy_set(native_thread, THREAD_AFFINITY_POLICY,
(thread_policy_t)&c, 1) != KERN_SUCCESS)
PFATAL("thread_policy_set failed");
+ #elif defined(__sun)
+ psetid_t c;
+
+ if (pset_create(&c)) PFATAL("pset_create failed");
+
+ if (pset_assign(c, i, NULL)) PFATAL("pset_assign failed");
#endif
#if defined(__FreeBSD__) || defined(__DragonFly__)
@@ -195,6 +203,12 @@ int main(int argc, char **argv) {
cpuset_destroy(c);
#endif
+ #if defined(__sun)
+ if (pset_bind(c, P_PID, getpid(), NULL)) PFATAL("pset_bind failed");
+
+ pset_destroy(c);
+ #endif
+
#if defined(__linux__)
if (sched_setaffinity(0, sizeof(c), &c)) {