]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix some (bone-headed) loose ends left by my last checkin. "make regtest"
authorJeremy Fitzhardinge <jeremy@valgrind.org>
Mon, 10 Nov 2003 21:21:00 +0000 (21:21 +0000)
committerJeremy Fitzhardinge <jeremy@valgrind.org>
Mon, 10 Nov 2003 21:21:00 +0000 (21:21 +0000)
actually works this time.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@2018

coregrind/vg_proxylwp.c
coregrind/vg_syscalls.c

index 9fc470ad3ef3d19d44db02e7a4be4bcfe5ff1f4a..aba9217490d42faaad061ecf366fc9ca689ec6a1 100644 (file)
@@ -371,22 +371,17 @@ static void proxy_fork_cleanup(ThreadId tid)
       tst->proxy = NULL;
    }
 
-   /* Create a proxy for calling thread
-      
-      We need to temporarily set the state back to Runnable for
-      proxy_create's benefit.
+   /* Create a proxy for calling thread.
+
+      Since fork() is non-blocking, the thread status should already
+      be Runnable.
     */
+   vg_assert(VG_(is_valid_tid)(tid));
+   vg_assert(VG_(threads)[tid].proxy == NULL);
+   vg_assert(VG_(threads)[tid].status == VgTs_Runnable);
 
-   {
-      ThreadState *tst = VG_(get_ThreadState)(tid);
-
-      vg_assert(tst->proxy == NULL);
-      vg_assert(tst->status == VgTs_WaitSys);
-      tst->status = VgTs_Runnable;
-      VG_(proxy_create)(tid);
-      VG_(proxy_setsigmask)(tid);
-      tst->status = VgTs_WaitSys;
-   }
+   VG_(proxy_create)(tid);
+   VG_(proxy_setsigmask)(tid);
 }
 
 Int VG_(proxy_resfd)(void)
@@ -442,7 +437,8 @@ void VG_(proxy_handlesig)(const vki_ksiginfo_t *siginfo,
         signal, or the syscall completed normally.  In either case
         eax contains the correct syscall return value, and the new
         state is effectively PXS_SysDone. */
-      vg_assert(px->state == PXS_RunSyscall || px->state == PXS_SysDone);
+      vg_assert(px->state == PXS_RunSyscall ||
+               px->state == PXS_SysDone);
       px->state = PXS_SysDone;
       px->tst->m_eax = eax;
    }
index 91a3db5b9c9399b57ce0d0e5714b05c178b9b62b..cebcef7ae496991a340c889ab1d6ab27b63d786d 100644 (file)
@@ -4435,7 +4435,10 @@ Bool VG_(pre_syscall) ( ThreadId tid )
            anything - just pretend the syscall happened. */
         syscall_done = True;
       } else if (sys->may_block) {
-        /* issue to worker */
+        /* Issue to worker.  If we're waiting on the syscall because
+           it's in the hands of the ProxyLWP, then set the thread
+           state to WaitSys. */
+        tst->status = VgTs_WaitSys;
         VG_(sys_issue)(tid);
       } else {
         /* run the syscall directly */
@@ -4452,10 +4455,8 @@ Bool VG_(pre_syscall) ( ThreadId tid )
 
    VGP_POPCC(VgpCoreSysWrap);
 
-   /* If we're waiting on the syscall because it's in the hands of the
-      ProxyLWP, then set the thread state to WaitSys. */
-   if (!syscall_done)
-      tst->status = VgTs_WaitSys;
+   vg_assert(( syscall_done && tst->status == VgTs_Runnable) ||
+            (!syscall_done && tst->status == VgTs_WaitSys ));
 
    return syscall_done;
 }