Updated Branches: refs/heads/master 83030764e -> d19ba4618
Make TS build on FreeBSD with hwloc installed Currently, building TS on FreeBSD and Solaris fails, as cpu_set_t as well as CPU_SET and CPU_ZERO are not defined within the usual includes. This is fixed by adding a clause, which includes sys/cpuset.h as well as pthread_np.h (for pthread_setaffinity_np). I do not have access to a Solaris machine myself, so I won't know if this works till the buildbot starts working on it. Also, this fixes a small issue with a thread pointer being referenced as %lu instead of the correct %p. Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/d19ba461 Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/d19ba461 Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/d19ba461 Branch: refs/heads/master Commit: d19ba4618f872d959f2ad9a8e19f1bf0498bfe1f Parents: 8303076 Author: Daniel Gruno <[email protected]> Authored: Tue Sep 18 15:49:00 2012 +0200 Committer: Daniel Gruno <[email protected]> Committed: Tue Sep 18 15:49:00 2012 +0200 ---------------------------------------------------------------------- iocore/eventsystem/UnixEventProcessor.cc | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafficserver/blob/d19ba461/iocore/eventsystem/UnixEventProcessor.cc ---------------------------------------------------------------------- diff --git a/iocore/eventsystem/UnixEventProcessor.cc b/iocore/eventsystem/UnixEventProcessor.cc index 2ed4200..78f6f7d 100644 --- a/iocore/eventsystem/UnixEventProcessor.cc +++ b/iocore/eventsystem/UnixEventProcessor.cc @@ -25,6 +25,12 @@ #include <sched.h> #if TS_USE_HWLOC #include <hwloc.h> +// TODO: (humbedooh): Make this build on Solaris with hwloc. +#if defined(freebsd) || defined(solaris) +#include <sys/cpuset.h> +#define cpu_set_t cpuset_t +#include <pthread_np.h> +#endif #endif #include "ink_defs.h" @@ -118,7 +124,7 @@ EventProcessor::start(int n_event_threads) CPU_ZERO(&cpuset); int cpu = (i - 1) % num_cpus; CPU_SET(cpu, &cpuset); - Debug("iocore_thread", "setaffinity tid: %lu, net thread: %d, cpu: %d", tid, i, cpu); + Debug("iocore_thread", "setaffinity tid: %p, net thread: %d, cpu: %d", tid, i, cpu); assert(pthread_setaffinity_np(tid, sizeof(cpu_set_t), &cpuset) == 0); } #endif
