I have committed a patch which works on Linux/Solaris/FreeBSD

https://git-wip-us.apache.org/repos/asf?p=trafficserver.git;a=commitdiff;h=eefd111a8e841b4a73d934ff81487317e640af13

n.b.: This is untested on OS X!

On Solaris this got me through the CPU affinity stuff, but hung on:

   "SplitDNS.cc", line 639: Error: Could not find a match for 
ink_atomic_cas(SplitDNSConfigInfo**, SplitDNSConfigInfo*, SplitDNSConfigInfo*) 
needed in SplitDNSConfigProcessor::set(unsigned, SplitDNSConfigInfo*).

Fortunately, Alan is planning to drop the bomb on DNS/ so, maybe
that'll fix it ;)

meanwhile, our buildbot, on which I developed and tested these
changes still doesn't build. And no, I have no friggin idea why.

So long,

i

----- Original Message -----
>
>
> ----- Original Message -----
> > j0!
> >
> > Humbedooh and moa have managed to gobble something together that
> > compiles on both, FreeBSD and Solaris. But maybe someone who
> > actually knows how to program would like to review this before
> > I commit the Solaris portion of the patch:
> >
> >
> > diff --git a/iocore/eventsystem/UnixEventProcessor.cc
> > b/iocore/eventsystem/UnixEventProcessor.cc
> > index 78f6f7d..95c0835 100644
> > --- a/iocore/eventsystem/UnixEventProcessor.cc
> > +++ b/iocore/eventsystem/UnixEventProcessor.cc
> > @@ -26,10 +26,14 @@
> >  #if TS_USE_HWLOC
> >  #include <hwloc.h>
> >  // TODO: (humbedooh): Make this build on Solaris with hwloc.
> > -#if defined(freebsd) || defined(solaris)
> > +#if defined(freebsd) || defined(darwin)
> >  #include <sys/cpuset.h>
> >  #define cpu_set_t cpuset_t
> >  #include <pthread_np.h>
> > +#elif defined(solaris)
> > +#include <sys/procset.h>
> > +#include <sys/processor.h>
> > +#include <sys/types.h>
> >  #endif
> >  #endif
> >  #include "ink_defs.h"
> > @@ -106,7 +110,9 @@ EventProcessor::start(int n_event_threads)
> >  #if TS_USE_HWLOC
> >    int affinity = 0;
> >    REC_ReadConfigInteger(affinity,
> >    "proxy.config.exec_thread.affinity");
> > +#if !defined(solaris)
> >    cpu_set_t cpuset;
> > +#endif
> >    const hwloc_topology_t *topology = ink_get_topology();
> >    int cu = hwloc_get_nbobjs_by_type(*topology, HWLOC_OBJ_CORE);
> >    int pu = hwloc_get_nbobjs_by_type(*topology, HWLOC_OBJ_PU);
> > @@ -121,11 +127,18 @@ EventProcessor::start(int n_event_threads)
> >
> >  #if TS_USE_HWLOC
> >      if (affinity == 1) {
> > -      CPU_ZERO(&cpuset);
> >        int cpu = (i - 1) % num_cpus;
> > +#if !defined(solaris)
> > +      CPU_ZERO(&cpuset);
> >        CPU_SET(cpu, &cpuset);
> > +#endif
> > +
> >        Debug("iocore_thread", "setaffinity tid: %p, net thread: %d,
> >        cpu: %d", tid, i, cpu);
> > +#if !defined(solaris)
> >        assert(pthread_setaffinity_np(tid, sizeof(cpu_set_t),
> >        &cpuset)
> >        == 0);
> > +#else
> > +      assert(processor_bind(P_LWPID, tid, cpu, NULL));
> > +#endif
> >      }
> >  #endif
> >    }
> >
>
> btw, after applying this patch, we get the next failure here:
>
> Making all in dns
> gmake[2]: Entering directory
> `/export/home/igalic/trafficserver/iocore/dns'
> source='SplitDNS.cc' object='SplitDNS.o' libtool=no \
>         DEPDIR=.deps depmode=none /bin/bash ../../build/aux/depcomp \
>         CC -DHAVE_CONFIG_H  -I. -I../../lib/ts
>          -I../../iocore/eventsystem -I../../iocore/net
>         -I../../iocore/aio -I../../iocore/hostdb
>         -I../../iocore/cache -I../../iocore/cluster
>         -I../../iocore/utils -I../../iocore/dns -I../../lib
>         -I../../lib/records -I../../lib/ts -I../../proxy
>         -I../../proxy/http -I../../proxy/hdrs -I../../mgmt
>         -I../../mgmt/utils -I../../mgmt/preparse
>         -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE
>         -D_REENTRANT -Dsolaris -I/opt/csw/include
>         -I/usr/local/include  -g -mt -m64 -D__WORDSIZE=64 -O3
>         -library=stlport4 -erroff -c -o SplitDNS.o SplitDNS.cc
> "SplitDNS.cc", line 639: Error: Could not find a match for
> ink_atomic_cas(SplitDNSConfigInfo**, SplitDNSConfigInfo*,
> SplitDNSConfigInfo*) needed in
> SplitDNSConfigProcessor::set(unsigned, SplitDNSConfigInfo*).
> 1 Error(s) detected.
> gmake[2]: *** [SplitDNS.o] Error 2
>
> so long,
>
> i
>
> --
> Igor Galić
>
> Tel: +43 (0) 664 886 22 883
> Mail: i.ga...@brainsware.org
> URL: http://brainsware.org/
> GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE
>
>

--
Igor Galić

Tel: +43 (0) 664 886 22 883
Mail: i.ga...@brainsware.org
URL: http://brainsware.org/
GPG: 6880 4155 74BD FD7C B515  2EA5 4B1D 9E08 A097 C9AE

Reply via email to