projects
/
lttng-tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Revert "sessiond: trigger: run trigger actions through an action executor"
[lttng-tools.git]
/
src
/
bin
/
lttng-sessiond
/
client.c
diff --git
a/src/bin/lttng-sessiond/client.c
b/src/bin/lttng-sessiond/client.c
index 74bbbe9b2e05e3be7f94a1cba1330aae6d7658ba..689dc258a604cff0f3d7816f72ff8778523f8cd5 100644
(file)
--- a/
src/bin/lttng-sessiond/client.c
+++ b/
src/bin/lttng-sessiond/client.c
@@
-13,6
+13,7
@@
#include "common/dynamic-array.h"
#include "common/payload.h"
#include "common/payload-view.h"
#include "common/dynamic-array.h"
#include "common/payload.h"
#include "common/payload-view.h"
+#include "common/fd-handle.h"
#include "common/sessiond-comm/sessiond-comm.h"
#include "common/payload.h"
#include "common/payload-view.h"
#include "common/sessiond-comm/sessiond-comm.h"
#include "common/payload.h"
#include "common/payload-view.h"
@@
-91,8
+92,12
@@
static int setup_lttng_msg(struct command_ctx *cmd_ctx,
.data_size = payload_len,
};
.data_size = payload_len,
};
- lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
- lttng_dynamic_array_clear(&cmd_ctx->reply_payload._fds);
+ ret = lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
+ if (ret) {
+ goto end;
+ }
+
+ lttng_dynamic_pointer_array_clear(&cmd_ctx->reply_payload._fd_handles);
cmd_ctx->lttng_msg_size = total_msg_size;
cmd_ctx->lttng_msg_size = total_msg_size;
@@
-132,7
+137,10
@@
static int setup_empty_lttng_msg(struct command_ctx *cmd_ctx)
int ret;
const struct lttcomm_lttng_msg llm = {};
int ret;
const struct lttcomm_lttng_msg llm = {};
- lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
+ ret = lttng_dynamic_buffer_set_size(&cmd_ctx->reply_payload.buffer, 0);
+ if (ret) {
+ goto end;
+ }
/* Append place-holder reply header. */
ret = lttng_dynamic_buffer_append(
/* Append place-holder reply header. */
ret = lttng_dynamic_buffer_append(
@@
-592,9
+600,10
@@
static unsigned int lttng_sessions_count(uid_t uid, gid_t gid)
static int receive_userspace_probe(struct command_ctx *cmd_ctx, int sock,
int *sock_error, struct lttng_event *event)
{
static int receive_userspace_probe(struct command_ctx *cmd_ctx, int sock,
int *sock_error, struct lttng_event *event)
{
- int fd, ret;
+ int fd
= -1
, ret;
struct lttng_userspace_probe_location *probe_location;
struct lttng_payload probe_location_payload;
struct lttng_userspace_probe_location *probe_location;
struct lttng_payload probe_location_payload;
+ struct fd_handle *handle = NULL;
/*
* Create a payload to store the serialized version of the probe
/*
* Create a payload to store the serialized version of the probe
@@
-633,13
+642,25
@@
static int receive_userspace_probe(struct command_ctx *cmd_ctx, int sock,
goto error;
}
goto error;
}
- ret = lttng_payload_push_fd(&probe_location_payload, fd);
+ handle = fd_handle_create(fd);
+ if (!handle) {
+ ret = LTTNG_ERR_NOMEM;
+ goto error;
+ }
+
+ /* Transferred to the handle. */
+ fd = -1;
+
+ ret = lttng_payload_push_fd_handle(&probe_location_payload, handle);
if (ret) {
ERR("Failed to add userspace probe file descriptor to payload");
ret = LTTNG_ERR_NOMEM;
goto error;
}
if (ret) {
ERR("Failed to add userspace probe file descriptor to payload");
ret = LTTNG_ERR_NOMEM;
goto error;
}
+ fd_handle_put(handle);
+ handle = NULL;
+
{
struct lttng_payload_view view = lttng_payload_view_from_payload(
&probe_location_payload, 0, -1);
{
struct lttng_payload_view view = lttng_payload_view_from_payload(
&probe_location_payload, 0, -1);
@@
-662,6
+683,13
@@
static int receive_userspace_probe(struct command_ctx *cmd_ctx, int sock,
}
error:
}
error:
+ if (fd >= 0) {
+ if (close(fd)) {
+ PERROR("Failed to close userspace probe location binary fd");
+ }
+ }
+
+ fd_handle_put(handle);
lttng_payload_reset(&probe_location_payload);
return ret;
}
lttng_payload_reset(&probe_location_payload);
return ret;
}
@@
-699,6
+727,7
@@
static int check_rotate_compatible(void)
static int send_unix_sock(int sock, struct lttng_payload_view *view)
{
int ret;
static int send_unix_sock(int sock, struct lttng_payload_view *view)
{
int ret;
+ const int fd_count = lttng_payload_view_get_fd_handle_count(view);
/* Check valid length */
if (view->buffer.size == 0) {
/* Check valid length */
if (view->buffer.size == 0) {
@@
-712,10
+741,11
@@
static int send_unix_sock(int sock, struct lttng_payload_view *view)
goto end;
}
goto end;
}
- if (lttng_dynamic_array_get_count(&view->_fds) > 0) {
- ret = lttcomm_send_fds_unix_sock(sock,
- (const int *) view->_fds.buffer.data,
- lttng_dynamic_array_get_count(&view->_fds));
+ if (fd_count > 0) {
+ ret = lttcomm_send_payload_view_fds_unix_sock(sock, view);
+ if (ret < 0) {
+ goto end;
+ }
}
end:
}
end:
@@
-2266,8
+2296,7
@@
static void *thread_manage_clients(void *data)
.gid = UINT32_MAX,
};
cmd_ctx.session = NULL;
.gid = UINT32_MAX,
};
cmd_ctx.session = NULL;
- lttng_dynamic_buffer_set_size(&cmd_ctx.reply_payload.buffer, 0);
- lttng_dynamic_array_clear(&cmd_ctx.reply_payload._fds);
+ lttng_payload_clear(&cmd_ctx.reply_payload);
cmd_ctx.lttng_msg_size = 0;
DBG("Accepting client command ...");
cmd_ctx.lttng_msg_size = 0;
DBG("Accepting client command ...");
@@
-2410,7
+2439,7
@@
static void *thread_manage_clients(void *data)
sizeof(llm));
assert(cmd_ctx.lttng_msg_size == cmd_ctx.reply_payload.buffer.size);
sizeof(llm));
assert(cmd_ctx.lttng_msg_size == cmd_ctx.reply_payload.buffer.size);
- llm->fd_count = lttng_payload_view_get_fd_count(&view);
+ llm->fd_count = lttng_payload_view_get_fd_
handle_
count(&view);
DBG("Sending response (size: %d, retcode: %s (%d))",
cmd_ctx.lttng_msg_size,
DBG("Sending response (size: %d, retcode: %s (%d))",
cmd_ctx.lttng_msg_size,
This page took
0.02665 seconds
and
4
git commands to generate.