VirtualBox

Changeset 3432 in kBuild


Ignore:
Timestamp:
Sep 1, 2020 1:17:57 PM (5 years ago)
Author:
bird
Message:

kmk: Quick output hack to repeat the failure output at the end of die() as it may easily get lost in output from other jobs (problem on systems with lots of cores).

Location:
trunk/src/kmk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/job.c

    r3312 r3432  
    10621062#ifndef NO_OUTPUT_SYNC
    10631063      /* Synchronize any remaining parallel output.  */
     1064# ifdef KMK
     1065      c->output.dont_truncate = !err && child_failed && !dontcare && !keep_going_flag && !handling_fatal_signal;
     1066# endif
    10641067      output_dump (&c->output);
    10651068#endif
     
    10961099        lastc->next = c->next;
    10971100
     1101#ifdef KMK /* Repeat the error  */
     1102      /* If the job failed, and the -k flag was not given, die,
     1103         unless we are already in the process of dying.  */
     1104      if (!err && child_failed && !dontcare && !keep_going_flag &&
     1105          /* fatal_error_signal will die with the right signal.  */
     1106          !handling_fatal_signal)
     1107        {
     1108          unblock_sigs ();
     1109          die_with_job_output (child_failed, &c->output);
     1110        }
     1111#endif
     1112
    10981113      free_child (c);
    10991114
    11001115      unblock_sigs ();
    11011116
     1117#ifndef KMK /* See above. */
    11021118      /* If the job failed, and the -k flag was not given, die,
    11031119         unless we are already in the process of dying.  */
     
    11061122          !handling_fatal_signal)
    11071123        die (child_failed);
     1124#endif
    11081125
    11091126      /* Only block for one child.  */
  • trunk/src/kmk/main.c

    r3396 r3432  
    43594359
    43604360void
     4361#ifdef KMK
     4362die_with_job_output (int status, struct output *out)
     4363#else
    43614364die (int status)
     4365#endif
    43624366{
    43634367  static char dying = 0;
    43644368#ifdef KMK
    43654369  static char need_2nd_error = 0;
     4370  static char need_2nd_error_output = 0;
    43664371#endif
    43674372
     
    43814386              || print_data_base_flag
    43824387              || print_stats_flag))
    4383         need_2nd_error = 1;
     4388        {
     4389          need_2nd_error = 1;
     4390          need_2nd_error_output = job_slots_used > 2
     4391                               && out == NULL
     4392                               && out != &make_sync;
     4393        }
    43844394#endif /* KMK */
    43854395
     
    44574467  if (need_2nd_error != 0)
    44584468    ON (error, NILF, _("*** Exiting with status %d"), status);
     4469  if (out)
     4470  {
     4471      out->dont_truncate = 0;
     4472      if (need_2nd_error_output)
     4473        output_dump (out);
     4474      output_close (out);
     4475  }
    44594476#endif
    44604477
    44614478  exit (status);
    44624479}
     4480
     4481#ifdef KMK
     4482void die(int status)
     4483{
     4484    die_with_job_output (status, NULL);
     4485}
     4486#endif
  • trunk/src/kmk/makeint.h

    r3389 r3432  
    663663
    664664void die (int) __attribute__ ((noreturn));
     665void die_with_job_output (int, struct output *) __attribute__ ((noreturn));
    665666void pfatal_with_name (const char *) __attribute__ ((noreturn));
    666667void perror_with_name (const char *, const char *);
  • trunk/src/kmk/output.c

    r3289 r3432  
    172172        release_semaphore (sem);
    173173
     174# ifdef KMK
     175      if (!out->dont_truncate)
     176        { /* likely */ }
     177      else return;
     178# endif
     179
    174180      /* Free the segments and reset the state. */
    175181      while ((seg = out->out.head_seg))
     
    926932        release_semaphore (sem);
    927933
     934# ifdef KMK
     935      if (!out->dont_truncate)
     936        { /* likely */ }
     937      else return;
     938# endif
    928939      /* Truncate and reset the output, in case we use it again.  */
    929940      if (out->out != OUTPUT_NONE)
     
    10681079#endif
    10691080      out->syncout = !!output_sync;
     1081#ifdef KMK
     1082      out->dont_truncate = 0;
     1083#endif
    10701084      return;
    10711085    }
  • trunk/src/kmk/output.h

    r3244 r3432  
    6060#endif
    6161    unsigned int syncout:1;     /* True if we want to synchronize output.  */
     62#ifdef KMK
     63    unsigned int dont_truncate:1; /* For die_with_child_output repeat.  */
     64#endif
    6265 };
    6366
Note: See TracChangeset for help on using the changeset viewer.

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