VirtualBox

Changeset 160 in kBuild for trunk/src


Ignore:
Timestamp:
Sep 8, 2004 3:15:50 AM (20 years ago)
Author:
bird
Message:

merged with beta1.

Location:
trunk/src/gmake
Files:
18 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gmake/function.c

    r57 r160  
    402402
    403403static char *
    404 func_patsubst (char *o, char **argv, const char *funcname)
     404func_patsubst (char *o, char **argv, const char *funcname UNUSED)
    405405{
    406406  o = patsubst_expand (o, argv[2], argv[0], argv[1], (char *) 0, (char *) 0);
     
    410410
    411411static char *
    412 func_join (char *o, char **argv, const char *funcname)
     412func_join (char *o, char **argv, const char *funcname UNUSED)
    413413{
    414414  int doneany = 0;
     
    450450
    451451static char *
    452 func_origin (char *o, char **argv, const char *funcname)
     452func_origin (char *o, char **argv, const char *funcname UNUSED)
    453453{
    454454  /* Expand the argument.  */
     
    645645
    646646static char *
    647 func_subst (char *o, char **argv, const char *funcname)
     647func_subst (char *o, char **argv, const char *funcname UNUSED)
    648648{
    649649  o = subst_expand (o, argv[2], argv[0], argv[1], strlen (argv[0]),
     
    655655
    656656static char *
    657 func_firstword (char *o, char **argv, const char *funcname)
     657func_firstword (char *o, char **argv, const char *funcname UNUSED)
    658658{
    659659  unsigned int i;
     
    669669
    670670static char *
    671 func_words (char *o, char **argv, const char *funcname)
     671func_words (char *o, char **argv, const char *funcname UNUSED)
    672672{
    673673  int i = 0;
     
    718718
    719719static char *
    720 func_word (char *o, char **argv, const char *funcname)
     720func_word (char *o, char **argv, const char *funcname UNUSED)
    721721{
    722722  char *end_p=0;
     
    744744
    745745static char *
    746 func_wordlist (char *o, char **argv, const char *funcname)
     746func_wordlist (char *o, char **argv, const char *funcname UNUSED)
    747747{
    748748  int start, count;
     
    781781
    782782static char*
    783 func_findstring (char *o, char **argv, const char *funcname)
     783func_findstring (char *o, char **argv, const char *funcname UNUSED)
    784784{
    785785  /* Find the first occurrence of the first string in the second.  */
     
    792792
    793793static char *
    794 func_foreach (char *o, char **argv, const char *funcname)
     794func_foreach (char *o, char **argv, const char *funcname UNUSED)
    795795{
    796796  /* expand only the first two.  */
     
    10121012
    10131013static char *
    1014 func_strip (char *o, char **argv, const char *funcname)
     1014func_strip (char *o, char **argv, const char *funcname UNUSED)
    10151015{
    10161016  char *p = argv[0];
     
    10811081 */
    10821082static char *
    1083 func_sort (char *o, char **argv, const char *funcname)
     1083func_sort (char *o, char **argv, const char *funcname UNUSED)
    10841084{
    10851085  char **words = 0;
     
    11431143
    11441144static char *
    1145 func_if (char *o, char **argv, const char *funcname)
     1145func_if (char *o, char **argv, const char *funcname UNUSED)
    11461146{
    11471147  const char *begp = argv[0];
     
    11841184
    11851185static char *
    1186 func_wildcard (char *o, char **argv, const char *funcname)
     1186func_wildcard (char *o, char **argv, const char *funcname UNUSED)
    11871187{
    11881188
     
    12051205
    12061206static char *
    1207 func_eval (char *o, char **argv, const char *funcname)
     1207func_eval (char *o, char **argv, const char *funcname UNUSED)
    12081208{
    12091209  char *buf;
     
    12241224
    12251225static char *
    1226 func_value (char *o, char **argv, const char *funcname)
     1226func_value (char *o, char **argv, const char *funcname UNUSED)
    12271227{
    12281228  /* Look up the variable.  */
     
    14241424#ifndef _AMIGA
    14251425static char *
    1426 func_shell (char *o, char **argv, const char *funcname)
     1426func_shell (char *o, char **argv, const char *funcname UNUSED)
    14271427{
    14281428  char* batch_filename = NULL;
    1429   int i;
     1429  unsigned int i;
    14301430
    14311431#ifdef __MSDOS__
     
    19211921
    19221922static char *
    1923 func_call (char *o, char **argv, const char *funcname)
     1923func_call (char *o, char **argv, const char *funcname UNUSED)
    19241924{
    19251925  static int max_args = 0;
  • trunk/src/gmake/job.c

    r58 r160  
    230230
    231231int unixy_shell = 1;
     232
     233/* Number of jobs started in the current second.  */
     234
     235unsigned long job_counter = 0;
    232236
    233237
     
    370374
    371375
    372 /*
    373    found apostrophe at (p-1)
    374 
    375    inc p until after closing apostrophe.  */
     376/* found apostrophe at (p-1)
     377   inc p until after closing apostrophe.
     378 */
    376379
    377380static char *
    378 handle_apos (char *p)
     381vms_handle_apos (char *p)
    379382{
    380383  int alast;
    381   int inside;
    382384
    383385#define SEPCHARS ",/()= "
    384386
    385   inside = 0;
     387  alast = 0;
    386388
    387389  while (*p != 0)
     
    389391      if (*p == '"')
    390392        {
    391           if (inside)
    392             {
    393               while ((alast > 0)
    394                     && (*p == '"'))
    395                 {
    396                   p++;
    397                   alast--;
    398                 }
    399               if (alast == 0)
    400                 inside = 0;
    401               else
    402                 {
    403                   fprintf (stderr, _("Syntax error, still inside '\"'\n"));
    404                   exit (3);
    405                 }
     393          if (alast)
     394            {
     395              alast = 0;
     396              p++;
    406397            }
    407398          else
     
    410401              if (strchr (SEPCHARS, *p))
    411402                break;
    412               inside = 1;
    413403              alast = 1;
    414               while (*p == '"')
    415                 {
    416                   alast++;
    417                   p++;
    418                 }
    419404            }
    420405        }
     
    442427
    443428RETSIGTYPE
    444 child_handler (int sig)
     429child_handler (int sig UNUSED)
    445430{
    446431  ++dead_children;
     
    453438
    454439#ifdef __EMX__
    455   signal(SIGCHLD, SIG_DFL); /* The signal handler must called only once! ????*/
    456 #endif
    457 
     440  /* The signal handler must called only once! */
     441  signal (SIGCHLD, SIG_DFL);
     442#endif
     443
     444  /* This causes problems if the SIGCHLD interrupts a printf().
    458445  DB (DB_JOBS, (_("Got a SIGCHLD; %u unreaped children.\n"), dead_children));
     446  */
    459447}
    460448
     
    605593              coredump = WCOREDUMP (status);
    606594
    607 #if 0 /*def __EMX__*/
    608               /* the SIGCHLD handler must not be used on OS/2 because, unlike
    609                  on UNIX systems, it had to call wait() itself.  Therefore
    610                  job_rfd has to be closed here.  */
    611               if (job_rfd >= 0)
    612                 {
    613                   close (job_rfd);
    614                   job_rfd = -1;
    615                 }
    616 #endif
    617 
     595              /* If we have started jobs in this second, remove one.  */
     596              if (job_counter)
     597                --job_counter;
    618598            }
    619599          else
     
    13781358#endif  /* __MSDOS__ or Amiga or WINDOWS32 */
    13791359
     1360  /* Bump the number of jobs started in this second.  */
     1361  ++job_counter;
     1362
    13801363  /* We are the parent side.  Set the state to
    13811364     say the commands are running and return.  */
     
    16671650        saved_errno = errno;
    16681651#ifdef __EMX__
    1669         signal(SIGCHLD, SIG_DFL); /* The child handler must be turned off here. */
     1652        /* The child handler must be turned off here.  */
     1653        signal (SIGCHLD, SIG_DFL);
    16701654#endif
    16711655        set_child_handler_action_flags (SA_RESTART);
     
    17251709}
    17261710
     1711/* Determine if the load average on the system is too high to start a new job.
     1712   The real system load average is only recomputed once a second.  However, a
     1713   very parallel make can easily start tens or even hundreds of jobs in a
     1714   second, which brings the system to its knees for a while until that first
     1715   batch of jobs clears out.
     1716
     1717   To avoid this we use a weighted algorithm to try to account for jobs which
     1718   have been started since the last second, and guess what the load average
     1719   would be now if it were computed.
     1720
     1721   This algorithm was provided by Thomas Riedl <[email protected]>,
     1722   who writes:
     1723
     1724!      calculate something load-oid and add to the observed sys.load,
     1725!      so that latter can catch up:
     1726!      - every job started increases jobctr;
     1727!      - every dying job decreases a positive jobctr;
     1728!      - the jobctr value gets zeroed every change of seconds,
     1729!        after its value*weight_b is stored into the 'backlog' value last_sec
     1730!      - weight_a times the sum of jobctr and last_sec gets
     1731!        added to the observed sys.load.
     1732!
     1733!      The two weights have been tried out on 24 and 48 proc. Sun Solaris-9
     1734!      machines, using a several-thousand-jobs-mix of cpp, cc, cxx and smallish
     1735!      sub-shelled commands (rm, echo, sed...) for tests.
     1736!      lowering the 'direct influence' factor weight_a (e.g. to 0.1)
     1737!      resulted in significant excession of the load limit, raising it
     1738!      (e.g. to 0.5) took bad to small, fast-executing jobs and didn't
     1739!      reach the limit in most test cases.
     1740!
     1741!      lowering the 'history influence' weight_b (e.g. to 0.1) resulted in
     1742!      exceeding the limit for longer-running stuff (compile jobs in
     1743!      the .5 to 1.5 sec. range),raising it (e.g. to 0.5) overrepresented
     1744!      small jobs' effects.
     1745
     1746 */
     1747
     1748#define LOAD_WEIGHT_A           0.25
     1749#define LOAD_WEIGHT_B           0.25
     1750
    17271751static int
    17281752load_too_high (void)
     
    17311755  return 1;
    17321756#else
    1733   double load;
     1757  static double last_sec;
     1758  static time_t last_now;
     1759  double load, guess;
     1760  time_t now;
    17341761
    17351762  if (max_load_average < 0)
    17361763    return 0;
    17371764
     1765  /* Find the real system load average.  */
    17381766  make_access ();
    17391767  if (getloadavg (&load, 1) != 1)
     
    17551783  user_access ();
    17561784
    1757   DB (DB_JOBS, ("Current system load = %f (max requested = %f)\n",
    1758                 load, max_load_average));
    1759   return load >= max_load_average;
     1785  /* If we're in a new second zero the counter and correct the backlog
     1786     value.  Only keep the backlog for one extra second; after that it's 0.  */
     1787  now = time (NULL);
     1788  if (last_now < now)
     1789    {
     1790      if (last_now == now - 1)
     1791        last_sec = LOAD_WEIGHT_B * job_counter;
     1792      else
     1793        last_sec = 0.0;
     1794
     1795      job_counter = 0;
     1796      last_now = now;
     1797    }
     1798
     1799  /* Try to guess what the load would be right now.  */
     1800  guess = load + (LOAD_WEIGHT_A * (job_counter + last_sec));
     1801
     1802  DB (DB_JOBS, ("Estimated system load = %f (actual = %f) (max requested = %f)\n",
     1803                guess, load, max_load_average));
     1804
     1805  return guess >= max_load_average;
    17601806#endif
    17611807}
     
    21932239                 comma or space and before slash. */
    21942240            case '"':
    2195               q = handle_apos (q + 1);
     2241              q = vms_handle_apos (q);
    21962242              sep = q;
    21972243              break;
     
    28682914  char** sh_cmds;
    28692915#else  /* must be UNIX-ish */
    2870   static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~";
    2871   static char *sh_cmds[] = { "cd", "eval", "exec", "exit", "login",
    2872                              "logout", "set", "umask", "wait", "while", "for",
    2873                              "case", "if", ":", ".", "break", "continue",
    2874                              "export", "read", "readonly", "shift", "times",
    2875                              "trap", "switch", 0 };
    2876 #endif /* __MSDOS__ */
     2916  static char sh_chars[] = "#;\"*?[]&|<>(){}$`^~!";
     2917  static char *sh_cmds[] = { ".", ":", "break", "case", "cd", "continue",
     2918                             "eval", "exec", "exit", "export", "for", "if",
     2919                             "login", "logout", "read", "readonly", "set",
     2920                             "shift", "switch", "test", "times", "trap",
     2921                             "umask", "wait", "while", 0 };
     2922#endif
    28772923  register int i;
    28782924  register char *p;
  • trunk/src/gmake/main.c

    r57 r160  
    392392    { CHAR_MAX+4, flag, (char *) &warn_undefined_variables_flag, 1, 1, 0, 0, 0,
    393393        "warn-undefined-variables" },
    394     { '\0', }
     394    { 0 }
    395395  };
    396396
     
    550550
    551551static RETSIGTYPE
    552 debug_signal_handler (int sig)
     552debug_signal_handler (int sig UNUSED)
    553553{
    554554  db_level = db_level ? DB_NONE : DB_BASIC;
     
    839839{
    840840  static char *stdin_nm = 0;
    841   register struct file *f;
    842   register unsigned int i;
     841  struct file *f;
     842  int i;
    843843  char **p;
    844844  struct dep *read_makefiles;
     
    11631163  if (current_directory[0] != '\0'
    11641164      && argv[0] != 0
    1165       && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':')))
     1165      && (argv[0][0] != '/' && (argv[0][0] == '\0' || argv[0][1] != ':'))
     1166#ifdef __EMX__
     1167      /* do not prepend cwd if argv[0] contains no '/', e.g. "make" */
     1168      && (strchr (argv[0], '/') != 0 || strchr (argv[0], '\\') != 0)
     1169# endif
     1170      )
    11661171    argv[0] = concat (current_directory, "/", argv[0]);
    11671172#else  /* !__MSDOS__ */
     
    15101515  {
    15111516    char *cp;
    1512 
    1513     for (i=1; i < jobserver_fds->idx; ++i)
    1514       if (!streq (jobserver_fds->list[0], jobserver_fds->list[i]))
     1517    unsigned int ui;
     1518
     1519    for (ui=1; ui < jobserver_fds->idx; ++ui)
     1520      if (!streq (jobserver_fds->list[0], jobserver_fds->list[ui]))
    15151521        fatal (NILF, _("internal error: multiple --jobserver-fds options"));
    15161522
     
    17431749               in updating or could not be found at all.  */
    17441750            int any_failed = 0;
    1745             register unsigned int i;
     1751            unsigned int i;
    17461752            struct dep *d;
    17471753
     
    18171823            {
    18181824              /* These names might have changed.  */
    1819               register unsigned int i, j = 0;
     1825              int i, j = 0;
    18201826              for (i = 1; i < argc; ++i)
    18211827                if (strneq (argv[i], "-f", 2)) /* XXX */
     
    20222028init_switches (void)
    20232029{
    2024   register char *p;
    2025   register int c;
    2026   register unsigned int i;
     2030  char *p;
     2031  unsigned int c;
     2032  unsigned int i;
    20272033
    20282034  if (options[0] != '\0')
     
    22362242                  if (optarg == 0)
    22372243                    optarg = cs->noarg_value;
     2244                  else if (*optarg == '\0')
     2245                    {
     2246                      error (NILF, _("the `-%c' option requires a non-empty string argument"),
     2247                             cs->c);
     2248                      bad = 1;
     2249                    }
    22382250
    22392251                  sl = *(struct stringlist **) cs->value_ptr;
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette