[PATCH 3/3] Add cygwin_internal() operation to convert siginfo_t * to EXCEPTION_RECORD *

Corinna Vinschen corinna-cygwin@cygwin.com
Tue Mar 31 19:11:00 GMT 2015


On Mar 31 18:46, Jon TURNEY wrote:
> 	* external.cc (cygwin_internal): Add operation to convert
> 	siginfo_t * to EXCEPTION_RECORD *.
> 	* include/sys/cygwin.h (cygwin_getinfo_types): Ditto.
> 	* exception.h (cygwin_exception): Add exception_record accessor.


> diff --git a/winsup/cygwin/external.cc b/winsup/cygwin/external.cc
> index 5fac4bb..3c6bab2 100644
> --- a/winsup/cygwin/external.cc
> +++ b/winsup/cygwin/external.cc
> @@ -27,6 +27,7 @@ details. */
>  #include "environ.h"
>  #include "cygserver_setpwd.h"
>  #include "pwdgrp.h"
> +#include "exception.h"
>  #include <unistd.h>
>  #include <stdlib.h>
>  #include <wchar.h>
> @@ -688,6 +689,18 @@ cygwin_internal (cygwin_getinfo_types t, ...)
>  	res = 0;
>  	break;
>  
> +      case CW_EXCEPTION_RECORD_FROM_SIGINFO_T:
> +	{
> +	  siginfo_t *si = va_arg(arg, siginfo_t *);
> +	  res = 0;
> +	  if (si && si->si_cyg)
> +	    {
> +	      EXCEPTION_RECORD *er = ((cygwin_exception *)si->si_cyg)->exception_record();
> +	      res = (uintptr_t)er;
> +	    }
> +	}
> +	break;

I would prefer if CW_EXCEPTION_RECORD_FROM_SIGINFO_T takes a buffer
address as additional parameter and then memcpy's the EXCEPTION_RECORD
over to this address.  This decouples the EXCEPTION_RECORDs in Cygwin
from the one in the application and no side is huffy if the other side
changes the contents.

> diff --git a/winsup/cygwin/include/sys/cygwin.h b/winsup/cygwin/include/sys/cygwin.h
> index edfcc56..13f9866 100644
> --- a/winsup/cygwin/include/sys/cygwin.h
> +++ b/winsup/cygwin/include/sys/cygwin.h
> @@ -1,3 +1,4 @@
> +
>  /* sys/cygwin.h
>  
>     Copyright 1997, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
> @@ -153,7 +154,8 @@ typedef enum
>      CW_CYGNAME_FROM_WINNAME,
>      CW_FIXED_ATEXIT,
>      CW_GETNSS_PWD_SRC,
> -    CW_GETNSS_GRP_SRC
> +    CW_GETNSS_GRP_SRC,
> +    CW_EXCEPTION_RECORD_FROM_SIGINFO_T,
>    } cygwin_getinfo_types;
>  
>  #define CW_LOCK_PINFO CW_LOCK_PINFO

There's a

#define CW_EXCEPTION_RECORD_FROM_SIGINFO_T CW_EXCEPTION_RECORD_FROM_SIGINFO_T

missing here.  With these changes, ok to apply.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin-patches/attachments/20150331/be422a1a/attachment.sig>


More information about the Cygwin-patches mailing list