bmake - Always pass the jobs pipe descriptor
authorMatthew Dillon <dillon@apollo.backplane.com>
Sat, 5 Apr 2014 19:48:59 +0000 (12:48 -0700)
committerSascha Wildner <saw@online.de>
Mon, 7 Apr 2014 06:36:45 +0000 (08:36 +0200)
commit8026b08ec354642e847aa896c4a6780fa11a8224
tree2d6ad559eeb026ba0c0582210d285b0b66a2535e
parentd9ea9660a8ca24d10a6015cdc20efc789982c7e1
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