* syscalls.cc (mount): Don't check win32_path when doing cygdrive mount.

This commit is contained in:
Christopher Faylor 2003-08-28 02:04:16 +00:00
parent cc9f0cf0af
commit e2bc5017fa
9 changed files with 72 additions and 44 deletions

View File

@ -1,3 +1,8 @@
2003-08-27 Christopher Faylor <cgf@redhat.com>
* syscalls.cc (mount): Don't check win32_path when doing cygdrive
mount.
2003-08-27 Christopher Faylor <cgf@redhat.com>
* specdir: Correctly remove temporary directory prior to use.

View File

@ -510,6 +510,7 @@ LoadDLLfunc (IsProcessorFeaturePresent, 4, kernel32);
LoadDLLfuncEx (Process32First, 8, kernel32, 1)
LoadDLLfuncEx (Process32Next, 8, kernel32, 1)
LoadDLLfuncEx (SignalObjectAndWait, 16, kernel32, 1)
LoadDLLfuncEx (SwitchToThread, 0, kernel32, 1)
LoadDLLfunc (TryEnterCriticalSection, 4, kernel32)
LoadDLLfuncEx (waveOutGetNumDevs, 0, winmm, 1)

View File

@ -18,12 +18,12 @@ class cygthread
LPTHREAD_START_ROUTINE func;
VOID *arg;
bool is_freerange;
static DWORD main_thread_id;
static bool exiting;
static DWORD WINAPI stub (VOID *);
static DWORD WINAPI simplestub (VOID *);
void terminate_thread ();
public:
static DWORD main_thread_id;
static const char * name (DWORD = 0);
cygthread (LPTHREAD_START_ROUTINE, LPVOID, const char *);
cygthread () {};

View File

@ -785,10 +785,9 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
CONTEXT cx;
bool interrupted = false;
sigthread *th = NULL; // Initialization needed to shut up gcc
int prio = INFINITE;
if (sigsave.sig)
goto set_pending;
goto out;
for (int i = 0; i < CALL_HANDLER_RETRY; i++)
{
@ -823,7 +822,18 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
SuspendThread on itself then just queue the signal. */
EnterCriticalSection (&mainthread.lock);
#ifndef DEBUGGING
sigproc_printf ("suspending mainthread");
#else
cx.ContextFlags = CONTEXT_CONTROL | CONTEXT_INTEGER;
if (!GetThreadContext (hth, &cx))
memset (&cx, 0, sizeof cx);
#if 0
if ((cx.Eip & 0xff000000) == 0x77000000)
try_to_debug ();
#endif
sigproc_printf ("suspending mainthread PC %p", cx.Eip);
#endif
res = SuspendThread (hth);
/* Just release the lock now since we hav suspended the main thread and it
definitely can't be grabbing it now. This will have to change, of course,
@ -866,13 +876,6 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
}
}
if ((DWORD) prio != INFINITE)
{
/* Reset the priority so we can finish this off quickly. */
SetThreadPriority (GetCurrentThread (), WAIT_SIG_PRIORITY);
prio = INFINITE;
}
if (th)
{
interrupted = interrupt_on_return (th, sig, handler, siga);
@ -888,20 +891,11 @@ setup_handler (int sig, void *handler, struct sigaction& siga)
if (interrupted)
break;
if ((DWORD) prio != INFINITE && !mainthread.frame)
prio = low_priority_sleep (SLEEP_0_STAY_LOW);
sigproc_printf ("couldn't interrupt. trying again.");
}
set_pending:
if (interrupted)
{
if ((DWORD) prio != INFINITE)
SetThreadPriority (GetCurrentThread (), WAIT_SIG_PRIORITY);
sigproc_printf ("signal successfully delivered");
}
sigproc_printf ("returning %d", interrupted);
out:
sigproc_printf ("signal %d %sdelivered", sig, interrupted ? "" : "not ");
return interrupted;
}
#endif /* i386 */

View File

@ -8,6 +8,7 @@ This software is a copyrighted work licensed under the terms of the
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
#define _WIN32_WINNT 0x400
#include "winsup.h"
#include "cygerrno.h"
#include <sys/errno.h>
@ -16,6 +17,7 @@ details. */
#include <limits.h>
#include <winbase.h>
#include <winnls.h>
#include "cygthread.h"
long tls_ix = -1;
@ -306,13 +308,27 @@ low_priority_sleep (DWORD secs)
staylow = true;
}
int main_prio = GetThreadPriority (hMainThread);
if (curr_prio != main_prio)
/* Force any threads in normal priority to be scheduled */
SetThreadPriority (thisthread, main_prio);
Sleep (secs);
if (!secs && wincap.has_switch_to_thread ())
{
for (int i = 0; i < 10; i++)
SwitchToThread ();
}
else
{
int new_prio;
if (GetCurrentThreadId () == cygthread::main_thread_id)
new_prio = THREAD_PRIORITY_LOWEST;
else
new_prio = GetThreadPriority (hMainThread);
if (curr_prio != new_prio)
/* Force any threads in normal priority to be scheduled */
SetThreadPriority (thisthread, new_prio);
Sleep (secs);
if (!staylow || curr_prio == new_prio)
SetThreadPriority (thisthread, curr_prio);
}
if (!staylow || curr_prio == main_prio)
SetThreadPriority (thisthread, curr_prio);
return curr_prio;
}

View File

@ -2592,8 +2592,7 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
{
int res = -1;
if (check_null_empty_str_errno (win32_path)
|| check_null_empty_str_errno (posix_path))
if (check_null_empty_str_errno (posix_path))
/* errno set */;
else if (strpbrk (posix_path, "\\:"))
set_errno (EINVAL);
@ -2605,7 +2604,7 @@ mount (const char *win32_path, const char *posix_path, unsigned flags)
res = mount_table->write_cygdrive_info_to_registry (posix_path, flags);
win32_path = NULL;
}
else
else if (!check_null_empty_str_errno (win32_path))
res = mount_table->add_item (win32_path, posix_path, flags, TRUE);
syscall_printf ("%d = mount (%s, %s, %p)", res, win32_path, posix_path, flags);

View File

@ -1218,7 +1218,6 @@ wait_sig (VOID *self)
if (!sig_handle (sig))
{
saw_failed_interrupt = true;
sigproc_printf ("couldn't send signal %d", sig);
x = InterlockedIncrement (myself->getsigtodo (sig));
pending_signals = true;
}

View File

@ -49,7 +49,8 @@ static NO_COPY wincaps wincap_unknown = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_95 = {
@ -90,7 +91,8 @@ static NO_COPY wincaps wincap_95 = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_95osr2 = {
@ -131,7 +133,8 @@ static NO_COPY wincaps wincap_95osr2 = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_98 = {
@ -172,7 +175,8 @@ static NO_COPY wincaps wincap_98 = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_98se = {
@ -213,7 +217,8 @@ static NO_COPY wincaps wincap_98se = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_me = {
@ -254,7 +259,8 @@ static NO_COPY wincaps wincap_me = {
supports_reading_modem_output_lines:false,
needs_memory_protection:false,
pty_needs_alloc_console:false,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_nt3 = {
@ -295,7 +301,8 @@ static NO_COPY wincaps wincap_nt3 = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:false
};
static NO_COPY wincaps wincap_nt4 = {
@ -336,7 +343,8 @@ static NO_COPY wincaps wincap_nt4 = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:true
};
static NO_COPY wincaps wincap_nt4sp4 = {
@ -377,7 +385,8 @@ static NO_COPY wincaps wincap_nt4sp4 = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:false
has_terminal_services:false,
has_switch_to_thread:true
};
static NO_COPY wincaps wincap_2000 = {
@ -418,7 +427,8 @@ static NO_COPY wincaps wincap_2000 = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true
has_terminal_services:true,
has_switch_to_thread:true
};
static NO_COPY wincaps wincap_xp = {
@ -459,7 +469,8 @@ static NO_COPY wincaps wincap_xp = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true
has_terminal_services:true,
has_switch_to_thread:true
};
static NO_COPY wincaps wincap_2003 = {
@ -500,7 +511,8 @@ static NO_COPY wincaps wincap_2003 = {
supports_reading_modem_output_lines:true,
needs_memory_protection:true,
pty_needs_alloc_console:true,
has_terminal_services:true
has_terminal_services:true,
has_switch_to_thread:true
};
wincapc wincap;

View File

@ -51,6 +51,7 @@ struct wincaps
unsigned needs_memory_protection : 1;
unsigned pty_needs_alloc_console : 1;
unsigned has_terminal_services : 1;
unsigned has_switch_to_thread : 1;
};
class wincapc
@ -106,6 +107,7 @@ public:
bool IMPLEMENT (needs_memory_protection)
bool IMPLEMENT (pty_needs_alloc_console)
bool IMPLEMENT (has_terminal_services)
bool IMPLEMENT (has_switch_to_thread)
#undef IMPLEMENT
};