mirror of
https://github.com/radareorg/radare2.git
synced 2025-03-03 03:35:37 +00:00
CPU affinity and backtrace upport or SunOS ##port (#17288)
* Backtrace is supported w/o external lib. * Thread affinity implementation.
This commit is contained in:
parent
4b8525759f
commit
320c001c4c
@ -32,7 +32,7 @@
|
|||||||
static char** env = NULL;
|
static char** env = NULL;
|
||||||
|
|
||||||
#if (__linux__ && __GNU_LIBRARY__) || defined(NETBSD_WITH_BACKTRACE) || \
|
#if (__linux__ && __GNU_LIBRARY__) || defined(NETBSD_WITH_BACKTRACE) || \
|
||||||
defined(FREEBSD_WITH_BACKTRACE) || __DragonFly__
|
defined(FREEBSD_WITH_BACKTRACE) || __DragonFly__ || __sun
|
||||||
# include <execinfo.h>
|
# include <execinfo.h>
|
||||||
#endif
|
#endif
|
||||||
#if __APPLE__
|
#if __APPLE__
|
||||||
@ -300,7 +300,7 @@ R_API char *r_sys_cmd_strf(const char *fmt, ...) {
|
|||||||
|
|
||||||
#if (__linux__ && __GNU_LIBRARY__) || (__APPLE__ && APPLE_WITH_BACKTRACE) || \
|
#if (__linux__ && __GNU_LIBRARY__) || (__APPLE__ && APPLE_WITH_BACKTRACE) || \
|
||||||
defined(NETBSD_WITH_BACKTRACE) || defined(FREEBSD_WITH_BACKTRACE) || \
|
defined(NETBSD_WITH_BACKTRACE) || defined(FREEBSD_WITH_BACKTRACE) || \
|
||||||
__DragonFly__
|
__DragonFly__ || __sun
|
||||||
#define HAVE_BACKTRACE 1
|
#define HAVE_BACKTRACE 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -9,6 +9,10 @@
|
|||||||
#include <mach/thread_policy.h>
|
#include <mach/thread_policy.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if __sun
|
||||||
|
#include <sys/pset.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#if __HAIKU__
|
#if __HAIKU__
|
||||||
#include <kernel/scheduler.h>
|
#include <kernel/scheduler.h>
|
||||||
#endif
|
#endif
|
||||||
@ -168,6 +172,19 @@ R_API bool r_th_setaffinity(RThread *th, int cpuid) {
|
|||||||
eprintf ("Failed to set cpu affinity\n");
|
eprintf ("Failed to set cpu affinity\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
#elif __sun
|
||||||
|
psetid_t c;
|
||||||
|
|
||||||
|
pset_create (&c);
|
||||||
|
pset_assign (c, cpuid, NULL);
|
||||||
|
|
||||||
|
if (pset_bind (c, P_PID, getpid (), NULL)) {
|
||||||
|
pset_destroy (c);
|
||||||
|
eprintf ("Failed to set cpu affinity\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
pset_destroy (c);
|
||||||
#else
|
#else
|
||||||
#pragma message("warning r_th_setaffinity not implemented")
|
#pragma message("warning r_th_setaffinity not implemented")
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user