Ignore:
Timestamp:
Jun 20, 2012, 12:44:52 AM (13 years ago)
Author:
bird
Message:

gnumake/current -> 3.82-cvs.

Location:
vendor/gnumake/current
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current

    • Property svn:ignore deleted
  • vendor/gnumake/current/vmsjobs.c

    • Property svn:keywords deleted
    r1989 r2596  
    33
    44Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
    5 2007 Free Software Foundation, Inc.
     52007, 2008, 2009, 2010 Free Software Foundation, Inc.
    66This file is part of GNU Make.
    77
     
    111111}
    112112
    113 /* This is called as an AST when a child process dies (it won't get
    114    interrupted by anything except a higher level AST).
     113static int ctrlYPressed= 0;
     114/* This is called at main or AST level. It is at AST level for DONTWAITFORCHILD
     115   and at main level otherwise. In any case it is called when a child process
     116   terminated. At AST level it won't get interrupted by anything except a
     117   inner mode level AST.
    115118*/
    116119int
     
    124127
    125128    lib$free_ef(&child->efn);
     129    if (child->comname)
     130      {
     131        if (!ISDB (DB_JOBS)&&!ctrlYPressed)
     132          unlink (child->comname);
     133        free (child->comname);
     134      }
    126135
    127136    (void) sigblock (fatal_signal_mask);
     
    220229static int oldCtrlMask;
    221230static int setupYAstTried= 0;
    222 static int pidToAbort= 0;
    223 static int chan= 0;
     231static unsigned short int chan= 0;
    224232
    225233static void
     
    229237}
    230238
    231 static void
    232 astHandler (void)
     239static int
     240astYHandler (void)
    233241{
    234         if (pidToAbort) {
    235                 sys$forcex (&pidToAbort, 0, SS$_ABORT);
    236                 pidToAbort= 0;
    237         }
     242        struct child *c;
     243        for (c = children; c != 0; c = c->next)
     244                sys$delprc (&c->pid, 0, 0);
     245        ctrlYPressed= 1;
    238246        kill (getpid(),SIGQUIT);
     247        return SS$_NORMAL;
    239248}
    240249
     
    248257                int     dvi;
    249258        } iosb;
     259        unsigned short int loc_chan;
    250260
    251261        setupYAstTried++;
    252262
    253         if (!chan) {
    254                 status= sys$assign(&inputDsc,&chan,0,0);
     263        if (chan)
     264          loc_chan= chan;
     265        else {
     266                status= sys$assign(&inputDsc,&loc_chan,0,0);
    255267                if (!(status&SS$_NORMAL)) {
    256268                        lib$signal(status);
     
    258270                }
    259271        }
    260         status= sys$qiow (0, chan, IO$_SETMODE|IO$M_CTRLYAST,&iosb,0,0,
    261                 astHandler,0,0,0,0,0);
    262         if (status==SS$_NORMAL)
    263                 status= iosb.status;
    264         if (status==SS$_ILLIOFUNC || status==SS$_NOPRIV) {
    265                 sys$dassgn(chan);
    266 #ifdef  CTRLY_ENABLED_ANYWAY
    267                 fprintf (stderr,
    268                          _("-warning, CTRL-Y will leave sub-process(es) around.\n"));
    269 #else
    270                 return;
    271 #endif
    272         }
    273         else if (!(status&SS$_NORMAL)) {
    274                 sys$dassgn(chan);
    275                 lib$signal(status);
     272        status= sys$qiow (0, loc_chan, IO$_SETMODE|IO$M_CTRLYAST,&iosb,0,0,
     273                          astYHandler,0,0,0,0,0);
     274        if (status==SS$_NORMAL)
     275                status= iosb.status;
     276        if (status!=SS$_NORMAL) {
     277                if (!chan)
     278                        sys$dassgn(loc_chan);
     279                if (status!=SS$_ILLIOFUNC && status!=SS$_NOPRIV)
     280                        lib$signal(status);
    276281                return;
    277282        }
     
    288293                return;
    289294        }
     295        if (!chan)
     296                chan = loc_chan;
    290297}
    291298
     
    300307  static struct dsc$descriptor_s efiledsc;
    301308  int have_redirection = 0;
     309  int have_append = 0;
    302310  int have_newline = 0;
    303311
     
    306314  char *cmd = alloca (strlen (argv) + 512), *p, *q;
    307315  char ifile[256], ofile[256], efile[256];
    308   char *comname = 0;
     316  int comnamelen;
    309317  char procname[100];
    310318  int in_string;
     
    315323  ofile[0] = 0;
    316324  efile[0] = 0;
     325  child->comname = NULL;
    317326
    318327  DB (DB_JOBS, ("child_execute_job (%s)\n", argv));
     
    384393            else
    385394              {
     395                if (*(p+1) == '>')
     396                  {
     397                    have_append = 1;
     398                    p += 1;
     399                  }
    386400                p = vms_redirect (&ofiledsc, ofile, p);
    387401              }
     
    482496        }
    483497
    484       outfile = open_tmpfile (&comname, "sys$scratch:CMDXXXXXX.COM");
     498      outfile = open_tmpfile (&child->comname, "sys$scratch:CMDXXXXXX.COM");
    485499      if (outfile == 0)
    486500        pfatal_with_name (_("fopen (temporary file)"));
     501      comnamelen = strlen (child->comname);
    487502
    488503      if (ifile[0])
     
    502517      if (ofile[0])
    503518        {
    504           fprintf (outfile, "$ define sys$output %s\n", ofile);
    505           DB (DB_JOBS, (_("Redirected output to %s\n"), ofile));
    506           ofiledsc.dsc$w_length = 0;
     519          if (have_append)
     520            {
     521              fprintf (outfile, "$ set noon\n");
     522              fprintf (outfile, "$ define sys$output %.*s\n", comnamelen-3, child->comname);
     523              DB (DB_JOBS, (_("Append output to %s\n"), ofile));
     524              ofiledsc.dsc$w_length = 0;
     525            }
     526          else
     527            {
     528              fprintf (outfile, "$ define sys$output %s\n", ofile);
     529              DB (DB_JOBS, (_("Redirected output to %s\n"), ofile));
     530              ofiledsc.dsc$w_length = 0;
     531            }
    507532        }
    508533
     
    559584        }
    560585
    561       fwrite (p, 1, q - p, outfile);
     586      if (*p)
     587        {
     588          fwrite (p, 1, --q - p, outfile);
    562589      fputc ('\n', outfile);
     590        }
     591
     592      if (have_append)
     593        {
     594          fprintf (outfile, "$ deassign sys$output ! 'f$verify(0)\n");
     595          fprintf (outfile, "$ append:=append\n");
     596          fprintf (outfile, "$ delete:=delete\n");
     597          fprintf (outfile, "$ append/new %.*s %s\n", comnamelen-3, child->comname, ofile);
     598          fprintf (outfile, "$ delete %.*s;*\n", comnamelen-3, child->comname);
     599          DB (DB_JOBS, (_("Append %.*s and cleanup\n"), comnamelen-3, child->comname));
     600        }
    563601
    564602      fclose (outfile);
    565603
    566       sprintf (cmd, "$ @%s", comname);
     604      sprintf (cmd, "$ @%s", child->comname);
    567605
    568606      DB (DB_JOBS, (_("Executing %s instead\n"), cmd));
     
    579617      status = lib$get_ef ((unsigned long *)&child->efn);
    580618      if (!(status & 1))
    581         return 0;
     619        {
     620          if (child->comname)
     621            {
     622              if (!ISDB (DB_JOBS))
     623                unlink (child->comname);
     624              free (child->comname);
     625            }
     626          return 0;
     627        }
    582628    }
    583629
     
    648694  if (status & 1)
    649695    {
    650       pidToAbort= child->pid;
    651696      status= sys$waitfr (child->efn);
    652       pidToAbort= 0;
    653697      vmsHandleChildTerm(child);
    654698    }
     
    678722    }
    679723
    680   if (comname && !ISDB (DB_JOBS))
    681     unlink (comname);
    682 
    683724  return (status & 1);
    684725}
Note: See TracChangeset for help on using the changeset viewer.