Move struct ltt_channel to shm for consumer flush
[lttng-ust.git] / liblttng-ust / lttng-ust-abi.c
1 /*
2 * lttng-ust-abi.c
3 *
4 * Copyright 2010-2011 (c) - Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 *
6 * LTTng UST ABI
7 *
8 * Mimic system calls for:
9 * - session creation, returns an object descriptor or failure.
10 * - channel creation, returns an object descriptor or failure.
11 * - Operates on a session object descriptor
12 * - Takes all channel options as parameters.
13 * - stream get, returns an object descriptor or failure.
14 * - Operates on a channel object descriptor.
15 * - stream notifier get, returns an object descriptor or failure.
16 * - Operates on a channel object descriptor.
17 * - event creation, returns an object descriptor or failure.
18 * - Operates on a channel object descriptor
19 * - Takes an event name as parameter
20 * - Takes an instrumentation source as parameter
21 * - e.g. tracepoints, dynamic_probes...
22 * - Takes instrumentation source specific arguments.
23 *
24 * Dual LGPL v2.1/GPL v2 license.
25 */
26
27 #include <lttng/ust-abi.h>
28 #include <urcu/compiler.h>
29 #include <urcu/list.h>
30 #include <lttng/ust-events.h>
31 #include <lttng/usterr-signal-safe.h>
32 #include "lttng/core.h"
33 #include "ltt-tracer.h"
34
35 /*
36 * Object descriptor table. Should be protected from concurrent access
37 * by the caller.
38 */
39
40 struct lttng_ust_obj {
41 union {
42 struct {
43 void *private_data;
44 const struct lttng_ust_objd_ops *ops;
45 int f_count;
46 } s;
47 int freelist_next; /* offset freelist. end is -1. */
48 } u;
49 };
50
51 struct lttng_ust_objd_table {
52 struct lttng_ust_obj *array;
53 unsigned int len, allocated_len;
54 int freelist_head; /* offset freelist head. end is -1 */
55 };
56
57 static struct lttng_ust_objd_table objd_table = {
58 .freelist_head = -1,
59 };
60
61 static
62 int objd_alloc(void *private_data, const struct lttng_ust_objd_ops *ops)
63 {
64 struct lttng_ust_obj *obj;
65
66 if (objd_table.freelist_head != -1) {
67 obj = &objd_table.array[objd_table.freelist_head];
68 objd_table.freelist_head = obj->u.freelist_next;
69 goto end;
70 }
71
72 if (objd_table.len >= objd_table.allocated_len) {
73 unsigned int new_allocated_len, old_allocated_len;
74 struct lttng_ust_obj *new_table, *old_table;
75
76 old_allocated_len = objd_table.allocated_len;
77 old_table = objd_table.array;
78 if (!old_allocated_len)
79 new_allocated_len = 1;
80 else
81 new_allocated_len = old_allocated_len << 1;
82 new_table = zmalloc(sizeof(struct lttng_ust_obj) * new_allocated_len);
83 if (!new_table)
84 return -ENOMEM;
85 memcpy(new_table, old_table,
86 sizeof(struct lttng_ust_obj) * old_allocated_len);
87 free(old_table);
88 objd_table.array = new_table;
89 objd_table.allocated_len = new_allocated_len;
90 }
91 obj = &objd_table.array[objd_table.len];
92 objd_table.len++;
93 end:
94 obj->u.s.private_data = private_data;
95 obj->u.s.ops = ops;
96 obj->u.s.f_count = 2; /* count == 1 : object is allocated */
97 /* count == 2 : allocated + hold ref */
98 return obj - objd_table.array;
99 }
100
101 static
102 struct lttng_ust_obj *_objd_get(int id)
103 {
104 if (id >= objd_table.len)
105 return NULL;
106 if (!objd_table.array[id].u.s.f_count)
107 return NULL;
108 return &objd_table.array[id];
109 }
110
111 static
112 void *objd_private(int id)
113 {
114 struct lttng_ust_obj *obj = _objd_get(id);
115 assert(obj);
116 return obj->u.s.private_data;
117 }
118
119 static
120 void objd_set_private(int id, void *private_data)
121 {
122 struct lttng_ust_obj *obj = _objd_get(id);
123 assert(obj);
124 obj->u.s.private_data = private_data;
125 }
126
127 const struct lttng_ust_objd_ops *objd_ops(int id)
128 {
129 struct lttng_ust_obj *obj = _objd_get(id);
130
131 if (!obj)
132 return NULL;
133 return obj->u.s.ops;
134 }
135
136 static
137 void objd_free(int id)
138 {
139 struct lttng_ust_obj *obj = _objd_get(id);
140
141 assert(obj);
142 obj->u.freelist_next = objd_table.freelist_head;
143 objd_table.freelist_head = obj - objd_table.array;
144 assert(obj->u.s.f_count == 1);
145 obj->u.s.f_count = 0; /* deallocated */
146 }
147
148 static
149 void objd_ref(int id)
150 {
151 struct lttng_ust_obj *obj = _objd_get(id);
152 obj->u.s.f_count++;
153 }
154
155 int lttng_ust_objd_unref(int id)
156 {
157 struct lttng_ust_obj *obj = _objd_get(id);
158
159 if (!obj)
160 return -EINVAL;
161 if (obj->u.s.f_count == 1) {
162 ERR("Reference counting error\n");
163 return -EINVAL;
164 }
165 if ((--obj->u.s.f_count) == 1) {
166 const struct lttng_ust_objd_ops *ops = objd_ops(id);
167
168 if (ops->release)
169 ops->release(id);
170 objd_free(id);
171 }
172 return 0;
173 }
174
175 static
176 void objd_table_destroy(void)
177 {
178 int i;
179
180 for (i = 0; i < objd_table.allocated_len; i++)
181 (void) lttng_ust_objd_unref(i);
182 free(objd_table.array);
183 objd_table.array = NULL;
184 objd_table.len = 0;
185 objd_table.allocated_len = 0;
186 objd_table.freelist_head = -1;
187 }
188
189 /*
190 * This is LTTng's own personal way to create an ABI for sessiond.
191 * We send commands over a socket.
192 */
193
194 static const struct lttng_ust_objd_ops lttng_ops;
195 static const struct lttng_ust_objd_ops lttng_session_ops;
196 static const struct lttng_ust_objd_ops lttng_channel_ops;
197 static const struct lttng_ust_objd_ops lttng_metadata_ops;
198 static const struct lttng_ust_objd_ops lttng_event_ops;
199 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops;
200
201 enum channel_type {
202 PER_CPU_CHANNEL,
203 METADATA_CHANNEL,
204 };
205
206 int lttng_abi_create_root_handle(void)
207 {
208 int root_handle;
209
210 root_handle = objd_alloc(NULL, &lttng_ops);
211 return root_handle;
212 }
213
214 static
215 int lttng_abi_create_session(void)
216 {
217 struct ltt_session *session;
218 int session_objd, ret;
219
220 session = ltt_session_create();
221 if (!session)
222 return -ENOMEM;
223 session_objd = objd_alloc(session, &lttng_session_ops);
224 if (session_objd < 0) {
225 ret = session_objd;
226 goto objd_error;
227 }
228 session->objd = session_objd;
229 return session_objd;
230
231 objd_error:
232 ltt_session_destroy(session);
233 return ret;
234 }
235
236 #if 0
237 static
238 int lttng_abi_tracepoint_list(void)
239 {
240 int list_objd, ret;
241
242 /* TODO: Create list private data */
243 list_objd = objd_alloc(NULL, &lttng_tracepoint_list_ops);
244 if (list_objd < 0) {
245 ret = list_objd;
246 goto objd_error;
247 }
248
249 return list_objd;
250
251 objd_error:
252 return ret;
253 }
254 #endif //0
255
256 static
257 long lttng_abi_tracer_version(int objd,
258 struct lttng_ust_tracer_version *v)
259 {
260 v->version = LTTNG_UST_VERSION;
261 v->patchlevel = LTTNG_UST_PATCHLEVEL;
262 v->sublevel = LTTNG_UST_SUBLEVEL;
263 return 0;
264 }
265
266 static
267 long lttng_abi_add_context(int objd,
268 struct lttng_ust_context *context_param,
269 struct lttng_ctx **ctx, struct ltt_session *session)
270 {
271 if (session->been_active)
272 return -EPERM;
273
274 switch (context_param->ctx) {
275 case LTTNG_UST_CONTEXT_PTHREAD_ID:
276 return lttng_add_pthread_id_to_ctx(ctx);
277 case LTTNG_UST_CONTEXT_VTID:
278 return lttng_add_vtid_to_ctx(ctx);
279 case LTTNG_UST_CONTEXT_VPID:
280 return lttng_add_vpid_to_ctx(ctx);
281 case LTTNG_UST_CONTEXT_PROCNAME:
282 return lttng_add_procname_to_ctx(ctx);
283 default:
284 return -EINVAL;
285 }
286 }
287
288 /**
289 * lttng_cmd - lttng control through socket commands
290 *
291 * @objd: the object descriptor
292 * @cmd: the command
293 * @arg: command arg
294 *
295 * This descriptor implements lttng commands:
296 * LTTNG_UST_SESSION
297 * Returns a LTTng trace session object descriptor
298 * LTTNG_UST_TRACER_VERSION
299 * Returns the LTTng kernel tracer version
300 * LTTNG_UST_TRACEPOINT_LIST
301 * Returns a file descriptor listing available tracepoints
302 * LTTNG_UST_WAIT_QUIESCENT
303 * Returns after all previously running probes have completed
304 *
305 * The returned session will be deleted when its file descriptor is closed.
306 */
307 static
308 long lttng_cmd(int objd, unsigned int cmd, unsigned long arg)
309 {
310 switch (cmd) {
311 case LTTNG_UST_SESSION:
312 return lttng_abi_create_session();
313 case LTTNG_UST_TRACER_VERSION:
314 return lttng_abi_tracer_version(objd,
315 (struct lttng_ust_tracer_version *) arg);
316 case LTTNG_UST_TRACEPOINT_LIST:
317 return -ENOSYS; //TODO
318 //return lttng_abi_tracepoint_list();
319 case LTTNG_UST_WAIT_QUIESCENT:
320 synchronize_trace();
321 return 0;
322 default:
323 return -EINVAL;
324 }
325 }
326
327 static const struct lttng_ust_objd_ops lttng_ops = {
328 .cmd = lttng_cmd,
329 };
330
331 /*
332 * We tolerate no failure in this function (if one happens, we print a dmesg
333 * error, but cannot return any error, because the channel information is
334 * invariant.
335 */
336 static
337 void lttng_metadata_create_events(int channel_objd)
338 {
339 struct ltt_channel *channel = objd_private(channel_objd);
340 static struct lttng_ust_event metadata_params = {
341 .instrumentation = LTTNG_UST_TRACEPOINT,
342 .name = "lttng_metadata",
343 };
344 struct ltt_event *event;
345 int ret;
346
347 /*
348 * We tolerate no failure path after event creation. It will stay
349 * invariant for the rest of the session.
350 */
351 event = ltt_event_create(channel, &metadata_params, NULL);
352 if (!event) {
353 ret = -EINVAL;
354 goto create_error;
355 }
356 return;
357
358 create_error:
359 WARN_ON(1);
360 return; /* not allowed to return error */
361 }
362
363 int lttng_abi_create_channel(int session_objd,
364 struct lttng_ust_channel *chan_param,
365 enum channel_type channel_type)
366 {
367 struct ltt_session *session = objd_private(session_objd);
368 const struct lttng_ust_objd_ops *ops;
369 const char *transport_name;
370 struct ltt_channel *chan;
371 int chan_objd;
372 int ret = 0;
373
374 chan_objd = objd_alloc(NULL, &lttng_channel_ops);
375 if (chan_objd < 0) {
376 ret = chan_objd;
377 goto objd_error;
378 }
379 switch (channel_type) {
380 case PER_CPU_CHANNEL:
381 if (chan_param->output == LTTNG_UST_MMAP) {
382 transport_name = chan_param->overwrite ?
383 "relay-overwrite-mmap" : "relay-discard-mmap";
384 } else {
385 return -EINVAL;
386 }
387 ops = &lttng_channel_ops;
388 break;
389 case METADATA_CHANNEL:
390 if (chan_param->output == LTTNG_UST_MMAP)
391 transport_name = "relay-metadata-mmap";
392 else
393 return -EINVAL;
394 ops = &lttng_metadata_ops;
395 break;
396 default:
397 transport_name = "<unknown>";
398 break;
399 }
400 /*
401 * We tolerate no failure path after channel creation. It will stay
402 * invariant for the rest of the session.
403 */
404 chan = ltt_channel_create(session, transport_name, NULL,
405 chan_param->subbuf_size,
406 chan_param->num_subbuf,
407 chan_param->switch_timer_interval,
408 chan_param->read_timer_interval,
409 &chan_param->shm_fd,
410 &chan_param->wait_fd,
411 &chan_param->memory_map_size);
412 if (!chan) {
413 ret = -EINVAL;
414 goto chan_error;
415 }
416 objd_set_private(chan_objd, chan);
417 chan->objd = chan_objd;
418 if (channel_type == METADATA_CHANNEL) {
419 session->metadata = chan;
420 lttng_metadata_create_events(chan_objd);
421 }
422 /* The channel created holds a reference on the session */
423 objd_ref(session_objd);
424 /* Copy of session UUID for consumer (availability through shm) */
425 memcpy(chan->uuid, session->uuid, sizeof(session->uuid));
426
427 return chan_objd;
428
429 chan_error:
430 {
431 int err;
432
433 err = lttng_ust_objd_unref(chan_objd);
434 assert(!err);
435 }
436 objd_error:
437 return ret;
438 }
439
440 /**
441 * lttng_session_cmd - lttng session object command
442 *
443 * @obj: the object
444 * @cmd: the command
445 * @arg: command arg
446 *
447 * This descriptor implements lttng commands:
448 * LTTNG_UST_CHANNEL
449 * Returns a LTTng channel object descriptor
450 * LTTNG_UST_ENABLE
451 * Enables tracing for a session (weak enable)
452 * LTTNG_UST_DISABLE
453 * Disables tracing for a session (strong disable)
454 * LTTNG_UST_METADATA
455 * Returns a LTTng metadata object descriptor
456 *
457 * The returned channel will be deleted when its file descriptor is closed.
458 */
459 static
460 long lttng_session_cmd(int objd, unsigned int cmd, unsigned long arg)
461 {
462 struct ltt_session *session = objd_private(objd);
463
464 switch (cmd) {
465 case LTTNG_UST_CHANNEL:
466 return lttng_abi_create_channel(objd,
467 (struct lttng_ust_channel *) arg,
468 PER_CPU_CHANNEL);
469 case LTTNG_UST_SESSION_START:
470 case LTTNG_UST_ENABLE:
471 return ltt_session_enable(session);
472 case LTTNG_UST_SESSION_STOP:
473 case LTTNG_UST_DISABLE:
474 return ltt_session_disable(session);
475 case LTTNG_UST_METADATA:
476 return lttng_abi_create_channel(objd,
477 (struct lttng_ust_channel *) arg,
478 METADATA_CHANNEL);
479 default:
480 return -EINVAL;
481 }
482 }
483
484 /*
485 * Called when the last file reference is dropped.
486 *
487 * Big fat note: channels and events are invariant for the whole session after
488 * their creation. So this session destruction also destroys all channel and
489 * event structures specific to this session (they are not destroyed when their
490 * individual file is released).
491 */
492 static
493 int lttng_release_session(int objd)
494 {
495 struct ltt_session *session = objd_private(objd);
496
497 if (session) {
498 ltt_session_destroy(session);
499 return 0;
500 } else {
501 return -EINVAL;
502 }
503 }
504
505 static const struct lttng_ust_objd_ops lttng_session_ops = {
506 .release = lttng_release_session,
507 .cmd = lttng_session_cmd,
508 };
509
510 struct stream_priv_data {
511 struct lttng_ust_lib_ring_buffer *buf;
512 struct ltt_channel *ltt_chan;
513 };
514
515 static
516 int lttng_abi_open_stream(int channel_objd, struct lttng_ust_stream *info)
517 {
518 struct ltt_channel *channel = objd_private(channel_objd);
519 struct lttng_ust_lib_ring_buffer *buf;
520 struct stream_priv_data *priv;
521 int stream_objd, ret;
522
523 buf = channel->ops->buffer_read_open(channel->chan, channel->handle,
524 &info->shm_fd, &info->wait_fd, &info->memory_map_size);
525 if (!buf)
526 return -ENOENT;
527
528 priv = zmalloc(sizeof(*priv));
529 if (!priv) {
530 ret = -ENOMEM;
531 goto alloc_error;
532 }
533 priv->buf = buf;
534 priv->ltt_chan = channel;
535 stream_objd = objd_alloc(priv, &lib_ring_buffer_objd_ops);
536 if (stream_objd < 0) {
537 ret = stream_objd;
538 goto objd_error;
539 }
540 /* Hold a reference on the channel object descriptor */
541 objd_ref(channel_objd);
542 return stream_objd;
543
544 objd_error:
545 free(priv);
546 alloc_error:
547 channel->ops->buffer_read_close(buf, channel->handle);
548 return ret;
549 }
550
551 static
552 int lttng_abi_create_event(int channel_objd,
553 struct lttng_ust_event *event_param)
554 {
555 struct ltt_channel *channel = objd_private(channel_objd);
556 struct ltt_event *event;
557 int event_objd, ret;
558
559 event_param->name[LTTNG_UST_SYM_NAME_LEN - 1] = '\0';
560 event_objd = objd_alloc(NULL, &lttng_event_ops);
561 if (event_objd < 0) {
562 ret = event_objd;
563 goto objd_error;
564 }
565 /*
566 * We tolerate no failure path after event creation. It will stay
567 * invariant for the rest of the session.
568 */
569 event = ltt_event_create(channel, event_param, NULL);
570 if (!event) {
571 ret = -EINVAL;
572 goto event_error;
573 }
574 objd_set_private(event_objd, event);
575 /* The event holds a reference on the channel */
576 objd_ref(channel_objd);
577 return event_objd;
578
579 event_error:
580 {
581 int err;
582
583 err = lttng_ust_objd_unref(event_objd);
584 assert(!err);
585 }
586 objd_error:
587 return ret;
588 }
589
590 /**
591 * lttng_channel_cmd - lttng control through object descriptors
592 *
593 * @objd: the object descriptor
594 * @cmd: the command
595 * @arg: command arg
596 *
597 * This object descriptor implements lttng commands:
598 * LTTNG_UST_STREAM
599 * Returns an event stream object descriptor or failure.
600 * (typically, one event stream records events from one CPU)
601 * LTTNG_UST_EVENT
602 * Returns an event object descriptor or failure.
603 * LTTNG_UST_CONTEXT
604 * Prepend a context field to each event in the channel
605 * LTTNG_UST_ENABLE
606 * Enable recording for events in this channel (weak enable)
607 * LTTNG_UST_DISABLE
608 * Disable recording for events in this channel (strong disable)
609 *
610 * Channel and event file descriptors also hold a reference on the session.
611 */
612 static
613 long lttng_channel_cmd(int objd, unsigned int cmd, unsigned long arg)
614 {
615 struct ltt_channel *channel = objd_private(objd);
616
617 switch (cmd) {
618 case LTTNG_UST_STREAM:
619 {
620 struct lttng_ust_stream *stream;
621
622 stream = (struct lttng_ust_stream *) arg;
623 /* stream used as output */
624 return lttng_abi_open_stream(objd, stream);
625 }
626 case LTTNG_UST_EVENT:
627 return lttng_abi_create_event(objd, (struct lttng_ust_event *) arg);
628 case LTTNG_UST_CONTEXT:
629 return lttng_abi_add_context(objd,
630 (struct lttng_ust_context *) arg,
631 &channel->ctx, channel->session);
632 case LTTNG_UST_ENABLE:
633 return ltt_channel_enable(channel);
634 case LTTNG_UST_DISABLE:
635 return ltt_channel_disable(channel);
636 case LTTNG_UST_FLUSH_BUFFER:
637 return channel->ops->flush_buffer(channel->chan, channel->handle);
638 default:
639 return -EINVAL;
640 }
641 }
642
643 /**
644 * lttng_metadata_cmd - lttng control through object descriptors
645 *
646 * @objd: the object descriptor
647 * @cmd: the command
648 * @arg: command arg
649 *
650 * This object descriptor implements lttng commands:
651 * LTTNG_UST_STREAM
652 * Returns an event stream file descriptor or failure.
653 *
654 * Channel and event file descriptors also hold a reference on the session.
655 */
656 static
657 long lttng_metadata_cmd(int objd, unsigned int cmd, unsigned long arg)
658 {
659 struct ltt_channel *channel = objd_private(objd);
660
661 switch (cmd) {
662 case LTTNG_UST_STREAM:
663 {
664 struct lttng_ust_stream *stream;
665
666 stream = (struct lttng_ust_stream *) arg;
667 /* stream used as output */
668 return lttng_abi_open_stream(objd, stream);
669 }
670 case LTTNG_UST_FLUSH_BUFFER:
671 return channel->ops->flush_buffer(channel->chan, channel->handle);
672 default:
673 return -EINVAL;
674 }
675 }
676
677 #if 0
678 /**
679 * lttng_channel_poll - lttng stream addition/removal monitoring
680 *
681 * @file: the file
682 * @wait: poll table
683 */
684 unsigned int lttng_channel_poll(struct file *file, poll_table *wait)
685 {
686 struct ltt_channel *channel = file->private_data;
687 unsigned int mask = 0;
688
689 if (file->f_mode & FMODE_READ) {
690 poll_wait_set_exclusive(wait);
691 poll_wait(file, channel->ops->get_hp_wait_queue(channel->chan),
692 wait);
693
694 if (channel->ops->is_disabled(channel->chan))
695 return POLLERR;
696 if (channel->ops->is_finalized(channel->chan))
697 return POLLHUP;
698 if (channel->ops->buffer_has_read_closed_stream(channel->chan))
699 return POLLIN | POLLRDNORM;
700 return 0;
701 }
702 return mask;
703
704 }
705 #endif //0
706
707 static
708 int lttng_channel_release(int objd)
709 {
710 struct ltt_channel *channel = objd_private(objd);
711
712 if (channel)
713 return lttng_ust_objd_unref(channel->session->objd);
714 return 0;
715 }
716
717 static const struct lttng_ust_objd_ops lttng_channel_ops = {
718 .release = lttng_channel_release,
719 //.poll = lttng_channel_poll,
720 .cmd = lttng_channel_cmd,
721 };
722
723 static const struct lttng_ust_objd_ops lttng_metadata_ops = {
724 .release = lttng_channel_release,
725 .cmd = lttng_metadata_cmd,
726 };
727
728 /**
729 * lttng_rb_cmd - lttng ring buffer control through object descriptors
730 *
731 * @objd: the object descriptor
732 * @cmd: the command
733 * @arg: command arg
734 *
735 * This object descriptor implements lttng commands:
736 * (None for now. Access is done directly though shm.)
737 */
738 static
739 long lttng_rb_cmd(int objd, unsigned int cmd, unsigned long arg)
740 {
741 switch (cmd) {
742 default:
743 return -EINVAL;
744 }
745 }
746
747 static
748 int lttng_rb_release(int objd)
749 {
750 struct stream_priv_data *priv = objd_private(objd);
751 struct lttng_ust_lib_ring_buffer *buf;
752 struct ltt_channel *channel;
753
754 if (priv) {
755 buf = priv->buf;
756 channel = priv->ltt_chan;
757 free(priv);
758 channel->ops->buffer_read_close(buf, channel->handle);
759
760 return lttng_ust_objd_unref(channel->objd);
761 }
762 return 0;
763 }
764
765 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops = {
766 .release = lttng_rb_release,
767 .cmd = lttng_rb_cmd,
768 };
769
770 /**
771 * lttng_event_cmd - lttng control through object descriptors
772 *
773 * @objd: the object descriptor
774 * @cmd: the command
775 * @arg: command arg
776 *
777 * This object descriptor implements lttng commands:
778 * LTTNG_UST_CONTEXT
779 * Prepend a context field to each record of this event
780 * LTTNG_UST_ENABLE
781 * Enable recording for this event (weak enable)
782 * LTTNG_UST_DISABLE
783 * Disable recording for this event (strong disable)
784 */
785 static
786 long lttng_event_cmd(int objd, unsigned int cmd, unsigned long arg)
787 {
788 struct ltt_event *event = objd_private(objd);
789
790 switch (cmd) {
791 case LTTNG_UST_CONTEXT:
792 return lttng_abi_add_context(objd,
793 (struct lttng_ust_context *) arg,
794 &event->ctx, event->chan->session);
795 case LTTNG_UST_ENABLE:
796 return ltt_event_enable(event);
797 case LTTNG_UST_DISABLE:
798 return ltt_event_disable(event);
799 default:
800 return -EINVAL;
801 }
802 }
803
804 static
805 int lttng_event_release(int objd)
806 {
807 struct ltt_event *event = objd_private(objd);
808
809 if (event)
810 return lttng_ust_objd_unref(event->chan->objd);
811 return 0;
812 }
813
814 /* TODO: filter control ioctl */
815 static const struct lttng_ust_objd_ops lttng_event_ops = {
816 .release = lttng_event_release,
817 .cmd = lttng_event_cmd,
818 };
819
820 void lttng_ust_abi_exit(void)
821 {
822 objd_table_destroy();
823 }
This page took 0.046842 seconds and 5 git commands to generate.