recovery.
* spawn.cc (spawn_guts): Reorganize slightly to consolidate handling when there
is a CreateProcess error.
(_spawnve): Only longjmp back to vfork handling when a process has been
successfuly started.
* winsup.h (vfork_save): Extend to include frame info. Remove obsolete cpplus
conditionals.
+Wed Aug 2 22:58:07 2000 Christopher Faylor <cgf@cygnus.com>
+
+ * fork.cc (vfork): Store complete stack frame in vfork_save structure
+ for later recovery.
+ * spawn.cc (spawn_guts): Reorganize slightly to consolidate handling
+ when there is a CreateProcess error.
+ (_spawnve): Only longjmp back to vfork handling when a process has been
+ successfuly started.
+ * winsup.h (vfork_save): Extend to include frame info. Remove obsolete
+ cpplus conditionals.
+
Wed Aug 2 15:14:51 2000 Christopher Faylor <cgf@cygnus.com>
* strace.cc (strace::prntf): Make second argument the function name,
return fork ();
#else
vfork_save *vf = get_vfork_val ();
+ char **esp, **pp;
if (vf == NULL)
vf = vfork_storage.create ();
if (!setjmp (vf->j))
{
vf->pid = -1;
+ __asm__ volatile ("movl %%esp,%0": "=r" (vf->vfork_esp):);
__asm__ volatile ("movl %%ebp,%0": "=r" (vf->vfork_ebp):);
- __asm__ volatile ("movl (%%ebp),%0": "=r" (vf->caller_ebp):);
- __asm__ volatile ("movl 4(%%ebp),%0": "=r" (vf->retaddr):);
+ for (pp = (char **)vf->frame, esp = vf->vfork_esp;
+ esp <= vf->vfork_ebp + 1; pp++, esp++)
+ *pp = *esp;
return dtable.vfork_child_dup () ? 0 : -1;
}
exit (exitval);
}
- vf->vfork_ebp[0] = vf->caller_ebp;
- vf->vfork_ebp[1] = vf->retaddr;
+ __asm__ volatile ("movl %%esp,%0": "=r" (esp):);
+ for (pp = (char **)vf->frame, esp = vf->vfork_esp;
+ esp <= vf->vfork_ebp + 1; pp++, esp++)
+ *esp = *pp;
+
return vf->pid;
#endif
}
final debugging message [this is a general rule for debugging
messages]. */
if (!rc)
- __seterrno ();
+
+ if (!rc)
+ {
+ if (spr)
+ ForceCloseHandle (spr);
+ __seterrno ();
+ syscall_printf ("CreateProcess failed, %E");
+ return -1;
+ }
if (mode == _P_OVERLAY)
cygpid = myself->pid;
rc ? cygpid : (unsigned int) -1,
prog_arg, one_line.buf);
- if (!rc)
- {
- if (spr)
- ForceCloseHandle (spr);
- return -1;
- }
-
MALLOC_CHECK;
/* Name the handle similarly to proc_subproc. */
ProtectHandle1 (pi.hProcess, childhProc);
case _P_DETACH:
subproc_init ();
ret = spawn_guts (hToken, path, argv, envp, mode);
- if (vf)
+ if (vf && ret > 0)
{
vf->pid = ret;
longjmp (vf->j, 1);
{
int pid;
jmp_buf j;
+ DWORD frame[100];
char **vfork_ebp;
- char *caller_ebp;
- char *retaddr;
+ char **vfork_esp;
int is_active () { return pid < 0; }
};
/* Initial and increment values for cygwin's fd table */
#define NOFILE_INCR 32
-#ifdef __cplusplus
-extern "C" {
-#endif
#include <sys/reent.h>
#define STD_RBITS (S_IRUSR | S_IRGRP | S_IROTH)
#define O_NOSYMLINK 0x080000
#define O_DIROPEN 0x100000
-#ifdef __cplusplus
-}
-#endif
-
/*************************** Environment ******************************/
/* The structure below is used to control conversion to/from posix-style