Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2001-09-15 04:47:44 +0400
committerChristopher Faylor <me@cgf.cx>2001-09-15 04:47:44 +0400
commit9661a0c8b7f59960d6d180ffa2872710f5253913 (patch)
tree08fad6a660efa6a0b678f417fcb826d02917aa76 /winsup/cygwin/how-signals-work.txt
parentbf0338856a38f856195d3d517fa5067357ed2f9d (diff)
* dcrt0.cc (dll_crt0_1): Create vfork main storage here so that it can be
queried in waitsig later. * sigproc.cc (wait_sig): Don't deliver a signal if in a vfork. * fork.cc (vfork): Deliver all signals on parent return from vfork.
Diffstat (limited to 'winsup/cygwin/how-signals-work.txt')
-rw-r--r--winsup/cygwin/how-signals-work.txt40
1 files changed, 26 insertions, 14 deletions
diff --git a/winsup/cygwin/how-signals-work.txt b/winsup/cygwin/how-signals-work.txt
index aaaea448a..ca1d8efd7 100644
--- a/winsup/cygwin/how-signals-work.txt
+++ b/winsup/cygwin/how-signals-work.txt
@@ -67,10 +67,10 @@ but not yet dispatched in the main thread. If the sigsave structure
seems to be "active", then a "pending" flag is set (see below) and the
function returns. Otherwise processing continues.
-After determining that sigsave is available, setup_handler will take
-one of two routes, depending on whether the main thread is executing
-in the cygwin DLL or is currently in "user" code. We'll discuss the
-cygwin DLL case first.
+After determining that sigsave is available, setup_handler will take one
+of two routes, depending on whether the main thread is executing in the
+cygwin DLL or is currently in "user" code. We'll discuss the cygwin DLL
+case first.
If sigsave seems to be available, then the frame information for the
main thread is inspected. This information is set by any cygwin
@@ -81,21 +81,33 @@ process. Any function which uses 'sigframe thisframe' should be signal
aware. It should detect when a signal has arrived and return
immediately.
-So, if mainframe is active, that means that we have good information about
-the state of the main thread. Cygwin uses the stack frame info from this
-structure to insert a call to the assembly language function 'sigdelayed'
-in place of the main thread's normal return address. So, when a call to
-(e.g.) _read returns after detecting a signal, it does not return to its
-caller. Rather, it returns to sigdelayed.
+So, if mainframe is active, that means that we have good information
+about the state of the main thread. Cygwin uses the stack frame info
+from this structure to insert a call to the assembly language function
+'sigdelayed' in place of the main thread's normal return address. So,
+when a call to (e.g.) _read returns after detecting a signal, it does
+not return to its caller. Rather, it returns to sigdelayed.
The sigdelayed function saves a lot of state on the stack and sets the
signal mask as appropriate for POSIX. It uses information from the
sigsave structure which has been filled in by interrupt_on_return, as
-called by setup_handler. sigdelayed pushes a "call" the function
+called by setup_handler. sigdelayed pushes a "call" to the function
"sigreturn" on the stack. This will be the return address seen by the
signal handler. After setting up the return value, modifying the signal
mask, and saving other information on the stack, sigreturn clears the
sigsave structure (so that setup_handler can use it) and jumps to the
-signal handler function.
-
-
+signal handler function. And, so a UNIX signal handler function is
+emulated.
+
+The signal handler function operates as normal for UNIX but, upon
+return, it does not go directly back to the return address of the
+original cygwin function. Instead it returns to the previously
+mentioned 'sigreturn' assembly language function.
+
+sigreturn resets the process mask to its state prior to calling the
+signal handler. It checks to see if any new signals have come in and
+calls the handler for them now, ensuring that the order of signal
+arrival is more or less maintained. It checks to see if a cygwin
+routine has set a special "restore this errno on returning from a
+signal" value and sets errno to this, if so. Finally, it restores all
+of the register values that were in effect when sigdelayed was called.