*
*/
-#include "bin/lttng-sessiond/tracker.h"
-#include "lttng/lttng-error.h"
-#include "lttng/tracker.h"
#define _LGPL_SOURCE
#include <assert.h>
#include <inttypes.h>
#include <lttng/session-internal.h>
#include <lttng/userspace-probe-internal.h>
#include <lttng/session-descriptor-internal.h>
+#include <lttng/lttng-error.h>
+#include <lttng/tracker.h>
#include <common/string-utils/string-utils.h>
#include "channel.h"
#include "rotation-thread.h"
#include "timer.h"
#include "agent-thread.h"
+#include "tracker.h"
#include "cmd.h"
struct consumer_socket *consumer_sock,
const char *session_name, const char *hostname,
const char *base_path, int session_live_timer,
- const uint64_t *current_chunk_id,
+ const uint64_t *current_chunk_id,
time_t session_creation_time,
bool session_name_contains_creation_time)
{
struct ltt_kernel_session *ksess;
struct consumer_socket *socket;
struct lttng_ht_iter iter;
- LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
+ LTTNG_OPTIONAL(uint64_t) current_chunk_id = {};
- assert(session);
+ assert(session);
usess = session->ust_session;
ksess = session->kernel_session;
*/
ret = validate_ust_event_name(event->name);
if (ret) {
- WARN("Userspace event name %s failed validation.",
+ WARN("Userspace event name %s failed validation.",
event->name);
ret = LTTNG_ERR_INVALID_EVENT_NAME;
goto error;
lttng_dynamic_buffer_init(&payload);
ret = lttng_dynamic_buffer_append(&payload, &llm, sizeof(llm));
- if (ret) {
+ if (ret) {
ERR("Failed to append session destruction message");
goto error;
- }
+ }
cmd_header.rotation_state =
(int32_t) (reply_context->implicit_rotation_on_destroy ?
session->name, lttng_strerror(-ret));
destruction_last_error = -ret;
}
- if (reply_context) {
+ if (reply_context) {
reply_context->implicit_rotation_on_destroy = true;
- }
- } else if (session->has_been_started && session->current_trace_chunk) {
+ }
+ } else if (session->has_been_started && session->current_trace_chunk) {
/*
* The user has not triggered a session rotation. However, to
* ensure all data has been consumed, the session is rotated
} else {
*sock_fd = -1;
}
- }
- ret = LTTNG_OK;
+ }
+ ret = LTTNG_OK;
end:
return ret;
}
unsigned int i = 0;
struct ltt_session *session;
struct ltt_session_list *list = session_get_list();
- struct lttng_session_extended *extended =
+ struct lttng_session_extended *extended =
(typeof(extended)) (&sessions[session_count]);
DBG("Getting all available session for UID %d GID %d",
/*
* Only list the sessions the user can control.
*/
- if (!session_access_ok(session, uid, gid) ||
+ if (!session_access_ok(session, uid) ||
session->destroyed) {
session_put(session);
continue;
ssize_t sock_recv_len;
struct lttng_trigger *trigger = NULL;
struct lttng_payload trigger_payload;
+ struct lttng_credentials cmd_creds = {
+ .uid = cmd_ctx->creds.uid,
+ .gid = cmd_ctx->creds.gid,
+ };
lttng_payload_init(&trigger_payload);
trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
goto end;
}
+ /* Receive fds, if any. */
+ if (cmd_ctx->lsm.fd_count > 0) {
+ ret = lttcomm_recv_payload_fds_unix_sock(
+ sock, cmd_ctx->lsm.fd_count, &trigger_payload);
+ if (ret > 0 && ret != cmd_ctx->lsm.fd_count * sizeof(int)) {
+ ret = LTTNG_ERR_INVALID_PROTOCOL;
+ goto end;
+ } else if (ret <= 0) {
+ ret = LTTNG_ERR_FATAL;
+ goto end;
+ }
+ }
+
+ /* Deserialize trigger. */
{
struct lttng_payload_view view =
lttng_payload_view_from_payload(
}
}
+ /* Set the trigger credential */
+ lttng_trigger_set_credentials(trigger, &cmd_creds);
+
+ /* Inform the notification thread */
ret = notification_thread_command_register_trigger(notification_thread,
trigger);
/* Ownership of trigger was transferred. */
ssize_t sock_recv_len;
struct lttng_trigger *trigger = NULL;
struct lttng_payload trigger_payload;
+ struct lttng_credentials cmd_creds = {
+ .uid = cmd_ctx->creds.uid,
+ .gid = cmd_ctx->creds.gid,
+ };
lttng_payload_init(&trigger_payload);
trigger_len = (size_t) cmd_ctx->lsm.u.trigger.length;
goto end;
}
+ /* Receive fds, if any. */
+ if (cmd_ctx->lsm.fd_count > 0) {
+ ret = lttcomm_recv_payload_fds_unix_sock(
+ sock, cmd_ctx->lsm.fd_count, &trigger_payload);
+ if (ret > 0 && ret != cmd_ctx->lsm.fd_count * sizeof(int)) {
+ ret = LTTNG_ERR_INVALID_PROTOCOL;
+ goto end;
+ } else if (ret <= 0) {
+ ret = LTTNG_ERR_FATAL;
+ goto end;
+ }
+ }
+
{
struct lttng_payload_view view =
lttng_payload_view_from_payload(
}
}
+ lttng_trigger_set_credentials(trigger, &cmd_creds);
+
ret = notification_thread_command_unregister_trigger(notification_thread,
trigger);
end:
cmd_ret = LTTNG_ERR_CREATE_DIR_FAIL;
goto error;
}
- }
+ }
/*
* The current trace chunk becomes the chunk being archived.