X-Git-Url: https://git.lttng.org/?a=blobdiff_plain;f=src%2Fcommon%2Fust-consumer%2Fust-consumer.h;h=e6590c33c047028f079bb905febdaf9779ef6472;hb=4878de5c7deb512bbdac4fdfc498907efa06fb7c;hp=c07377f8ea38711cfbd72951982ff173640ff683;hpb=d14d33bf091e72b23b1f90ea18a0a01bed098b76;p=lttng-tools.git diff --git a/src/common/ust-consumer/ust-consumer.h b/src/common/ust-consumer/ust-consumer.h index c07377f8e..e6590c33c 100644 --- a/src/common/ust-consumer/ust-consumer.h +++ b/src/common/ust-consumer/ust-consumer.h @@ -1,69 +1,36 @@ /* - * Copyright (C) 2011 - Julien Desfossez - * Copyright (C) 2011 - Mathieu Desnoyers + * Copyright (C) 2011 EfficiOS Inc. + * Copyright (C) 2011 Mathieu Desnoyers * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License, version 2 only, - * as published by the Free Software Foundation. + * SPDX-License-Identifier: GPL-2.0-only * - * This program 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ #ifndef _LTTNG_USTCONSUMER_H #define _LTTNG_USTCONSUMER_H -#include -#include - -#include +#include +#include +#include #ifdef HAVE_LIBLTTNG_UST_CTL -/* - * Mmap the ring buffer, read it and write the data to the tracefile. - * - * Returns the number of bytes written, else negative value on error. - */ -extern ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len); +int lttng_ustconsumer_take_snapshot(struct lttng_consumer_stream *stream); +int lttng_ustconsumer_sample_snapshot_positions( + struct lttng_consumer_stream *stream); -/* Not implemented */ -extern ssize_t lttng_ustconsumer_on_read_subbuffer_splice( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len); - -/* - * Take a snapshot for a specific fd - * - * Returns 0 on success, < 0 on error - */ -int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream); - -/* - * Get the produced position - * - * Returns 0 on success, < 0 on error - */ int lttng_ustconsumer_get_produced_snapshot( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, - unsigned long *pos); + struct lttng_consumer_stream *stream, unsigned long *pos); +int lttng_ustconsumer_get_consumed_snapshot( + struct lttng_consumer_stream *stream, unsigned long *pos); int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, int sock, struct pollfd *consumer_sockpoll); extern int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan); extern void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan); -extern int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream); +extern void lttng_ustconsumer_free_channel(struct lttng_consumer_channel *chan); +extern int lttng_ustconsumer_add_stream(struct lttng_consumer_stream *stream); extern void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream); int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, @@ -72,87 +39,250 @@ int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream); void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream); +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream, + int producer_active); +int lttng_ustconsumer_get_stream_id(struct lttng_consumer_stream *stream, + uint64_t *stream_id); +int lttng_ustconsumer_data_pending(struct lttng_consumer_stream *stream); +void lttng_ustconsumer_close_all_metadata(struct lttng_ht *ht); +void lttng_ustconsumer_close_metadata(struct lttng_consumer_channel *metadata); +void lttng_ustconsumer_close_stream_wakeup(struct lttng_consumer_stream *stream); +int lttng_ustconsumer_recv_metadata(int sock, uint64_t key, uint64_t offset, + uint64_t len, uint64_t version, + struct lttng_consumer_channel *channel, int timer, int wait); +int lttng_ustconsumer_request_metadata(struct lttng_consumer_local_data *ctx, + struct lttng_consumer_channel *channel, int timer, int wait); +enum sync_metadata_status lttng_ustconsumer_sync_metadata( + struct lttng_consumer_local_data *ctx, + struct lttng_consumer_stream *metadata); +int lttng_ustconsumer_flush_buffer(struct lttng_consumer_stream *stream, + int producer); +int lttng_ustconsumer_clear_buffer(struct lttng_consumer_stream *stream); +int lttng_ustconsumer_get_current_timestamp( + struct lttng_consumer_stream *stream, uint64_t *ts); +int lttng_ustconsumer_get_sequence_number( + struct lttng_consumer_stream *stream, uint64_t *seq); +void lttng_ustconsumer_sigbus_handle(void *addr); + #else /* HAVE_LIBLTTNG_UST_CTL */ static inline ssize_t lttng_ustconsumer_on_read_subbuffer_mmap( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, unsigned long len) + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *stream __attribute__((unused)), + unsigned long len __attribute__((unused)), + unsigned long padding __attribute__((unused))) { return -ENOSYS; } static inline ssize_t lttng_ustconsumer_on_read_subbuffer_splice( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *uststream, unsigned long len) + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *uststream __attribute__((unused)), + unsigned long len __attribute__((unused)), + unsigned long padding __attribute__((unused))) { return -ENOSYS; } static inline -int lttng_ustconsumer_take_snapshot(struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream) +int lttng_ustconsumer_take_snapshot( + struct lttng_consumer_stream *stream __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_sample_snapshot_positions( + struct lttng_consumer_stream *stream __attribute__((unused))) { return -ENOSYS; } static inline int lttng_ustconsumer_get_produced_snapshot( - struct lttng_consumer_local_data *ctx, - struct lttng_consumer_stream *stream, - unsigned long *pos) + struct lttng_consumer_stream *stream __attribute__((unused)), + unsigned long *pos __attribute__((unused))) { return -ENOSYS; } static inline -int lttng_ustconsumer_recv_cmd(struct lttng_consumer_local_data *ctx, - int sock, struct pollfd *consumer_sockpoll) +int lttng_ustconsumer_get_consumed_snapshot( + struct lttng_consumer_stream *stream __attribute__((unused)), + unsigned long *pos __attribute__((unused))) { return -ENOSYS; } static inline -int lttng_ustconsumer_allocate_channel(struct lttng_consumer_channel *chan) +int lttng_ustconsumer_recv_cmd( + struct lttng_consumer_local_data *ctx __attribute__((unused)), + int sock __attribute__((unused)), + struct pollfd *consumer_sockpoll __attribute__((unused))) { return -ENOSYS; } static inline -void lttng_ustconsumer_del_channel(struct lttng_consumer_channel *chan) +int lttng_ustconsumer_allocate_channel( + struct lttng_consumer_channel *chan __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +void lttng_ustconsumer_del_channel( + struct lttng_consumer_channel *chan __attribute__((unused))) +{ +} + +static inline +void lttng_ustconsumer_free_channel( + struct lttng_consumer_channel *chan __attribute__((unused))) { } static inline -int lttng_ustconsumer_allocate_stream(struct lttng_consumer_stream *stream) +int lttng_ustconsumer_add_stream( + struct lttng_consumer_stream *stream __attribute__((unused))) { return -ENOSYS; } static inline -void lttng_ustconsumer_del_stream(struct lttng_consumer_stream *stream) +void lttng_ustconsumer_del_stream( + struct lttng_consumer_stream *stream __attribute__((unused))) { } static inline -int lttng_ustconsumer_read_subbuffer(struct lttng_consumer_stream *stream, - struct lttng_consumer_local_data *ctx) +int lttng_ustconsumer_read_subbuffer( + struct lttng_consumer_stream *stream __attribute__((unused)), + struct lttng_consumer_local_data *ctx __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_on_recv_stream( + struct lttng_consumer_stream *stream __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +void lttng_ustconsumer_on_stream_hangup( + struct lttng_consumer_stream *stream __attribute__((unused))) +{ +} + +static inline +int lttng_ustconsumer_data_pending( + struct lttng_consumer_stream *stream __attribute__((unused))) { return -ENOSYS; } static inline -int lttng_ustconsumer_on_recv_stream(struct lttng_consumer_stream *stream) +int lttng_ust_flush_buffer(struct lttng_consumer_stream *stream __attribute__((unused)), + int producer_active __attribute__((unused))) { return -ENOSYS; } static inline -void lttng_ustconsumer_on_stream_hangup(struct lttng_consumer_stream *stream) +void lttng_ustconsumer_close_all_metadata( + struct lttng_ht *ht __attribute__((unused))) { } +static inline +void lttng_ustconsumer_close_metadata( + struct lttng_consumer_channel *metadata __attribute__((unused))) +{ +} +static inline +void lttng_ustconsumer_close_stream_wakeup( + struct lttng_consumer_stream *stream __attribute__((unused))) +{ +} + +static inline +int lttng_ustconsumer_recv_metadata(int sock __attribute__((unused)), + uint64_t key __attribute__((unused)), + uint64_t offset __attribute__((unused)), + uint64_t len __attribute__((unused)), + uint64_t version __attribute__((unused)), + struct lttng_consumer_channel *channel __attribute__((unused)), + int timer __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_request_metadata( + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_channel *channel __attribute__((unused)), + int timer __attribute__((unused)), + int wait __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +enum sync_metadata_status lttng_ustconsumer_sync_metadata( + struct lttng_consumer_local_data *ctx __attribute__((unused)), + struct lttng_consumer_stream *metadata __attribute__((unused))) +{ + return SYNC_METADATA_STATUS_ERROR; +} + +static inline +int lttng_ustconsumer_flush_buffer( + struct lttng_consumer_stream *stream __attribute__((unused)), + int producer __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_clear_buffer( + struct lttng_consumer_stream *stream __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_get_current_timestamp( + struct lttng_consumer_stream *stream __attribute__((unused)), + uint64_t *ts __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_get_sequence_number( + struct lttng_consumer_stream *stream __attribute__((unused)), + uint64_t *seq __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +int lttng_ustconsumer_get_stream_id( + struct lttng_consumer_stream *stream __attribute__((unused)), + uint64_t *stream_id __attribute__((unused))) +{ + return -ENOSYS; +} + +static inline +void lttng_ustconsumer_sigbus_handle( + void *addr __attribute__((unused))) +{ +} #endif /* HAVE_LIBLTTNG_UST_CTL */ #endif /* _LTTNG_USTCONSUMER_H */