bmake - Always pass the jobs pipe descriptor
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 5 Apr 2014 19:48:59 +0000 (12:48 -0700)
committerMatthew Dillon <dillon@apollo.backplane.com>
Sat, 5 Apr 2014 19:48:59 +0000 (12:48 -0700)
commit7fafe32491764cd82be639892c65d4b3c798efc8
treea7684d8e3342be8cf7782ab28b303d74f9eaf5ea
parent357f4b5b563ac699dbb6625f9228279c21c69eef
bmake - Always pass the jobs pipe descriptor

* bmake currently requires a .MAKE target dependency to induce the passing
  of the jobs pipe descriptor to sub-jobs (aka sub-makes).  This requirement
  was lost due to a bug in bmake where it's F_SETFD fcntl was being run on
  the wrong descriptor.  This was recently fixed in bmake and exposed this
  new problem.

* bmake might be run with the MAKEFLAGS environment intact but not be passed
  the jobs descriptor.  While bmake creates a new fresh jobs descriptor in
  this case, it would remain an issue if some other parent program happened
  to use a pipe descriptor with the same fd number.

* bmake or intermediate build programs might not be run with a .MAKE target
  dependency, causing sub-bmakes to run an excessive number of concurrent
  jobs.

* The question is whether we can really safely require this new behavior
  or whether we should revert to the prior behavior.

  FreeBSD modified the default to be the prior behavior of always passing
  the jobs pipe descriptor and added a new .MAKE* directive to override it,
  but I don't see how this helps matters when the default really needs to be
  the always-pass behavior anyway.

  The only other solution is to use a filesystem-visible pipe (filesystem fifo
  in /tmp), which the old make used.  But this often results in a lot of cruft
  building up in /tmp from ^C's and/or system crashes.  This solution is the
  most compatible with expectations, frankly.

* For now revert to the prior behavior of always passing the jobs pipe
  descriptor.  This does a better job of guarenteeing that the descriptor
  number remains intact through multiple fork/execs.
contrib/bmake/job.c