- int ret;
- struct ust_registry_session *session;
-
- LTTNG_ASSERT(sessionp);
-
- session = zmalloc<ust_registry_session>();
- if (!session) {
- PERROR("zmalloc ust registry session");
- goto error_alloc;
- }
-
- pthread_mutex_init(&session->lock, NULL);
- session->bits_per_long = bits_per_long;
- session->uint8_t_alignment = uint8_t_alignment;
- session->uint16_t_alignment = uint16_t_alignment;
- session->uint32_t_alignment = uint32_t_alignment;
- session->uint64_t_alignment = uint64_t_alignment;
- session->long_alignment = long_alignment;
- session->byte_order = byte_order;
- session->metadata_fd = -1;
- session->uid = euid;
- session->gid = egid;
- session->next_enum_id = 0;
- session->major = major;
- session->minor = minor;
- strncpy(session->root_shm_path, root_shm_path,
- sizeof(session->root_shm_path));
- session->root_shm_path[sizeof(session->root_shm_path) - 1] = '\0';
- if (shm_path[0]) {
- strncpy(session->shm_path, shm_path,
- sizeof(session->shm_path));
- session->shm_path[sizeof(session->shm_path) - 1] = '\0';
- strncpy(session->metadata_path, shm_path,
- sizeof(session->metadata_path));
- session->metadata_path[sizeof(session->metadata_path) - 1] = '\0';
- strncat(session->metadata_path, "/metadata",
- sizeof(session->metadata_path)
- - strlen(session->metadata_path) - 1);
+ try {
+ return new ust_registry_session_per_uid(bits_per_long, uint8_t_alignment,
+ uint16_t_alignment, uint32_t_alignment, uint64_t_alignment,
+ long_alignment, byte_order, major, minor, root_shm_path, shm_path,
+ euid, egid, tracing_id, tracing_uid);
+ } catch (const std::exception &ex) {
+ ERR("Failed to create per-uid registry session: %s", ex.what());
+ return nullptr;