mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-18 12:29:32 +08:00
* 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.
This commit is contained in:
parent
74d893b13c
commit
13584f077b
@ -1,3 +1,15 @@
|
||||
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.
|
||||
|
@ -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
|
||||
@ :
|
||||
|
@ -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. */
|
||||
|
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user