return lttcomm_send_unix_sock(sock, buf, len);
}
-
void parse_health_env()
{
const char *health_path;
health_code_update();
try {
live_control_sock = init_socket(live_uri, "Live listener");
- } catch(const lttng::runtime_error& ex) {
+ } catch (const lttng::runtime_error& ex) {
ERR("Failed to initialize live socket: %s", ex.what());
goto error_sock_control;
}
nullptr,
'b',
},
- {
- "pid-file",
- 1,
- nullptr,
- 'P'
- },
+ { "pid-file", 1, nullptr, 'P' },
{
"group",
1,
},
{ "disallow-clear", 0, nullptr, 'x' },
{ "dynamic-port-allocation", 0, nullptr, '\0' },
- {
- "sig-parent",
- 0,
- nullptr,
- 'S'
- },
+ { "sig-parent", 0, nullptr, 'S' },
{
nullptr,
0,
goto error;
}
- DBG("Bound %s socket fd %d to port %d", name, sock->fd, ntohs(sock->sockaddr.addr.sin.sin_port));
+ DBG("Bound %s socket fd %d to port %d",
+ name,
+ sock->fd,
+ ntohs(sock->sockaddr.addr.sin.sin_port));
ret = sock->ops->listen(sock, -1);
if (ret < 0) {
goto error;
create_lttng_rundir_with_perm(rundir_path.get());
create_lttng_rundir_with_perm(relayd_rundir_path.get());
- ret = snprintf(relayd_control_port_path, sizeof(relayd_control_port_path), DEFAULT_RELAYD_CONTROL_PORT_PATH, relayd_rundir_path.get());
+ ret = snprintf(relayd_control_port_path,
+ sizeof(relayd_control_port_path),
+ DEFAULT_RELAYD_CONTROL_PORT_PATH,
+ relayd_rundir_path.get());
if (ret < 0) {
ERR("Failed to format relayd_control_port_path");
goto error_sock_control;
}
- ret = snprintf(relayd_data_port_path, sizeof(relayd_data_port_path), DEFAULT_RELAYD_DATA_PORT_PATH, relayd_rundir_path.get());
+ ret = snprintf(relayd_data_port_path,
+ sizeof(relayd_data_port_path),
+ DEFAULT_RELAYD_DATA_PORT_PATH,
+ relayd_rundir_path.get());
if (ret < 0) {
ERR("Failed to format relayd_data_port_path");
goto error_sock_control;
}
if (auto _ret = utils_create_value_file(ntohs(control_sock->sockaddr.addr.sin.sin_port),
- relayd_control_port_path)) {
- ERR_FMT("Failed to create control port path file: port={}, path=`{}`, ret={}", ntohs(control_sock->sockaddr.addr.sin.sin_port), relayd_control_port_path, _ret);
+ relayd_control_port_path)) {
+ ERR_FMT("Failed to create control port path file: port={}, path=`{}`, ret={}",
+ ntohs(control_sock->sockaddr.addr.sin.sin_port),
+ relayd_control_port_path,
+ _ret);
goto error_create_poll;
goto error_sock_relay;
}
}
if (auto _ret = utils_create_value_file(ntohs(data_sock->sockaddr.addr.sin.sin_port),
- relayd_data_port_path)) {
- ERR_FMT("Failed to create data port path file: port={}, path=`{}`, ret={}", ntohs(data_sock->sockaddr.addr.sin.sin_port), relayd_data_port_path, _ret);
+ relayd_data_port_path)) {
+ ERR_FMT("Failed to create data port path file: port={}, path=`{}`, ret={}",
+ ntohs(data_sock->sockaddr.addr.sin.sin_port),
+ relayd_data_port_path,
+ _ret);
goto error_create_poll;
}
*/
char *create_output_path(const char *path_name);
-void create_lttng_rundir_with_perm(const char* rundir);
+void create_lttng_rundir_with_perm(const char *rundir);
#endif /* RELAYD_UTILS_H */
}
}
-static bool system_has_memory_for_channel_buffers(char *session_name, struct lttng_channel *channel, uint64_t *bytes_required, uint64_t *bytes_available) {
+static bool system_has_memory_for_channel_buffers(char *session_name,
+ struct lttng_channel *channel,
+ uint64_t *bytes_required,
+ uint64_t *bytes_available)
+{
/*
* Verify that the amount of memory required to create the requested
* buffer is available on the system at the moment.
*/
- unsigned long total_buffer_size_needed_per_cpu {0};
- const auto spec = lttng::cli::session_spec(lttng::cli::session_spec::type::NAME, session_name);
+ unsigned long total_buffer_size_needed_per_cpu{ 0 };
+ const auto spec =
+ lttng::cli::session_spec(lttng::cli::session_spec::type::NAME, session_name);
const auto sessions = list_sessions(spec);
- int ncpus {0};
+ int ncpus{ 0 };
if (sessions.size() <= 0) {
/* Session not found */
if (channel->attr.num_subbuf > UINT64_MAX / channel->attr.subbuf_size) {
/* Overflow */
- ERR_FMT("Integer overflow calculating total buffer size per CPU on channel '{}': num_subbuf={}, subbuf_size={}", channel->name, channel->attr.num_subbuf, channel->attr.subbuf_size)
+ ERR_FMT("Integer overflow calculating total buffer size per CPU on channel '{}': num_subbuf={}, subbuf_size={}",
+ channel->name,
+ channel->attr.num_subbuf,
+ channel->attr.subbuf_size)
return false;
}
total_buffer_size_needed_per_cpu = channel->attr.num_subbuf * channel->attr.subbuf_size;
try {
ncpus = utils_get_cpu_count();
- } catch (const std::exception &ex) {
+ } catch (const std::exception& ex) {
ERR_FMT("Exception when getting CPU count: {}", ex.what());
return false;
}
/* In snapshot mode, an extra set of buffers is required. */
- const auto _bytes_required = static_cast<uint64_t>(total_buffer_size_needed_per_cpu * ncpus + sessions[0].snapshot_mode);
+ const auto _bytes_required = static_cast<uint64_t>(
+ total_buffer_size_needed_per_cpu * ncpus + sessions[0].snapshot_mode);
if (bytes_required != nullptr) {
*bytes_required = _bytes_required;
}
#define DEFAULT_USTCONSUMERD32_ERR_SOCK_PATH DEFAULT_USTCONSUMERD32_PATH "/error"
/* Relayd path */
-#define DEFAULT_RELAYD_RUNDIR "%s"
-#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd"
-#define DEFAULT_RELAYD_CONTROL_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/control.port"
-#define DEFAULT_RELAYD_DATA_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/data.port"
-#define DEFAULT_RELAYD_LIVE_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/live.port"
+#define DEFAULT_RELAYD_RUNDIR "%s"
+#define DEFAULT_RELAYD_PATH DEFAULT_RELAYD_RUNDIR "/relayd"
+#define DEFAULT_RELAYD_CONTROL_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/control.port"
+#define DEFAULT_RELAYD_DATA_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/data.port"
+#define DEFAULT_RELAYD_LIVE_PORT_PATH DEFAULT_LTTNG_EXPLICIT_RUNDIR "/live.port"
#define DEFAULT_RELAYD_MIN_FD_POOL_SIZE 100
/*
*/
#define DEFAULT_ROTATE_PENDING_TIMER CONFIG_DEFAULT_ROTATE_PENDING_TIMER
-#define DEFAULT_LINUX_POSSIBLE_CPU_PATH "/sys/devices/system/cpu/possible"
+#define DEFAULT_LINUX_POSSIBLE_CPU_PATH "/sys/devices/system/cpu/possible"
#define DEFAULT_LINUX_POSSIBLE_CPU_MASK_LENGTH 4096
/*
return get_max_possible_cpu_id() + 1;
}
-/**
+/*
* Returns LTTNG_OK if the system as num_bytes available.
*
* If bytes_available is not NULL, the best estimate of the available memory
* will be recorded at that address.
*/
-enum lttng_error_code utils_check_enough_available_memory(uint64_t num_bytes, uint64_t *bytes_available)
+enum lttng_error_code utils_check_enough_available_memory(uint64_t num_bytes,
+ uint64_t *bytes_available)
{
int ret;
enum lttng_error_code ret_code;