X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=libringbuffer%2Fring_buffer_backend.c;h=b65105f3a92afdfc8eceab615b73708bb045307e;hb=5ea386c3b8e3566ec0b6710c82aae433de4d944a;hp=3a667adce53c8ccdda4f15b872c13d054907f7ed;hpb=a9ff648cc4cc06d28b522d705c467d45ab916a9d;p=lttng-ust.git diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c index 3a667adc..b65105f3 100644 --- a/libringbuffer/ring_buffer_backend.c +++ b/libringbuffer/ring_buffer_backend.c @@ -29,8 +29,6 @@ #include "smp.h" #include "shm.h" -#define UINT_MAX_STR_LEN 11 /* includes \0 */ - /** * lib_ring_buffer_backend_allocate - allocate a channel buffer * @config: ring buffer instance configuration @@ -200,7 +198,7 @@ void channel_backend_reset(struct channel_backend *chanb) * @subbuf_size: size of sub-buffers (> PAGE_SIZE, power of 2) * @num_subbuf: number of sub-buffers (power of 2) * @lttng_ust_shm_handle: shared memory handle - * @shm_path: shared memory files path + * @stream_fds: stream file descriptors. * * Returns channel pointer if successful, %NULL otherwise. * @@ -215,7 +213,7 @@ int channel_backend_init(struct channel_backend *chanb, const struct lttng_ust_lib_ring_buffer_config *config, size_t subbuf_size, size_t num_subbuf, struct lttng_ust_shm_handle *handle, - const char *shm_path) + const int *stream_fds) { struct channel *chan = caa_container_of(chanb, struct channel, backend); unsigned int i; @@ -288,21 +286,9 @@ int channel_backend_init(struct channel_backend *chanb, */ for_each_possible_cpu(i) { struct shm_object *shmobj; - char shm_buf_path[PATH_MAX]; - - if (shm_path) { - char cpu_nr[UINT_MAX_STR_LEN]; /* unsigned int max len */ - - strncpy(shm_buf_path, shm_path, PATH_MAX); - shm_buf_path[PATH_MAX - 1] = '\0'; - ret = snprintf(cpu_nr, UINT_MAX_STR_LEN, "%u", i); - if (ret != 1) - goto end; - strncat(shm_buf_path, cpu_nr, - PATH_MAX - strlen(shm_buf_path) - 1); - } + shmobj = shm_object_table_alloc(handle->table, shmsize, - SHM_OBJECT_SHM, shm_path ? shm_buf_path : NULL); + SHM_OBJECT_SHM, stream_fds[i]); if (!shmobj) goto end; align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer)); @@ -321,7 +307,7 @@ int channel_backend_init(struct channel_backend *chanb, struct lttng_ust_lib_ring_buffer *buf; shmobj = shm_object_table_alloc(handle->table, shmsize, - SHM_OBJECT_SHM, shm_path); + SHM_OBJECT_SHM, stream_fds[0]); if (!shmobj) goto end; align_shm(shmobj, __alignof__(struct lttng_ust_lib_ring_buffer));