DRD: do not assert() upon fork(). Fixes the DRD part of #255355.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@11520 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff --git a/drd/drd_main.c b/drd/drd_main.c
index e317857..ebf0845 100644
--- a/drd/drd_main.c
+++ b/drd/drd_main.c
@@ -627,6 +627,18 @@
    DRD_(thread_finished)(drd_tid);
 }
 
+/*
+ * Called immediately after fork for the child process only. 'tid' is the
+ * only surviving thread in the child process. Cleans up thread state.
+ * See also http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_atfork.html for a detailed discussion of using fork() in combination with mutexes.
+ */
+static
+void drd__atfork_child(ThreadId tid)
+{
+   DRD_(drd_thread_atfork_child)(tid);
+}
+
+
 //
 // Implementation of the tool interface.
 //
@@ -756,6 +768,8 @@
    VG_(track_pre_thread_ll_create) (drd_pre_thread_create);
    VG_(track_pre_thread_first_insn)(drd_post_thread_create);
    VG_(track_pre_thread_ll_exit)   (drd_thread_finished);
+   VG_(atfork)                     (NULL/*pre*/, NULL/*parent*/,
+				    drd__atfork_child/*child*/);
 
    // Other stuff.
    DRD_(register_malloc_wrappers)(drd_start_using_mem_w_ecu,