X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fbin%2Flttng-sessiond%2Fbuffer-registry.c;h=b96e585001c9bf7f420b0aac1ce274329550ce7c;hp=0ff76defbdcce18ad8aae47b28f9b7a43951af19;hb=d7ba13889c8692b14f99238ddf2721ed78df89d2;hpb=90e7d72ff2b93752b8c81c49e9251a83b01703c6 diff --git a/src/bin/lttng-sessiond/buffer-registry.c b/src/bin/lttng-sessiond/buffer-registry.c index 0ff76defb..b96e58500 100644 --- a/src/bin/lttng-sessiond/buffer-registry.c +++ b/src/bin/lttng-sessiond/buffer-registry.c @@ -106,7 +106,8 @@ void buffer_reg_init_uid_registry(void) * Return 0 on success else a negative value and regp is untouched. */ int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid, - enum lttng_domain_type domain, struct buffer_reg_uid **regp) + enum lttng_domain_type domain, struct buffer_reg_uid **regp, + const char *shm_path) { int ret = 0; struct buffer_reg_uid *reg = NULL; @@ -131,7 +132,12 @@ int buffer_reg_uid_create(uint64_t session_id, uint32_t bits_per_long, uid_t uid reg->bits_per_long = bits_per_long; reg->uid = uid; reg->domain = domain; - + if (shm_path[0]) { + strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path)); + reg->shm_path[sizeof(reg->shm_path) - 1] = '\0'; + DBG3("shm path '%s' is assigned to uid buffer registry for session id %" PRIu64, + reg->shm_path, session_id); + } reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64); if (!reg->registry->channels) { ret = -ENOMEM; @@ -226,7 +232,8 @@ void buffer_reg_init_pid_registry(void) * * Return 0 on success else a negative value and regp is untouched. */ -int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp) +int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp, + const char *shm_path) { int ret = 0; struct buffer_reg_pid *reg = NULL; @@ -249,7 +256,12 @@ int buffer_reg_pid_create(uint64_t session_id, struct buffer_reg_pid **regp) /* A cast is done here so we can use the session ID as a u64 ht node. */ reg->session_id = session_id; - + if (shm_path[0]) { + strncpy(reg->shm_path, shm_path, sizeof(reg->shm_path)); + reg->shm_path[sizeof(reg->shm_path) - 1] = '\0'; + DBG3("shm path '%s' is assigned to pid buffer registry for session id %" PRIu64, + reg->shm_path, session_id); + } reg->registry->channels = lttng_ht_new(0, LTTNG_HT_TYPE_U64); if (!reg->registry->channels) { ret = -ENOMEM;