Command to dump the metadata cache again
[lttng-modules.git] / lttng-abi.c
CommitLineData
baf20995 1/*
e8951e63 2 * lttng-abi.c
baf20995 3 *
e8951e63 4 * LTTng ABI
baf20995 5 *
886d51a3
MD
6 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 *
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Lesser General Public
10 * License as published by the Free Software Foundation; only
11 * version 2.1 of the License.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
18 * You should have received a copy of the GNU Lesser General Public
19 * License along with this library; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 *
22 *
baf20995
MD
23 * Mimic system calls for:
24 * - session creation, returns a file descriptor or failure.
ad1c05e1
MD
25 * - channel creation, returns a file descriptor or failure.
26 * - Operates on a session file descriptor
27 * - Takes all channel options as parameters.
28 * - stream get, returns a file descriptor or failure.
29 * - Operates on a channel file descriptor.
30 * - stream notifier get, returns a file descriptor or failure.
31 * - Operates on a channel file descriptor.
32 * - event creation, returns a file descriptor or failure.
33 * - Operates on a channel file descriptor
34 * - Takes an event name as parameter
35 * - Takes an instrumentation source as parameter
36 * - e.g. tracepoints, dynamic_probes...
37 * - Takes instrumentation source specific arguments.
baf20995
MD
38 */
39
11b5a3c2 40#include <linux/module.h>
e6a17f26 41#include <linux/proc_fs.h>
11b5a3c2
MD
42#include <linux/anon_inodes.h>
43#include <linux/file.h>
44#include <linux/uaccess.h>
45#include <linux/slab.h>
abc0446a 46#include <linux/err.h>
241ae9a8
MD
47#include <wrapper/vmalloc.h> /* for wrapper_vmalloc_sync_all() */
48#include <wrapper/ringbuffer/vfs.h>
49#include <wrapper/ringbuffer/backend.h>
50#include <wrapper/ringbuffer/frontend.h>
51#include <wrapper/poll.h>
52#include <wrapper/file.h>
53#include <wrapper/kref.h>
4993071a 54#include <lttng-string-utils.h>
241ae9a8
MD
55#include <lttng-abi.h>
56#include <lttng-abi-old.h>
57#include <lttng-events.h>
58#include <lttng-tracer.h>
59#include <lib/ringbuffer/frontend_types.h>
baf20995
MD
60
61/*
62 * This is LTTng's own personal way to create a system call as an external
80996790 63 * module. We use ioctl() on /proc/lttng.
baf20995
MD
64 */
65
e6a17f26 66static struct proc_dir_entry *lttng_proc_dentry;
ad1c05e1
MD
67static const struct file_operations lttng_fops;
68static const struct file_operations lttng_session_fops;
69static const struct file_operations lttng_channel_fops;
5dbbdb43 70static const struct file_operations lttng_metadata_fops;
305d3e42 71static const struct file_operations lttng_event_fops;
ed8d02d6 72static struct file_operations lttng_stream_ring_buffer_file_operations;
baf20995 73
9616f0bf
JD
74static int put_u64(uint64_t val, unsigned long arg);
75
a33c9927
MD
76/*
77 * Teardown management: opened file descriptors keep a refcount on the module,
78 * so it can only exit when all file descriptors are closed.
79 */
80
ad1c05e1 81static
baf20995
MD
82int lttng_abi_create_session(void)
83{
a90917c3 84 struct lttng_session *session;
c0e31d2e 85 struct file *session_file;
11b5a3c2 86 int session_fd, ret;
baf20995 87
a90917c3 88 session = lttng_session_create();
baf20995
MD
89 if (!session)
90 return -ENOMEM;
4ac10b76 91 session_fd = lttng_get_unused_fd();
baf20995
MD
92 if (session_fd < 0) {
93 ret = session_fd;
94 goto fd_error;
95 }
c0e31d2e 96 session_file = anon_inode_getfile("[lttng_session]",
ad1c05e1 97 &lttng_session_fops,
baf20995 98 session, O_RDWR);
c0e31d2e
MD
99 if (IS_ERR(session_file)) {
100 ret = PTR_ERR(session_file);
baf20995
MD
101 goto file_error;
102 }
c0e31d2e
MD
103 session->file = session_file;
104 fd_install(session_fd, session_file);
baf20995
MD
105 return session_fd;
106
107file_error:
108 put_unused_fd(session_fd);
109fd_error:
a90917c3 110 lttng_session_destroy(session);
baf20995
MD
111 return ret;
112}
113
271b6681
MD
114static
115int lttng_abi_tracepoint_list(void)
116{
117 struct file *tracepoint_list_file;
118 int file_fd, ret;
119
4ac10b76 120 file_fd = lttng_get_unused_fd();
271b6681
MD
121 if (file_fd < 0) {
122 ret = file_fd;
123 goto fd_error;
124 }
30f18bf0 125
8ee099b6 126 tracepoint_list_file = anon_inode_getfile("[lttng_tracepoint_list]",
271b6681
MD
127 &lttng_tracepoint_list_fops,
128 NULL, O_RDWR);
129 if (IS_ERR(tracepoint_list_file)) {
130 ret = PTR_ERR(tracepoint_list_file);
131 goto file_error;
132 }
30f18bf0
MD
133 ret = lttng_tracepoint_list_fops.open(NULL, tracepoint_list_file);
134 if (ret < 0)
135 goto open_error;
271b6681
MD
136 fd_install(file_fd, tracepoint_list_file);
137 return file_fd;
138
30f18bf0
MD
139open_error:
140 fput(tracepoint_list_file);
271b6681
MD
141file_error:
142 put_unused_fd(file_fd);
143fd_error:
144 return ret;
145}
146
f127e61e
MD
147#ifndef CONFIG_HAVE_SYSCALL_TRACEPOINTS
148static inline
149int lttng_abi_syscall_list(void)
150{
151 return -ENOSYS;
152}
153#else
154static
155int lttng_abi_syscall_list(void)
156{
157 struct file *syscall_list_file;
158 int file_fd, ret;
159
160 file_fd = lttng_get_unused_fd();
161 if (file_fd < 0) {
162 ret = file_fd;
163 goto fd_error;
164 }
165
166 syscall_list_file = anon_inode_getfile("[lttng_syscall_list]",
167 &lttng_syscall_list_fops,
168 NULL, O_RDWR);
169 if (IS_ERR(syscall_list_file)) {
170 ret = PTR_ERR(syscall_list_file);
171 goto file_error;
172 }
173 ret = lttng_syscall_list_fops.open(NULL, syscall_list_file);
174 if (ret < 0)
175 goto open_error;
176 fd_install(file_fd, syscall_list_file);
f127e61e
MD
177 return file_fd;
178
179open_error:
180 fput(syscall_list_file);
181file_error:
182 put_unused_fd(file_fd);
183fd_error:
184 return ret;
185}
186#endif
187
80c16bcf 188static
6dccd6c1 189void lttng_abi_tracer_version(struct lttng_kernel_tracer_version *v)
80c16bcf 190{
6dccd6c1
JD
191 v->major = LTTNG_MODULES_MAJOR_VERSION;
192 v->minor = LTTNG_MODULES_MINOR_VERSION;
193 v->patchlevel = LTTNG_MODULES_PATCHLEVEL_VERSION;
80c16bcf
MD
194}
195
42cabb80
MD
196static
197void lttng_abi_tracer_abi_version(struct lttng_kernel_tracer_abi_version *v)
198{
199 v->major = LTTNG_MODULES_ABI_MAJOR_VERSION;
200 v->minor = LTTNG_MODULES_ABI_MINOR_VERSION;
201}
202
8070f5c0
MD
203static
204long lttng_abi_add_context(struct file *file,
6dccd6c1 205 struct lttng_kernel_context *context_param,
a90917c3 206 struct lttng_ctx **ctx, struct lttng_session *session)
8070f5c0 207{
8070f5c0
MD
208
209 if (session->been_active)
210 return -EPERM;
211
6dccd6c1 212 switch (context_param->ctx) {
12a313a5 213 case LTTNG_KERNEL_CONTEXT_PID:
8070f5c0 214 return lttng_add_pid_to_ctx(ctx);
a8ad3613
MD
215 case LTTNG_KERNEL_CONTEXT_PRIO:
216 return lttng_add_prio_to_ctx(ctx);
53f1f0ca
MD
217 case LTTNG_KERNEL_CONTEXT_NICE:
218 return lttng_add_nice_to_ctx(ctx);
b64bc438
MD
219 case LTTNG_KERNEL_CONTEXT_VPID:
220 return lttng_add_vpid_to_ctx(ctx);
221 case LTTNG_KERNEL_CONTEXT_TID:
222 return lttng_add_tid_to_ctx(ctx);
223 case LTTNG_KERNEL_CONTEXT_VTID:
224 return lttng_add_vtid_to_ctx(ctx);
225 case LTTNG_KERNEL_CONTEXT_PPID:
226 return lttng_add_ppid_to_ctx(ctx);
227 case LTTNG_KERNEL_CONTEXT_VPPID:
228 return lttng_add_vppid_to_ctx(ctx);
12a313a5 229 case LTTNG_KERNEL_CONTEXT_PERF_COUNTER:
6dccd6c1
JD
230 context_param->u.perf_counter.name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
231 return lttng_add_perf_counter_to_ctx(context_param->u.perf_counter.type,
232 context_param->u.perf_counter.config,
233 context_param->u.perf_counter.name,
c24a0d71 234 ctx);
a2563e83
MD
235 case LTTNG_KERNEL_CONTEXT_PROCNAME:
236 return lttng_add_procname_to_ctx(ctx);
975da2c0
JD
237 case LTTNG_KERNEL_CONTEXT_HOSTNAME:
238 return lttng_add_hostname_to_ctx(ctx);
b3699d90
MD
239 case LTTNG_KERNEL_CONTEXT_CPU_ID:
240 return lttng_add_cpu_id_to_ctx(ctx);
79150a49
JD
241 case LTTNG_KERNEL_CONTEXT_INTERRUPTIBLE:
242 return lttng_add_interruptible_to_ctx(ctx);
243 case LTTNG_KERNEL_CONTEXT_NEED_RESCHEDULE:
244 return lttng_add_need_reschedule_to_ctx(ctx);
245 case LTTNG_KERNEL_CONTEXT_PREEMPTIBLE:
246 return lttng_add_preemptible_to_ctx(ctx);
247 case LTTNG_KERNEL_CONTEXT_MIGRATABLE:
248 return lttng_add_migratable_to_ctx(ctx);
8070f5c0
MD
249 default:
250 return -EINVAL;
251 }
252}
253
ad1c05e1
MD
254/**
255 * lttng_ioctl - lttng syscall through ioctl
256 *
c0e31d2e 257 * @file: the file
ad1c05e1
MD
258 * @cmd: the command
259 * @arg: command arg
260 *
261 * This ioctl implements lttng commands:
38d024ae 262 * LTTNG_KERNEL_SESSION
ad1c05e1 263 * Returns a LTTng trace session file descriptor
271b6681
MD
264 * LTTNG_KERNEL_TRACER_VERSION
265 * Returns the LTTng kernel tracer version
266 * LTTNG_KERNEL_TRACEPOINT_LIST
267 * Returns a file descriptor listing available tracepoints
360f38ea
MD
268 * LTTNG_KERNEL_WAIT_QUIESCENT
269 * Returns after all previously running probes have completed
42cabb80
MD
270 * LTTNG_KERNEL_TRACER_ABI_VERSION
271 * Returns the LTTng kernel tracer ABI version
ad1c05e1
MD
272 *
273 * The returned session will be deleted when its file descriptor is closed.
274 */
275static
c0e31d2e 276long lttng_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ad1c05e1
MD
277{
278 switch (cmd) {
6dccd6c1 279 case LTTNG_KERNEL_OLD_SESSION:
38d024ae 280 case LTTNG_KERNEL_SESSION:
ad1c05e1 281 return lttng_abi_create_session();
6dccd6c1
JD
282 case LTTNG_KERNEL_OLD_TRACER_VERSION:
283 {
284 struct lttng_kernel_tracer_version v;
285 struct lttng_kernel_old_tracer_version oldv;
286 struct lttng_kernel_old_tracer_version *uversion =
287 (struct lttng_kernel_old_tracer_version __user *) arg;
288
289 lttng_abi_tracer_version(&v);
290 oldv.major = v.major;
291 oldv.minor = v.minor;
292 oldv.patchlevel = v.patchlevel;
293
294 if (copy_to_user(uversion, &oldv, sizeof(oldv)))
295 return -EFAULT;
296 return 0;
297 }
80c16bcf 298 case LTTNG_KERNEL_TRACER_VERSION:
6dccd6c1
JD
299 {
300 struct lttng_kernel_tracer_version version;
301 struct lttng_kernel_tracer_version *uversion =
302 (struct lttng_kernel_tracer_version __user *) arg;
303
304 lttng_abi_tracer_version(&version);
42cabb80
MD
305
306 if (copy_to_user(uversion, &version, sizeof(version)))
307 return -EFAULT;
308 return 0;
309 }
310 case LTTNG_KERNEL_TRACER_ABI_VERSION:
311 {
312 struct lttng_kernel_tracer_abi_version version;
313 struct lttng_kernel_tracer_abi_version *uversion =
314 (struct lttng_kernel_tracer_abi_version __user *) arg;
315
316 lttng_abi_tracer_abi_version(&version);
317
6dccd6c1
JD
318 if (copy_to_user(uversion, &version, sizeof(version)))
319 return -EFAULT;
320 return 0;
321 }
322 case LTTNG_KERNEL_OLD_TRACEPOINT_LIST:
271b6681
MD
323 case LTTNG_KERNEL_TRACEPOINT_LIST:
324 return lttng_abi_tracepoint_list();
2d2464bd
MD
325 case LTTNG_KERNEL_SYSCALL_LIST:
326 return lttng_abi_syscall_list();
6dccd6c1 327 case LTTNG_KERNEL_OLD_WAIT_QUIESCENT:
5f7f9078
MD
328 case LTTNG_KERNEL_WAIT_QUIESCENT:
329 synchronize_trace();
330 return 0;
6dccd6c1
JD
331 case LTTNG_KERNEL_OLD_CALIBRATE:
332 {
333 struct lttng_kernel_old_calibrate __user *ucalibrate =
334 (struct lttng_kernel_old_calibrate __user *) arg;
335 struct lttng_kernel_old_calibrate old_calibrate;
336 struct lttng_kernel_calibrate calibrate;
337 int ret;
338
339 if (copy_from_user(&old_calibrate, ucalibrate, sizeof(old_calibrate)))
340 return -EFAULT;
341 calibrate.type = old_calibrate.type;
342 ret = lttng_calibrate(&calibrate);
343 if (copy_to_user(ucalibrate, &old_calibrate, sizeof(old_calibrate)))
344 return -EFAULT;
345 return ret;
346 }
57105fc2
MD
347 case LTTNG_KERNEL_CALIBRATE:
348 {
3db41b2c
MD
349 struct lttng_kernel_calibrate __user *ucalibrate =
350 (struct lttng_kernel_calibrate __user *) arg;
351 struct lttng_kernel_calibrate calibrate;
57105fc2
MD
352 int ret;
353
354 if (copy_from_user(&calibrate, ucalibrate, sizeof(calibrate)))
355 return -EFAULT;
356 ret = lttng_calibrate(&calibrate);
357 if (copy_to_user(ucalibrate, &calibrate, sizeof(calibrate)))
358 return -EFAULT;
359 return ret;
360 }
ad1c05e1
MD
361 default:
362 return -ENOIOCTLCMD;
363 }
364}
365
ad1c05e1 366static const struct file_operations lttng_fops = {
a33c9927 367 .owner = THIS_MODULE,
ad1c05e1
MD
368 .unlocked_ioctl = lttng_ioctl,
369#ifdef CONFIG_COMPAT
03037b98 370 .compat_ioctl = lttng_ioctl,
ad1c05e1 371#endif
11b5a3c2 372};
ad1c05e1 373
5dbbdb43 374static
c0e31d2e 375int lttng_abi_create_channel(struct file *session_file,
6dccd6c1 376 struct lttng_kernel_channel *chan_param,
5dbbdb43 377 enum channel_type channel_type)
baf20995 378{
a90917c3 379 struct lttng_session *session = session_file->private_data;
88dfd899 380 const struct file_operations *fops = NULL;
5dbbdb43 381 const char *transport_name;
a90917c3 382 struct lttng_channel *chan;
c0e31d2e 383 struct file *chan_file;
baf20995 384 int chan_fd;
ad1c05e1 385 int ret = 0;
baf20995 386
4ac10b76 387 chan_fd = lttng_get_unused_fd();
baf20995
MD
388 if (chan_fd < 0) {
389 ret = chan_fd;
390 goto fd_error;
391 }
88dfd899
MD
392 switch (channel_type) {
393 case PER_CPU_CHANNEL:
394 fops = &lttng_channel_fops;
395 break;
396 case METADATA_CHANNEL:
397 fops = &lttng_metadata_fops;
398 break;
399 }
2470a237 400
c0e31d2e 401 chan_file = anon_inode_getfile("[lttng_channel]",
88dfd899 402 fops,
03037b98 403 NULL, O_RDWR);
c0e31d2e
MD
404 if (IS_ERR(chan_file)) {
405 ret = PTR_ERR(chan_file);
baf20995
MD
406 goto file_error;
407 }
5dbbdb43
MD
408 switch (channel_type) {
409 case PER_CPU_CHANNEL:
6dccd6c1
JD
410 if (chan_param->output == LTTNG_KERNEL_SPLICE) {
411 transport_name = chan_param->overwrite ?
96ba7208 412 "relay-overwrite" : "relay-discard";
6dccd6c1
JD
413 } else if (chan_param->output == LTTNG_KERNEL_MMAP) {
414 transport_name = chan_param->overwrite ?
96ba7208
JD
415 "relay-overwrite-mmap" : "relay-discard-mmap";
416 } else {
417 return -EINVAL;
418 }
5dbbdb43 419 break;
5dbbdb43 420 case METADATA_CHANNEL:
6dccd6c1 421 if (chan_param->output == LTTNG_KERNEL_SPLICE)
96ba7208 422 transport_name = "relay-metadata";
6dccd6c1 423 else if (chan_param->output == LTTNG_KERNEL_MMAP)
96ba7208
JD
424 transport_name = "relay-metadata-mmap";
425 else
426 return -EINVAL;
5dbbdb43
MD
427 break;
428 default:
429 transport_name = "<unknown>";
430 break;
431 }
9c1f4643
MD
432 if (atomic_long_add_unless(&session_file->f_count,
433 1, INT_MAX) == INT_MAX) {
434 goto refcount_error;
435 }
03037b98
MD
436 /*
437 * We tolerate no failure path after channel creation. It will stay
438 * invariant for the rest of the session.
439 */
a90917c3 440 chan = lttng_channel_create(session, transport_name, NULL,
6dccd6c1
JD
441 chan_param->subbuf_size,
442 chan_param->num_subbuf,
443 chan_param->switch_timer_interval,
d83004aa
JD
444 chan_param->read_timer_interval,
445 channel_type);
03037b98 446 if (!chan) {
f3d01b96 447 ret = -EINVAL;
03037b98
MD
448 goto chan_error;
449 }
11b5a3c2 450 chan->file = chan_file;
c0e31d2e
MD
451 chan_file->private_data = chan;
452 fd_install(chan_fd, chan_file);
ad1c05e1 453
baf20995
MD
454 return chan_fd;
455
03037b98 456chan_error:
9c1f4643
MD
457 atomic_long_dec(&session_file->f_count);
458refcount_error:
c0e31d2e 459 fput(chan_file);
baf20995
MD
460file_error:
461 put_unused_fd(chan_fd);
462fd_error:
baf20995
MD
463 return ret;
464}
465
466/**
ad1c05e1 467 * lttng_session_ioctl - lttng session fd ioctl
baf20995 468 *
c0e31d2e 469 * @file: the file
baf20995
MD
470 * @cmd: the command
471 * @arg: command arg
472 *
473 * This ioctl implements lttng commands:
38d024ae 474 * LTTNG_KERNEL_CHANNEL
baf20995 475 * Returns a LTTng channel file descriptor
e64957da
MD
476 * LTTNG_KERNEL_ENABLE
477 * Enables tracing for a session (weak enable)
478 * LTTNG_KERNEL_DISABLE
479 * Disables tracing for a session (strong disable)
8070f5c0
MD
480 * LTTNG_KERNEL_METADATA
481 * Returns a LTTng metadata file descriptor
e0130fab
MD
482 * LTTNG_KERNEL_SESSION_TRACK_PID
483 * Add PID to session tracker
484 * LTTNG_KERNEL_SESSION_UNTRACK_PID
485 * Remove PID from session tracker
ad1c05e1
MD
486 *
487 * The returned channel will be deleted when its file descriptor is closed.
488 */
489static
c0e31d2e 490long lttng_session_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ad1c05e1 491{
a90917c3 492 struct lttng_session *session = file->private_data;
c0e31d2e 493
ad1c05e1 494 switch (cmd) {
6dccd6c1
JD
495 case LTTNG_KERNEL_OLD_CHANNEL:
496 {
497 struct lttng_kernel_channel chan_param;
498 struct lttng_kernel_old_channel old_chan_param;
499
500 if (copy_from_user(&old_chan_param,
501 (struct lttng_kernel_old_channel __user *) arg,
502 sizeof(struct lttng_kernel_old_channel)))
503 return -EFAULT;
504 chan_param.overwrite = old_chan_param.overwrite;
505 chan_param.subbuf_size = old_chan_param.subbuf_size;
506 chan_param.num_subbuf = old_chan_param.num_subbuf;
507 chan_param.switch_timer_interval = old_chan_param.switch_timer_interval;
508 chan_param.read_timer_interval = old_chan_param.read_timer_interval;
509 chan_param.output = old_chan_param.output;
510
511 return lttng_abi_create_channel(file, &chan_param,
512 PER_CPU_CHANNEL);
513 }
38d024ae 514 case LTTNG_KERNEL_CHANNEL:
6dccd6c1
JD
515 {
516 struct lttng_kernel_channel chan_param;
517
518 if (copy_from_user(&chan_param,
38d024ae 519 (struct lttng_kernel_channel __user *) arg,
6dccd6c1
JD
520 sizeof(struct lttng_kernel_channel)))
521 return -EFAULT;
522 return lttng_abi_create_channel(file, &chan_param,
5dbbdb43 523 PER_CPU_CHANNEL);
6dccd6c1
JD
524 }
525 case LTTNG_KERNEL_OLD_SESSION_START:
526 case LTTNG_KERNEL_OLD_ENABLE:
38d024ae 527 case LTTNG_KERNEL_SESSION_START:
e64957da 528 case LTTNG_KERNEL_ENABLE:
a90917c3 529 return lttng_session_enable(session);
6dccd6c1
JD
530 case LTTNG_KERNEL_OLD_SESSION_STOP:
531 case LTTNG_KERNEL_OLD_DISABLE:
38d024ae 532 case LTTNG_KERNEL_SESSION_STOP:
e64957da 533 case LTTNG_KERNEL_DISABLE:
a90917c3 534 return lttng_session_disable(session);
6dccd6c1
JD
535 case LTTNG_KERNEL_OLD_METADATA:
536 {
537 struct lttng_kernel_channel chan_param;
538 struct lttng_kernel_old_channel old_chan_param;
539
540 if (copy_from_user(&old_chan_param,
541 (struct lttng_kernel_old_channel __user *) arg,
542 sizeof(struct lttng_kernel_old_channel)))
543 return -EFAULT;
544 chan_param.overwrite = old_chan_param.overwrite;
545 chan_param.subbuf_size = old_chan_param.subbuf_size;
546 chan_param.num_subbuf = old_chan_param.num_subbuf;
547 chan_param.switch_timer_interval = old_chan_param.switch_timer_interval;
548 chan_param.read_timer_interval = old_chan_param.read_timer_interval;
549 chan_param.output = old_chan_param.output;
550
551 return lttng_abi_create_channel(file, &chan_param,
552 METADATA_CHANNEL);
553 }
38d024ae 554 case LTTNG_KERNEL_METADATA:
6dccd6c1
JD
555 {
556 struct lttng_kernel_channel chan_param;
557
558 if (copy_from_user(&chan_param,
559 (struct lttng_kernel_channel __user *) arg,
560 sizeof(struct lttng_kernel_channel)))
561 return -EFAULT;
562 return lttng_abi_create_channel(file, &chan_param,
5dbbdb43 563 METADATA_CHANNEL);
6dccd6c1 564 }
e0130fab
MD
565 case LTTNG_KERNEL_SESSION_TRACK_PID:
566 return lttng_session_track_pid(session, (int) arg);
567 case LTTNG_KERNEL_SESSION_UNTRACK_PID:
568 return lttng_session_untrack_pid(session, (int) arg);
7e6f9ef6
MD
569 case LTTNG_KERNEL_SESSION_LIST_TRACKER_PIDS:
570 return lttng_session_list_tracker_pids(session);
9616f0bf
JD
571 case LTTNG_KERNEL_SESSION_METADATA_REGEN:
572 return lttng_session_metadata_regenerate(session);
601252cf
MD
573 case LTTNG_KERNEL_SESSION_STATEDUMP:
574 return lttng_session_statedump(session);
ad1c05e1
MD
575 default:
576 return -ENOIOCTLCMD;
577 }
578}
579
03037b98
MD
580/*
581 * Called when the last file reference is dropped.
582 *
583 * Big fat note: channels and events are invariant for the whole session after
584 * their creation. So this session destruction also destroys all channel and
585 * event structures specific to this session (they are not destroyed when their
586 * individual file is released).
587 */
ad1c05e1 588static
03037b98 589int lttng_session_release(struct inode *inode, struct file *file)
ad1c05e1 590{
a90917c3 591 struct lttng_session *session = file->private_data;
c269fff4
MD
592
593 if (session)
a90917c3 594 lttng_session_destroy(session);
11b5a3c2 595 return 0;
ad1c05e1 596}
ad1c05e1
MD
597
598static const struct file_operations lttng_session_fops = {
a33c9927 599 .owner = THIS_MODULE,
03037b98 600 .release = lttng_session_release,
ad1c05e1
MD
601 .unlocked_ioctl = lttng_session_ioctl,
602#ifdef CONFIG_COMPAT
03037b98 603 .compat_ioctl = lttng_session_ioctl,
ad1c05e1 604#endif
11b5a3c2 605};
ad1c05e1 606
d83004aa
JD
607/**
608 * lttng_metadata_ring_buffer_poll - LTTng ring buffer poll file operation
609 * @filp: the file
610 * @wait: poll table
611 *
612 * Handles the poll operations for the metadata channels.
613 */
ad1c05e1 614static
d83004aa
JD
615unsigned int lttng_metadata_ring_buffer_poll(struct file *filp,
616 poll_table *wait)
617{
618 struct lttng_metadata_stream *stream = filp->private_data;
619 struct lib_ring_buffer *buf = stream->priv;
620 int finalized;
621 unsigned int mask = 0;
622
623 if (filp->f_mode & FMODE_READ) {
624 poll_wait_set_exclusive(wait);
625 poll_wait(filp, &stream->read_wait, wait);
626
627 finalized = stream->finalized;
628
629 /*
630 * lib_ring_buffer_is_finalized() contains a smp_rmb()
631 * ordering finalized load before offsets loads.
632 */
633 WARN_ON(atomic_long_read(&buf->active_readers) != 1);
634
635 if (finalized)
636 mask |= POLLHUP;
637
92d9f5e6 638 mutex_lock(&stream->metadata_cache->lock);
d83004aa 639 if (stream->metadata_cache->metadata_written >
f613e3e6 640 stream->metadata_out)
d83004aa 641 mask |= POLLIN;
92d9f5e6 642 mutex_unlock(&stream->metadata_cache->lock);
d83004aa
JD
643 }
644
645 return mask;
646}
647
f613e3e6
MD
648static
649void lttng_metadata_ring_buffer_ioctl_put_next_subbuf(struct file *filp,
650 unsigned int cmd, unsigned long arg)
651{
652 struct lttng_metadata_stream *stream = filp->private_data;
653
654 stream->metadata_out = stream->metadata_in;
655}
656
d1344afa
JD
657/*
658 * Reset the counter of how much metadata has been consumed to 0. That way,
659 * the consumer receives the content of the metadata cache unchanged. This is
660 * different from the metadata_regenerate where the offset from epoch is
661 * resampled, here we want the exact same content as the last time the metadata
662 * was generated. This command is only possible if all the metadata written
663 * in the cache has been output to the metadata stream to avoid corrupting the
664 * metadata file.
665 *
666 * Return 0 on success, a negative value on error.
667 */
668static
669int lttng_metadata_cache_dump(struct lttng_metadata_stream *stream)
670{
671 int ret;
672 struct lttng_metadata_cache *cache = stream->metadata_cache;
673
674 mutex_lock(&cache->lock);
675 if (stream->metadata_out != cache->metadata_written) {
676 ret = -EBUSY;
677 goto end;
678 }
679 stream->metadata_out = 0;
680 stream->metadata_in = 0;
681 wake_up_interruptible(&stream->read_wait);
682 ret = 0;
683
684end:
685 mutex_unlock(&cache->lock);
686 return ret;
687}
688
d83004aa
JD
689static
690long lttng_metadata_ring_buffer_ioctl(struct file *filp,
691 unsigned int cmd, unsigned long arg)
692{
693 int ret;
694 struct lttng_metadata_stream *stream = filp->private_data;
695 struct lib_ring_buffer *buf = stream->priv;
696
697 switch (cmd) {
d83004aa
JD
698 case RING_BUFFER_GET_NEXT_SUBBUF:
699 {
35097f36
JD
700 struct lttng_metadata_stream *stream = filp->private_data;
701 struct lib_ring_buffer *buf = stream->priv;
702 struct channel *chan = buf->backend.chan;
703
704 ret = lttng_metadata_output_channel(stream, chan);
705 if (ret > 0) {
706 lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
707 ret = 0;
708 } else if (ret < 0)
d83004aa
JD
709 goto err;
710 break;
711 }
f613e3e6
MD
712 case RING_BUFFER_GET_SUBBUF:
713 {
714 /*
715 * Random access is not allowed for metadata channel.
716 */
717 return -ENOSYS;
718 }
c6f05468 719 case RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
35097f36
JD
720 case RING_BUFFER_FLUSH:
721 {
722 struct lttng_metadata_stream *stream = filp->private_data;
723 struct lib_ring_buffer *buf = stream->priv;
724 struct channel *chan = buf->backend.chan;
725
726 /*
727 * Before doing the actual ring buffer flush, write up to one
728 * packet of metadata in the ring buffer.
729 */
730 ret = lttng_metadata_output_channel(stream, chan);
731 if (ret < 0)
732 goto err;
733 break;
734 }
9616f0bf
JD
735 case RING_BUFFER_GET_METADATA_VERSION:
736 {
737 struct lttng_metadata_stream *stream = filp->private_data;
738
739 return put_u64(stream->version, arg);
740 }
d1344afa
JD
741 case RING_BUFFER_METADATA_CACHE_DUMP:
742 {
743 struct lttng_metadata_stream *stream = filp->private_data;
744
745 return lttng_metadata_cache_dump(stream);
746 }
d83004aa
JD
747 default:
748 break;
749 }
f613e3e6
MD
750 /* PUT_SUBBUF is the one from lib ring buffer, unmodified. */
751
d83004aa 752 /* Performing lib ring buffer ioctl after our own. */
f613e3e6
MD
753 ret = lib_ring_buffer_ioctl(filp, cmd, arg, buf);
754 if (ret < 0)
755 goto err;
d83004aa 756
f613e3e6
MD
757 switch (cmd) {
758 case RING_BUFFER_PUT_NEXT_SUBBUF:
759 {
760 lttng_metadata_ring_buffer_ioctl_put_next_subbuf(filp,
761 cmd, arg);
762 break;
763 }
764 default:
765 break;
766 }
d83004aa
JD
767err:
768 return ret;
769}
770
aeb9064d 771#ifdef CONFIG_COMPAT
d83004aa
JD
772static
773long lttng_metadata_ring_buffer_compat_ioctl(struct file *filp,
774 unsigned int cmd, unsigned long arg)
775{
776 int ret;
777 struct lttng_metadata_stream *stream = filp->private_data;
778 struct lib_ring_buffer *buf = stream->priv;
779
780 switch (cmd) {
d83004aa
JD
781 case RING_BUFFER_GET_NEXT_SUBBUF:
782 {
35097f36
JD
783 struct lttng_metadata_stream *stream = filp->private_data;
784 struct lib_ring_buffer *buf = stream->priv;
785 struct channel *chan = buf->backend.chan;
786
787 ret = lttng_metadata_output_channel(stream, chan);
788 if (ret > 0) {
789 lib_ring_buffer_switch_slow(buf, SWITCH_ACTIVE);
790 ret = 0;
791 } else if (ret < 0)
d83004aa
JD
792 goto err;
793 break;
794 }
f613e3e6
MD
795 case RING_BUFFER_GET_SUBBUF:
796 {
797 /*
798 * Random access is not allowed for metadata channel.
799 */
800 return -ENOSYS;
801 }
c6f05468 802 case RING_BUFFER_FLUSH_EMPTY: /* Fall-through. */
96c55c2f
MD
803 case RING_BUFFER_FLUSH:
804 {
805 struct lttng_metadata_stream *stream = filp->private_data;
806 struct lib_ring_buffer *buf = stream->priv;
807 struct channel *chan = buf->backend.chan;
808
809 /*
810 * Before doing the actual ring buffer flush, write up to one
811 * packet of metadata in the ring buffer.
812 */
813 ret = lttng_metadata_output_channel(stream, chan);
814 if (ret < 0)
815 goto err;
816 break;
817 }
818 case RING_BUFFER_GET_METADATA_VERSION:
819 {
820 struct lttng_metadata_stream *stream = filp->private_data;
821
822 return put_u64(stream->version, arg);
823 }
d1344afa
JD
824 case RING_BUFFER_METADATA_CACHE_DUMP:
825 {
826 struct lttng_metadata_stream *stream = filp->private_data;
827
828 return lttng_metadata_cache_dump(stream);
829 }
d83004aa
JD
830 default:
831 break;
832 }
f613e3e6
MD
833 /* PUT_SUBBUF is the one from lib ring buffer, unmodified. */
834
d83004aa 835 /* Performing lib ring buffer ioctl after our own. */
f613e3e6
MD
836 ret = lib_ring_buffer_compat_ioctl(filp, cmd, arg, buf);
837 if (ret < 0)
838 goto err;
d83004aa 839
f613e3e6
MD
840 switch (cmd) {
841 case RING_BUFFER_PUT_NEXT_SUBBUF:
842 {
843 lttng_metadata_ring_buffer_ioctl_put_next_subbuf(filp,
844 cmd, arg);
845 break;
846 }
847 default:
848 break;
849 }
d83004aa
JD
850err:
851 return ret;
852}
aeb9064d 853#endif
d83004aa 854
b3b8072b
MD
855/*
856 * This is not used by anonymous file descriptors. This code is left
857 * there if we ever want to implement an inode with open() operation.
858 */
d83004aa
JD
859static
860int lttng_metadata_ring_buffer_open(struct inode *inode, struct file *file)
861{
862 struct lttng_metadata_stream *stream = inode->i_private;
863 struct lib_ring_buffer *buf = stream->priv;
864
865 file->private_data = buf;
b3b8072b
MD
866 /*
867 * Since life-time of metadata cache differs from that of
868 * session, we need to keep our own reference on the transport.
869 */
870 if (!try_module_get(stream->transport->owner)) {
871 printk(KERN_WARNING "LTT : Can't lock transport module.\n");
872 return -EBUSY;
873 }
d83004aa
JD
874 return lib_ring_buffer_open(inode, file, buf);
875}
876
877static
878int lttng_metadata_ring_buffer_release(struct inode *inode, struct file *file)
879{
880 struct lttng_metadata_stream *stream = file->private_data;
881 struct lib_ring_buffer *buf = stream->priv;
882
883 kref_put(&stream->metadata_cache->refcount, metadata_cache_destroy);
b3b8072b 884 module_put(stream->transport->owner);
d83004aa
JD
885 return lib_ring_buffer_release(inode, file, buf);
886}
887
888static
889ssize_t lttng_metadata_ring_buffer_splice_read(struct file *in, loff_t *ppos,
890 struct pipe_inode_info *pipe, size_t len,
891 unsigned int flags)
892{
893 struct lttng_metadata_stream *stream = in->private_data;
894 struct lib_ring_buffer *buf = stream->priv;
895
896 return lib_ring_buffer_splice_read(in, ppos, pipe, len,
897 flags, buf);
898}
899
900static
901int lttng_metadata_ring_buffer_mmap(struct file *filp,
902 struct vm_area_struct *vma)
903{
904 struct lttng_metadata_stream *stream = filp->private_data;
905 struct lib_ring_buffer *buf = stream->priv;
906
907 return lib_ring_buffer_mmap(filp, vma, buf);
908}
909
910static
911const struct file_operations lttng_metadata_ring_buffer_file_operations = {
912 .owner = THIS_MODULE,
913 .open = lttng_metadata_ring_buffer_open,
914 .release = lttng_metadata_ring_buffer_release,
915 .poll = lttng_metadata_ring_buffer_poll,
916 .splice_read = lttng_metadata_ring_buffer_splice_read,
917 .mmap = lttng_metadata_ring_buffer_mmap,
918 .unlocked_ioctl = lttng_metadata_ring_buffer_ioctl,
919 .llseek = vfs_lib_ring_buffer_no_llseek,
920#ifdef CONFIG_COMPAT
921 .compat_ioctl = lttng_metadata_ring_buffer_compat_ioctl,
922#endif
923};
924
925static
926int lttng_abi_create_stream_fd(struct file *channel_file, void *stream_priv,
927 const struct file_operations *fops)
ad1c05e1 928{
ad1c05e1 929 int stream_fd, ret;
11b5a3c2 930 struct file *stream_file;
ad1c05e1 931
4ac10b76 932 stream_fd = lttng_get_unused_fd();
ad1c05e1
MD
933 if (stream_fd < 0) {
934 ret = stream_fd;
935 goto fd_error;
936 }
d83004aa
JD
937 stream_file = anon_inode_getfile("[lttng_stream]", fops,
938 stream_priv, O_RDWR);
c0e31d2e
MD
939 if (IS_ERR(stream_file)) {
940 ret = PTR_ERR(stream_file);
ad1c05e1
MD
941 goto file_error;
942 }
409453cb
MD
943 /*
944 * OPEN_FMODE, called within anon_inode_getfile/alloc_file, don't honor
945 * FMODE_LSEEK, FMODE_PREAD nor FMODE_PWRITE. We need to read from this
946 * file descriptor, so we set FMODE_PREAD here.
947 */
d7b6f197 948 stream_file->f_mode |= FMODE_PREAD;
c0e31d2e 949 fd_install(stream_fd, stream_file);
dda6a249
MD
950 /*
951 * The stream holds a reference to the channel within the generic ring
952 * buffer library, so no need to hold a refcount on the channel and
953 * session files here.
954 */
ad1c05e1
MD
955 return stream_fd;
956
957file_error:
958 put_unused_fd(stream_fd);
d83004aa
JD
959fd_error:
960 return ret;
961}
962
963static
964int lttng_abi_open_stream(struct file *channel_file)
965{
966 struct lttng_channel *channel = channel_file->private_data;
967 struct lib_ring_buffer *buf;
968 int ret;
969 void *stream_priv;
970
971 buf = channel->ops->buffer_read_open(channel->chan);
972 if (!buf)
973 return -ENOENT;
974
975 stream_priv = buf;
976 ret = lttng_abi_create_stream_fd(channel_file, stream_priv,
ed8d02d6 977 &lttng_stream_ring_buffer_file_operations);
d83004aa
JD
978 if (ret < 0)
979 goto fd_error;
980
981 return ret;
982
983fd_error:
984 channel->ops->buffer_read_close(buf);
985 return ret;
986}
987
988static
989int lttng_abi_open_metadata_stream(struct file *channel_file)
990{
991 struct lttng_channel *channel = channel_file->private_data;
992 struct lttng_session *session = channel->session;
993 struct lib_ring_buffer *buf;
994 int ret;
995 struct lttng_metadata_stream *metadata_stream;
996 void *stream_priv;
997
998 buf = channel->ops->buffer_read_open(channel->chan);
999 if (!buf)
1000 return -ENOENT;
1001
1002 metadata_stream = kzalloc(sizeof(struct lttng_metadata_stream),
1003 GFP_KERNEL);
b3b8072b
MD
1004 if (!metadata_stream) {
1005 ret = -ENOMEM;
1006 goto nomem;
1007 }
d83004aa
JD
1008 metadata_stream->metadata_cache = session->metadata_cache;
1009 init_waitqueue_head(&metadata_stream->read_wait);
1010 metadata_stream->priv = buf;
1011 stream_priv = metadata_stream;
b3b8072b
MD
1012 metadata_stream->transport = channel->transport;
1013
1014 /*
1015 * Since life-time of metadata cache differs from that of
1016 * session, we need to keep our own reference on the transport.
1017 */
1018 if (!try_module_get(metadata_stream->transport->owner)) {
1019 printk(KERN_WARNING "LTT : Can't lock transport module.\n");
1020 ret = -EINVAL;
1021 goto notransport;
1022 }
1023
901aaa5f
FD
1024 if (!lttng_kref_get(&session->metadata_cache->refcount)) {
1025 ret = -EOVERFLOW;
9c1f4643 1026 goto kref_error;
901aaa5f
FD
1027 }
1028
d83004aa
JD
1029 ret = lttng_abi_create_stream_fd(channel_file, stream_priv,
1030 &lttng_metadata_ring_buffer_file_operations);
1031 if (ret < 0)
1032 goto fd_error;
1033
d83004aa
JD
1034 list_add(&metadata_stream->list,
1035 &session->metadata_cache->metadata_stream);
1036 return ret;
1037
ad1c05e1 1038fd_error:
9c1f4643
MD
1039 kref_put(&session->metadata_cache->refcount, metadata_cache_destroy);
1040kref_error:
b3b8072b
MD
1041 module_put(metadata_stream->transport->owner);
1042notransport:
1043 kfree(metadata_stream);
1044nomem:
11b5a3c2 1045 channel->ops->buffer_read_close(buf);
ad1c05e1
MD
1046 return ret;
1047}
1048
653fe716 1049static
c0e31d2e 1050int lttng_abi_create_event(struct file *channel_file,
6dccd6c1 1051 struct lttng_kernel_event *event_param)
653fe716 1052{
a90917c3 1053 struct lttng_channel *channel = channel_file->private_data;
653fe716 1054 int event_fd, ret;
11b5a3c2 1055 struct file *event_file;
3c997079 1056 void *priv;
653fe716 1057
6dccd6c1
JD
1058 event_param->name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
1059 switch (event_param->instrumentation) {
7371f44c 1060 case LTTNG_KERNEL_KRETPROBE:
6dccd6c1 1061 event_param->u.kretprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
7371f44c 1062 break;
ab2277d6 1063 case LTTNG_KERNEL_KPROBE:
6dccd6c1 1064 event_param->u.kprobe.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
e0a7a7c4 1065 break;
ab2277d6 1066 case LTTNG_KERNEL_FUNCTION:
6dccd6c1 1067 event_param->u.ftrace.symbol_name[LTTNG_KERNEL_SYM_NAME_LEN - 1] = '\0';
e0a7a7c4
MD
1068 break;
1069 default:
1070 break;
1071 }
33a39a3c
MD
1072 event_fd = lttng_get_unused_fd();
1073 if (event_fd < 0) {
1074 ret = event_fd;
1075 goto fd_error;
1076 }
1077 event_file = anon_inode_getfile("[lttng_event]",
1078 &lttng_event_fops,
1079 NULL, O_RDWR);
1080 if (IS_ERR(event_file)) {
1081 ret = PTR_ERR(event_file);
1082 goto file_error;
1083 }
9c1f4643
MD
1084 /* The event holds a reference on the channel */
1085 if (atomic_long_add_unless(&channel_file->f_count,
1086 1, INT_MAX) == INT_MAX) {
0d2c717f 1087 ret = -EOVERFLOW;
9c1f4643
MD
1088 goto refcount_error;
1089 }
33a39a3c
MD
1090 if (event_param->instrumentation == LTTNG_KERNEL_TRACEPOINT
1091 || event_param->instrumentation == LTTNG_KERNEL_SYSCALL) {
1092 struct lttng_enabler *enabler;
1093
4993071a
PP
1094 if (strutils_is_star_glob_pattern(event_param->name)) {
1095 /*
1096 * If the event name is a star globbing pattern,
1097 * we create the special star globbing enabler.
1098 */
1099 enabler = lttng_enabler_create(LTTNG_ENABLER_STAR_GLOB,
33a39a3c 1100 event_param, channel);
3c997079 1101 } else {
33a39a3c
MD
1102 enabler = lttng_enabler_create(LTTNG_ENABLER_NAME,
1103 event_param, channel);
1ec65de1 1104 }
33a39a3c
MD
1105 priv = enabler;
1106 } else {
1107 struct lttng_event *event;
4ee2453d 1108
33a39a3c
MD
1109 /*
1110 * We tolerate no failure path after event creation. It
1111 * will stay invariant for the rest of the session.
1112 */
1113 event = lttng_event_create(channel, event_param,
1114 NULL, NULL,
1115 event_param->instrumentation);
1116 WARN_ON_ONCE(!event);
1117 if (IS_ERR(event)) {
1118 ret = PTR_ERR(event);
1119 goto event_error;
80f87dd2 1120 }
33a39a3c 1121 priv = event;
03037b98 1122 }
33a39a3c
MD
1123 event_file->private_data = priv;
1124 fd_install(event_fd, event_file);
653fe716
MD
1125 return event_fd;
1126
03037b98 1127event_error:
9c1f4643
MD
1128 atomic_long_dec(&channel_file->f_count);
1129refcount_error:
c0e31d2e 1130 fput(event_file);
653fe716
MD
1131file_error:
1132 put_unused_fd(event_fd);
1133fd_error:
653fe716
MD
1134 return ret;
1135}
ad1c05e1
MD
1136
1137/**
1138 * lttng_channel_ioctl - lttng syscall through ioctl
1139 *
c0e31d2e 1140 * @file: the file
ad1c05e1
MD
1141 * @cmd: the command
1142 * @arg: command arg
1143 *
1144 * This ioctl implements lttng commands:
38d024ae 1145 * LTTNG_KERNEL_STREAM
ad1c05e1
MD
1146 * Returns an event stream file descriptor or failure.
1147 * (typically, one event stream records events from one CPU)
38d024ae 1148 * LTTNG_KERNEL_EVENT
ad1c05e1 1149 * Returns an event file descriptor or failure.
8070f5c0
MD
1150 * LTTNG_KERNEL_CONTEXT
1151 * Prepend a context field to each event in the channel
e64957da
MD
1152 * LTTNG_KERNEL_ENABLE
1153 * Enable recording for events in this channel (weak enable)
1154 * LTTNG_KERNEL_DISABLE
1155 * Disable recording for events in this channel (strong disable)
baf20995 1156 *
baf20995
MD
1157 * Channel and event file descriptors also hold a reference on the session.
1158 */
ad1c05e1 1159static
c0e31d2e 1160long lttng_channel_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
baf20995 1161{
a90917c3 1162 struct lttng_channel *channel = file->private_data;
8070f5c0 1163
baf20995 1164 switch (cmd) {
6dccd6c1 1165 case LTTNG_KERNEL_OLD_STREAM:
38d024ae 1166 case LTTNG_KERNEL_STREAM:
c0e31d2e 1167 return lttng_abi_open_stream(file);
6dccd6c1
JD
1168 case LTTNG_KERNEL_OLD_EVENT:
1169 {
1170 struct lttng_kernel_event *uevent_param;
1171 struct lttng_kernel_old_event *old_uevent_param;
1172 int ret;
1173
1174 uevent_param = kmalloc(sizeof(struct lttng_kernel_event),
1175 GFP_KERNEL);
1176 if (!uevent_param) {
1177 ret = -ENOMEM;
1178 goto old_event_end;
1179 }
1180 old_uevent_param = kmalloc(
1181 sizeof(struct lttng_kernel_old_event),
1182 GFP_KERNEL);
1183 if (!old_uevent_param) {
1184 ret = -ENOMEM;
1185 goto old_event_error_free_param;
1186 }
1187 if (copy_from_user(old_uevent_param,
1188 (struct lttng_kernel_old_event __user *) arg,
1189 sizeof(struct lttng_kernel_old_event))) {
1190 ret = -EFAULT;
1191 goto old_event_error_free_old_param;
1192 }
1193
1194 memcpy(uevent_param->name, old_uevent_param->name,
1195 sizeof(uevent_param->name));
1196 uevent_param->instrumentation =
1197 old_uevent_param->instrumentation;
1198
1199 switch (old_uevent_param->instrumentation) {
1200 case LTTNG_KERNEL_KPROBE:
1201 uevent_param->u.kprobe.addr =
1202 old_uevent_param->u.kprobe.addr;
1203 uevent_param->u.kprobe.offset =
1204 old_uevent_param->u.kprobe.offset;
1205 memcpy(uevent_param->u.kprobe.symbol_name,
1206 old_uevent_param->u.kprobe.symbol_name,
1207 sizeof(uevent_param->u.kprobe.symbol_name));
1208 break;
1209 case LTTNG_KERNEL_KRETPROBE:
1210 uevent_param->u.kretprobe.addr =
1211 old_uevent_param->u.kretprobe.addr;
1212 uevent_param->u.kretprobe.offset =
1213 old_uevent_param->u.kretprobe.offset;
1214 memcpy(uevent_param->u.kretprobe.symbol_name,
1215 old_uevent_param->u.kretprobe.symbol_name,
1216 sizeof(uevent_param->u.kretprobe.symbol_name));
1217 break;
1218 case LTTNG_KERNEL_FUNCTION:
1219 memcpy(uevent_param->u.ftrace.symbol_name,
1220 old_uevent_param->u.ftrace.symbol_name,
1221 sizeof(uevent_param->u.ftrace.symbol_name));
1222 break;
1223 default:
1224 break;
1225 }
1226 ret = lttng_abi_create_event(file, uevent_param);
1227
1228old_event_error_free_old_param:
1229 kfree(old_uevent_param);
1230old_event_error_free_param:
1231 kfree(uevent_param);
1232old_event_end:
1233 return ret;
1234 }
38d024ae 1235 case LTTNG_KERNEL_EVENT:
6dccd6c1
JD
1236 {
1237 struct lttng_kernel_event uevent_param;
1238
1239 if (copy_from_user(&uevent_param,
1240 (struct lttng_kernel_event __user *) arg,
1241 sizeof(uevent_param)))
1242 return -EFAULT;
1243 return lttng_abi_create_event(file, &uevent_param);
1244 }
1245 case LTTNG_KERNEL_OLD_CONTEXT:
1246 {
1247 struct lttng_kernel_context *ucontext_param;
1248 struct lttng_kernel_old_context *old_ucontext_param;
1249 int ret;
1250
1251 ucontext_param = kmalloc(sizeof(struct lttng_kernel_context),
1252 GFP_KERNEL);
1253 if (!ucontext_param) {
1254 ret = -ENOMEM;
1255 goto old_ctx_end;
1256 }
1257 old_ucontext_param = kmalloc(sizeof(struct lttng_kernel_old_context),
1258 GFP_KERNEL);
1259 if (!old_ucontext_param) {
1260 ret = -ENOMEM;
1261 goto old_ctx_error_free_param;
1262 }
1263
1264 if (copy_from_user(old_ucontext_param,
1265 (struct lttng_kernel_old_context __user *) arg,
1266 sizeof(struct lttng_kernel_old_context))) {
1267 ret = -EFAULT;
1268 goto old_ctx_error_free_old_param;
1269 }
1270 ucontext_param->ctx = old_ucontext_param->ctx;
1271 memcpy(ucontext_param->padding, old_ucontext_param->padding,
1272 sizeof(ucontext_param->padding));
1273 /* only type that uses the union */
1274 if (old_ucontext_param->ctx == LTTNG_KERNEL_CONTEXT_PERF_COUNTER) {
1275 ucontext_param->u.perf_counter.type =
1276 old_ucontext_param->u.perf_counter.type;
1277 ucontext_param->u.perf_counter.config =
1278 old_ucontext_param->u.perf_counter.config;
1279 memcpy(ucontext_param->u.perf_counter.name,
1280 old_ucontext_param->u.perf_counter.name,
1281 sizeof(ucontext_param->u.perf_counter.name));
1282 }
1283
1284 ret = lttng_abi_add_context(file,
1285 ucontext_param,
1286 &channel->ctx, channel->session);
1287
1288old_ctx_error_free_old_param:
1289 kfree(old_ucontext_param);
1290old_ctx_error_free_param:
1291 kfree(ucontext_param);
1292old_ctx_end:
1293 return ret;
1294 }
8070f5c0 1295 case LTTNG_KERNEL_CONTEXT:
6dccd6c1
JD
1296 {
1297 struct lttng_kernel_context ucontext_param;
1298
1299 if (copy_from_user(&ucontext_param,
8070f5c0 1300 (struct lttng_kernel_context __user *) arg,
6dccd6c1
JD
1301 sizeof(ucontext_param)))
1302 return -EFAULT;
1303 return lttng_abi_add_context(file,
1304 &ucontext_param,
8070f5c0 1305 &channel->ctx, channel->session);
6dccd6c1
JD
1306 }
1307 case LTTNG_KERNEL_OLD_ENABLE:
e64957da 1308 case LTTNG_KERNEL_ENABLE:
a90917c3 1309 return lttng_channel_enable(channel);
6dccd6c1 1310 case LTTNG_KERNEL_OLD_DISABLE:
e64957da 1311 case LTTNG_KERNEL_DISABLE:
a90917c3 1312 return lttng_channel_disable(channel);
12e579db
MD
1313 case LTTNG_KERNEL_SYSCALL_MASK:
1314 return lttng_channel_syscall_mask(channel,
1315 (struct lttng_kernel_syscall_mask __user *) arg);
baf20995
MD
1316 default:
1317 return -ENOIOCTLCMD;
1318 }
6dccd6c1 1319
baf20995
MD
1320}
1321
5dbbdb43
MD
1322/**
1323 * lttng_metadata_ioctl - lttng syscall through ioctl
1324 *
1325 * @file: the file
1326 * @cmd: the command
1327 * @arg: command arg
1328 *
1329 * This ioctl implements lttng commands:
38d024ae 1330 * LTTNG_KERNEL_STREAM
5dbbdb43
MD
1331 * Returns an event stream file descriptor or failure.
1332 *
1333 * Channel and event file descriptors also hold a reference on the session.
1334 */
1335static
1336long lttng_metadata_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1337{
1338 switch (cmd) {
6dccd6c1 1339 case LTTNG_KERNEL_OLD_STREAM:
38d024ae 1340 case LTTNG_KERNEL_STREAM:
d83004aa 1341 return lttng_abi_open_metadata_stream(file);
5dbbdb43
MD
1342 default:
1343 return -ENOIOCTLCMD;
1344 }
1345}
1346
653fe716
MD
1347/**
1348 * lttng_channel_poll - lttng stream addition/removal monitoring
1349 *
c0e31d2e 1350 * @file: the file
653fe716
MD
1351 * @wait: poll table
1352 */
c0e31d2e 1353unsigned int lttng_channel_poll(struct file *file, poll_table *wait)
653fe716 1354{
a90917c3 1355 struct lttng_channel *channel = file->private_data;
653fe716
MD
1356 unsigned int mask = 0;
1357
c0e31d2e 1358 if (file->f_mode & FMODE_READ) {
a33e44a6 1359 poll_wait_set_exclusive(wait);
24cedcfe
MD
1360 poll_wait(file, channel->ops->get_hp_wait_queue(channel->chan),
1361 wait);
653fe716 1362
254ec7bc
MD
1363 if (channel->ops->is_disabled(channel->chan))
1364 return POLLERR;
24cedcfe 1365 if (channel->ops->is_finalized(channel->chan))
653fe716 1366 return POLLHUP;
f71ecafa 1367 if (channel->ops->buffer_has_read_closed_stream(channel->chan))
653fe716 1368 return POLLIN | POLLRDNORM;
f71ecafa 1369 return 0;
653fe716
MD
1370 }
1371 return mask;
1372
1373}
1374
0a84a57f
MD
1375static
1376int lttng_channel_release(struct inode *inode, struct file *file)
1377{
a90917c3 1378 struct lttng_channel *channel = file->private_data;
c269fff4
MD
1379
1380 if (channel)
1381 fput(channel->session->file);
0a84a57f
MD
1382 return 0;
1383}
1384
d83004aa
JD
1385static
1386int lttng_metadata_channel_release(struct inode *inode, struct file *file)
1387{
1388 struct lttng_channel *channel = file->private_data;
1389
1390 if (channel) {
d83004aa 1391 fput(channel->session->file);
a3381417 1392 lttng_metadata_channel_destroy(channel);
d83004aa
JD
1393 }
1394
1395 return 0;
1396}
1397
ad1c05e1 1398static const struct file_operations lttng_channel_fops = {
a33c9927 1399 .owner = THIS_MODULE,
03037b98 1400 .release = lttng_channel_release,
653fe716 1401 .poll = lttng_channel_poll,
ad1c05e1 1402 .unlocked_ioctl = lttng_channel_ioctl,
baf20995 1403#ifdef CONFIG_COMPAT
03037b98 1404 .compat_ioctl = lttng_channel_ioctl,
baf20995 1405#endif
11b5a3c2 1406};
baf20995 1407
5dbbdb43 1408static const struct file_operations lttng_metadata_fops = {
a33c9927 1409 .owner = THIS_MODULE,
d83004aa 1410 .release = lttng_metadata_channel_release,
5dbbdb43
MD
1411 .unlocked_ioctl = lttng_metadata_ioctl,
1412#ifdef CONFIG_COMPAT
1413 .compat_ioctl = lttng_metadata_ioctl,
1414#endif
1415};
1416
8070f5c0
MD
1417/**
1418 * lttng_event_ioctl - lttng syscall through ioctl
1419 *
1420 * @file: the file
1421 * @cmd: the command
1422 * @arg: command arg
1423 *
1424 * This ioctl implements lttng commands:
8070f5c0
MD
1425 * LTTNG_KERNEL_CONTEXT
1426 * Prepend a context field to each record of this event
e64957da
MD
1427 * LTTNG_KERNEL_ENABLE
1428 * Enable recording for this event (weak enable)
1429 * LTTNG_KERNEL_DISABLE
1430 * Disable recording for this event (strong disable)
8070f5c0
MD
1431 */
1432static
1433long lttng_event_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
1434{
3c997079
MD
1435 struct lttng_event *event;
1436 struct lttng_enabler *enabler;
1437 enum lttng_event_type *evtype = file->private_data;
8070f5c0
MD
1438
1439 switch (cmd) {
6dccd6c1
JD
1440 case LTTNG_KERNEL_OLD_CONTEXT:
1441 {
3c997079
MD
1442 /* Not implemented */
1443 return -ENOSYS;
6dccd6c1 1444 }
8070f5c0 1445 case LTTNG_KERNEL_CONTEXT:
6dccd6c1 1446 {
3c997079
MD
1447 /* Not implemented */
1448 return -ENOSYS;
6dccd6c1
JD
1449 }
1450 case LTTNG_KERNEL_OLD_ENABLE:
e64957da 1451 case LTTNG_KERNEL_ENABLE:
3c997079
MD
1452 switch (*evtype) {
1453 case LTTNG_TYPE_EVENT:
1454 event = file->private_data;
1455 return lttng_event_enable(event);
1456 case LTTNG_TYPE_ENABLER:
1457 enabler = file->private_data;
1458 return lttng_enabler_enable(enabler);
1459 default:
1460 WARN_ON_ONCE(1);
1461 return -ENOSYS;
1462 }
6dccd6c1 1463 case LTTNG_KERNEL_OLD_DISABLE:
e64957da 1464 case LTTNG_KERNEL_DISABLE:
3c997079
MD
1465 switch (*evtype) {
1466 case LTTNG_TYPE_EVENT:
1467 event = file->private_data;
1468 return lttng_event_disable(event);
1469 case LTTNG_TYPE_ENABLER:
1470 enabler = file->private_data;
1471 return lttng_enabler_disable(enabler);
1472 default:
1473 WARN_ON_ONCE(1);
1474 return -ENOSYS;
1475 }
07dfc1d0
MD
1476 case LTTNG_KERNEL_FILTER:
1477 switch (*evtype) {
1478 case LTTNG_TYPE_EVENT:
1479 return -EINVAL;
1480 case LTTNG_TYPE_ENABLER:
1481 {
1482 enabler = file->private_data;
1483 return lttng_enabler_attach_bytecode(enabler,
1484 (struct lttng_kernel_filter_bytecode __user *) arg);
1485 }
1486
1487 }
8070f5c0
MD
1488 default:
1489 return -ENOIOCTLCMD;
1490 }
1491}
1492
0a84a57f
MD
1493static
1494int lttng_event_release(struct inode *inode, struct file *file)
1495{
3c997079
MD
1496 struct lttng_event *event;
1497 struct lttng_enabler *enabler;
1498 enum lttng_event_type *evtype = file->private_data;
1499
1500 if (!evtype)
1501 return 0;
1502
1503 switch (*evtype) {
1504 case LTTNG_TYPE_EVENT:
1505 event = file->private_data;
1506 if (event)
1507 fput(event->chan->file);
1508 break;
1509 case LTTNG_TYPE_ENABLER:
1510 enabler = file->private_data;
1511 if (enabler)
1512 fput(enabler->chan->file);
1513 break;
1514 default:
1515 WARN_ON_ONCE(1);
1516 break;
1517 }
c269fff4 1518
0a84a57f
MD
1519 return 0;
1520}
1521
3b923e5b 1522/* TODO: filter control ioctl */
0a84a57f 1523static const struct file_operations lttng_event_fops = {
a33c9927 1524 .owner = THIS_MODULE,
0a84a57f 1525 .release = lttng_event_release,
8070f5c0
MD
1526 .unlocked_ioctl = lttng_event_ioctl,
1527#ifdef CONFIG_COMPAT
1528 .compat_ioctl = lttng_event_ioctl,
1529#endif
11b5a3c2 1530};
0a84a57f 1531
3b731ab1
JD
1532static int put_u64(uint64_t val, unsigned long arg)
1533{
1534 return put_user(val, (uint64_t __user *) arg);
1535}
1536
ed8d02d6
JD
1537static long lttng_stream_ring_buffer_ioctl(struct file *filp,
1538 unsigned int cmd, unsigned long arg)
1539{
3b731ab1
JD
1540 struct lib_ring_buffer *buf = filp->private_data;
1541 struct channel *chan = buf->backend.chan;
1542 const struct lib_ring_buffer_config *config = &chan->backend.config;
dd5a0db3 1543 const struct lttng_channel_ops *ops = chan->backend.priv_ops;
3b731ab1
JD
1544 int ret;
1545
1546 if (atomic_read(&chan->record_disabled))
1547 return -EIO;
1548
ed8d02d6 1549 switch (cmd) {
3b731ab1
JD
1550 case LTTNG_RING_BUFFER_GET_TIMESTAMP_BEGIN:
1551 {
1552 uint64_t ts;
1553
dd5a0db3 1554 ret = ops->timestamp_begin(config, buf, &ts);
3b731ab1
JD
1555 if (ret < 0)
1556 goto error;
1557 return put_u64(ts, arg);
1558 }
1559 case LTTNG_RING_BUFFER_GET_TIMESTAMP_END:
1560 {
1561 uint64_t ts;
1562
dd5a0db3 1563 ret = ops->timestamp_end(config, buf, &ts);
3b731ab1
JD
1564 if (ret < 0)
1565 goto error;
1566 return put_u64(ts, arg);
1567 }
1568 case LTTNG_RING_BUFFER_GET_EVENTS_DISCARDED:
1569 {
1570 uint64_t ed;
1571
dd5a0db3 1572 ret = ops->events_discarded(config, buf, &ed);
3b731ab1
JD
1573 if (ret < 0)
1574 goto error;
1575 return put_u64(ed, arg);
1576 }
1577 case LTTNG_RING_BUFFER_GET_CONTENT_SIZE:
1578 {
1579 uint64_t cs;
1580
dd5a0db3 1581 ret = ops->content_size(config, buf, &cs);
3b731ab1
JD
1582 if (ret < 0)
1583 goto error;
1584 return put_u64(cs, arg);
1585 }
1586 case LTTNG_RING_BUFFER_GET_PACKET_SIZE:
1587 {
1588 uint64_t ps;
1589
dd5a0db3 1590 ret = ops->packet_size(config, buf, &ps);
3b731ab1
JD
1591 if (ret < 0)
1592 goto error;
1593 return put_u64(ps, arg);
1594 }
1595 case LTTNG_RING_BUFFER_GET_STREAM_ID:
1596 {
1597 uint64_t si;
1598
dd5a0db3 1599 ret = ops->stream_id(config, buf, &si);
3b731ab1
JD
1600 if (ret < 0)
1601 goto error;
1602 return put_u64(si, arg);
1603 }
2348ca17
JD
1604 case LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP:
1605 {
1606 uint64_t ts;
1607
dd5a0db3 1608 ret = ops->current_timestamp(config, buf, &ts);
2348ca17
JD
1609 if (ret < 0)
1610 goto error;
1611 return put_u64(ts, arg);
1612 }
5b3cf4f9
JD
1613 case LTTNG_RING_BUFFER_GET_SEQ_NUM:
1614 {
1615 uint64_t seq;
1616
1617 ret = ops->sequence_number(config, buf, &seq);
1618 if (ret < 0)
1619 goto error;
1620 return put_u64(seq, arg);
1621 }
5594698f
JD
1622 case LTTNG_RING_BUFFER_INSTANCE_ID:
1623 {
1624 uint64_t id;
1625
1626 ret = ops->instance_id(config, buf, &id);
1627 if (ret < 0)
1628 goto error;
1629 return put_u64(id, arg);
1630 }
3b731ab1
JD
1631 default:
1632 return lib_ring_buffer_file_operations.unlocked_ioctl(filp,
1633 cmd, arg);
ed8d02d6 1634 }
3b731ab1
JD
1635
1636error:
1637 return -ENOSYS;
ed8d02d6
JD
1638}
1639
1640#ifdef CONFIG_COMPAT
1641static long lttng_stream_ring_buffer_compat_ioctl(struct file *filp,
1642 unsigned int cmd, unsigned long arg)
1643{
3b731ab1
JD
1644 struct lib_ring_buffer *buf = filp->private_data;
1645 struct channel *chan = buf->backend.chan;
1646 const struct lib_ring_buffer_config *config = &chan->backend.config;
dd5a0db3 1647 const struct lttng_channel_ops *ops = chan->backend.priv_ops;
3b731ab1
JD
1648 int ret;
1649
1650 if (atomic_read(&chan->record_disabled))
1651 return -EIO;
1652
ed8d02d6 1653 switch (cmd) {
3b731ab1
JD
1654 case LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_BEGIN:
1655 {
1656 uint64_t ts;
1657
dd5a0db3 1658 ret = ops->timestamp_begin(config, buf, &ts);
3b731ab1
JD
1659 if (ret < 0)
1660 goto error;
1661 return put_u64(ts, arg);
1662 }
1663 case LTTNG_RING_BUFFER_COMPAT_GET_TIMESTAMP_END:
1664 {
1665 uint64_t ts;
1666
dd5a0db3 1667 ret = ops->timestamp_end(config, buf, &ts);
3b731ab1
JD
1668 if (ret < 0)
1669 goto error;
1670 return put_u64(ts, arg);
1671 }
1672 case LTTNG_RING_BUFFER_COMPAT_GET_EVENTS_DISCARDED:
1673 {
1674 uint64_t ed;
1675
dd5a0db3 1676 ret = ops->events_discarded(config, buf, &ed);
3b731ab1
JD
1677 if (ret < 0)
1678 goto error;
1679 return put_u64(ed, arg);
ed8d02d6 1680 }
3b731ab1
JD
1681 case LTTNG_RING_BUFFER_COMPAT_GET_CONTENT_SIZE:
1682 {
1683 uint64_t cs;
1684
dd5a0db3 1685 ret = ops->content_size(config, buf, &cs);
3b731ab1
JD
1686 if (ret < 0)
1687 goto error;
1688 return put_u64(cs, arg);
1689 }
1690 case LTTNG_RING_BUFFER_COMPAT_GET_PACKET_SIZE:
1691 {
1692 uint64_t ps;
1693
dd5a0db3 1694 ret = ops->packet_size(config, buf, &ps);
3b731ab1
JD
1695 if (ret < 0)
1696 goto error;
1697 return put_u64(ps, arg);
1698 }
1699 case LTTNG_RING_BUFFER_COMPAT_GET_STREAM_ID:
1700 {
1701 uint64_t si;
1702
dd5a0db3 1703 ret = ops->stream_id(config, buf, &si);
3b731ab1
JD
1704 if (ret < 0)
1705 goto error;
1706 return put_u64(si, arg);
1707 }
2348ca17
JD
1708 case LTTNG_RING_BUFFER_GET_CURRENT_TIMESTAMP:
1709 {
1710 uint64_t ts;
1711
dd5a0db3 1712 ret = ops->current_timestamp(config, buf, &ts);
2348ca17
JD
1713 if (ret < 0)
1714 goto error;
1715 return put_u64(ts, arg);
1716 }
5b3cf4f9
JD
1717 case LTTNG_RING_BUFFER_COMPAT_GET_SEQ_NUM:
1718 {
1719 uint64_t seq;
1720
1721 ret = ops->sequence_number(config, buf, &seq);
1722 if (ret < 0)
1723 goto error;
1724 return put_u64(seq, arg);
1725 }
5594698f
JD
1726 case LTTNG_RING_BUFFER_COMPAT_INSTANCE_ID:
1727 {
1728 uint64_t id;
1729
1730 ret = ops->instance_id(config, buf, &id);
1731 if (ret < 0)
1732 goto error;
1733 return put_u64(id, arg);
1734 }
3b731ab1
JD
1735 default:
1736 return lib_ring_buffer_file_operations.compat_ioctl(filp,
1737 cmd, arg);
1738 }
1739
1740error:
1741 return -ENOSYS;
ed8d02d6
JD
1742}
1743#endif /* CONFIG_COMPAT */
1744
1745static void lttng_stream_override_ring_buffer_fops(void)
1746{
1747 lttng_stream_ring_buffer_file_operations.owner = THIS_MODULE;
1748 lttng_stream_ring_buffer_file_operations.open =
1749 lib_ring_buffer_file_operations.open;
1750 lttng_stream_ring_buffer_file_operations.release =
1751 lib_ring_buffer_file_operations.release;
1752 lttng_stream_ring_buffer_file_operations.poll =
1753 lib_ring_buffer_file_operations.poll;
1754 lttng_stream_ring_buffer_file_operations.splice_read =
1755 lib_ring_buffer_file_operations.splice_read;
1756 lttng_stream_ring_buffer_file_operations.mmap =
1757 lib_ring_buffer_file_operations.mmap;
1758 lttng_stream_ring_buffer_file_operations.unlocked_ioctl =
1759 lttng_stream_ring_buffer_ioctl;
1760 lttng_stream_ring_buffer_file_operations.llseek =
1761 lib_ring_buffer_file_operations.llseek;
1762#ifdef CONFIG_COMPAT
1763 lttng_stream_ring_buffer_file_operations.compat_ioctl =
1764 lttng_stream_ring_buffer_compat_ioctl;
1765#endif
1766}
1767
80996790 1768int __init lttng_abi_init(void)
baf20995
MD
1769{
1770 int ret = 0;
1771
6d2a620c 1772 wrapper_vmalloc_sync_all();
2754583e 1773 lttng_clock_ref();
d29348f7 1774 lttng_proc_dentry = proc_create_data("lttng", S_IRUSR | S_IWUSR, NULL,
e6a17f26 1775 &lttng_fops, NULL);
2470a237 1776
255e52a4 1777 if (!lttng_proc_dentry) {
baf20995
MD
1778 printk(KERN_ERR "Error creating LTTng control file\n");
1779 ret = -ENOMEM;
1780 goto error;
1781 }
ed8d02d6 1782 lttng_stream_override_ring_buffer_fops();
2754583e 1783 return 0;
ed8d02d6 1784
baf20995 1785error:
2754583e 1786 lttng_clock_unref();
baf20995
MD
1787 return ret;
1788}
1789
e6e65fcd
MD
1790/* No __exit annotation because used by init error path too. */
1791void lttng_abi_exit(void)
baf20995 1792{
2754583e 1793 lttng_clock_unref();
e6a17f26
MD
1794 if (lttng_proc_dentry)
1795 remove_proc_entry("lttng", NULL);
baf20995 1796}
This page took 0.121686 seconds and 4 git commands to generate.