]> git.ozlabs.org Git - ccan-lca-2011.git/commitdiff
lca2011: dump talloc tree in child.
authorRusty Russell <rusty@rustcorp.com.au>
Fri, 21 Jan 2011 03:50:45 +0000 (14:20 +1030)
committerRusty Russell <rusty@rustcorp.com.au>
Fri, 21 Jan 2011 03:50:45 +0000 (14:20 +1030)
Avoids stopping the entire server just for debug dumps.

ccan/oserver/oserver.c

index c7a523c21ff121f9f0ace96895216e143d3d2131..ad8f31538ec31663c90624490217b1c6936f5294 100644 (file)
@@ -314,10 +314,16 @@ static void talloc_dump(struct tevent_context *ev,
                        void *_oserver)
 {
        struct oserver *oserver = _oserver;
-       FILE *f = fopen("/var/run/oserver/talloc.dump", "w");
-       if (f) {
-               talloc_report_full(oserver, f);
-               fclose(f);
+       FILE *f;
+
+       /* Fork off a child for the report, so we aren't stopped. */
+       if (fork() == 0) {
+               f = fopen("/var/run/oserver/talloc.dump", "w");
+               if (f) {
+                       talloc_report_full(oserver, f);
+                       fclose(f);
+               }
+               _exit(0);
        }
 }