Cygwin: return full sigset_t from sig_send
So far sig_send's return type is int. The problem with this is that sig_send returns a sigset_t on __SIGPENDING, and sigset_t is defined as long type. So the function only returns the lower 32 bit of sigset_t, which is fine on 32 bit, but casts away the pending RT signals on 64 bit. Fix this by changing the return type of sig_send to sigset_t, so as not to narrow down the sigset when returning from handling __SIGPENDING. Make sure to cast correctly in all invocations of sig_send. Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
		| @@ -422,7 +422,7 @@ _cygtls::remove_pending_sigs () | ||||
| extern "C" int | ||||
| sigpending (sigset_t *mask) | ||||
| { | ||||
|   sigset_t outset = (sigset_t) sig_send (myself, __SIGPENDING, &_my_tls); | ||||
|   sigset_t outset = sig_send (myself, __SIGPENDING, &_my_tls); | ||||
|   if (outset == SIG_BAD_MASK) | ||||
|     return -1; | ||||
|   *mask = outset; | ||||
| @@ -503,7 +503,7 @@ exit_thread (DWORD res) | ||||
|   ExitThread (res); | ||||
| } | ||||
|  | ||||
| int __reg3 | ||||
| sigset_t __reg3 | ||||
| sig_send (_pinfo *p, int sig, _cygtls *tls) | ||||
| { | ||||
|   siginfo_t si = {}; | ||||
| @@ -516,7 +516,7 @@ sig_send (_pinfo *p, int sig, _cygtls *tls) | ||||
|    If pinfo *p == NULL, send to the current process. | ||||
|    If sending to this process, wait for notification that a signal has | ||||
|    completed before returning.  */ | ||||
| int __reg3 | ||||
| sigset_t __reg3 | ||||
| sig_send (_pinfo *p, siginfo_t& si, _cygtls *tls) | ||||
| { | ||||
|   int rc = 1; | ||||
| @@ -748,7 +748,7 @@ out: | ||||
|   if (si.si_signo != __SIGPENDING) | ||||
|     /* nothing */; | ||||
|   else if (!rc) | ||||
|     rc = (int) pending; | ||||
|     rc = pending; | ||||
|   else | ||||
|     rc = SIG_BAD_MASK; | ||||
|   sigproc_printf ("returning %p from sending signal %d", rc, si.si_signo); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user