#include <lttng-abi-old.h>
#include <lttng-events.h>
#include <lttng-tracer.h>
+#include <lttng-tp-mempool.h>
#include <lib/ringbuffer/frontend_types.h>
/*
*/
static struct proc_dir_entry *lttng_proc_dentry;
-static const struct file_operations lttng_fops;
+
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
+static const struct proc_ops lttng_proc_ops;
+#else
+static const struct file_operations lttng_proc_ops;
+#endif
+
static const struct file_operations lttng_session_fops;
static const struct file_operations lttng_channel_fops;
static const struct file_operations lttng_metadata_fops;
}
}
-static const struct file_operations lttng_fops = {
+#if (LTTNG_LINUX_VERSION_CODE >= LTTNG_KERNEL_VERSION(5,6,0))
+static const struct proc_ops lttng_proc_ops = {
+ .proc_ioctl = lttng_ioctl,
+#ifdef CONFIG_COMPAT
+ .proc_compat_ioctl = lttng_ioctl,
+#endif /* CONFIG_COMPAT */
+};
+#else
+static const struct file_operations lttng_proc_ops = {
.owner = THIS_MODULE,
.unlocked_ioctl = lttng_ioctl,
#ifdef CONFIG_COMPAT
.compat_ioctl = lttng_ioctl,
-#endif
+#endif /* CONFIG_COMPAT */
};
+#endif
static
int lttng_abi_create_channel(struct file *session_file,
transport_name = "<unknown>";
break;
}
- if (atomic_long_add_unless(&session_file->f_count,
- 1, INT_MAX) == INT_MAX) {
+ if (!atomic_long_add_unless(&session_file->f_count, 1, LONG_MAX)) {
+ ret = -EOVERFLOW;
goto refcount_error;
}
/*
long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
{
struct lttng_session *session = file->private_data;
+ struct lttng_kernel_channel chan_param;
+ struct lttng_kernel_old_channel old_chan_param;
switch (cmd) {
case LTTNG_KERNEL_OLD_CHANNEL:
{
- struct lttng_kernel_channel chan_param;
- struct lttng_kernel_old_channel old_chan_param;
-
if (copy_from_user(&old_chan_param,
(struct lttng_kernel_old_channel __user *) arg,
sizeof(struct lttng_kernel_old_channel)))
}
case LTTNG_KERNEL_CHANNEL:
{
- struct lttng_kernel_channel chan_param;
-
if (copy_from_user(&chan_param,
(struct lttng_kernel_channel __user *) arg,
sizeof(struct lttng_kernel_channel)))
return lttng_session_disable(session);
case LTTNG_KERNEL_OLD_METADATA:
{
- struct lttng_kernel_channel chan_param;
- struct lttng_kernel_old_channel old_chan_param;
-
if (copy_from_user(&old_chan_param,
(struct lttng_kernel_old_channel __user *) arg,
sizeof(struct lttng_kernel_old_channel)))
}
case LTTNG_KERNEL_METADATA:
{
- struct lttng_kernel_channel chan_param;
-
if (copy_from_user(&chan_param,
(struct lttng_kernel_channel __user *) arg,
sizeof(struct lttng_kernel_channel)))
event_param->u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
break;
case LTTNG_KERNEL_FUNCTION:
- event_param->u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
+ WARN_ON_ONCE(1);
+ /* Not implemented. */
break;
default:
break;
goto file_error;
}
/* The event holds a reference on the channel */
- if (atomic_long_add_unless(&channel_file->f_count,
- 1, INT_MAX) == INT_MAX) {
+ if (!atomic_long_add_unless(&channel_file->f_count, 1, LONG_MAX)) {
ret = -EOVERFLOW;
goto refcount_error;
}
sizeof(uevent_param->u.kretprobe.symbol_name));
break;
case LTTNG_KERNEL_FUNCTION:
- memcpy(uevent_param->u.ftrace.symbol_name,
- old_uevent_param->u.ftrace.symbol_name,
- sizeof(uevent_param->u.ftrace.symbol_name));
+ WARN_ON_ONCE(1);
+ /* Not implemented. */
break;
default:
break;
wrapper_vmalloc_sync_all();
lttng_clock_ref();
+
+ ret = lttng_tp_mempool_init();
+ if (ret) {
+ goto error;
+ }
+
lttng_proc_dentry = proc_create_data("lttng", S_IRUSR | S_IWUSR, NULL,
- <tng_fops, NULL);
+ <tng_proc_ops, NULL);
if (!lttng_proc_dentry) {
printk(KERN_ERR "Error creating LTTng control file\n");
return 0;
error:
+ lttng_tp_mempool_destroy();
lttng_clock_unref();
return ret;
}
/* No __exit annotation because used by init error path too. */
void lttng_abi_exit(void)
{
+ lttng_tp_mempool_destroy();
lttng_clock_unref();
if (lttng_proc_dentry)
remove_proc_entry("lttng", NULL);