Deny register consumer if one exists
[lttng-tools.git] / src / bin / lttng-sessiond / main.c
index f24b317d02a89e5bedf8baee7d1a671076b95022..d0b1e17e544ef21b110381ea266f5037172e80f0 100644 (file)
@@ -4328,6 +4328,16 @@ static int process_client_msg(struct command_ctx *cmd_ctx, int sock,
                goto error;
        }
 
+       /* Deny register consumer if we already have a spawned consumer. */
+       if (cmd_ctx->lsm->cmd_type == LTTNG_REGISTER_CONSUMER) {
+               pthread_mutex_lock(&kconsumer_data.pid_mutex);
+               if (kconsumer_data.pid > 0) {
+                       ret = LTTCOMM_KERN_CONSUMER_FAIL;
+                       goto error;
+               }
+               pthread_mutex_unlock(&kconsumer_data.pid_mutex);
+       }
+
        /*
         * Check for command that don't needs to allocate a returned payload. We do
         * this here so we don't have to make the call for no payload at each
This page took 0.022535 seconds and 4 git commands to generate.