}
}
+ DBG("Cleaning up all agent apps");
+ agent_app_ht_clean();
+
DBG("Closing all UST sockets");
ust_app_clean_list();
buffer_reg_destroy_registries();
ust_cmd = zmalloc(sizeof(struct ust_command));
if (ust_cmd == NULL) {
PERROR("ust command zmalloc");
+ ret = close(sock);
+ if (ret) {
+ PERROR("close");
+ }
goto error;
}
}
case LTTNG_DISABLE_EVENT:
{
+
+ /*
+ * FIXME: handle filter; for now we just receive the filter's
+ * bytecode along with the filter expression which are sent by
+ * liblttng-ctl and discard them.
+ *
+ * This fixes an issue where the client may block while sending
+ * the filter payload and encounter an error because the session
+ * daemon closes the socket without ever handling this data.
+ */
+ size_t count = cmd_ctx->lsm->u.disable.expression_len +
+ cmd_ctx->lsm->u.disable.bytecode_len;
+
+ if (count) {
+ char data[LTTNG_FILTER_MAX_LEN];
+
+ DBG("Discarding disable event command payload of size %zu", count);
+ while (count) {
+ ret = lttcomm_recv_unix_sock(sock, data,
+ count > sizeof(data) ? sizeof(data) : count);
+ if (ret < 0) {
+ goto error;
+ }
+
+ count -= (size_t) ret;
+ }
+ }
/* FIXME: passing packed structure to non-packed pointer */
- /* TODO: handle filter */
ret = cmd_disable_event(cmd_ctx->session, cmd_ctx->lsm->domain.type,
cmd_ctx->lsm->u.disable.channel_name,
&cmd_ctx->lsm->u.disable.event);
void *status;
const char *home_path, *env_app_timeout;
+ /* Initialize agent apps ht global variable */
+ agent_apps_ht_by_sock = NULL;
+
init_kernel_workarounds();
rcu_register_thread();
goto error;
}
+ /* After this point, we can safely call cleanup() with "goto exit" */
+
/*
* Init UST app hash table. Alloc hash table before this point since
* cleanup() can get called after that point.
*/
ust_app_ht_alloc();
- /* Initialize agent domain subsystem. */
- if ((ret = agent_setup()) < 0) {
- /* ENOMEM at this point. */
- goto error;
+ /*
+ * Initialize agent app hash table. We allocate the hash table here
+ * since cleanup() can get called after this point.
+ */
+ if (agent_app_ht_alloc()) {
+ ERR("Failed to allocate Agent app hash table");
+ ret = -1;
+ goto exit;
}
- /* After this point, we can safely call cleanup() with "goto exit" */
-
/*
* These actions must be executed as root. We do that *after* setting up
* the sockets path because we MUST make the check for another daemon using