* fork.cc (frok::parent): Simplify error messages. Don't issue an error when

child.remember fails.
(fork): When appropriate, build up an error message from grouped.error.
This commit is contained in:
Christopher Faylor 2005-09-30 00:18:30 +00:00
parent f859ca87a7
commit 40c7d132ef
2 changed files with 24 additions and 11 deletions

View File

@ -1,3 +1,9 @@
2005-09-29 Christopher Faylor <cgf@timesys.com>
* fork.cc (frok::parent): Simplify error messages. Don't issue an
error when child.remember fails.
(fork): When appropriate, build up an error message from grouped.error.
2005-09-29 Corinna Vinschen <corinna@vinschen.de> 2005-09-29 Corinna Vinschen <corinna@vinschen.de>
* fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Don't call * fhandler_floppy.cc (fhandler_dev_floppy::get_drive_info): Don't call

View File

@ -334,7 +334,7 @@ frok::parent (void *stack_here)
if (forker_finished == NULL) if (forker_finished == NULL)
{ {
this_errno = geterrno_from_win_error (); this_errno = geterrno_from_win_error ();
error = "child %d - unable to allocate forker_finished event, %E"; error = "unable to allocate forker_finished event";
return -1; return -1;
} }
@ -369,7 +369,7 @@ frok::parent (void *stack_here)
if (!rc) if (!rc)
{ {
this_errno = geterrno_from_win_error (); this_errno = geterrno_from_win_error ();
error = "child %d - CreateProcessA failed, %E"; error = "CreateProcessA failed";
goto cleanup; goto cleanup;
} }
@ -389,7 +389,7 @@ frok::parent (void *stack_here)
{ {
this_errno = get_errno () == ENOMEM ? ENOMEM : EAGAIN; this_errno = get_errno () == ENOMEM ? ENOMEM : EAGAIN;
#ifdef DEBUGGING #ifdef DEBUGGING
error = "child %d - pinfo failed"; error = "pinfo failed";
#else #else
syscall_printf ("pinfo failed"); syscall_printf ("pinfo failed");
#endif #endif
@ -425,8 +425,8 @@ frok::parent (void *stack_here)
{ {
TerminateProcess (pi.hProcess, 1); TerminateProcess (pi.hProcess, 1);
this_errno = EAGAIN; this_errno = EAGAIN;
#ifdef DEBUGGING #ifdef DEBUGGING0
error = "child %d - child.remember failed"; error = "child.remember failed";
#endif #endif
goto cleanup; goto cleanup;
} }
@ -439,7 +439,7 @@ frok::parent (void *stack_here)
if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT)) if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT))
{ {
this_errno = EAGAIN; this_errno = EAGAIN;
error = "child %d - died waiting for longjmp before initialization"; error = "died waiting for longjmp before initialization";
goto cleanup; goto cleanup;
} }
@ -485,7 +485,7 @@ frok::parent (void *stack_here)
{ {
this_errno = get_errno (); this_errno = get_errno ();
#ifdef DEBUGGING #ifdef DEBUGGING
error = "child %d - fork_copy for linked dll data/bss failed"; error = "fork_copy for linked dll data/bss failed";
#endif #endif
goto cleanup; goto cleanup;
} }
@ -497,7 +497,7 @@ frok::parent (void *stack_here)
else if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT)) else if (!ch.sync (child->pid, pi.hProcess, FORK_WAIT_TIMEOUT))
{ {
this_errno = EAGAIN; this_errno = EAGAIN;
error = "child %d died waiting for dll loading"; error = "died waiting for dll loading";
goto cleanup; goto cleanup;
} }
@ -517,7 +517,7 @@ frok::parent (void *stack_here)
{ {
this_errno = get_errno (); this_errno = get_errno ();
#ifdef DEBUGGING #ifdef DEBUGGING
error = "child %d - copying data/bss for a loaded dll"; error = "copying data/bss for a loaded dll";
#endif #endif
goto cleanup; goto cleanup;
} }
@ -589,9 +589,16 @@ fork ()
else else
{ {
if (!grouped.error) if (!grouped.error)
syscall_printf ("fork failed - child pid %d", grouped.child_pid); syscall_printf ("fork failed - child pid %d, errno %d", grouped.child_pid, grouped.this_errno);
else else
system_printf (grouped.error, grouped.child_pid); {
char buf[strlen (grouped.error) + sizeof ("child %d - , errno 4294967295 ")];
strcpy (buf, "child %d - ");
strcat (buf, grouped.error);
strcat (buf, ", errno %d");
system_printf (buf, grouped.child_pid, grouped.this_errno);
}
set_errno (grouped.this_errno); set_errno (grouped.this_errno);
} }
syscall_printf ("%d = fork()", res); syscall_printf ("%d = fork()", res);