X-Git-Url: http://git.lttng.org/?a=blobdiff_plain;ds=sidebyside;f=libringbuffer%2Ffrontend.h;h=bac86d17cdbcdd925637e114f5ab2eadb7dc44ef;hb=c0c0989ab70574e09b2f7e8b48c2da6af664a849;hp=8c8517086828d1fc5c9cf2bf2c780b8a933fc653;hpb=5ea386c3b8e3566ec0b6710c82aae433de4d944a;p=lttng-ust.git diff --git a/libringbuffer/frontend.h b/libringbuffer/frontend.h index 8c851708..bac86d17 100644 --- a/libringbuffer/frontend.h +++ b/libringbuffer/frontend.h @@ -1,34 +1,19 @@ -#ifndef _LTTNG_RING_BUFFER_FRONTEND_H -#define _LTTNG_RING_BUFFER_FRONTEND_H - /* - * libringbuffer/frontend.h - * - * Ring Buffer Library Synchronization Header (API). + * SPDX-License-Identifier: LGPL-2.1-only * * Copyright (C) 2005-2012 Mathieu Desnoyers * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - * - * - * Author: - * Mathieu Desnoyers + * Ring Buffer Library Synchronization Header (API). * * See ring_buffer_frontend.c for more information on wait-free algorithms. */ +#ifndef _LTTNG_RING_BUFFER_FRONTEND_H +#define _LTTNG_RING_BUFFER_FRONTEND_H + +#include +#include + #include #include @@ -65,7 +50,8 @@ struct lttng_ust_shm_handle *channel_create(const struct lttng_ust_lib_ring_buff size_t subbuf_size, size_t num_subbuf, unsigned int switch_timer_interval, unsigned int read_timer_interval, - const int *stream_fds, int nr_stream_fds); + const int *stream_fds, int nr_stream_fds, + int64_t blocking_timeout); /* * channel_destroy finalizes all channel's buffers, waits for readers to @@ -131,6 +117,11 @@ extern int lib_ring_buffer_snapshot(struct lttng_ust_lib_ring_buffer *buf, unsigned long *consumed, unsigned long *produced, struct lttng_ust_shm_handle *handle); +extern int lib_ring_buffer_snapshot_sample_positions( + struct lttng_ust_lib_ring_buffer *buf, + unsigned long *consumed, + unsigned long *produced, + struct lttng_ust_shm_handle *handle); extern void lib_ring_buffer_move_consumer(struct lttng_ust_lib_ring_buffer *buf, unsigned long consumed_new, struct lttng_ust_shm_handle *handle); @@ -162,9 +153,14 @@ static inline void lib_ring_buffer_put_next_subbuf(struct lttng_ust_lib_ring_buffer *buf, struct lttng_ust_shm_handle *handle) { + struct channel *chan; + + chan = shmp(handle, buf->backend.chan); + if (!chan) + return; lib_ring_buffer_put_subbuf(buf, handle); - lib_ring_buffer_move_consumer(buf, subbuf_align(buf->cons_snapshot, - shmp(handle, buf->backend.chan)), handle); + lib_ring_buffer_move_consumer(buf, subbuf_align(buf->cons_snapshot, chan), + handle); } extern void channel_reset(struct channel *chan);