From: Pierre-Marc Fournier Date: Sat, 27 Feb 2010 17:12:59 +0000 (-0500) Subject: ust_fork(): close the ustcomm_app socket in the child on fork() X-Git-Tag: v1.9.1~696 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=393bc3911a4d704f85d6331aca2fb4a5b57b5e8a;p=lttng-ust.git ust_fork(): close the ustcomm_app socket in the child on fork() This fixes a bug where the parent's connections remained jammed open. --- diff --git a/libust/tracectl.c b/libust/tracectl.c index 220d37f6..848b272f 100644 --- a/libust/tracectl.c +++ b/libust/tracectl.c @@ -1478,6 +1478,8 @@ static void ust_fork(void) list_del(&bc->list); } + ustcomm_free_app(&ustcomm_app); + buffers_to_export = 0; have_listener = 0; init_socket(); diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 7dd12510..5f2517b1 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -678,6 +678,16 @@ free_name: return -1; } +void ustcomm_free_app(struct ustcomm_app *app) +{ + int result; + result = close(app->server.listen_fd); + if(result == -1) { + PERROR("close"); + return; + } +} + /* Used by the daemon to initialize its server so applications * can connect to it. */ diff --git a/libustcomm/ustcomm.h b/libustcomm/ustcomm.h index a554678c..05d90ebc 100644 --- a/libustcomm/ustcomm.h +++ b/libustcomm/ustcomm.h @@ -68,6 +68,7 @@ extern int ustcomm_app_recv_message(struct ustcomm_app *app, char **msg, struct extern int ustcomm_init_app(pid_t pid, struct ustcomm_app *handle); extern void ustcomm_fini_app(struct ustcomm_app *handle); +extern void ustcomm_free_app(struct ustcomm_app *app); extern int ustcomm_init_ustd(struct ustcomm_ustd *handle, const char *sock_path);