LTTNG_ENABLER_FORMAT_NAME,
};
+enum channel_type {
+ PER_CPU_CHANNEL,
+ METADATA_CHANNEL,
+};
+
/*
* Objects in a linked-list of enablers, owned by an event.
*/
};
+struct lttng_kernel_channel_common_private {
+ struct lttng_kernel_channel_common *pub;
+
+ struct file *file; /* File associated to channel */
+ unsigned int sys_enter_registered:1,
+ sys_exit_registered:1,
+ tstate:1; /* Transient enable state */
+
+ struct hlist_head *sc_table; /* for syscall tracing */
+ struct hlist_head *compat_sc_table;
+ struct hlist_head *sc_exit_table; /* for syscall exit tracing */
+ struct hlist_head *compat_sc_exit_table;
+ struct hlist_head sc_unknown; /* for unknown syscalls */
+ struct hlist_head sc_compat_unknown;
+ struct hlist_head sc_exit_unknown;
+ struct hlist_head compat_sc_exit_unknown;
+ struct lttng_syscall_filter *sc_filter;
+ int syscall_all_entry;
+ int syscall_all_exit;
+};
+
+struct lttng_kernel_channel_buffer_private {
+ struct lttng_kernel_channel_common_private parent;
+
+ struct lttng_kernel_channel_buffer *pub;
+
+ unsigned int id; /* Channel ID */
+ unsigned int free_event_id; /* Next event ID to allocate */
+ int header_type; /* 0: unset, 1: compact, 2: large */
+
+ enum channel_type channel_type;
+ struct lttng_kernel_ctx *ctx;
+ struct channel *rb_chan; /* Ring buffer channel */
+ unsigned int metadata_dumped:1;
+ struct list_head node; /* Channel list in session */
+ struct lttng_transport *transport;
+};
+
enum lttng_kernel_bytecode_interpreter_ret {
LTTNG_KERNEL_BYTECODE_INTERPRETER_ERROR = -1,
LTTNG_KERNEL_BYTECODE_INTERPRETER_OK = 0,
struct lttng_event_enabler {
struct lttng_enabler base;
struct list_head node; /* per-session list of enablers */
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer *chan;
};
struct lttng_event_notifier_enabler {
size_t offset);
void (*record)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan);
+ struct lttng_kernel_channel_buffer *chan);
void (*get_value)(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_ctx_value *value);
void (*destroy)(void *priv);
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_kernel_abi_event *event_param,
- struct lttng_channel *chan);
+ struct lttng_kernel_channel_buffer *chan);
int lttng_event_enabler_enable(struct lttng_event_enabler *event_enabler);
int lttng_event_enabler_disable(struct lttng_event_enabler *event_enabler);
#if defined(CONFIG_HAVE_SYSCALL_TRACEPOINTS)
int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler);
-int lttng_syscalls_unregister_channel(struct lttng_channel *chan);
-int lttng_syscalls_destroy_event(struct lttng_channel *chan);
+int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan);
+int lttng_syscalls_destroy_event(struct lttng_kernel_channel_buffer *chan);
int lttng_syscall_filter_enable_event(
- struct lttng_channel *chan,
+ struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event);
int lttng_syscall_filter_disable_event(
- struct lttng_channel *chan,
+ struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event);
-long lttng_channel_syscall_mask(struct lttng_channel *channel,
+long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel,
struct lttng_kernel_abi_syscall_mask __user *usyscall_mask);
int lttng_syscalls_register_event_notifier(
return -ENOSYS;
}
-static inline int lttng_syscalls_unregister_channel(struct lttng_channel *chan)
+static inline int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan)
{
return 0;
}
-static inline int lttng_syscalls_destroy(struct lttng_channel *chan)
+static inline int lttng_syscalls_destroy(struct lttng_kernel_channel_buffer *chan)
{
return 0;
}
-static inline int lttng_syscall_filter_enable_event(struct lttng_channel *chan,
+static inline int lttng_syscall_filter_enable_event(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event);
{
return -ENOSYS;
}
-static inline int lttng_syscall_filter_disable_event(struct lttng_channel *chan,
+static inline int lttng_syscall_filter_disable_event(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event);
{
return -ENOSYS;
}
-static inline long lttng_channel_syscall_mask(struct lttng_channel *channel,
+static inline long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel,
struct lttng_kernel_syscall_mask __user *usyscall_mask)
{
return -ENOSYS;
void lttng_event_notifier_group_destroy(
struct lttng_event_notifier_group *event_notifier_group);
-struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session,
+struct lttng_kernel_channel_buffer *lttng_channel_create(struct lttng_kernel_session *session,
const char *transport_name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
unsigned int read_timer_interval,
enum channel_type channel_type);
-struct lttng_channel *lttng_global_channel_create(struct lttng_kernel_session *session,
+struct lttng_kernel_channel_buffer *lttng_global_channel_create(struct lttng_kernel_session *session,
int overwrite, void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int switch_timer_interval,
unsigned int read_timer_interval);
-void lttng_metadata_channel_destroy(struct lttng_channel *chan);
-struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
+void lttng_metadata_channel_destroy(struct lttng_kernel_channel_buffer *chan);
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype);
-struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype);
-struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_event_compat_old_create(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_abi_old_event *old_event_param,
const struct lttng_kernel_event_desc *internal_desc);
struct lttng_kernel_abi_event_notifier *event_notifier_param,
enum lttng_kernel_abi_instrumentation itype);
-int lttng_channel_enable(struct lttng_channel *channel);
-int lttng_channel_disable(struct lttng_channel *channel);
+int lttng_channel_enable(struct lttng_kernel_channel_buffer *channel);
+int lttng_channel_disable(struct lttng_kernel_channel_buffer *channel);
int lttng_event_enable(struct lttng_kernel_event_common *event);
int lttng_event_disable(struct lttng_kernel_event_common *event);
#define lttng_is_signed_type(type) (((type) -1) < (type) 1)
-struct lttng_channel;
+struct lttng_kernel_channel_buffer;
struct lttng_kernel_session;
struct lttng_kernel_ring_buffer_ctx;
NR_LTTNG_KERNEL_STRING_ENCODING,
};
-enum channel_type {
- PER_CPU_CHANNEL,
- METADATA_CHANNEL,
-};
-
struct lttng_kernel_enum_value {
unsigned long long value;
unsigned int signedness:1;
struct lttng_kernel_event_common parent;
struct lttng_kernel_event_recorder_private *priv; /* Private event record interface */
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer *chan;
};
struct lttng_kernel_notification_ctx {
size_t len);
void (*event_strcpy_from_user)(struct lttng_kernel_ring_buffer_ctx *ctx,
const char __user *src, size_t len);
+ void (*lost_event_too_big)(struct lttng_kernel_channel_buffer *lttng_channel);
+};
+
+enum lttng_kernel_channel_type {
+ LTTNG_KERNEL_CHANNEL_TYPE_BUFFER = 0,
};
-struct lttng_channel {
- unsigned int id;
- struct channel *chan; /* Channel buffers */
+struct lttng_kernel_channel_common_private;
+
+/* Use container_of() to get child. */
+struct lttng_kernel_channel_common {
+ struct lttng_kernel_channel_common_private *priv; /* Private channel interface. */
+
+ enum lttng_kernel_channel_type type;
+
int enabled;
- struct lttng_kernel_ctx *ctx;
- /* Event ID management */
struct lttng_kernel_session *session;
- struct file *file; /* File associated to channel */
- unsigned int free_event_id; /* Next event ID to allocate */
- struct list_head list; /* Channel list */
+};
+
+struct lttng_kernel_channel_buffer_private;
+
+struct lttng_kernel_channel_buffer {
+ struct lttng_kernel_channel_common parent;
+ struct lttng_kernel_channel_buffer_private *priv;
+
struct lttng_kernel_channel_buffer_ops *ops;
- struct lttng_transport *transport;
- struct hlist_head *sc_table; /* for syscall tracing */
- struct hlist_head *compat_sc_table;
- struct hlist_head *sc_exit_table; /* for syscall exit tracing */
- struct hlist_head *compat_sc_exit_table;
- struct hlist_head sc_unknown; /* for unknown syscalls */
- struct hlist_head sc_compat_unknown;
- struct hlist_head sc_exit_unknown;
- struct hlist_head compat_sc_exit_unknown;
- struct lttng_syscall_filter *sc_filter;
- int header_type; /* 0: unset, 1: compact, 2: large */
- enum channel_type channel_type;
- int syscall_all_entry;
- int syscall_all_exit;
- unsigned int metadata_dumped:1,
- sys_enter_registered:1,
- sys_exit_registered:1,
- tstate:1; /* Transient enable state */
};
#define LTTNG_DYNAMIC_LEN_STACK_SIZE 128
{ \
struct lttng_kernel_event_recorder *__event_recorder = \
container_of(__event, struct lttng_kernel_event_recorder, parent); \
- struct lttng_channel *__chan = __event_recorder->chan; \
- struct lttng_kernel_session *__session = __chan->session; \
+ struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \
+ struct lttng_kernel_session *__session = __chan->parent.session; \
struct lttng_kernel_id_tracker_rcu *__lf; \
\
if (!_TP_SESSION_CHECK(session, __session)) \
return; \
if (unlikely(!LTTNG_READ_ONCE(__session->active))) \
return; \
- if (unlikely(!LTTNG_READ_ONCE(__chan->enabled))) \
+ if (unlikely(!LTTNG_READ_ONCE(__chan->parent.enabled))) \
return; \
__lf = lttng_rcu_dereference(__session->pid_tracker.p); \
if (__lf && likely(!lttng_id_tracker_lookup(__lf, current->tgid))) \
{ \
struct lttng_kernel_event_recorder *__event_recorder = \
container_of(__event, struct lttng_kernel_event_recorder, parent); \
- struct lttng_channel *__chan = __event_recorder->chan; \
+ struct lttng_kernel_channel_buffer *__chan = __event_recorder->chan; \
struct lttng_kernel_ring_buffer_ctx __ctx; \
ssize_t __event_len; \
size_t __event_align; \
\
__event_len = __event_get_size__##_name(_locvar_args); \
if (unlikely(__event_len < 0)) { \
- lib_ring_buffer_lost_event_too_big(__chan->chan); \
+ __chan->ops->lost_event_too_big(__chan); \
goto __post; \
} \
__event_align = __event_get_align__##_name(_locvar_args); \
#include <ringbuffer/config.h>
struct lttng_kernel_session;
-struct lttng_channel;
-struct lttng_event;
#endif /* LTTNG_TRACER_CORE_H */
struct lttng_kernel_session *session = session_file->private_data;
const struct file_operations *fops = NULL;
const char *transport_name;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer *chan;
struct file *chan_file;
int chan_fd;
int ret = 0;
ret = -EINVAL;
goto chan_error;
}
- chan->file = chan_file;
+ chan->priv->parent.file = chan_file;
chan_file->private_data = chan;
fd_install(chan_fd, chan_file);
static
int lttng_abi_open_stream(struct file *channel_file)
{
- struct lttng_channel *channel = channel_file->private_data;
+ struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
struct lib_ring_buffer *buf;
int ret;
void *stream_priv;
- buf = channel->ops->priv->buffer_read_open(channel->chan);
+ buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan);
if (!buf)
return -ENOENT;
static
int lttng_abi_open_metadata_stream(struct file *channel_file)
{
- struct lttng_channel *channel = channel_file->private_data;
- struct lttng_kernel_session *session = channel->session;
+ struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
+ struct lttng_kernel_session *session = channel->parent.session;
struct lib_ring_buffer *buf;
int ret;
struct lttng_metadata_stream *metadata_stream;
void *stream_priv;
- buf = channel->ops->priv->buffer_read_open(channel->chan);
+ buf = channel->ops->priv->buffer_read_open(channel->priv->rb_chan);
if (!buf)
return -ENOENT;
init_waitqueue_head(&metadata_stream->read_wait);
metadata_stream->priv = buf;
stream_priv = metadata_stream;
- metadata_stream->transport = channel->transport;
+ metadata_stream->transport = channel->priv->transport;
/* Initial state is an empty metadata, considered as incoherent. */
metadata_stream->coherent = false;
struct lttng_kernel_abi_event *event_param)
{
const struct file_operations *fops;
- struct lttng_channel *channel = channel_file->private_data;
+ struct lttng_kernel_channel_buffer *channel = channel_file->private_data;
int event_fd, ret;
struct file *event_file;
void *priv;
static
long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
- struct lttng_channel *channel = file->private_data;
+ struct lttng_kernel_channel_buffer *channel = file->private_data;
switch (cmd) {
case LTTNG_KERNEL_ABI_OLD_STREAM:
ret = lttng_abi_add_context(file,
ucontext_param,
- &channel->ctx, channel->session);
+ &channel->priv->ctx, channel->parent.session);
old_ctx_error_free_old_param:
kfree(old_ucontext_param);
return -EFAULT;
return lttng_abi_add_context(file,
&ucontext_param,
- &channel->ctx, channel->session);
+ &channel->priv->ctx, channel->parent.session);
}
case LTTNG_KERNEL_ABI_OLD_ENABLE:
case LTTNG_KERNEL_ABI_ENABLE:
*/
unsigned int lttng_channel_poll(struct file *file, poll_table *wait)
{
- struct lttng_channel *channel = file->private_data;
+ struct lttng_kernel_channel_buffer *channel = file->private_data;
unsigned int mask = 0;
if (file->f_mode & FMODE_READ) {
poll_wait_set_exclusive(wait);
- poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->chan),
+ poll_wait(file, channel->ops->priv->get_hp_wait_queue(channel->priv->rb_chan),
wait);
- if (channel->ops->priv->is_disabled(channel->chan))
+ if (channel->ops->priv->is_disabled(channel->priv->rb_chan))
return POLLERR;
- if (channel->ops->priv->is_finalized(channel->chan))
+ if (channel->ops->priv->is_finalized(channel->priv->rb_chan))
return POLLHUP;
- if (channel->ops->priv->buffer_has_read_closed_stream(channel->chan))
+ if (channel->ops->priv->buffer_has_read_closed_stream(channel->priv->rb_chan))
return POLLIN | POLLRDNORM;
return 0;
}
static
int lttng_channel_release(struct inode *inode, struct file *file)
{
- struct lttng_channel *channel = file->private_data;
+ struct lttng_kernel_channel_buffer *channel = file->private_data;
if (channel)
- fput(channel->session->priv->file);
+ fput(channel->parent.session->priv->file);
return 0;
}
static
int lttng_metadata_channel_release(struct inode *inode, struct file *file)
{
- struct lttng_channel *channel = file->private_data;
+ struct lttng_kernel_channel_buffer *channel = file->private_data;
if (channel) {
- fput(channel->session->priv->file);
+ fput(channel->parent.session->priv->file);
lttng_metadata_channel_destroy(channel);
}
struct lttng_kernel_event_recorder *event = file->private_data;
if (event)
- fput(event->chan->file);
+ fput(event->chan->priv->parent.file);
return 0;
}
struct lttng_event_enabler *event_enabler = file->private_data;
if (event_enabler)
- fput(event_enabler->chan->file);
+ fput(event_enabler->chan->priv->parent.file);
return 0;
}
static
void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int cpu = ctx->priv.reserve_cpu;
struct field_data *fdata = (struct field_data *) priv;
static
void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int cpu = ctx->priv.reserve_cpu;
struct field_data *fdata = (struct field_data *) priv;
static
void lttng_callstack_length_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int cpu = ctx->priv.reserve_cpu;
struct field_data *fdata = (struct field_data *) priv;
static
void lttng_callstack_sequence_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int cpu = ctx->priv.reserve_cpu;
struct field_data *fdata = (struct field_data *) priv;
static
void cgroup_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int cgroup_ns_inum = 0;
static
void cpu_id_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int cpu;
static
void egid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t egid;
static
void euid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t euid;
static
void gid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t gid;
static
void hostname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct nsproxy *nsproxy;
struct uts_namespace *ns;
static
void interruptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct lttng_kernel_probe_ctx *lttng_probe_ctx = ctx->probe_ctx;
int8_t interruptible = lttng_probe_ctx->interruptible;
static
void ipc_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int ipc_ns_inum = 0;
static
void migratable_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uint8_t migratable = !current->migrate_disable;
static
void mnt_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int mnt_ns_inum = 0;
static
void need_reschedule_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uint8_t need_reschedule = test_tsk_need_resched(current);
static
void net_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int net_ns_inum = 0;
static
void nice_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int nice;
static
void perf_counter_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct lttng_perf_counter_field *perf_field = (struct lttng_perf_counter_field *) priv;
struct perf_event *event;
static
void pid_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct pid_namespace *ns;
unsigned int pid_ns_inum = 0;
static
void pid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
pid_t pid;
static
void ppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
pid_t ppid;
static
void preemptible_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int pc = preempt_count();
uint8_t preemptible = 0;
static
void prio_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int prio;
static
void procname_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
chan->ops->event_write(ctx, current->comm, sizeof(current->comm));
}
static
void sgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t sgid;
static
void suid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t suid;
static
void tid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
pid_t tid;
static
void time_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int time_ns_inum = 0;
static
void uid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t uid;
static
void user_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int user_ns_inum = 0;
static
void uts_ns_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
unsigned int uts_ns_inum = 0;
static
void vegid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t vegid;
static
void veuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t veuid;
static
void vgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t vgid;
static
void vpid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
pid_t vpid;
static
void vppid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct task_struct *parent;
pid_t vppid;
static
void vsgid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
gid_t vsgid;
static
void vsuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t vsuid;
static
void vtid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
pid_t vtid;
static
void vuid_record(void *priv, struct lttng_kernel_probe_ctx *probe_ctx,
struct lttng_kernel_ring_buffer_ctx *ctx,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
uid_t vuid;
static void lttng_event_notifier_group_sync_enablers(struct lttng_event_notifier_group *event_notifier_group);
static void _lttng_event_destroy(struct lttng_kernel_event_common *event);
-static void _lttng_channel_destroy(struct lttng_channel *chan);
+static void _lttng_channel_destroy(struct lttng_kernel_channel_buffer *chan);
static int _lttng_event_unregister(struct lttng_kernel_event_recorder *event);
static int _lttng_event_notifier_unregister(struct lttng_kernel_event_notifier *event_notifier);
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_channel *chan,
+ struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event);
static
int _lttng_session_metadata_statedump(struct lttng_kernel_session *session);
void lttng_session_destroy(struct lttng_kernel_session *session)
{
- struct lttng_channel *chan, *tmpchan;
+ struct lttng_kernel_channel_buffer_private *chan_priv, *tmpchan_priv;
struct lttng_kernel_event_recorder_private *event_recorder_priv, *tmpevent_recorder_priv;
struct lttng_metadata_stream *metadata_stream;
struct lttng_event_enabler *event_enabler, *tmp_event_enabler;
mutex_lock(&sessions_mutex);
WRITE_ONCE(session->active, 0);
- list_for_each_entry(chan, &session->priv->chan, list) {
- ret = lttng_syscalls_unregister_channel(chan);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ ret = lttng_syscalls_unregister_channel(chan_priv->pub);
WARN_ON(ret);
}
list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
WARN_ON(ret);
}
synchronize_trace(); /* Wait for in-flight events to complete */
- list_for_each_entry(chan, &session->priv->chan, list) {
- ret = lttng_syscalls_destroy_event(chan);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ ret = lttng_syscalls_destroy_event(chan_priv->pub);
WARN_ON(ret);
}
list_for_each_entry_safe(event_enabler, tmp_event_enabler,
lttng_event_enabler_destroy(event_enabler);
list_for_each_entry_safe(event_recorder_priv, tmpevent_recorder_priv, &session->priv->events, node)
_lttng_event_destroy(&event_recorder_priv->pub->parent);
- list_for_each_entry_safe(chan, tmpchan, &session->priv->chan, list) {
- BUG_ON(chan->channel_type == METADATA_CHANNEL);
- _lttng_channel_destroy(chan);
+ list_for_each_entry_safe(chan_priv, tmpchan_priv, &session->priv->chan, node) {
+ BUG_ON(chan_priv->channel_type == METADATA_CHANNEL);
+ _lttng_channel_destroy(chan_priv->pub);
}
mutex_lock(&session->priv->metadata_cache->lock);
list_for_each_entry(metadata_stream, &session->priv->metadata_cache->metadata_stream, list)
int lttng_session_enable(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
mutex_lock(&sessions_mutex);
if (session->active) {
* Snapshot the number of events per channel to know the type of header
* we need to use.
*/
- list_for_each_entry(chan, &session->priv->chan, list) {
- if (chan->header_type)
- continue; /* don't change it if session stop/restart */
- if (chan->free_event_id < 31)
- chan->header_type = 1; /* compact */
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ if (chan_priv->header_type)
+ continue; /* don't change it if session stop/restart */
+ if (chan_priv->free_event_id < 31)
+ chan_priv->header_type = 1; /* compact */
else
- chan->header_type = 2; /* large */
+ chan_priv->header_type = 2; /* large */
}
/* Clear each stream's quiescent state. */
- list_for_each_entry(chan, &session->priv->chan, list) {
- if (chan->channel_type != METADATA_CHANNEL)
- lib_ring_buffer_clear_quiescent_channel(chan->chan);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ if (chan_priv->channel_type != METADATA_CHANNEL)
+ lib_ring_buffer_clear_quiescent_channel(chan_priv->rb_chan);
}
WRITE_ONCE(session->active, 1);
int lttng_session_disable(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
mutex_lock(&sessions_mutex);
if (!session->active) {
lttng_session_sync_event_enablers(session);
/* Set each stream's quiescent state. */
- list_for_each_entry(chan, &session->priv->chan, list) {
- if (chan->channel_type != METADATA_CHANNEL)
- lib_ring_buffer_set_quiescent_channel(chan->chan);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ if (chan_priv->channel_type != METADATA_CHANNEL)
+ lib_ring_buffer_set_quiescent_channel(chan_priv->rb_chan);
}
end:
mutex_unlock(&sessions_mutex);
int lttng_session_metadata_regenerate(struct lttng_kernel_session *session)
{
int ret = 0;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
struct lttng_metadata_cache *cache = session->priv->metadata_cache;
struct lttng_metadata_stream *stream;
mutex_unlock(&cache->lock);
session->priv->metadata_dumped = 0;
- list_for_each_entry(chan, &session->priv->chan, list) {
- chan->metadata_dumped = 0;
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ chan_priv->metadata_dumped = 0;
}
list_for_each_entry(event_recorder_priv, &session->priv->events, node) {
return ret;
}
-int lttng_channel_enable(struct lttng_channel *channel)
+int lttng_channel_enable(struct lttng_kernel_channel_buffer *channel)
{
int ret = 0;
mutex_lock(&sessions_mutex);
- if (channel->channel_type == METADATA_CHANNEL) {
+ if (channel->priv->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
- if (channel->enabled) {
+ if (channel->parent.enabled) {
ret = -EEXIST;
goto end;
}
/* Set transient enabler state to "enabled" */
- channel->tstate = 1;
- lttng_session_sync_event_enablers(channel->session);
+ channel->priv->parent.tstate = 1;
+ lttng_session_sync_event_enablers(channel->parent.session);
/* Set atomically the state to "enabled" */
- WRITE_ONCE(channel->enabled, 1);
+ WRITE_ONCE(channel->parent.enabled, 1);
end:
mutex_unlock(&sessions_mutex);
return ret;
}
-int lttng_channel_disable(struct lttng_channel *channel)
+int lttng_channel_disable(struct lttng_kernel_channel_buffer *channel)
{
int ret = 0;
mutex_lock(&sessions_mutex);
- if (channel->channel_type == METADATA_CHANNEL) {
+ if (channel->priv->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
- if (!channel->enabled) {
+ if (!channel->parent.enabled) {
ret = -EEXIST;
goto end;
}
/* Set atomically the state to "disabled" */
- WRITE_ONCE(channel->enabled, 0);
+ WRITE_ONCE(channel->parent.enabled, 0);
/* Set transient enabler state to "enabled" */
- channel->tstate = 0;
- lttng_session_sync_event_enablers(channel->session);
+ channel->priv->parent.tstate = 0;
+ lttng_session_sync_event_enablers(channel->parent.session);
end:
mutex_unlock(&sessions_mutex);
return ret;
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->priv->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- if (event_recorder->chan->channel_type == METADATA_CHANNEL) {
+ if (event_recorder->chan->priv->channel_type == METADATA_CHANNEL) {
ret = -EPERM;
goto end;
}
return ret;
}
-struct lttng_channel *lttng_channel_create(struct lttng_kernel_session *session,
+struct lttng_kernel_channel_buffer *lttng_channel_create(struct lttng_kernel_session *session,
const char *transport_name,
void *buf_addr,
size_t subbuf_size, size_t num_subbuf,
unsigned int read_timer_interval,
enum channel_type channel_type)
{
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
struct lttng_transport *transport = NULL;
mutex_lock(&sessions_mutex);
printk(KERN_WARNING "LTTng: Can't lock transport module.\n");
goto notransport;
}
- chan = kzalloc(sizeof(struct lttng_channel), GFP_KERNEL);
+ chan = kzalloc(sizeof(struct lttng_kernel_channel_buffer), GFP_KERNEL);
if (!chan)
goto nomem;
- chan->session = session;
- chan->id = session->priv->free_chan_id++;
+ chan_priv = kzalloc(sizeof(struct lttng_kernel_channel_buffer_private), GFP_KERNEL);
+ if (!chan_priv)
+ goto nomem_priv;
+ chan->priv = chan_priv;
+ chan_priv->pub = chan;
+ chan->parent.type = LTTNG_KERNEL_CHANNEL_TYPE_BUFFER;
+ chan->parent.session = session;
+ chan->priv->id = session->priv->free_chan_id++;
chan->ops = &transport->ops;
/*
* Note: the channel creation op already writes into the packet
* headers. Therefore the "chan" information used as input
* should be already accessible.
*/
- chan->chan = transport->ops.priv->channel_create(transport_name,
+ chan->priv->rb_chan = transport->ops.priv->channel_create(transport_name,
chan, buf_addr, subbuf_size, num_subbuf,
switch_timer_interval, read_timer_interval);
- if (!chan->chan)
+ if (!chan->priv->rb_chan)
goto create_error;
- chan->tstate = 1;
- chan->enabled = 1;
- chan->transport = transport;
- chan->channel_type = channel_type;
- list_add(&chan->list, &session->priv->chan);
+ chan->priv->parent.tstate = 1;
+ chan->parent.enabled = 1;
+ chan->priv->transport = transport;
+ chan->priv->channel_type = channel_type;
+ list_add(&chan->priv->node, &session->priv->chan);
mutex_unlock(&sessions_mutex);
return chan;
create_error:
+ kfree(chan_priv);
+nomem_priv:
kfree(chan);
nomem:
if (transport)
* Needs to be called with sessions mutex held.
*/
static
-void _lttng_channel_destroy(struct lttng_channel *chan)
+void _lttng_channel_destroy(struct lttng_kernel_channel_buffer *chan)
{
- chan->ops->priv->channel_destroy(chan->chan);
- module_put(chan->transport->owner);
- list_del(&chan->list);
- lttng_kernel_destroy_context(chan->ctx);
+ chan->ops->priv->channel_destroy(chan->priv->rb_chan);
+ module_put(chan->priv->transport->owner);
+ list_del(&chan->priv->node);
+ lttng_kernel_destroy_context(chan->priv->ctx);
+ kfree(chan->priv);
kfree(chan);
}
-void lttng_metadata_channel_destroy(struct lttng_channel *chan)
+void lttng_metadata_channel_destroy(struct lttng_kernel_channel_buffer *chan)
{
- BUG_ON(chan->channel_type != METADATA_CHANNEL);
+ BUG_ON(chan->priv->channel_type != METADATA_CHANNEL);
/* Protect the metadata cache with the sessions_mutex. */
mutex_lock(&sessions_mutex);
* Supports event creation while tracing session is active.
* Needs to be called with sessions mutex held.
*/
-struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *_lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
{
- struct lttng_kernel_session *session = chan->session;
+ struct lttng_kernel_session *session = chan->parent.session;
struct lttng_kernel_event_recorder *event_recorder;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
const char *event_name;
struct hlist_head *head;
int ret;
- if (chan->free_event_id == -1U) {
+ if (chan->priv->free_event_id == -1U) {
ret = -EMFILE;
goto full;
}
event_recorder->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder->chan = chan;
- event_recorder->priv->id = chan->free_event_id++;
+ event_recorder->priv->id = chan->priv->free_event_id++;
event_recorder->priv->parent.instrumentation = itype;
INIT_LIST_HEAD(&event_recorder->priv->parent.filter_bytecode_runtime_head);
INIT_LIST_HEAD(&event_recorder->priv->parent.enablers_ref_head);
event_recorder_return->parent.run_filter = lttng_kernel_interpret_event_filter;
event_recorder_return->chan = chan;
- event_recorder_return->priv->id = chan->free_event_id++;
+ event_recorder_return->priv->id = chan->priv->free_event_id++;
event_recorder_return->priv->parent.instrumentation = itype;
event_recorder_return->parent.enabled = 0;
event_recorder_return->priv->parent.registered = 1;
WARN_ON_ONCE(!ret);
ret = try_module_get(event_recorder_return->priv->parent.desc->owner);
WARN_ON_ONCE(!ret);
- ret = _lttng_event_metadata_statedump(chan->session, chan,
+ ret = _lttng_event_metadata_statedump(chan->parent.session, chan,
event_recorder_return);
WARN_ON_ONCE(ret > 0);
if (ret) {
module_put(event_recorder->priv->parent.desc->owner);
goto statedump_error;
}
- list_add(&event_recorder_return->priv->node, &chan->session->priv->events);
+ list_add(&event_recorder_return->priv->node, &chan->parent.session->priv->events);
break;
}
ret = -EINVAL;
goto register_error;
}
- ret = _lttng_event_metadata_statedump(chan->session, chan, event_recorder);
+ ret = _lttng_event_metadata_statedump(chan->parent.session, chan, event_recorder);
WARN_ON_ONCE(ret > 0);
if (ret) {
goto statedump_error;
}
hlist_add_head(&event_recorder->priv->hlist, head);
- list_add(&event_recorder->priv->node, &chan->session->priv->events);
+ list_add(&event_recorder->priv->node, &chan->parent.session->priv->events);
return event_recorder;
statedump_error:
return counter->ops->counter_clear(counter->counter, dim_indexes);
}
-struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_channel *chan,
+struct lttng_kernel_event_recorder *lttng_kernel_event_recorder_create(struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_abi_event *event_param,
const struct lttng_kernel_event_desc *event_desc,
enum lttng_kernel_abi_instrumentation itype)
static
void lttng_create_tracepoint_event_if_missing(struct lttng_event_enabler *event_enabler)
{
- struct lttng_kernel_session *session = event_enabler->chan->session;
+ struct lttng_kernel_session *session = event_enabler->chan->parent.session;
struct lttng_kernel_probe_desc *probe_desc;
const struct lttng_kernel_event_desc *desc;
int i;
static
int lttng_event_enabler_ref_events(struct lttng_event_enabler *event_enabler)
{
- struct lttng_channel *chan = event_enabler->chan;
- struct lttng_kernel_session *session = event_enabler->chan->session;
+ struct lttng_kernel_channel_buffer *chan = event_enabler->chan;
+ struct lttng_kernel_session *session = event_enabler->chan->parent.session;
struct lttng_enabler *base_enabler = lttng_event_enabler_as_enabler(event_enabler);
struct lttng_kernel_event_recorder_private *event_recorder_priv;
enum lttng_kernel_abi_syscall_entryexit entryexit = base_enabler->event_param.u.syscall.entryexit;
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRY || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
- WRITE_ONCE(chan->syscall_all_entry, enabled);
+ WRITE_ONCE(chan->priv->parent.syscall_all_entry, enabled);
if (entryexit == LTTNG_KERNEL_ABI_SYSCALL_EXIT || entryexit == LTTNG_KERNEL_ABI_SYSCALL_ENTRYEXIT)
- WRITE_ONCE(chan->syscall_all_exit, enabled);
+ WRITE_ONCE(chan->priv->parent.syscall_all_exit, enabled);
}
/* First ensure that probe events are created for this enabler. */
struct lttng_event_enabler *lttng_event_enabler_create(
enum lttng_enabler_format_type format_type,
struct lttng_kernel_abi_event *event_param,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
struct lttng_event_enabler *event_enabler;
/* ctx left NULL */
event_enabler->base.enabled = 0;
mutex_lock(&sessions_mutex);
- list_add(&event_enabler->node, &event_enabler->chan->session->priv->enablers_head);
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ list_add(&event_enabler->node, &event_enabler->chan->parent.session->priv->enablers_head);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session);
mutex_unlock(&sessions_mutex);
return event_enabler;
}
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 1;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session);
mutex_unlock(&sessions_mutex);
return 0;
}
{
mutex_lock(&sessions_mutex);
lttng_event_enabler_as_enabler(event_enabler)->enabled = 0;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session);
mutex_unlock(&sessions_mutex);
return 0;
}
if (ret)
goto error;
- lttng_session_lazy_sync_event_enablers(event_enabler->chan->session);
+ lttng_session_lazy_sync_event_enablers(event_enabler->chan->parent.session);
return 0;
error:
* intesection of session and channel transient enable
* states.
*/
- enabled = enabled && session->priv->tstate && event_recorder->chan->tstate;
+ enabled = enabled && session->priv->tstate && event_recorder->chan->priv->parent.tstate;
WRITE_ONCE(event_recorder->parent.enabled, enabled);
/*
*/
static
int _lttng_event_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_channel *chan,
+ struct lttng_kernel_channel_buffer *chan,
struct lttng_kernel_event_recorder *event_recorder)
{
int ret = 0;
if (event_recorder->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
- if (chan->channel_type == METADATA_CHANNEL)
+ if (chan->priv->channel_type == METADATA_CHANNEL)
return 0;
lttng_metadata_begin(session);
" stream_id = %u;\n",
event_recorder->priv->parent.desc->event_name,
event_recorder->priv->id,
- event_recorder->chan->id);
+ event_recorder->chan->priv->id);
if (ret)
goto end;
*/
static
int _lttng_channel_metadata_statedump(struct lttng_kernel_session *session,
- struct lttng_channel *chan)
+ struct lttng_kernel_channel_buffer *chan)
{
int ret = 0;
- if (chan->metadata_dumped || !LTTNG_READ_ONCE(session->active))
+ if (chan->priv->metadata_dumped || !LTTNG_READ_ONCE(session->active))
return 0;
- if (chan->channel_type == METADATA_CHANNEL)
+ if (chan->priv->channel_type == METADATA_CHANNEL)
return 0;
lttng_metadata_begin(session);
- WARN_ON_ONCE(!chan->header_type);
+ WARN_ON_ONCE(!chan->priv->header_type);
ret = lttng_metadata_printf(session,
"stream {\n"
" id = %u;\n"
" event.header := %s;\n"
" packet.context := struct packet_context;\n",
- chan->id,
- chan->header_type == 1 ? "struct event_header_compact" :
+ chan->priv->id,
+ chan->priv->header_type == 1 ? "struct event_header_compact" :
"struct event_header_large");
if (ret)
goto end;
- if (chan->ctx) {
+ if (chan->priv->ctx) {
ret = lttng_metadata_printf(session,
" event.context := struct {\n");
if (ret)
goto end;
}
- ret = _lttng_context_metadata_statedump(session, chan->ctx);
+ ret = _lttng_context_metadata_statedump(session, chan->priv->ctx);
if (ret)
goto end;
- if (chan->ctx) {
+ if (chan->priv->ctx) {
ret = lttng_metadata_printf(session,
" };\n");
if (ret)
ret = lttng_metadata_printf(session,
"};\n\n");
- chan->metadata_dumped = 1;
+ chan->priv->metadata_dumped = 1;
end:
lttng_metadata_end(session);
return ret;
unsigned char *uuid_c = session->priv->uuid.b;
unsigned char uuid_s[37], clock_uuid_s[BOOT_ID_LEN];
const char *product_uuid;
- struct lttng_channel *chan;
+ struct lttng_kernel_channel_buffer_private *chan_priv;
struct lttng_kernel_event_recorder_private *event_recorder_priv;
int ret = 0;
goto end;
skip_session:
- list_for_each_entry(chan, &session->priv->chan, list) {
- ret = _lttng_channel_metadata_statedump(session, chan);
+ list_for_each_entry(chan_priv, &session->priv->chan, node) {
+ ret = _lttng_channel_metadata_statedump(session, chan_priv->pub);
if (ret)
goto end;
}
}
#endif /* #else #if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(4,10,0)) */
-
static int __init lttng_events_init(void)
{
int ret;
static inline
void ctx_get_struct_size(struct lttng_kernel_ctx *ctx, size_t *ctx_len,
- struct lttng_channel *chan, struct lttng_kernel_ring_buffer_ctx *bufctx)
+ struct lttng_kernel_channel_buffer *lttng_chan,
+ struct lttng_kernel_ring_buffer_ctx *bufctx)
{
int i;
size_t offset = 0;
static inline
void ctx_record(struct lttng_kernel_ring_buffer_ctx *bufctx,
- struct lttng_channel *chan,
+ struct lttng_kernel_channel_buffer *lttng_chan,
struct lttng_kernel_ctx *ctx)
{
int i;
lib_ring_buffer_align_ctx(bufctx, ctx->largest_align);
for (i = 0; i < ctx->nr_fields; i++)
ctx->fields[i].record(ctx->fields[i].priv, bufctx->probe_ctx,
- bufctx, chan);
+ bufctx, lttng_chan);
}
/*
struct lttng_kernel_ring_buffer_ctx *ctx,
struct lttng_client_ctx *client_ctx)
{
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan);
size_t orig_offset = offset;
size_t padding;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
padding = lib_ring_buffer_align(offset, lttng_alignof(uint32_t));
offset += padding;
padding = 0;
WARN_ON_ONCE(1);
}
- offset += ctx_get_aligned_size(offset, lttng_chan->ctx,
+ offset += ctx_get_aligned_size(offset, lttng_chan->priv->ctx,
client_ctx->packet_context_len);
*pre_header_padding = padding;
return offset - orig_offset;
struct lttng_kernel_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_channel *lttng_chan = channel_get_private(ctx->priv.chan);
+ struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(ctx->priv.chan);
if (unlikely(ctx->priv.rflags))
goto slow_path;
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
{
uint32_t id_time = 0;
WARN_ON_ONCE(1);
}
- ctx_record(ctx, lttng_chan, lttng_chan->ctx);
+ ctx_record(ctx, lttng_chan, lttng_chan->priv->ctx);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
return;
struct lttng_kernel_ring_buffer_ctx *ctx,
uint32_t event_id)
{
- struct lttng_channel *lttng_chan = channel_get_private(ctx->priv.chan);
+ struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(ctx->priv.chan);
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
if (!(ctx->priv.rflags & (RING_BUFFER_RFLAG_FULL_TSC | LTTNG_RFLAG_EXTENDED))) {
uint32_t id_time = 0;
default:
WARN_ON_ONCE(1);
}
- ctx_record(ctx, lttng_chan, lttng_chan->ctx);
+ ctx_record(ctx, lttng_chan, lttng_chan->priv->ctx);
lib_ring_buffer_align_ctx(ctx, ctx->largest_align);
}
(struct packet_header *)
lib_ring_buffer_offset_address(&buf->backend,
subbuf_idx * chan->backend.subbuf_size);
- struct lttng_channel *lttng_chan = channel_get_private(chan);
- struct lttng_kernel_session *session = lttng_chan->session;
+ struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan);
+ struct lttng_kernel_session *session = lttng_chan->parent.session;
header->magic = CTF_MAGIC_NUMBER;
memcpy(header->uuid, session->priv->uuid.b, sizeof(session->priv->uuid));
- header->stream_id = lttng_chan->id;
+ header->stream_id = lttng_chan->priv->id;
header->stream_instance_id = buf->backend.cpu;
header->ctx.timestamp_begin = tsc;
header->ctx.timestamp_end = 0;
uint64_t *stream_id)
{
struct channel *chan = buf->backend.chan;
- struct lttng_channel *lttng_chan = channel_get_private(chan);
+ struct lttng_kernel_channel_buffer *lttng_chan = channel_get_private(chan);
- *stream_id = lttng_chan->id;
+ *stream_id = lttng_chan->priv->id;
return 0;
}
unsigned int switch_timer_interval,
unsigned int read_timer_interval)
{
- struct lttng_channel *lttng_chan = priv;
+ struct lttng_kernel_channel_buffer *lttng_chan = priv;
struct channel *chan;
chan = channel_create(&client_config, name, lttng_chan, buf_addr,
int lttng_event_reserve(struct lttng_kernel_ring_buffer_ctx *ctx)
{
struct lttng_kernel_event_recorder *event_recorder = ctx->client_priv;
- struct lttng_channel *lttng_chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *lttng_chan = event_recorder->chan;
struct lttng_client_ctx client_ctx;
int ret, cpu;
uint32_t event_id;
return -EPERM;
event_id = event_recorder->priv->id;
memset(&ctx->priv, 0, sizeof(ctx->priv));
- ctx->priv.chan = lttng_chan->chan;
+ ctx->priv.chan = lttng_chan->priv->rb_chan;
ctx->priv.reserve_cpu = cpu;
/* Compute internal size of context structures. */
- ctx_get_struct_size(lttng_chan->ctx, &client_ctx.packet_context_len, lttng_chan, ctx);
+ ctx_get_struct_size(lttng_chan->priv->ctx, &client_ctx.packet_context_len, lttng_chan, ctx);
- switch (lttng_chan->header_type) {
+ switch (lttng_chan->priv->header_type) {
case 1: /* compact */
if (event_id > 30)
ctx->priv.rflags |= LTTNG_RFLAG_EXTENDED;
len, '#');
}
+static
+void lttng_channel_buffer_lost_event_too_big(struct lttng_kernel_channel_buffer *lttng_chan)
+{
+ lib_ring_buffer_lost_event_too_big(lttng_chan->priv->rb_chan);
+}
+
static
wait_queue_head_t *lttng_get_writer_buf_wait_queue(struct channel *chan, int cpu)
{
.event_memset = lttng_event_memset,
.event_strcpy = lttng_event_strcpy,
.event_strcpy_from_user = lttng_event_strcpy_from_user,
+ .lost_event_too_big = lttng_channel_buffer_lost_event_too_big,
},
};
unsigned int switch_timer_interval,
unsigned int read_timer_interval)
{
- struct lttng_channel *lttng_chan = priv;
+ struct lttng_kernel_channel_buffer *lttng_chan = priv;
struct channel *chan;
chan = channel_create(&client_config, name,
- lttng_chan->session->priv->metadata_cache, buf_addr,
+ lttng_chan->parent.session->priv->metadata_cache, buf_addr,
subbuf_size, num_subbuf, switch_timer_interval,
read_timer_interval);
if (chan) {
void syscall_entry_event_probe(void *__data, struct pt_regs *regs, long id)
{
- struct lttng_channel *chan = __data;
+ struct lttng_kernel_channel_buffer *chan = __data;
struct hlist_head *action_list, *unknown_action_list;
const struct trace_syscall_entry *table, *entry;
size_t table_len;
if (unlikely(in_compat_syscall())) {
- struct lttng_syscall_filter *filter = chan->sc_filter;
+ struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter;
if (id < 0 || id >= NR_compat_syscalls
- || (!READ_ONCE(chan->syscall_all_entry) && !test_bit(id, filter->sc_compat_entry))) {
+ || (!READ_ONCE(chan->priv->parent.syscall_all_entry) && !test_bit(id, filter->sc_compat_entry))) {
/* System call filtered out. */
return;
}
table = compat_sc_table.table;
table_len = compat_sc_table.len;
- unknown_action_list = &chan->sc_compat_unknown;
+ unknown_action_list = &chan->priv->parent.sc_compat_unknown;
} else {
- struct lttng_syscall_filter *filter = chan->sc_filter;
+ struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter;
if (id < 0 || id >= NR_syscalls
- || (!READ_ONCE(chan->syscall_all_entry) && !test_bit(id, filter->sc_entry))) {
+ || (!READ_ONCE(chan->priv->parent.syscall_all_entry) && !test_bit(id, filter->sc_entry))) {
/* System call filtered out. */
return;
}
table = sc_table.table;
table_len = sc_table.len;
- unknown_action_list = &chan->sc_unknown;
+ unknown_action_list = &chan->priv->parent.sc_unknown;
}
if (unlikely(id < 0 || id >= table_len)) {
syscall_entry_event_unknown(unknown_action_list, regs, id);
}
if (unlikely(in_compat_syscall())) {
- action_list = &chan->compat_sc_table[id];
+ action_list = &chan->priv->parent.compat_sc_table[id];
} else {
- action_list = &chan->sc_table[id];
+ action_list = &chan->priv->parent.sc_table[id];
}
if (unlikely(hlist_empty(action_list)))
return;
void syscall_exit_event_probe(void *__data, struct pt_regs *regs, long ret)
{
- struct lttng_channel *chan = __data;
+ struct lttng_kernel_channel_buffer *chan = __data;
struct hlist_head *action_list, *unknown_action_list;
const struct trace_syscall_entry *table, *entry;
size_t table_len;
id = syscall_get_nr(current, regs);
if (unlikely(in_compat_syscall())) {
- struct lttng_syscall_filter *filter = chan->sc_filter;
+ struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter;
if (id < 0 || id >= NR_compat_syscalls
- || (!READ_ONCE(chan->syscall_all_exit) && !test_bit(id, filter->sc_compat_exit))) {
+ || (!READ_ONCE(chan->priv->parent.syscall_all_exit) && !test_bit(id, filter->sc_compat_exit))) {
/* System call filtered out. */
return;
}
table = compat_sc_exit_table.table;
table_len = compat_sc_exit_table.len;
- unknown_action_list = &chan->compat_sc_exit_unknown;
+ unknown_action_list = &chan->priv->parent.compat_sc_exit_unknown;
} else {
- struct lttng_syscall_filter *filter = chan->sc_filter;
+ struct lttng_syscall_filter *filter = chan->priv->parent.sc_filter;
if (id < 0 || id >= NR_syscalls
- || (!READ_ONCE(chan->syscall_all_exit) && !test_bit(id, filter->sc_exit))) {
+ || (!READ_ONCE(chan->priv->parent.syscall_all_exit) && !test_bit(id, filter->sc_exit))) {
/* System call filtered out. */
return;
}
table = sc_exit_table.table;
table_len = sc_exit_table.len;
- unknown_action_list = &chan->sc_exit_unknown;
+ unknown_action_list = &chan->priv->parent.sc_exit_unknown;
}
if (unlikely(id < 0 || id >= table_len)) {
syscall_exit_event_unknown(unknown_action_list, regs, id, ret);
}
if (unlikely(in_compat_syscall())) {
- action_list = &chan->compat_sc_exit_table[id];
+ action_list = &chan->priv->parent.compat_sc_exit_table[id];
} else {
- action_list = &chan->sc_exit_table[id];
+ action_list = &chan->priv->parent.sc_exit_table[id];
}
if (unlikely(hlist_empty(action_list)))
return;
struct hlist_head *chan_table, struct lttng_event_enabler *event_enabler,
enum sc_type type)
{
- struct lttng_channel *chan = event_enabler->chan;
- struct lttng_kernel_session *session = chan->session;
+ struct lttng_kernel_channel_buffer *chan = event_enabler->chan;
+ struct lttng_kernel_session *session = chan->parent.session;
unsigned int i;
/* Allocate events for each syscall matching enabler, insert into table */
*/
int lttng_syscalls_register_event(struct lttng_event_enabler *event_enabler)
{
- struct lttng_channel *chan = event_enabler->chan;
+ struct lttng_kernel_channel_buffer *chan = event_enabler->chan;
struct lttng_kernel_abi_event ev;
int ret;
wrapper_vmalloc_sync_mappings();
- if (!chan->sc_table) {
+ if (!chan->priv->parent.sc_table) {
/* create syscall table mapping syscall to events */
- chan->sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
+ chan->priv->parent.sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* sc_table.len, GFP_KERNEL);
- if (!chan->sc_table)
+ if (!chan->priv->parent.sc_table)
return -ENOMEM;
}
- if (!chan->sc_exit_table) {
+ if (!chan->priv->parent.sc_exit_table) {
/* create syscall table mapping syscall to events */
- chan->sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
+ chan->priv->parent.sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* sc_exit_table.len, GFP_KERNEL);
- if (!chan->sc_exit_table)
+ if (!chan->priv->parent.sc_exit_table)
return -ENOMEM;
}
#ifdef CONFIG_COMPAT
- if (!chan->compat_sc_table) {
+ if (!chan->priv->parent.compat_sc_table) {
/* create syscall table mapping compat syscall to events */
- chan->compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
+ chan->priv->parent.compat_sc_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* compat_sc_table.len, GFP_KERNEL);
- if (!chan->compat_sc_table)
+ if (!chan->priv->parent.compat_sc_table)
return -ENOMEM;
}
- if (!chan->compat_sc_exit_table) {
+ if (!chan->priv->parent.compat_sc_exit_table) {
/* create syscall table mapping compat syscall to events */
- chan->compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
+ chan->priv->parent.compat_sc_exit_table = kzalloc(sizeof(struct lttng_kernel_event_recorder *)
* compat_sc_exit_table.len, GFP_KERNEL);
- if (!chan->compat_sc_exit_table)
+ if (!chan->priv->parent.compat_sc_exit_table)
return -ENOMEM;
}
#endif
- if (hlist_empty(&chan->sc_unknown)) {
+ if (hlist_empty(&chan->priv->parent.sc_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_entry_unknown;
struct lttng_kernel_event_recorder *event_recorder;
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_unknown);
}
- if (hlist_empty(&chan->sc_compat_unknown)) {
+ if (hlist_empty(&chan->priv->parent.sc_compat_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_entry_unknown;
struct lttng_kernel_event_recorder *event_recorder;
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_compat_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_compat_unknown);
}
- if (hlist_empty(&chan->compat_sc_exit_unknown)) {
+ if (hlist_empty(&chan->priv->parent.compat_sc_exit_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___compat_syscall_exit_unknown;
struct lttng_kernel_event_recorder *event_recorder;
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->compat_sc_exit_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.compat_sc_exit_unknown);
}
- if (hlist_empty(&chan->sc_exit_unknown)) {
+ if (hlist_empty(&chan->priv->parent.sc_exit_unknown)) {
const struct lttng_kernel_event_desc *desc =
&__event_desc___syscall_exit_unknown;
struct lttng_kernel_event_recorder *event_recorder;
if (IS_ERR(event_recorder)) {
return PTR_ERR(event_recorder);
}
- hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->sc_exit_unknown);
+ hlist_add_head(&event_recorder->priv->parent.u.syscall.node, &chan->priv->parent.sc_exit_unknown);
}
ret = lttng_create_syscall_event_if_missing(sc_table.table, sc_table.len,
- chan->sc_table, event_enabler, SC_TYPE_ENTRY);
+ chan->priv->parent.sc_table, event_enabler, SC_TYPE_ENTRY);
if (ret)
return ret;
ret = lttng_create_syscall_event_if_missing(sc_exit_table.table, sc_exit_table.len,
- chan->sc_exit_table, event_enabler, SC_TYPE_EXIT);
+ chan->priv->parent.sc_exit_table, event_enabler, SC_TYPE_EXIT);
if (ret)
return ret;
#ifdef CONFIG_COMPAT
ret = lttng_create_syscall_event_if_missing(compat_sc_table.table, compat_sc_table.len,
- chan->compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY);
+ chan->priv->parent.compat_sc_table, event_enabler, SC_TYPE_COMPAT_ENTRY);
if (ret)
return ret;
ret = lttng_create_syscall_event_if_missing(compat_sc_exit_table.table, compat_sc_exit_table.len,
- chan->compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT);
+ chan->priv->parent.compat_sc_exit_table, event_enabler, SC_TYPE_COMPAT_EXIT);
if (ret)
return ret;
#endif
- if (!chan->sc_filter) {
- chan->sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
+ if (!chan->priv->parent.sc_filter) {
+ chan->priv->parent.sc_filter = kzalloc(sizeof(struct lttng_syscall_filter),
GFP_KERNEL);
- if (!chan->sc_filter)
+ if (!chan->priv->parent.sc_filter)
return -ENOMEM;
}
- if (!chan->sys_enter_registered) {
+ if (!chan->priv->parent.sys_enter_registered) {
ret = lttng_wrapper_tracepoint_probe_register("sys_enter",
(void *) syscall_entry_event_probe, chan);
if (ret)
return ret;
- chan->sys_enter_registered = 1;
+ chan->priv->parent.sys_enter_registered = 1;
}
/*
* We change the name of sys_exit tracepoint due to namespace
* conflict with sys_exit syscall entry.
*/
- if (!chan->sys_exit_registered) {
+ if (!chan->priv->parent.sys_exit_registered) {
ret = lttng_wrapper_tracepoint_probe_register("sys_exit",
(void *) syscall_exit_event_probe, chan);
if (ret) {
(void *) syscall_entry_event_probe, chan));
return ret;
}
- chan->sys_exit_registered = 1;
+ chan->priv->parent.sys_exit_registered = 1;
}
return ret;
}
return 0;
}
-int lttng_syscalls_unregister_channel(struct lttng_channel *chan)
+int lttng_syscalls_unregister_channel(struct lttng_kernel_channel_buffer *chan)
{
int ret;
- if (!chan->sc_table)
+ if (!chan->priv->parent.sc_table)
return 0;
- if (chan->sys_enter_registered) {
+ if (chan->priv->parent.sys_enter_registered) {
ret = lttng_wrapper_tracepoint_probe_unregister("sys_enter",
(void *) syscall_entry_event_probe, chan);
if (ret)
return ret;
- chan->sys_enter_registered = 0;
+ chan->priv->parent.sys_enter_registered = 0;
}
- if (chan->sys_exit_registered) {
+ if (chan->priv->parent.sys_exit_registered) {
ret = lttng_wrapper_tracepoint_probe_unregister("sys_exit",
(void *) syscall_exit_event_probe, chan);
if (ret)
return ret;
- chan->sys_exit_registered = 0;
+ chan->priv->parent.sys_exit_registered = 0;
}
return 0;
}
-int lttng_syscalls_destroy_event(struct lttng_channel *chan)
+int lttng_syscalls_destroy_event(struct lttng_kernel_channel_buffer *chan)
{
- kfree(chan->sc_table);
- kfree(chan->sc_exit_table);
+ kfree(chan->priv->parent.sc_table);
+ kfree(chan->priv->parent.sc_exit_table);
#ifdef CONFIG_COMPAT
- kfree(chan->compat_sc_table);
- kfree(chan->compat_sc_exit_table);
+ kfree(chan->priv->parent.compat_sc_table);
+ kfree(chan->priv->parent.compat_sc_exit_table);
#endif
- kfree(chan->sc_filter);
+ kfree(chan->priv->parent.sc_filter);
return 0;
}
}
int lttng_syscall_filter_enable_event(
- struct lttng_channel *channel,
+ struct lttng_kernel_channel_buffer *channel,
struct lttng_kernel_event_recorder *event_recorder)
{
WARN_ON_ONCE(event_recorder->priv->parent.instrumentation != LTTNG_KERNEL_ABI_SYSCALL);
- return lttng_syscall_filter_enable(channel->sc_filter,
+ return lttng_syscall_filter_enable(channel->priv->parent.sc_filter,
event_recorder->priv->parent.desc->event_name,
event_recorder->priv->parent.u.syscall.abi,
event_recorder->priv->parent.u.syscall.entryexit);
}
int lttng_syscall_filter_disable_event(
- struct lttng_channel *channel,
+ struct lttng_kernel_channel_buffer *channel,
struct lttng_kernel_event_recorder *event_recorder)
{
- return lttng_syscall_filter_disable(channel->sc_filter,
+ return lttng_syscall_filter_disable(channel->priv->parent.sc_filter,
event_recorder->priv->parent.desc->event_name,
event_recorder->priv->parent.u.syscall.abi,
event_recorder->priv->parent.u.syscall.entryexit);
/*
* A syscall is enabled if it is traced for either entry or exit.
*/
-long lttng_channel_syscall_mask(struct lttng_channel *channel,
+long lttng_channel_syscall_mask(struct lttng_kernel_channel_buffer *channel,
struct lttng_kernel_abi_syscall_mask __user *usyscall_mask)
{
uint32_t len, sc_tables_len, bitmask_len;
tmp_mask = kzalloc(bitmask_len, GFP_KERNEL);
if (!tmp_mask)
return -ENOMEM;
- filter = channel->sc_filter;
+ filter = channel->priv->parent.sc_filter;
for (bit = 0; bit < sc_table.len; bit++) {
char state;
- if (channel->sc_table) {
- if (!(READ_ONCE(channel->syscall_all_entry)
- || READ_ONCE(channel->syscall_all_exit)) && filter)
+ if (channel->priv->parent.sc_table) {
+ if (!(READ_ONCE(channel->priv->parent.syscall_all_entry)
+ || READ_ONCE(channel->priv->parent.syscall_all_exit)) && filter)
state = test_bit(bit, filter->sc_entry)
|| test_bit(bit, filter->sc_exit);
else
for (; bit < sc_tables_len; bit++) {
char state;
- if (channel->compat_sc_table) {
- if (!(READ_ONCE(channel->syscall_all_entry)
- || READ_ONCE(channel->syscall_all_exit)) && filter)
+ if (channel->priv->parent.compat_sc_table) {
+ if (!(READ_ONCE(channel->priv->parent.syscall_all_entry)
+ || READ_ONCE(channel->priv->parent.syscall_all_exit)) && filter)
state = test_bit(bit - sc_table.len,
filter->sc_compat_entry)
|| test_bit(bit - sc_table.len,
container_of(event_priv, struct lttng_kernel_event_recorder_private, parent);
struct lttng_kernel_event_recorder *event_recorder =
event_recorder_priv->pub;
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
- if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled)))
return 0;
break;
}
{
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
struct lttng_kernel_ring_buffer_ctx ctx;
int ret;
{
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
- if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled)))
return 0;
break;
}
{
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
struct lttng_kernel_ring_buffer_ctx ctx;
int ret;
{
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
- if (unlikely(!LTTNG_READ_ONCE(chan->session->active)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.session->active)))
return 0;
- if (unlikely(!LTTNG_READ_ONCE(chan->enabled)))
+ if (unlikely(!LTTNG_READ_ONCE(chan->parent.enabled)))
return 0;
break;
}
{
struct lttng_kernel_event_recorder *event_recorder =
container_of(event, struct lttng_kernel_event_recorder, parent);
- struct lttng_channel *chan = event_recorder->chan;
+ struct lttng_kernel_channel_buffer *chan = event_recorder->chan;
struct lttng_kernel_ring_buffer_ctx ctx;
int ret;