* path.cc (normalize_posix_path): Reorganize to short circuit to DOS path
handling whenever a '\' is detected. * signal.cc (sigaction): Make strace output more informative. * sigproc.cc (pending_signals::add): Just index directly into signal array rather than treating the array as a heap. (pending_signals::del): Ditto. (wait_sig): Don't send signal if we already have a similar signal queued. * sigproc.h (call_signal_handler_now): Remove obsolete declaration.
This commit is contained in:
parent
3ca0d9b613
commit
474048c26e
|
@ -1,3 +1,16 @@
|
||||||
|
2004-03-25 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* path.cc (normalize_posix_path): Reorganize to short circuit to DOS
|
||||||
|
path handling whenever a '\' is detected.
|
||||||
|
|
||||||
|
* signal.cc (sigaction): Make strace output more informative.
|
||||||
|
* sigproc.cc (pending_signals::add): Just index directly into signal
|
||||||
|
array rather than treating the array as a heap.
|
||||||
|
(pending_signals::del): Ditto.
|
||||||
|
(wait_sig): Don't send signal if we already have a similar signal
|
||||||
|
queued.
|
||||||
|
* sigproc.h (call_signal_handler_now): Remove obsolete declaration.
|
||||||
|
|
||||||
2004-03-23 Gerd Spalink <Gerd.Spalink@t-online.de>
|
2004-03-23 Gerd Spalink <Gerd.Spalink@t-online.de>
|
||||||
|
|
||||||
* fhandler_dsp.cc (fhandler_dev_dsp::write): Remove type
|
* fhandler_dsp.cc (fhandler_dev_dsp::write): Remove type
|
||||||
|
|
|
@ -188,7 +188,6 @@ pathmatch (const char *path1, const char *path2)
|
||||||
#define isslash(c) ((c) == '/')
|
#define isslash(c) ((c) == '/')
|
||||||
|
|
||||||
/* Normalize a POSIX path.
|
/* Normalize a POSIX path.
|
||||||
\'s are converted to /'s in the process.
|
|
||||||
All duplicate /'s, except for 2 leading /'s, are deleted.
|
All duplicate /'s, except for 2 leading /'s, are deleted.
|
||||||
The result is 0 for success, or an errno error value. */
|
The result is 0 for success, or an errno error value. */
|
||||||
|
|
||||||
|
@ -200,14 +199,11 @@ normalize_posix_path (const char *src, char *dst)
|
||||||
|
|
||||||
syscall_printf ("src %s", src);
|
syscall_printf ("src %s", src);
|
||||||
|
|
||||||
|
const char *in_src = src;
|
||||||
|
char *in_dst = dst;
|
||||||
|
|
||||||
if (isdrive (src) || slash_unc_prefix_p (src))
|
if (isdrive (src) || slash_unc_prefix_p (src))
|
||||||
{
|
goto win32_path;
|
||||||
int err = normalize_win32_path (src, dst);
|
|
||||||
if (!err)
|
|
||||||
for (char *p = dst; (p = strchr (p, '\\')); p++)
|
|
||||||
*p = '/';
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isslash (src[0]))
|
if (!isslash (src[0]))
|
||||||
{
|
{
|
||||||
|
@ -247,6 +243,8 @@ normalize_posix_path (const char *src, char *dst)
|
||||||
|
|
||||||
while (*src)
|
while (*src)
|
||||||
{
|
{
|
||||||
|
if (*src == '\\')
|
||||||
|
goto win32_path;
|
||||||
/* Strip runs of /'s. */
|
/* Strip runs of /'s. */
|
||||||
if (!isslash (*src))
|
if (!isslash (*src))
|
||||||
*dst++ = *src++;
|
*dst++ = *src++;
|
||||||
|
@ -309,6 +307,13 @@ done:
|
||||||
|
|
||||||
debug_printf ("%s = normalize_posix_path (%s)", dst_start, src_start);
|
debug_printf ("%s = normalize_posix_path (%s)", dst_start, src_start);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
win32_path:
|
||||||
|
int err = normalize_win32_path (in_src, in_dst);
|
||||||
|
if (!err)
|
||||||
|
for (char *p = in_dst; (p = strchr (p, '\\')); p++)
|
||||||
|
*p = '/';
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
|
|
|
@ -349,17 +349,22 @@ extern "C" int
|
||||||
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
|
sigaction (int sig, const struct sigaction *newact, struct sigaction *oldact)
|
||||||
{
|
{
|
||||||
sig_dispatch_pending ();
|
sig_dispatch_pending ();
|
||||||
sigproc_printf ("signal %d, newact %p, oldact %p", sig, newact, oldact);
|
|
||||||
/* check that sig is in right range */
|
/* check that sig is in right range */
|
||||||
if (sig < 0 || sig >= NSIG)
|
if (sig < 0 || sig >= NSIG)
|
||||||
{
|
{
|
||||||
set_errno (EINVAL);
|
set_errno (EINVAL);
|
||||||
|
sigproc_printf ("signal %d, newact %p, oldact %p", sig, newact, oldact);
|
||||||
syscall_printf ("SIG_ERR = sigaction signal %d out of range", sig);
|
syscall_printf ("SIG_ERR = sigaction signal %d out of range", sig);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct sigaction oa = global_sigs[sig];
|
struct sigaction oa = global_sigs[sig];
|
||||||
|
|
||||||
|
if (newact)
|
||||||
|
sigproc_printf ("signal %d, newact %p (handler %p), oa %p", sig, newact, newact->sa_handler, oa, oa.sa_handler);
|
||||||
|
else
|
||||||
|
sigproc_printf ("signal %d, newact %p, oa %p", sig, newact, oa, oa.sa_handler);
|
||||||
|
|
||||||
if (newact)
|
if (newact)
|
||||||
{
|
{
|
||||||
if (sig == SIGKILL || sig == SIGSTOP)
|
if (sig == SIGKILL || sig == SIGSTOP)
|
||||||
|
|
|
@ -48,31 +48,11 @@ details. */
|
||||||
|
|
||||||
#define NZOMBIES 256
|
#define NZOMBIES 256
|
||||||
|
|
||||||
class pending_signals
|
|
||||||
{
|
|
||||||
sigpacket sigs[NSIG + 1];
|
|
||||||
sigpacket start;
|
|
||||||
sigpacket *end;
|
|
||||||
sigpacket *prev;
|
|
||||||
sigpacket *curr;
|
|
||||||
int empty;
|
|
||||||
public:
|
|
||||||
void reset () {curr = &start; prev = &start;}
|
|
||||||
void add (sigpacket&);
|
|
||||||
void del ();
|
|
||||||
sigpacket *next ();
|
|
||||||
sigpacket *save () const {return curr;}
|
|
||||||
void restore (sigpacket *saved) {curr = saved;}
|
|
||||||
friend void __stdcall sig_dispatch_pending (bool);
|
|
||||||
};
|
|
||||||
|
|
||||||
static pending_signals sigq;
|
|
||||||
|
|
||||||
struct sigaction *global_sigs;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global variables
|
* Global variables
|
||||||
*/
|
*/
|
||||||
|
struct sigaction *global_sigs;
|
||||||
|
|
||||||
const char *__sp_fn ;
|
const char *__sp_fn ;
|
||||||
int __sp_ln;
|
int __sp_ln;
|
||||||
|
|
||||||
|
@ -114,15 +94,37 @@ muto NO_COPY *sync_proc_subproc = NULL; // Control access to subproc stuff
|
||||||
|
|
||||||
DWORD NO_COPY sigtid = 0; // ID of the signal thread
|
DWORD NO_COPY sigtid = 0; // ID of the signal thread
|
||||||
|
|
||||||
/* Functions
|
/* Function declarations */
|
||||||
*/
|
|
||||||
static int __stdcall checkstate (waitq *) __attribute__ ((regparm (1)));
|
static int __stdcall checkstate (waitq *) __attribute__ ((regparm (1)));
|
||||||
static __inline__ bool get_proc_lock (DWORD, DWORD);
|
static __inline__ bool get_proc_lock (DWORD, DWORD);
|
||||||
static void __stdcall remove_zombie (int);
|
static void __stdcall remove_zombie (int);
|
||||||
static DWORD WINAPI wait_sig (VOID *arg);
|
|
||||||
static int __stdcall stopped_or_terminated (waitq *, _pinfo *);
|
static int __stdcall stopped_or_terminated (waitq *, _pinfo *);
|
||||||
static DWORD WINAPI wait_subproc (VOID *);
|
static DWORD WINAPI wait_subproc (VOID *);
|
||||||
|
static DWORD WINAPI wait_sig (VOID *arg);
|
||||||
|
|
||||||
|
/* wait_sig bookkeeping */
|
||||||
|
|
||||||
|
class pending_signals
|
||||||
|
{
|
||||||
|
sigpacket sigs[NSIG + 1];
|
||||||
|
sigpacket start;
|
||||||
|
sigpacket *end;
|
||||||
|
sigpacket *prev;
|
||||||
|
sigpacket *curr;
|
||||||
|
public:
|
||||||
|
void reset () {curr = &start; prev = &start;}
|
||||||
|
void add (sigpacket&);
|
||||||
|
void del ();
|
||||||
|
sigpacket *next ();
|
||||||
|
sigpacket *save () const {return curr;}
|
||||||
|
void restore (sigpacket *saved) {curr = saved;}
|
||||||
|
friend void __stdcall sig_dispatch_pending (bool);
|
||||||
|
friend DWORD WINAPI wait_sig (VOID *arg);
|
||||||
|
};
|
||||||
|
|
||||||
|
static pending_signals sigq;
|
||||||
|
|
||||||
|
/* Functions */
|
||||||
void __stdcall
|
void __stdcall
|
||||||
sigalloc ()
|
sigalloc ()
|
||||||
{
|
{
|
||||||
|
@ -1012,25 +1014,13 @@ talktome ()
|
||||||
pids[i]->commune_recv ();
|
pids[i]->commune_recv ();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Process signals by waiting for a semaphore to become signaled.
|
|
||||||
Then scan an in-memory array representing queued signals.
|
|
||||||
Executes in a separate thread.
|
|
||||||
|
|
||||||
Signals sent from this process are sent a completion signal so
|
|
||||||
that returns from kill/raise do not occur until the signal has
|
|
||||||
has been handled, as per POSIX. */
|
|
||||||
|
|
||||||
void
|
void
|
||||||
pending_signals::add (sigpacket& pack)
|
pending_signals::add (sigpacket& pack)
|
||||||
{
|
{
|
||||||
sigpacket *se;
|
sigpacket *se;
|
||||||
for (se = start.next; se; se = se->next)
|
if (sigs[pack.si.si_signo].si.si_signo)
|
||||||
if (se->si.si_signo == pack.si.si_signo)
|
|
||||||
return;
|
return;
|
||||||
while (sigs[empty].si.si_signo)
|
se = sigs + pack.si.si_signo;
|
||||||
if (++empty == NSIG)
|
|
||||||
empty = 0;
|
|
||||||
se = sigs + empty;
|
|
||||||
*se = pack;
|
*se = pack;
|
||||||
se->mask = &myself->getsigmask ();
|
se->mask = &myself->getsigmask ();
|
||||||
se->next = NULL;
|
se->next = NULL;
|
||||||
|
@ -1039,7 +1029,6 @@ pending_signals::add (sigpacket& pack)
|
||||||
end = se;
|
end = se;
|
||||||
if (!start.next)
|
if (!start.next)
|
||||||
start.next = se;
|
start.next = se;
|
||||||
empty++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -1053,7 +1042,6 @@ pending_signals::del ()
|
||||||
#endif
|
#endif
|
||||||
if (end == curr)
|
if (end == curr)
|
||||||
end = prev;
|
end = prev;
|
||||||
empty = curr - sigs;
|
|
||||||
curr = next;
|
curr = next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1174,7 +1162,7 @@ wait_sig (VOID *self)
|
||||||
default:
|
default:
|
||||||
if (pack.si.si_signo < 0)
|
if (pack.si.si_signo < 0)
|
||||||
sig_clear (-pack.si.si_signo);
|
sig_clear (-pack.si.si_signo);
|
||||||
else
|
else if (!sigq.sigs[pack.si.si_signo].si.si_signo)
|
||||||
{
|
{
|
||||||
int sig = pack.si.si_signo;
|
int sig = pack.si.si_signo;
|
||||||
int sigres = pack.process ();
|
int sigres = pack.process ();
|
||||||
|
|
|
@ -66,7 +66,6 @@ int __stdcall handle_sigprocmask (int sig, const sigset_t *set,
|
||||||
__attribute__ ((regparm (3)));
|
__attribute__ ((regparm (3)));
|
||||||
|
|
||||||
extern "C" void __stdcall reset_signal_arrived ();
|
extern "C" void __stdcall reset_signal_arrived ();
|
||||||
extern "C" int __stdcall call_signal_handler_now ();
|
|
||||||
void __stdcall sig_clear (int) __attribute__ ((regparm (1)));
|
void __stdcall sig_clear (int) __attribute__ ((regparm (1)));
|
||||||
void __stdcall sig_set_pending (int) __attribute__ ((regparm (1)));
|
void __stdcall sig_set_pending (int) __attribute__ ((regparm (1)));
|
||||||
int __stdcall handle_sigsuspend (sigset_t);
|
int __stdcall handle_sigsuspend (sigset_t);
|
||||||
|
|
Loading…
Reference in New Issue