Changeset bdda8c2 in git for Singular/cntrlc.cc


Ignore:
Timestamp:
Apr 9, 2013, 4:39:42 PM (11 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'fieker-DuVal', '117eb8c30fc9e991c4decca4832b1d19036c4c65')(u'spielwiese', 'b52fc4b2495505785981d640dcf7eb3e456778ef')
Children:
2d5ff537ab672bcbb2ca73df6830672f38b1ea63
Parents:
bc0d32def5d3461a77eed40c1e1a3d254811858a
Message:
add: handling signals in system calls, p2
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Singular/cntrlc.cc

    rbc0d32 rbdda8c2  
    143143     fprintf(stderr, "Unable to init signal %d ... exiting...\n", sig);
    144144  }
    145 #ifdef HAVE_SIGINTERRUPT
    146   siginterrupt(sig, 0);
     145  si_siginterrupt(sig, 0);
    147146  /*system calls will be restarted if interrupted by  the  specified
    148147   * signal sig.  This is the default behavior in Linux.
    149148   */
    150 #endif
    151149#else
    152150  struct sigaction new_action,old_action;
     
    159157    new_action.sa_flags = SA_RESTART;
    160158
    161   int r=sigaction (sig, &new_action, &old_action);
     159  int r=si_sigaction (sig, &new_action, &old_action);
    162160  si_hdl_typ retval=(si_hdl_typ)old_action.sa_handler;
    163161  if (r == -1)
     
    503501  if (pid == 0)
    504502  {
    505     close (0); dup2 (in_fd[0],0);   /* set the stdin to the in pipe */
    506     close (1); dup2 (out_fd[1],1);  /* set the stdout to the out pipe */
    507     close (2); dup2 (out_fd[1],2);  /* set the stderr to the out pipe */
     503    si_close (0); si_dup2 (in_fd[0],0);   /* set the stdin to the in pipe */
     504    si_close (1); si_dup2 (out_fd[1],1);  /* set the stdout to the out pipe */
     505    si_close (2); si_dup2 (out_fd[1],2);  /* set the stderr to the out pipe */
    508506
    509507    execvp (args[0], args);      /* exec gdb */
     
    520518  FD_SET (out_fd[0], &fdset);
    521519
    522   write (in_fd[1], "backtrace\n", 10);
    523   write (in_fd[1], "p si_stop_stack_trace_x = 0\n", 28);
    524   write (in_fd[1], "quit\n", 5);
     520  si_write (in_fd[1], "backtrace\n", 10);
     521  si_write (in_fd[1], "p si_stop_stack_trace_x = 0\n", 28);
     522  si_write (in_fd[1], "quit\n", 5);
    525523
    526524  index = 0;
     
    533531    tv.tv_usec = 0;
    534532
    535     sel = select (FD_SETSIZE, &readset, NULL, NULL, &tv);
     533    sel = si_select (FD_SETSIZE, &readset, NULL, NULL, &tv);
    536534    if (sel == -1)
    537535      break;
     
    539537    if ((sel > 0) && (FD_ISSET (out_fd[0], &readset)))
    540538    {
    541       if (read (out_fd[0], &c, 1))
     539      if (si_read (out_fd[0], &c, 1))
    542540      {
    543541        switch (state)
     
    570568  }
    571569
    572   close (in_fd[0]);
    573   close (in_fd[1]);
    574   close (out_fd[0]);
    575   close (out_fd[1]);
     570  si_close (in_fd[0]);
     571  si_close (in_fd[1]);
     572  si_close (out_fd[0]);
     573  si_close (out_fd[1]);
    576574  m2_end(0);
    577575}
Note: See TracChangeset for help on using the changeset viewer.