From: Rusty Russell Date: Fri, 21 Jan 2011 03:50:45 +0000 (+1030) Subject: lca2011: dump talloc tree in child. X-Git-Url: https://git.ozlabs.org/?a=commitdiff_plain;h=5cde12ca405f988a8a35b4281c90fbaf53f5464f;hp=e3096dff04758d433eb415f00d586d144b2ffea4;p=ccan-lca-2011.git lca2011: dump talloc tree in child. Avoids stopping the entire server just for debug dumps. --- diff --git a/ccan/oserver/oserver.c b/ccan/oserver/oserver.c index c7a523c..ad8f315 100644 --- a/ccan/oserver/oserver.c +++ b/ccan/oserver/oserver.c @@ -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); } }