Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/winsup
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2005-12-26 22:34:59 +0300
committerChristopher Faylor <me@cgf.cx>2005-12-26 22:34:59 +0300
commita16b738dd53486a3a65a28519129ebd060a02db9 (patch)
tree997fdb3185d3f3e8e83524e53a7578bd63aef357 /winsup
parentc675040a068e107e8628b8e29efd975b1162dc66 (diff)
* dcrt0.cc (__api_fatal): Simplify to just use strace mechamisms.
(do_exit): Move minimal_printf... * pinfo.cc (pinfo::exit): ...into here. * strace.cc (strace::vprntf): Guarantee output to the console when system_printf/api_fatal. * heap.cc (heap_init): Wait a second before issuing an error when ERROR_INVALID_ADDRESS since this is probably due to a CTRL-C handler sneaking in, using the memory that we want to use for the heap, and, eventually exiting.
Diffstat (limited to 'winsup')
-rw-r--r--winsup/cygwin/ChangeLog19
-rw-r--r--winsup/cygwin/dcrt0.cc19
-rw-r--r--winsup/cygwin/heap.cc12
-rw-r--r--winsup/cygwin/pinfo.cc1
-rw-r--r--winsup/cygwin/strace.cc19
5 files changed, 42 insertions, 28 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index b1c559c5f..2721ce706 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,3 +1,16 @@
+2005-12-26 Christopher Faylor <cgf@timesys.com>
+
+ * dcrt0.cc (__api_fatal): Simplify to just use strace mechamisms.
+ (do_exit): Move minimal_printf...
+ * pinfo.cc (pinfo::exit): ...into here.
+ * strace.cc (strace::vprntf): Guarantee output to the console when
+ system_printf/api_fatal.
+
+ * heap.cc (heap_init): Wait a second before issuing an error when
+ ERROR_INVALID_ADDRESS since this is probably due to a CTRL-C handler
+ sneaking in, using the memory that we want to use for the heap, and,
+ eventually exiting.
+
2005-12-23 Christopher Faylor <cgf@timesys.com>
* cygtls.cc (_cygtls::handle_threadlist_exception): Make an error
@@ -5,7 +18,7 @@
* cygtls.h (sockaddr_in): Use header rather than defining our own
structure.
* exceptions.cc (_cygtls::interrupt_setup): Use exact contents of
- sa_mask rather than assuming tht current sig should be masked, too.
+ sa_mask rather than assuming that current sig should be masked, too.
(_cygtls::call_signal_handler): Use more aggressive locking.
* gendef (_sigbe): Wait until later before releasing incyg.
(_sigreturn): Remove more arguments to accommodate quasi-sa_sigaction
@@ -13,8 +26,8 @@
(_sigdelayed): Push arguments for sa_sigaction. More work needed here.
* signal.cc (sigaction): Implement SA_NODEFER.
* tlsoffsets.h: Regenerate.
-
- * sigproc.cc (wait_sig): Use default buffer size or Windows 9x complains.
+
+ * sigproc.cc (wait_sig): Use default buffer size or Windows 9x complains
* pinfo.cc (_onreturn::dummy_handle): Remove.
(_onreturn::h): Make this a pointer.
diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc
index fcff2c324..ff61d3e13 100644
--- a/winsup/cygwin/dcrt0.cc
+++ b/winsup/cygwin/dcrt0.cc
@@ -1132,7 +1132,6 @@ do_exit (int status)
tty_terminate ();
}
- minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
myself.exit (n);
}
@@ -1171,24 +1170,10 @@ __api_fatal (const char *fmt, ...)
va_list ap;
va_start (ap, fmt);
- int n = __small_sprintf (buf, "%P (%u): *** ", cygwin_pid (GetCurrentProcessId ()));
+ int n = __small_sprintf (buf, "%P: *** fatal error - ", cygwin_pid (GetCurrentProcessId ()));
__small_vsprintf (buf + n, fmt, ap);
va_end (ap);
- strcat (buf, "\n");
- int len = strlen (buf);
- DWORD done;
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, len, &done, 0);
-
- /* Make sure that the message shows up on the screen, too, since this is
- a serious error. */
- if (GetFileType (GetStdHandle (STD_ERROR_HANDLE)) != FILE_TYPE_CHAR)
- {
- HANDLE h = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE,
- FILE_SHARE_WRITE | FILE_SHARE_WRITE,
- &sec_none, OPEN_EXISTING, 0, 0);
- if (h != INVALID_HANDLE_VALUE)
- WriteFile (h, buf, len, &done, 0);
- }
+ strace.prntf (_STRACE_SYSTEM, NULL, "%s", buf);
#ifdef DEBUGGING
try_to_debug ();
diff --git a/winsup/cygwin/heap.cc b/winsup/cygwin/heap.cc
index b45019981..3f6becf76 100644
--- a/winsup/cygwin/heap.cc
+++ b/winsup/cygwin/heap.cc
@@ -76,10 +76,14 @@ heap_init ()
break;
}
if (!p)
- api_fatal ("couldn't allocate heap, %E, base %p, top %p, "
- "reserve_size %d, allocsize %d, page_const %d",
- cygheap->user_heap.base, cygheap->user_heap.top,
- reserve_size, allocsize, page_const);
+ {
+ if (GetLastError () == ERROR_INVALID_ADDRESS)
+ Sleep (2000);
+ api_fatal ("couldn't allocate heap, %E, base %p, top %p, "
+ "reserve_size %d, allocsize %d, page_const %d",
+ cygheap->user_heap.base, cygheap->user_heap.top,
+ reserve_size, allocsize, page_const);
+ }
if (p != cygheap->user_heap.base)
api_fatal ("heap allocated at wrong address %p (mapped) != %p (expected)", p, cygheap->user_heap.base);
if (!VirtualAlloc (cygheap->user_heap.base, allocsize, MEM_COMMIT, PAGE_READWRITE))
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 47c2b7d0d..7940051d3 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -139,6 +139,7 @@ pinfo::zap_cwd ()
void
pinfo::exit (DWORD n)
{
+ minimal_printf ("winpid %d, exit %d", GetCurrentProcessId (), n);
lock_process until_exit ();
cygthread::terminate ();
diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc
index 54fab722a..6634a68dd 100644
--- a/winsup/cygwin/strace.cc
+++ b/winsup/cygwin/strace.cc
@@ -202,24 +202,35 @@ void
strace::vprntf (unsigned category, const char *func, const char *fmt, va_list ap)
{
DWORD err = GetLastError ();
- int count;
+ int len;
char buf[10000];
PROTECT (buf);
SetLastError (err);
- count = vsprntf (buf, func, fmt, ap);
+ len = vsprntf (buf, func, fmt, ap);
CHECK (buf);
if (category & _STRACE_SYSTEM)
{
DWORD done;
- WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, count, &done, 0);
+ WriteFile (GetStdHandle (STD_ERROR_HANDLE), buf, len, &done, 0);
FlushFileBuffers (GetStdHandle (STD_ERROR_HANDLE));
+ /* Make sure that the message shows up on the screen, too, since this is
+ a serious error. */
+ if (GetFileType (GetStdHandle (STD_ERROR_HANDLE)) != FILE_TYPE_CHAR)
+ {
+ HANDLE h = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_WRITE | FILE_SHARE_WRITE,
+ &sec_none, OPEN_EXISTING, 0, 0);
+ if (h != INVALID_HANDLE_VALUE)
+ WriteFile (h, buf, len, &done, 0);
+ CloseHandle (h);
+ }
}
#ifndef NOSTRACE
if (active)
- write (category, buf, count);
+ write (category, buf, len);
#endif
SetLastError (err);
}