mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-22 16:49:45 +08:00
* shared.cc (open_shared): Revert to "old" method for shared memory location if
!wincap.needs_memory_protection. * wincap.cc: Implement needs_memory_protection throughout. * wincap.h: Ditto.
This commit is contained in:
parent
fdb28b5e5f
commit
6c6c3b90e9
@ -1,3 +1,10 @@
|
|||||||
|
2002-10-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
|
* shared.cc (open_shared): Revert to "old" method for shared memory
|
||||||
|
location if !wincap.needs_memory_protection.
|
||||||
|
* wincap.cc: Implement needs_memory_protection throughout.
|
||||||
|
* wincap.h: Ditto.
|
||||||
|
|
||||||
2002-10-15 Christopher Faylor <cgf@redhat.com>
|
2002-10-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
|
* child_info.h (CURR_CHILD_INFO_MAGIC): Reset.
|
||||||
|
@ -70,19 +70,14 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat
|
|||||||
+ pround (sizeof (_pinfo))
|
+ pround (sizeof (_pinfo))
|
||||||
};
|
};
|
||||||
|
|
||||||
if (m == SH_CYGWIN_SHARED)
|
void *addr;
|
||||||
|
if (!wincap.needs_memory_protection ())
|
||||||
|
addr = NULL;
|
||||||
|
else
|
||||||
{
|
{
|
||||||
for (int i = SH_CYGWIN_SHARED; i < SH_TOTAL_SIZE; i++)
|
addr = offsets[m];
|
||||||
if (!VirtualAlloc (offsets[i], offsets[i + 1] - offsets[i],
|
|
||||||
MEM_RESERVE, PAGE_NOACCESS))
|
|
||||||
continue; /* oh well */
|
|
||||||
if (!child_proc_info)
|
|
||||||
for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000)
|
|
||||||
VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
void *addr = offsets[m];
|
|
||||||
(void) VirtualFree (addr, 0, MEM_RELEASE);
|
(void) VirtualFree (addr, 0, MEM_RELEASE);
|
||||||
|
}
|
||||||
|
|
||||||
if (!size)
|
if (!size)
|
||||||
return addr;
|
return addr;
|
||||||
@ -118,6 +113,22 @@ open_shared (const char *name, int n, HANDLE &shared_h, DWORD size, shared_locat
|
|||||||
if (!shared)
|
if (!shared)
|
||||||
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h);
|
api_fatal ("MapViewOfFileEx '%s'(%p), %E. Terminating.", name, shared_h);
|
||||||
|
|
||||||
|
if (m == SH_CYGWIN_SHARED)
|
||||||
|
{
|
||||||
|
for (int i = SH_CYGWIN_SHARED + 1; i < SH_TOTAL_SIZE; i++)
|
||||||
|
{
|
||||||
|
offsets[i] += (char *) shared - offsets[0];
|
||||||
|
if (!VirtualAlloc (offsets[i], offsets[i + 1] - offsets[i],
|
||||||
|
MEM_RESERVE, PAGE_NOACCESS))
|
||||||
|
continue; /* oh well */
|
||||||
|
offsets[0] = (char *) shared;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!child_proc_info && wincap.needs_memory_protection ())
|
||||||
|
for (DWORD s = 0x950000; s <= 0xa40000; s += 0x1000)
|
||||||
|
VirtualAlloc ((void *) s, 4, MEM_RESERVE, PAGE_NOACCESS);
|
||||||
|
}
|
||||||
|
|
||||||
debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
|
debug_printf ("name %s, shared %p (wanted %p), h %p", name, shared, addr, shared_h);
|
||||||
|
|
||||||
/* FIXME: I couldn't find anywhere in the documentation a note about
|
/* FIXME: I couldn't find anywhere in the documentation a note about
|
||||||
|
@ -47,6 +47,7 @@ static NO_COPY wincaps wincap_unknown = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95 = {
|
static NO_COPY wincaps wincap_95 = {
|
||||||
@ -85,6 +86,7 @@ static NO_COPY wincaps wincap_95 = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_95osr2 = {
|
static NO_COPY wincaps wincap_95osr2 = {
|
||||||
@ -123,6 +125,7 @@ static NO_COPY wincaps wincap_95osr2 = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98 = {
|
static NO_COPY wincaps wincap_98 = {
|
||||||
@ -161,6 +164,7 @@ static NO_COPY wincaps wincap_98 = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_98se = {
|
static NO_COPY wincaps wincap_98se = {
|
||||||
@ -199,6 +203,7 @@ static NO_COPY wincaps wincap_98se = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_me = {
|
static NO_COPY wincaps wincap_me = {
|
||||||
@ -237,6 +242,7 @@ static NO_COPY wincaps wincap_me = {
|
|||||||
has_64bit_file_access:false,
|
has_64bit_file_access:false,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:false,
|
supports_reading_modem_output_lines:false,
|
||||||
|
needs_memory_protection:false
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt3 = {
|
static NO_COPY wincaps wincap_nt3 = {
|
||||||
@ -275,6 +281,7 @@ static NO_COPY wincaps wincap_nt3 = {
|
|||||||
has_64bit_file_access:true,
|
has_64bit_file_access:true,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:true,
|
supports_reading_modem_output_lines:true,
|
||||||
|
needs_memory_protection:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4 = {
|
static NO_COPY wincaps wincap_nt4 = {
|
||||||
@ -313,6 +320,7 @@ static NO_COPY wincaps wincap_nt4 = {
|
|||||||
has_64bit_file_access:true,
|
has_64bit_file_access:true,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:true,
|
supports_reading_modem_output_lines:true,
|
||||||
|
needs_memory_protection:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_nt4sp4 = {
|
static NO_COPY wincaps wincap_nt4sp4 = {
|
||||||
@ -351,6 +359,7 @@ static NO_COPY wincaps wincap_nt4sp4 = {
|
|||||||
has_64bit_file_access:true,
|
has_64bit_file_access:true,
|
||||||
has_process_io_counters:false,
|
has_process_io_counters:false,
|
||||||
supports_reading_modem_output_lines:true,
|
supports_reading_modem_output_lines:true,
|
||||||
|
needs_memory_protection:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_2000 = {
|
static NO_COPY wincaps wincap_2000 = {
|
||||||
@ -389,6 +398,7 @@ static NO_COPY wincaps wincap_2000 = {
|
|||||||
has_64bit_file_access:true,
|
has_64bit_file_access:true,
|
||||||
has_process_io_counters:true,
|
has_process_io_counters:true,
|
||||||
supports_reading_modem_output_lines:true,
|
supports_reading_modem_output_lines:true,
|
||||||
|
needs_memory_protection:true
|
||||||
};
|
};
|
||||||
|
|
||||||
static NO_COPY wincaps wincap_xp = {
|
static NO_COPY wincaps wincap_xp = {
|
||||||
@ -427,6 +437,7 @@ static NO_COPY wincaps wincap_xp = {
|
|||||||
has_64bit_file_access:true,
|
has_64bit_file_access:true,
|
||||||
has_process_io_counters:true,
|
has_process_io_counters:true,
|
||||||
supports_reading_modem_output_lines:true,
|
supports_reading_modem_output_lines:true,
|
||||||
|
needs_memory_protection:true
|
||||||
};
|
};
|
||||||
|
|
||||||
wincapc wincap;
|
wincapc wincap;
|
||||||
|
@ -48,6 +48,7 @@ struct wincaps
|
|||||||
unsigned has_64bit_file_access : 1;
|
unsigned has_64bit_file_access : 1;
|
||||||
unsigned has_process_io_counters : 1;
|
unsigned has_process_io_counters : 1;
|
||||||
unsigned supports_reading_modem_output_lines : 1;
|
unsigned supports_reading_modem_output_lines : 1;
|
||||||
|
unsigned needs_memory_protection : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
class wincapc
|
class wincapc
|
||||||
@ -100,6 +101,7 @@ public:
|
|||||||
bool IMPLEMENT (has_64bit_file_access)
|
bool IMPLEMENT (has_64bit_file_access)
|
||||||
bool IMPLEMENT (has_process_io_counters)
|
bool IMPLEMENT (has_process_io_counters)
|
||||||
bool IMPLEMENT (supports_reading_modem_output_lines)
|
bool IMPLEMENT (supports_reading_modem_output_lines)
|
||||||
|
bool IMPLEMENT (needs_memory_protection)
|
||||||
|
|
||||||
#undef IMPLEMENT
|
#undef IMPLEMENT
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user