* 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>
+ * 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>
$(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
@ :
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--)
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)
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;
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. */
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)
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
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;
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);
return -1;
}
- struct sigaction oa = myself->getsig (sig);
+ struct sigaction oa = global_sigs[sig];
if (newact)
{
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)
/* 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;
}
}
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);
}
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;
}