aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2003-11-28 22:13:57 +0000
committerChristopher Faylor <me@cgf.cx>2003-11-28 22:13:57 +0000
commit13584f077b708083b9e1cba78ff580c7bae6130e (patch)
tree51b7e9b3c173d1e5234af8b57413814501589f07
parent74d893b13cb75408ec3ffe2b399787b9b78fa979 (diff)
downloadnewlib-13584f077b708083b9e1cba78ff580c7bae6130e.zip
newlib-13584f077b708083b9e1cba78ff580c7bae6130e.tar.gz
newlib-13584f077b708083b9e1cba78ff580c7bae6130e.tar.bz2
* pinfo.h (_pinfo::getsig): Remove obsolete function, here and throughout.
* exceptions.cc: Ditto. * fhandler_termios.cc: Ditto. * signal.cc: Ditto. * sigproc.cc: Ditto. * Makefile.in: Revert previous change which made a cygwin.din newer than a version.h a warning rather than an error.
-rw-r--r--winsup/cygwin/ChangeLog12
-rw-r--r--winsup/cygwin/Makefile.in4
-rw-r--r--winsup/cygwin/exceptions.cc16
-rw-r--r--winsup/cygwin/fhandler_termios.cc2
-rw-r--r--winsup/cygwin/how-signals-work.txt19
-rw-r--r--winsup/cygwin/pinfo.h5
-rw-r--r--winsup/cygwin/signal.cc12
-rw-r--r--winsup/cygwin/sigproc.cc10
8 files changed, 36 insertions, 44 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index c1d5c82..7d4abb4 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,17 @@
2003-11-28 Christopher Faylor <cgf@redhat.com>
+ * pinfo.h (_pinfo::getsig): Remove obsolete function, here and
+ throughout.
+ * exceptions.cc: Ditto.
+ * fhandler_termios.cc: Ditto.
+ * signal.cc: Ditto.
+ * sigproc.cc: Ditto.
+
+ * Makefile.in: Revert previous change which made a cygwin.din newer
+ than a version.h a warning rather than an error.
+
+2003-11-28 Christopher Faylor <cgf@redhat.com>
+
* cygwin.din: Re-add inexplicably missing semaphore/msg functions.
2003-11-28 Christopher Faylor <cgf@redhat.com>
diff --git a/winsup/cygwin/Makefile.in b/winsup/cygwin/Makefile.in
index e285d0b..ed5247a 100644
--- a/winsup/cygwin/Makefile.in
+++ b/winsup/cygwin/Makefile.in
@@ -375,8 +375,8 @@ $(LIBGMON_A): $(GMON_OFILES) $(GMON_START)
$(AR) rcv $(LIBGMON_A) $(GMON_OFILES)
$(API_VER): $(srcdir)/cygwin.din
- @echo Error: Version info is older than DLL API!
-# @false
+ @echo Error: Version info is older than DLL API!;\
+ false
version.cc winver.o: winver_stamp
@ :
diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index a15e761..059b570 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -547,11 +547,11 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
debug_printf ("In cygwin_except_handler exc %p at %p sp %p", e.ExceptionCode, in.Eip, in.Esp);
debug_printf ("In cygwin_except_handler sig = %d at %p", sig, in.Eip);
- if (myself->getsig (sig).sa_mask & SIGTOMASK (sig))
- syscall_printf ("signal %d, masked %p", sig, myself->getsig (sig).sa_mask);
+ if (global_sigs[sig].sa_mask & SIGTOMASK (sig))
+ syscall_printf ("signal %d, masked %p", sig, global_sigs[sig].sa_mask);
debug_printf ("In cygwin_except_handler calling %p",
- myself->getsig (sig).sa_handler);
+ global_sigs[sig].sa_handler);
DWORD *ebp = (DWORD *)in.Esp;
for (DWORD *bpend = (DWORD *) __builtin_frame_address (0); ebp > bpend; ebp--)
@@ -563,9 +563,9 @@ handle_exceptions (EXCEPTION_RECORD *e0, void *frame, CONTEXT *in0, void *)
if (!myself->progname[0]
|| GetCurrentThreadId () == sigtid
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_DFL
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_IGN
- || (void *) myself->getsig (sig).sa_handler == (void *) SIG_ERR)
+ || (void *) global_sigs[sig].sa_handler == (void *) SIG_DFL
+ || (void *) global_sigs[sig].sa_handler == (void *) SIG_IGN
+ || (void *) global_sigs[sig].sa_handler == (void *) SIG_ERR)
{
/* Print the exception to the console */
if (1)
@@ -1010,7 +1010,7 @@ sig_handle (int sig, sigset_t mask, int pid, _threadinfo *tls)
sig_clear (SIGCONT);
sigproc_printf ("signal %d processing", sig);
- struct sigaction thissig = myself->getsig (sig);
+ struct sigaction thissig = global_sigs[sig];
void *handler;
handler = (void *) thissig.sa_handler;
@@ -1061,7 +1061,7 @@ stop:
if (ISSTATE (myself, PID_STOPPED))
goto done;
handler = (void *) sig_handle_tty_stop;
- thissig = myself->getsig (SIGSTOP);
+ thissig = global_sigs[SIGSTOP];
dosig:
/* Dispatch to the appropriate function. */
diff --git a/winsup/cygwin/fhandler_termios.cc b/winsup/cygwin/fhandler_termios.cc
index ddf20ae..1b509e2 100644
--- a/winsup/cygwin/fhandler_termios.cc
+++ b/winsup/cygwin/fhandler_termios.cc
@@ -155,7 +155,7 @@ fhandler_termios::bg_check (int sig)
return with error */
int pgid_gone = !pid_exists (myself->pgid);
int sigs_ignored =
- ((void *) myself->getsig (sig).sa_handler == (void *) SIG_IGN) ||
+ ((void *) global_sigs[sig].sa_handler == (void *) SIG_IGN) ||
(myself->getsigmask () & SIGTOMASK (sig));
if (pgid_gone)
diff --git a/winsup/cygwin/how-signals-work.txt b/winsup/cygwin/how-signals-work.txt
index aab65f6..b890e31 100644
--- a/winsup/cygwin/how-signals-work.txt
+++ b/winsup/cygwin/how-signals-work.txt
@@ -1,25 +1,10 @@
Copyright 2001 Red Hat Inc., Christopher Faylor
-[this information is currently obsolete -- sorry]
How do signals work?
On process startup, cygwin starts a secondary thread that deals with signals.
-This thread contains a loop which blocks waiting for one of three events:
-
-1) sigcatch_main - a semaphore which, when incremented, indicates that a
- signal may be available for the main thread. The caller waits for the
- signal to be delivered before returning.
-
-2) sigcatch_nonmain - a semaphore which , when incremented, indicates that
- a signal is available for a non-main thread (currently this is not truly
- implemented). The caller waits for the signal to be delivered before
- returning.
-
-3) sigcatch_nosync - a semaphore which, when incremented, indicates that
- a signal may be available for the main thread. The caller does not wait
- for the delivery of the signal before returning.
-
-So, the signal handler blocks waiting for one of these three semaphores.
+This thread contains a loop which blocks waiting for information to show up
+on a pipe whose handle (sendsig) is currently stored in _pinfo (this may change).
If one of these is activated, then the the signal handler inspects an
array of integers looking for a non-zero value. The array corresponds
diff --git a/winsup/cygwin/pinfo.h b/winsup/cygwin/pinfo.h
index 573e050..b2e8af3 100644
--- a/winsup/cygwin/pinfo.h
+++ b/winsup/cygwin/pinfo.h
@@ -104,11 +104,6 @@ public:
inline void set_has_pgid_children (bool val) {has_pgid_children = val;}
- inline struct sigaction& getsig (int sig)
- {
- return global_sigs[sig];
- }
-
inline sigset_t& getsigmask ()
{
return sig_mask;
diff --git a/winsup/cygwin/signal.cc b/winsup/cygwin/signal.cc
index 9bf9eb0..311e730 100644
--- a/winsup/cygwin/signal.cc
+++ b/winsup/cygwin/signal.cc
@@ -56,12 +56,12 @@ signal (int sig, _sig_func_ptr func)
return (_sig_func_ptr) SIG_ERR;
}
- prev = myself->getsig (sig).sa_handler;
- myself->getsig (sig).sa_handler = func;
- myself->getsig (sig).sa_mask = 0;
+ prev = global_sigs[sig].sa_handler;
+ global_sigs[sig].sa_handler = func;
+ global_sigs[sig].sa_mask = 0;
/* SA_RESTART is set to maintain BSD compatible signal behaviour by default.
This is also compatible with the behaviour of signal(2) in Linux. */
- myself->getsig (sig).sa_flags |= SA_RESTART;
+ global_sigs[sig].sa_flags |= SA_RESTART;
set_sigcatchers (prev, func);
syscall_printf ("%p = signal (%d, %p)", prev, sig, func);
@@ -332,7 +332,7 @@ sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
return -1;
}
- struct sigaction oa = myself->getsig (sig);
+ struct sigaction oa = global_sigs[sig];
if (newact)
{
@@ -341,7 +341,7 @@ sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
set_errno (EINVAL);
return -1;
}
- myself->getsig (sig) = *newact;
+ global_sigs[sig] = *newact;
if (newact->sa_handler == SIG_IGN)
sig_clear (sig);
if (newact->sa_handler == SIG_DFL && sig == SIGCHLD)
diff --git a/winsup/cygwin/sigproc.cc b/winsup/cygwin/sigproc.cc
index 9840004..0aeb4d8 100644
--- a/winsup/cygwin/sigproc.cc
+++ b/winsup/cygwin/sigproc.cc
@@ -98,9 +98,9 @@ signal_fixup_after_exec ()
/* Set up child's signal handlers */
for (int i = 0; i < NSIG; i++)
{
- myself->getsig (i).sa_mask = 0;
- if (myself->getsig (i).sa_handler != SIG_IGN)
- myself->getsig (i).sa_handler = SIG_DFL;
+ global_sigs[i].sa_mask = 0;
+ if (global_sigs[i].sa_handler != SIG_IGN)
+ global_sigs[i].sa_handler = SIG_DFL;
}
}
@@ -381,7 +381,7 @@ proc_subproc (DWORD what, DWORD val)
remove the process and move on. Otherwise, this process becomes a zombie
which must be reaped by a wait() call. */
if (nzombies >= NZOMBIES
- || myself->getsig (SIGCHLD).sa_handler == (void *) SIG_IGN)
+ || global_sigs[SIGCHLD].sa_handler == (void *) SIG_IGN)
{
sigproc_printf ("automatically removing zombie %d", thiszombie);
remove_zombie (thiszombie);
@@ -616,7 +616,7 @@ sigproc_init ()
}
memset (w, 0, sizeof *w); // Just to be safe
- myself->getsig (SIGSTOP).sa_flags = SA_RESTART | SA_NODEFER;
+ global_sigs[SIGSTOP].sa_flags = SA_RESTART | SA_NODEFER;
sigproc_printf ("process/signal handling enabled(%x)", myself->process_state);
return;
}