* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
+#include <stdint.h>
#include <string.h>
+#include <sys/mman.h>
+#include <unistd.h>
+
#include <lttng/ust-config.h>
#include <lttng/ust-ctl.h>
#include <lttng/ust-abi.h>
#include <lttng/ust-events.h>
-#include <sys/mman.h>
-#include <byteswap.h>
-
+#include <lttng/ust-endian.h>
#include <usterr-signal-safe.h>
#include <ust-comm.h>
#include <helper.h>
extern void lttng_ring_buffer_client_discard_rt_exit(void);
extern void lttng_ring_buffer_metadata_client_exit(void);
-volatile enum ust_loglevel ust_loglevel;
-
int ustctl_release_handle(int sock, int handle)
{
struct ustcomm_ust_msg lum;
ret = -errno;
return ret;
}
+ data->u.channel.wakeup_fd = -1;
}
free(data->u.channel.data);
+ data->u.channel.data = NULL;
break;
case LTTNG_UST_OBJECT_TYPE_STREAM:
if (data->u.stream.shm_fd >= 0) {
ret = -errno;
return ret;
}
+ data->u.stream.shm_fd = -1;
}
if (data->u.stream.wakeup_fd >= 0) {
ret = close(data->u.stream.wakeup_fd);
ret = -errno;
return ret;
}
+ data->u.stream.wakeup_fd = -1;
}
break;
case LTTNG_UST_OBJECT_TYPE_EVENT:
attr->switch_timer_interval,
attr->read_timer_interval,
attr->uuid, attr->chan_id,
- stream_fds, nr_stream_fds);
+ stream_fds, nr_stream_fds,
+ attr->blocking_timeout);
if (!chan->chan) {
goto chan_error;
}
chan = consumer_chan->chan->chan;
*len = lib_ring_buffer_get_read_data_size(&chan->backend.config, buf,
consumer_chan->chan->handle);
- *len = PAGE_ALIGN(*len);
+ *len = LTTNG_UST_PAGE_ALIGN(*len);
return 0;
}
consumer_chan->chan->handle);
}
+void ustctl_clear_buffer(struct ustctl_consumer_stream *stream)
+{
+ struct lttng_ust_lib_ring_buffer *buf;
+ struct ustctl_consumer_channel *consumer_chan;
+
+ assert(stream);
+ buf = stream->buf;
+ consumer_chan = stream->chan;
+ lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE,
+ consumer_chan->chan->handle);
+ lib_ring_buffer_clear_reader(buf, consumer_chan->chan->handle);
+}
+
static
struct lttng_ust_client_lib_ring_buffer_client_cb *get_client_cb(
struct lttng_ust_lib_ring_buffer *buf,
*uint64_t_alignment = reg_msg.uint64_t_alignment;
*long_alignment = reg_msg.long_alignment;
memcpy(name, reg_msg.name, LTTNG_UST_ABI_PROCNAME_LEN);
- if (reg_msg.major != LTTNG_UST_ABI_MAJOR_VERSION) {
+ if (reg_msg.major < LTTNG_UST_ABI_MAJOR_VERSION_OLDEST_COMPATIBLE ||
+ reg_msg.major > LTTNG_UST_ABI_MAJOR_VERSION) {
return -LTTNG_UST_ERR_UNSUP_MAJOR;
}