Print this page
make: ship the Joyent patch to enable parallel make (originally from rm)

Split Close
Expand all
Collapse all
          --- old/usr/src/cmd/make/bin/parallel.cc
          +++ new/usr/src/cmd/make/bin/parallel.cc
↓ open down ↓ 33 lines elided ↑ open up ↑
  34   34  /*
  35   35   * Included files
  36   36   */
  37   37  #ifdef DISTRIBUTED
  38   38  #include <avo/strings.h>        /* AVO_STRDUP() */
  39   39  #include <dm/Avo_DoJobMsg.h>
  40   40  #include <dm/Avo_MToolJobResultMsg.h>
  41   41  #endif
  42   42  #include <errno.h>              /* errno */
  43   43  #include <fcntl.h>
  44      -#include <avo/util.h>           /* avo_get_user(), avo_hostname() */
  45   44  #include <mk/defs.h>
  46   45  #include <mksh/dosys.h>         /* redirect_io() */
  47   46  #include <mksh/macro.h>         /* expand_value() */
  48   47  #include <mksh/misc.h>          /* getmem() */
  49   48  #include <sys/signal.h>
  50   49  #include <sys/stat.h>
  51   50  #include <sys/types.h>
  52   51  #include <sys/utsname.h>
  53   52  #include <sys/wait.h>
  54   53  #include <unistd.h>
       54 +#include <netdb.h>
  55   55  
  56   56  
  57   57  
  58   58  /*
  59   59   * Defined macros
  60   60   */
  61   61  #define MAXRULES                100
  62   62  
  63   63  /*
  64   64   * This const should be in avo_dms/include/AvoDmakeCommand.h
↓ open down ↓ 73 lines elided ↑ open up ↑
 138  138          char                    **p;
 139  139          Property                prop;
 140  140          Doname                  result = build_ok;
 141  141          Cmd_line                rule;
 142  142          Boolean                 silent_flag;
 143  143          Name                    target = line->body.line.target;
 144  144          Boolean                 wrote_state_file = false;
 145  145  
 146  146          if ((pmake_max_jobs == 0) &&
 147  147              (dmake_mode_type == parallel_mode)) {
 148      -                if (user_name[0] == '\0') {
 149      -                        avo_get_user(user_name, NULL);
 150      -                }
 151  148                  if (local_host[0] == '\0') {
 152      -                        strcpy(local_host, avo_hostname());
      149 +                        (void) gethostname(local_host, MAXNAMELEN);
 153  150                  }
 154  151                  MBSTOWCS(wcs_buffer, NOCATGETS("DMAKE_MAX_JOBS"));
 155  152                  dmake_name = GETNAME(wcs_buffer, FIND_LENGTH);
 156  153                  if (((prop = get_prop(dmake_name->prop, macro_prop)) != NULL) &&
 157  154                      ((dmake_value = prop->body.macro.value) != NULL)) {
 158  155                          pmake_max_jobs = atoi(dmake_value->string_mb);
 159  156                          if (pmake_max_jobs <= 0) {
 160  157                                  warning(catgets(catd, 1, 308, "DMAKE_MAX_JOBS cannot be less than or equal to zero."));
 161  158                                  warning(catgets(catd, 1, 309, "setting DMAKE_MAX_JOBS to %d."), PMAKE_DEF_MAX_JOBS);
 162  159                                  pmake_max_jobs = PMAKE_DEF_MAX_JOBS;
↓ open down ↓ 499 lines elided ↑ open up ↑
 662  659  static void
 663  660  job_adjust_error() {
 664  661          if (job_adjust_mode != ADJUST_NONE) {
 665  662                  /* cleanup internals */
 666  663                  job_adjust_fini();
 667  664  
 668  665                  /* warning message for the user */
 669  666                  warning(catgets(catd, 1, 339, "Encountered max jobs auto adjustment error - disabling auto adjustment."));
 670  667  
 671  668                  /* switch off job adjustment for the children */
 672      -                putenv(NOCATGETS("DMAKE_ADJUST_MAX_JOBS=NO"));
      669 +                putenv(strdup(NOCATGETS("DMAKE_ADJUST_MAX_JOBS=NO")));
 673  670  
 674  671                  /* and for this dmake */
 675  672                  job_adjust_mode = ADJUST_NONE;
 676  673          }
 677  674  }
 678  675  
 679  676  /*
 680  677   *  void job_adjust_init()
 681  678   *
 682  679   *  Description:
↓ open down ↓ 1046 lines elided ↑ open up ↑
1729 1726  add_running(Name target, Name true_target, Property command, int recursion_level, int auto_count, Name *automatics, Boolean do_get, Boolean implicit)
1730 1727  {
1731 1728          Running         rp;
1732 1729          Name            *p;
1733 1730  
1734 1731          rp = new_running_struct();
1735 1732          rp->state = build_running;
1736 1733          rp->target = target;
1737 1734          rp->true_target = true_target;
1738 1735          rp->command = command;
1739      -        Property spro_val = get_prop(sunpro_dependencies->prop, macro_prop);
1740      -        if(spro_val) {
1741      -                rp->sprodep_value = spro_val->body.macro.value;
1742      -                spro_val->body.macro.value = NULL;
1743      -                spro_val = get_prop(sunpro_dependencies->prop, env_mem_prop);
1744      -                if(spro_val) {
1745      -                        rp->sprodep_env = spro_val->body.env_mem.value;
1746      -                        spro_val->body.env_mem.value = NULL;
1747      -                }
1748      -        }
1749 1736          rp->recursion_level = recursion_level;
1750 1737          rp->do_get = do_get;
1751 1738          rp->implicit = implicit;
1752 1739          rp->auto_count = auto_count;
1753 1740          if (auto_count > 0) {
1754 1741                  rp->automatics = (Name *) getmem(auto_count * sizeof (Name));
1755 1742                  for (p = rp->automatics; auto_count > 0; auto_count--) {
1756 1743                          *p++ = *automatics++;
1757 1744                  }
1758 1745          } else {
↓ open down ↓ 440 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX