This is the mail archive of the cygwin@sourceware.cygnus.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Signal handling for cygwin.dll


If You can figure out why this works, we're in business.

On my Win95 box.

I made the following changes to exceptions.cc after applying your Signal
handling patch.
this eliminated the segv.
start bash
press <CTRL> C untill your fingers get tired ;^)
start an app
press <CTRL> C once, you will get a message box popup BASH caused an
invalid page fault in module BASH.EXE at XXXX.XXX
<C>lose the message box the foreground app is dead, and the bash prompt
comes back!!!!!!!!!!!!!!!!!!

I realize that this messes up exception handling, so it is probably not a
good permanent solution.

PS. just eliminaging k++; and if(k == 13), dosen't work, it kills bash
immediatly.

if(sig == SIGINT)
  k++;

  if (k == 13)
  {
    /* We are going down - reset our inuse_p. */
    u->self->record_death();
    ExitProcess (0);
    }

  /* FIXME: The original version had code here to reinitialize the
exception
     handler under the guise of initializing thread exceptions.  It's not
     clear what this code was ever intended to do.  */

/*  debug_printf ("ctrl_c_handler: returning 1\n"); */
/*  return 1; */

debug_printf ("ctrl_c_handler: returning 0\n");
return 0;
}


----------
> From: Sergey Okhapkin <sos@prospect.com.ru>
> To: 'Gnu-Win32' <gnu-win32@cygnus.com>
> Cc: 'Geoffrey Noer' <noer@cygnus.com>
> Subject: Signal handling for cygwin.dll
> Date: Tuesday, April 01, 1997 5:09 AM
> 
> Hi!
> 
> This patch adds interprocess signals support with (almost :-) unix 
> semantics for cygwin.dll while running on Windows NT. The only supported 
> signal on Windows 95 is SIGKILL, because of Win32 API call 
> CreateRemoteThread() is not supported on W95, and I don't see any way to 
> implement signals without this call easy... This patch also includes my 
> "Ctrl-C in bash" patch. Any bug reports/improvements are welcome. To test

> this patch I've used the following simple program:
> 
> kill.c:
> #include <stdio.h>
> #include <stdlib.h>
> #include <signal.h>
> 
> static void 
> usage ();
> 
> int
> main (int ac, char **av)
> {
>   int i=1, sig=SIGKILL;
> 
>   if (ac 
> == 1)
>     usage ();
>   if (av[1][0] == '-') {
>     sig = -atoi(av[1]);
>  
>    i++;
>   }
>   for (; i < ac; ++i)
>     {
>       int pid = atoi (av[i]);
>  
>      printf ("Killing %d with %d\n", pid, sig);
>       kill(pid, sig);
>  
>    }
>   return 0;
> }
> 
> static void
> usage ()
> {
>   fprintf (stderr, "Usage: kill 
> [-SigNum] pid1 [pid2 ...]\n");
>   exit (1);
> }
> ------------------------
> BTW, prototype for kill() is missed in <signal.h>...
> 
> 
>  
> 
> --
> Sergey Okhapkin
> Moscow, Russia
> Looking for a job.
> 
> 
> -
> For help on using this list, send a message to
> "gnu-win32-request@cygnus.com" with one line of text: "help".
-
For help on using this list, send a message to
"gnu-win32-request@cygnus.com" with one line of text: "help".


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]