*** fork.cc Thu Jun 16 07:51:22 2005 --- fork.cc Sun Jul 10 03:53:10 2005 *************** *** 61,66 **** --- 61,68 ---- /* Copy memory from parent to child. The result is a boolean indicating success. */ + #define MEMDIVSIZE 4096 + static int fork_copy (PROCESS_INFORMATION &pi, const char *what, ...) { *************** *** 75,105 **** char *high = va_arg (args, char *); DWORD todo = wincap.chunksize () ?: high - low; char *here; for (here = low; here < high; here += todo) { DWORD done = 0; if (here + todo > high) todo = high - here; ! int res; ! if (pi.hThread) ! res = WriteProcessMemory (pi.hProcess, here, here, todo, &done); ! else ! res = ReadProcessMemory (pi.hProcess, here, here, todo, &done); ! debug_printf ("child handle %p, low %p, high %p, res %d", pi.hProcess, ! low, high, res); ! if (!res || todo != done) ! { ! if (!res) ! __seterrno (); ! /* If this happens then there is a bug in our fork ! implementation somewhere. */ ! system_printf ("%s pass %d failed, %p..%p, done %d, windows pid %u, %E", ! what, pass, low, high, done, pi.dwProcessId); ! goto err; } } ! pass++; } --- 77,136 ---- char *high = va_arg (args, char *); DWORD todo = wincap.chunksize () ?: high - low; char *here; + int blk ; + int mod ; + int i ; for (here = low; here < high; here += todo) { + int res; DWORD done = 0; if (here + todo > high) todo = high - here; ! blk=todo/MEMDIVSIZE ; ! mod=todo%MEMDIVSIZE ; ! if (pi.hThread){ ! for( i=0 ; i