*/
#include "lttng-sessiond.h"
+#include <common/compat/uuid.h>
+
+lttng_uuid sessiond_uuid;
int ust_consumerd64_fd = -1;
int ust_consumerd32_fd = -1;
enum consumerd_state ust_consumerd_state;
enum consumerd_state kernel_consumerd_state;
+
+static void __attribute__((constructor)) init_sessiond_uuid(void)
+{
+ if (lttng_uuid_generate(sessiond_uuid)) {
+ ERR("Failed to generate a session daemon UUID");
+ abort();
+ }
+}
#include <common/sessiond-comm/sessiond-comm.h>
#include <common/compat/poll.h>
#include <common/compat/socket.h>
+#include <common/compat/uuid.h>
#include "session.h"
#include "ust-app.h"
CONSUMER_ERROR = 3,
};
+/* Unique identifier of a session daemon instance. */
+extern lttng_uuid sessiond_uuid;
+
/*
* This consumer daemon state is used to validate if a client command will be
* able to reach the consumer. If not, the client is informed. For instance,
&config);
}
+static void sessiond_uuid_log(void)
+{
+ char uuid_str[UUID_STR_LEN];
+
+ lttng_uuid_to_str(sessiond_uuid, uuid_str);
+ DBG("Starting lttng-sessiond {%s}", uuid_str);
+}
+
/*
* main
*/
set_clock_plugin_env();
sessiond_config_log(&config);
+ sessiond_uuid_log();
if (create_lttng_rundir()) {
retval = -1;
#include <stdio.h>
#include <common/compat/uuid.h>
-void lttng_uuid_to_str(const unsigned char *uuid, char *uuid_str)
+void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str)
{
sprintf(uuid_str,
"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
#define UUID_STR_LEN 37
#define UUID_LEN 16
+typedef unsigned char lttng_uuid[UUID_LEN];
+
#ifdef LTTNG_HAVE_LIBUUID
#include <uuid/uuid.h>
* uuid_out is of len UUID_LEN.
*/
static inline
-int lttng_uuid_generate(unsigned char *uuid_out)
+int lttng_uuid_generate(lttng_uuid uuid_out)
{
uuid_generate(uuid_out);
return 0;
* uuid_out is of len UUID_LEN.
*/
static inline
-int lttng_uuid_generate(unsigned char *uuid_out)
+int lttng_uuid_generate(lttng_uuid uuid_out)
{
uint32_t status;
* Assumes uuid_str is at least UUID_STR_LEN byte long.
*/
LTTNG_HIDDEN
-void lttng_uuid_to_str(const unsigned char *uuid, char *uuid_str);
+void lttng_uuid_to_str(const lttng_uuid uuid, char *uuid_str);
#endif /* LTTNG_UUID_H */