* cygheap.cc (cygheap_init): Allocate space for sigaction array in cygheap.
* cygheap.h (cygheap_types): Add HEAP_SIGS. * exceptions.cc (signal_fixup_after_exec): Remove from this file. * pinfo.h (pinfo::getsig): Just return global_sigs array. (pinfo::sigs): Delete. * sigproc.cc (signal_fixup_after_exec): Move it here. (global_sigs): New global array, moved from pinfo structure. (sigalloc): New function. Allocate global sigaction array here. (proc_subproc): Remove copysigs call. It's automatic now. * include/sys/cygwin.h (PID_NOCLDSTOP): New value. * signal.cc (sigaction): Set myself->PID_NODCLDSTOP when appropriate. * sigproc.h (sigalloc): Declare. * fnmatch.c (fnmatch): Use C90 parameters. (rangematch): Ditto. * fhandler.cc (fhandler_base::raw_read): Use right coercion to avoid a compiler warning.
This commit is contained in:
parent
40d885eb7b
commit
c0a9bffd03
|
@ -1,3 +1,25 @@
|
||||||
|
2003-08-31 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* cygheap.cc (cygheap_init): Allocate space for sigaction array in
|
||||||
|
cygheap.
|
||||||
|
* cygheap.h (cygheap_types): Add HEAP_SIGS.
|
||||||
|
* exceptions.cc (signal_fixup_after_exec): Remove from this file.
|
||||||
|
* pinfo.h (pinfo::getsig): Just return global_sigs array.
|
||||||
|
(pinfo::sigs): Delete.
|
||||||
|
* sigproc.cc (signal_fixup_after_exec): Move it here.
|
||||||
|
(global_sigs): New global array, moved from pinfo structure.
|
||||||
|
(sigalloc): New function. Allocate global sigaction array here.
|
||||||
|
(proc_subproc): Remove copysigs call. It's automatic now.
|
||||||
|
* include/sys/cygwin.h (PID_NOCLDSTOP): New value.
|
||||||
|
* signal.cc (sigaction): Set myself->PID_NODCLDSTOP when appropriate.
|
||||||
|
* sigproc.h (sigalloc): Declare.
|
||||||
|
|
||||||
|
* fnmatch.c (fnmatch): Use C90 parameters.
|
||||||
|
(rangematch): Ditto.
|
||||||
|
|
||||||
|
* fhandler.cc (fhandler_base::raw_read): Use right coercion to avoid a
|
||||||
|
compiler warning.
|
||||||
|
|
||||||
2003-08-31 Christopher Faylor <cgf@redhat.com>
|
2003-08-31 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* net.cc (dup_ent): Make debugging output consistent.
|
* net.cc (dup_ent): Make debugging output consistent.
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include "heap.h"
|
#include "heap.h"
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "shared_info.h"
|
#include "shared_info.h"
|
||||||
|
#include "sigproc.h"
|
||||||
|
|
||||||
init_cygheap NO_COPY *cygheap;
|
init_cygheap NO_COPY *cygheap;
|
||||||
void NO_COPY *cygheap_max;
|
void NO_COPY *cygheap_max;
|
||||||
|
@ -203,6 +204,8 @@ cygheap_init ()
|
||||||
}
|
}
|
||||||
if (!cygheap->fdtab)
|
if (!cygheap->fdtab)
|
||||||
cygheap->fdtab.init ();
|
cygheap->fdtab.init ();
|
||||||
|
if (!cygheap->sigs)
|
||||||
|
sigalloc ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Copyright (C) 1997, 2000 DJ Delorie */
|
/* Copyright (C) 1997, 2000 DJ Delorie */
|
||||||
|
|
|
@ -17,6 +17,7 @@ enum cygheap_types
|
||||||
HEAP_ARGV,
|
HEAP_ARGV,
|
||||||
HEAP_BUF,
|
HEAP_BUF,
|
||||||
HEAP_MOUNT,
|
HEAP_MOUNT,
|
||||||
|
HEAP_SIGS,
|
||||||
HEAP_1_START,
|
HEAP_1_START,
|
||||||
HEAP_1_STR,
|
HEAP_1_STR,
|
||||||
HEAP_1_ARGV,
|
HEAP_1_ARGV,
|
||||||
|
@ -255,6 +256,7 @@ struct init_cygheap
|
||||||
#ifdef DEBUGGING
|
#ifdef DEBUGGING
|
||||||
cygheap_debug debug;
|
cygheap_debug debug;
|
||||||
#endif
|
#endif
|
||||||
|
struct sigaction *sigs;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CYGHEAPSIZE (sizeof (init_cygheap) + (16000 * sizeof (fhandler_union)) + (5 * 65536))
|
#define CYGHEAPSIZE (sizeof (init_cygheap) + (16000 * sizeof (fhandler_union)) + (5 * 65536))
|
||||||
|
|
|
@ -731,18 +731,6 @@ signal_fixup_after_fork ()
|
||||||
sigproc_init ();
|
sigproc_init ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void __stdcall
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static int interrupt_on_return (sigthread *, int, void *, struct sigaction&) __attribute__((regparm(3)));
|
static int interrupt_on_return (sigthread *, int, void *, struct sigaction&) __attribute__((regparm(3)));
|
||||||
static int
|
static int
|
||||||
interrupt_on_return (sigthread *th, int sig, void *handler, struct sigaction& siga)
|
interrupt_on_return (sigthread *th, int sig, void *handler, struct sigaction& siga)
|
||||||
|
|
|
@ -264,7 +264,7 @@ fhandler_base::raw_read (void *ptr, size_t& ulen)
|
||||||
int prio = 0; /* ditto */
|
int prio = 0; /* ditto */
|
||||||
DWORD len = ulen;
|
DWORD len = ulen;
|
||||||
|
|
||||||
(ssize_t) ulen = -1;
|
ulen = (size_t) -1;
|
||||||
if (read_state)
|
if (read_state)
|
||||||
{
|
{
|
||||||
h = GetCurrentThread ();
|
h = GetCurrentThread ();
|
||||||
|
|
|
@ -92,7 +92,7 @@ enum
|
||||||
PID_SPLIT_HEAP = 0x0100, /* Set if the heap has been split, */
|
PID_SPLIT_HEAP = 0x0100, /* Set if the heap has been split, */
|
||||||
/* which means we can't fork again. */
|
/* which means we can't fork again. */
|
||||||
PID_MYSELF = 0x0200, /* Flag that pid is me. */
|
PID_MYSELF = 0x0200, /* Flag that pid is me. */
|
||||||
PID_UNUSED1 = 0x0400, /* Set if process uses Winsock. */
|
PID_NOCLDSTOP = 0x0400, /* Set if no SIGCHLD signal on stop. */
|
||||||
PID_INITIALIZING = 0x0800, /* Set until ready to receive signals. */
|
PID_INITIALIZING = 0x0800, /* Set until ready to receive signals. */
|
||||||
PID_USETTY = 0x1000, /* Setting this enables or disables cygwin's */
|
PID_USETTY = 0x1000, /* Setting this enables or disables cygwin's */
|
||||||
/* tty support. This is inherited by */
|
/* tty support. This is inherited by */
|
||||||
|
|
|
@ -66,9 +66,7 @@ static char rcsid[] = "$OpenBSD: fnmatch.c,v 1.7 2000/03/23 19:13:51 millert Exp
|
||||||
static int rangematch __P((const char *, char, int, char **));
|
static int rangematch __P((const char *, char, int, char **));
|
||||||
|
|
||||||
int
|
int
|
||||||
fnmatch(pattern, string, flags)
|
fnmatch(const char *pattern, const char *string, int flags)
|
||||||
const char *pattern, *string;
|
|
||||||
int flags;
|
|
||||||
{
|
{
|
||||||
const char *stringstart;
|
const char *stringstart;
|
||||||
char *newp;
|
char *newp;
|
||||||
|
@ -168,15 +166,7 @@ fnmatch(pattern, string, flags)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
#ifdef __STDC__
|
|
||||||
rangematch(const char *pattern, char test, int flags, char **newp)
|
rangematch(const char *pattern, char test, int flags, char **newp)
|
||||||
#else
|
|
||||||
rangematch(pattern, test, flags, newp)
|
|
||||||
char *pattern;
|
|
||||||
char test;
|
|
||||||
int flags;
|
|
||||||
char **newp;
|
|
||||||
#endif
|
|
||||||
{
|
{
|
||||||
int negate, ok;
|
int negate, ok;
|
||||||
char c, c2;
|
char c, c2;
|
||||||
|
|
|
@ -36,6 +36,8 @@ enum picom
|
||||||
PICOM_CMDLINE = 1
|
PICOM_CMDLINE = 1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
extern struct sigaction *global_sigs;
|
||||||
|
|
||||||
class _pinfo
|
class _pinfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -110,11 +112,9 @@ public:
|
||||||
|
|
||||||
inline struct sigaction& getsig (int sig)
|
inline struct sigaction& getsig (int sig)
|
||||||
{
|
{
|
||||||
return thread2signal ? thread2signal->sigs[sig] : sigs[sig];
|
return global_sigs[sig];
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void copysigs (_pinfo *p) {memcpy (sigs, p->sigs, sizeof (sigs));}
|
|
||||||
|
|
||||||
inline sigset_t& getsigmask ()
|
inline sigset_t& getsigmask ()
|
||||||
{
|
{
|
||||||
return thread2signal ? *thread2signal->sigmask : sig_mask;
|
return thread2signal ? *thread2signal->sigmask : sig_mask;
|
||||||
|
@ -143,7 +143,6 @@ public:
|
||||||
friend void __stdcall set_myself (pid_t, HANDLE);
|
friend void __stdcall set_myself (pid_t, HANDLE);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct sigaction sigs[NSIG];
|
|
||||||
sigset_t sig_mask; /* one set for everything to ignore. */
|
sigset_t sig_mask; /* one set for everything to ignore. */
|
||||||
LONG _sigtodo[NSIG + __SIGOFFSET];
|
LONG _sigtodo[NSIG + __SIGOFFSET];
|
||||||
pthread *thread2signal; // NULL means thread any other means a pthread
|
pthread *thread2signal; // NULL means thread any other means a pthread
|
||||||
|
|
|
@ -338,6 +338,12 @@ sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
|
||||||
if (newact->sa_handler == SIG_DFL && sig == SIGCHLD)
|
if (newact->sa_handler == SIG_DFL && sig == SIGCHLD)
|
||||||
sig_clear (sig);
|
sig_clear (sig);
|
||||||
set_sigcatchers (oa.sa_handler, newact->sa_handler);
|
set_sigcatchers (oa.sa_handler, newact->sa_handler);
|
||||||
|
if (sig == SIGCHLD)
|
||||||
|
{
|
||||||
|
myself->process_state &= ~PID_NOCLDSTOP;
|
||||||
|
if (newact->sa_flags & SA_NOCLDSTOP);
|
||||||
|
myself->process_state |= PID_NOCLDSTOP;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oldact)
|
if (oldact)
|
||||||
|
|
|
@ -17,6 +17,7 @@ details. */
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <sys/cygwin.h>
|
#include <sys/cygwin.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
#include <sys/signal.h>
|
||||||
#include "cygerrno.h"
|
#include "cygerrno.h"
|
||||||
#include "sync.h"
|
#include "sync.h"
|
||||||
#include "sigproc.h"
|
#include "sigproc.h"
|
||||||
|
@ -48,12 +49,35 @@ details. */
|
||||||
|
|
||||||
#define NZOMBIES 256
|
#define NZOMBIES 256
|
||||||
|
|
||||||
LONG local_sigtodo[TOTSIGS];
|
static LONG local_sigtodo[TOTSIGS];
|
||||||
inline LONG* getlocal_sigtodo (int sig)
|
struct sigaction *global_sigs;
|
||||||
|
|
||||||
|
inline LONG *
|
||||||
|
getlocal_sigtodo (int sig)
|
||||||
{
|
{
|
||||||
return local_sigtodo + __SIGOFFSET + sig;
|
return local_sigtodo + __SIGOFFSET + sig;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void __stdcall
|
||||||
|
sigalloc ()
|
||||||
|
{
|
||||||
|
cygheap->sigs = global_sigs =
|
||||||
|
(struct sigaction *) ccalloc (HEAP_SIGS, NSIG, sizeof (struct sigaction));
|
||||||
|
}
|
||||||
|
|
||||||
|
void __stdcall
|
||||||
|
signal_fixup_after_exec ()
|
||||||
|
{
|
||||||
|
global_sigs = cygheap->sigs;
|
||||||
|
/* 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 variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
@ -300,7 +324,6 @@ proc_subproc (DWORD what, DWORD val)
|
||||||
vchild->sid = myself->sid;
|
vchild->sid = myself->sid;
|
||||||
vchild->ctty = myself->ctty;
|
vchild->ctty = myself->ctty;
|
||||||
vchild->process_state |= PID_INITIALIZING | (myself->process_state & PID_USETTY);
|
vchild->process_state |= PID_INITIALIZING | (myself->process_state & PID_USETTY);
|
||||||
vchild->copysigs (myself);
|
|
||||||
|
|
||||||
sigproc_printf ("added pid %d to wait list, slot %d, winpid %p, handle %p",
|
sigproc_printf ("added pid %d to wait list, slot %d, winpid %p, handle %p",
|
||||||
vchild->pid, nchildren, vchild->dwProcessId,
|
vchild->pid, nchildren, vchild->dwProcessId,
|
||||||
|
|
|
@ -120,6 +120,7 @@ int __stdcall sig_send (_pinfo *, int, DWORD ebp = (DWORD) __builtin_frame_addre
|
||||||
void __stdcall signal_fixup_after_fork ();
|
void __stdcall signal_fixup_after_fork ();
|
||||||
void __stdcall signal_fixup_after_exec ();
|
void __stdcall signal_fixup_after_exec ();
|
||||||
void __stdcall wait_for_sigthread ();
|
void __stdcall wait_for_sigthread ();
|
||||||
|
void __stdcall sigalloc ();
|
||||||
|
|
||||||
extern char myself_nowait_dummy[];
|
extern char myself_nowait_dummy[];
|
||||||
extern char myself_nowait_nonmain_dummy[];
|
extern char myself_nowait_nonmain_dummy[];
|
||||||
|
|
Loading…
Reference in New Issue