X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=libustcomm%2Fustcomm.c;h=e773f7189fe313f78f0704f1ad907730a715aa38;hb=99b72dc0657875cee4a10bf4c855e99a1b1d1f9c;hp=1f4bce95cbc4a7f726c1d612ca28e5cb130d42d2;hpb=a327294108470b94873a0c248fc02811db98fd64;p=ust.git diff --git a/libustcomm/ustcomm.c b/libustcomm/ustcomm.c index 1f4bce9..e773f71 100644 --- a/libustcomm/ustcomm.c +++ b/libustcomm/ustcomm.c @@ -191,6 +191,23 @@ int ustcomm_send_reply(struct ustcomm_server *server, char *msg, struct ustcomm_ return 0; } +/* Called after a fork. */ + +int ustcomm_close_all_connections(struct ustcomm_server *server) +{ + struct ustcomm_connection *conn; + struct ustcomm_connection *deletable_conn = NULL; + + list_for_each_entry(conn, &server->connections, list) { + free(deletable_conn); + deletable_conn = conn; + close(conn->fd); + list_del(&conn->list); + } + + return 0; +} + /* @timeout: max blocking time in milliseconds, -1 means infinity * * returns 1 to indicate a message was received