Commit Graph

7 Commits

Author SHA1 Message Date
Corinna Vinschen 948d40e482 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>
2019-07-12 17:27:26 +02:00
Corinna Vinschen 7f983079d4 Cygwin: timerfd/signalfd: return EINVAL from write
Linux returns EINVAL, "fd is attached to an object which is unsuitable
for writing".  If we don't handle write locally, write returns EBADF.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-17 11:51:11 +01:00
Corinna Vinschen b6f53617a7 Cygwin: signalfd: set st_mode in fhandler_signalfd::fstat
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-15 21:49:52 +01:00
Corinna Vinschen 9b2318c428 Cygwin: signalfd: fix comment
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-15 21:46:23 +01:00
Corinna Vinschen 704068e4f9 Cygwin: signalfd: drop incorrect handling of EINTR in read(2)
In case sigwait_common returns EINTR, read wrongly ignores it,
so read can't be interrupt by a signal.  Fix that.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-15 09:58:30 +01:00
Corinna Vinschen f42776fa78 Cygwin: signalfd: implement non-polling select
Allow the signal thread to recognize we're called in consequence of
select on a signalfd.  If the signal is part of the wait mask, don't
call any signal handler and don't remove the signal from the queue,
so a subsequent read (or sigwaitinfo/sigtimedwait) still gets the
signal.  Instead, just signal the event object at
_cygtls::signalfd_select_wait for the thread running select.

The addition of signalfd_select_wait to _cygtls unearthed the alignment
problem of the context member again.  To make sure this doesn't get lost,
improve the related comment in the header file so that this (hopefully)
doesn't get lost (again).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-14 17:19:37 +01:00
Corinna Vinschen 9d13a2995c Cygwin: signal: implement signalfd
First cut of a signalfd implementation.

Still TODO: Non-polling select.

This should mostly work as on Linux except for missing support
for some members of struct signalfd_siginfo, namely ssi_fd,
ssi_band (both SIGIO/SIGPOLL, not fully implemented) and ssi_trapno
(HW exception, required HW support).

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2019-01-13 23:13:33 +01:00