}
read_count += copy_len;
}
- return read_count;
+ goto put_record;
nodata:
*ppos = 0;
chan->iter.len_left = 0;
+
+put_record:
+ lib_ring_buffer_put_current_record(buf);
return read_count;
}
const struct lib_ring_buffer_config *config = &chan->backend.config;
int finalized, disabled;
unsigned long consumed, offset;
+ size_t subbuffer_header_size = config->cb.subbuffer_header_size();
if (filp->f_mode & FMODE_READ) {
poll_wait_set_exclusive(wait);
/*
* If there is a non-empty subbuffer, flush and try again.
*/
- if (subbuf_offset(offset, chan) != 0) {
+ if (subbuf_offset(offset, chan) > subbuffer_header_size) {
lib_ring_buffer_switch_remote(buf);
goto retry;
}
static
long lttng_event_notifier_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
+ struct lttng_event_notifier *event_notifier;
struct lttng_event_notifier_enabler *event_notifier_enabler;
enum lttng_event_type *evtype = file->private_data;
case LTTNG_KERNEL_ENABLE:
switch (*evtype) {
case LTTNG_TYPE_EVENT:
- return -EINVAL;
+ event_notifier = file->private_data;
+ return lttng_event_notifier_enable(event_notifier);
case LTTNG_TYPE_ENABLER:
event_notifier_enabler = file->private_data;
return lttng_event_notifier_enabler_enable(event_notifier_enabler);
case LTTNG_KERNEL_DISABLE:
switch (*evtype) {
case LTTNG_TYPE_EVENT:
- return -EINVAL;
+ event_notifier = file->private_data;
+ return lttng_event_notifier_disable(event_notifier);
case LTTNG_TYPE_ENABLER:
event_notifier_enabler = file->private_data;
return lttng_event_notifier_enabler_disable(event_notifier_enabler);
WARN_ON_ONCE(1);
return -ENOSYS;
}
+ case LTTNG_KERNEL_ADD_CALLSITE:
+ switch (*evtype) {
+ case LTTNG_TYPE_EVENT:
+ event_notifier = file->private_data;
+ return lttng_event_notifier_add_callsite(event_notifier,
+ (struct lttng_kernel_event_callsite __user *) arg);
+ case LTTNG_TYPE_ENABLER:
+ return -EINVAL;
+ default:
+ WARN_ON_ONCE(1);
+ return -ENOSYS;
+ }
default:
return -ENOIOCTLCMD;
}
switch (event_notifier_param->event.instrumentation) {
case LTTNG_KERNEL_TRACEPOINT:
- case LTTNG_KERNEL_KPROBE:
case LTTNG_KERNEL_UPROBE:
+ break;
+ case LTTNG_KERNEL_KPROBE:
+ event_notifier_param->event.u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ break;
case LTTNG_KERNEL_KRETPROBE:
+ /* Placing an event notifier on kretprobe is not supported. */
case LTTNG_KERNEL_FUNCTION:
case LTTNG_KERNEL_NOOP:
case LTTNG_KERNEL_SYSCALL: