[Aboriginal] Dealing with distcc

Rob Landley rob at landley.net
Thu Oct 25 18:44:48 PDT 2012


On 10/07/2012 01:56:21 PM, John Spencer wrote:
> On 10/07/2012 08:45 PM, John Spencer wrote:
> > i have now limited success using distcc: when i compile a bigger
> piece
> > of sw i get "(distcc)" output in the beginning, but in the later
> phase
> > it's only "gcc -foo bar.c" kinda stuff...
> 
> well, actually it's
> distcc[203] (dcc_build_somewhere) Warning: failed to distribute,
> running 
> locally instead
> distcc[202] (dcc_build_somewhere) Warning: failed to distribute,
> running 
> locally instead
> distcc[204] (dcc_build_somewhere) Warning: failed to distribute,
> running 
> locally instead
> 
> is it possible that all aboriginal instances use the same distcc port
> ?
> i currently have armv4tl, armv6 and mips running...

It shouldn't. It should randomize based on the PID, within a port 
range that's otherwise unused. The logic for all this is in sources/
toys/unique-port.sh (which gets sucked into dev-environment.sh in the 
system images).

The first 8192 ports are restricted to root only by the kernel (it used 
to be 1024 but the kernel's gotten increasingly conservative in its old 
age). In addition, a range of ports are dynamically assigned to normal 
connections.

So what the code does is it tries to use 8192 through the start of the 
dynamic range. If there are fewer than 8 entries in that, it tries to 
use the end of the range through 65535. If there are fewer than 8 
entries in _that_, it punts and goes "ok, 16384 through 32768, hope we 
don't collide with anything". It then takes the current PID, modulo the
range, plus the start of the range, and uses that as the port number.

This is not guaranteed to work, but it is at least _trying_ to find an 
unused port. (The problem with dynamically assigning a port is we don't 
get to see what the port number _is_ because we backgrounded the 
daemon. Last I checked dhcpd doesn't have an inetd mode so we can't 
handle this more gracefully, or at least I haven't figured out how 
yet.)

Rob


 1351215888.0


More information about the Aboriginal mailing list