6 * Copyright (C) 2010-2012 Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
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.
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.
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
23 * Mimic system calls for:
24 * - session creation, returns an object descriptor or failure.
25 * - channel creation, returns an object descriptor or failure.
26 * - Operates on a session object descriptor
27 * - Takes all channel options as parameters.
28 * - stream get, returns an object descriptor or failure.
29 * - Operates on a channel object descriptor.
30 * - stream notifier get, returns an object descriptor or failure.
31 * - Operates on a channel object descriptor.
32 * - event creation, returns an object descriptor or failure.
33 * - Operates on a channel object 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.
40 #include <lttng/ust-abi.h>
41 #include <lttng/ust-error.h>
42 #include <urcu/compiler.h>
43 #include <urcu/list.h>
44 #include <lttng/ust-events.h>
45 #include <lttng/ust-version.h>
46 #include <lttng/tracepoint.h>
47 #include "tracepoint-internal.h"
48 #include <usterr-signal-safe.h>
50 #include "lttng-tracer.h"
52 static int lttng_ust_abi_close_in_progress
;
55 int lttng_abi_tracepoint_list(void *owner
);
57 int lttng_abi_tracepoint_field_list(void *owner
);
60 * Object descriptor table. Should be protected from concurrent access
64 struct lttng_ust_obj
{
68 const struct lttng_ust_objd_ops
*ops
;
72 int freelist_next
; /* offset freelist. end is -1. */
76 struct lttng_ust_objd_table
{
77 struct lttng_ust_obj
*array
;
78 unsigned int len
, allocated_len
;
79 int freelist_head
; /* offset freelist head. end is -1 */
82 static struct lttng_ust_objd_table objd_table
= {
87 int objd_alloc(void *private_data
, const struct lttng_ust_objd_ops
*ops
,
90 struct lttng_ust_obj
*obj
;
92 if (objd_table
.freelist_head
!= -1) {
93 obj
= &objd_table
.array
[objd_table
.freelist_head
];
94 objd_table
.freelist_head
= obj
->u
.freelist_next
;
98 if (objd_table
.len
>= objd_table
.allocated_len
) {
99 unsigned int new_allocated_len
, old_allocated_len
;
100 struct lttng_ust_obj
*new_table
, *old_table
;
102 old_allocated_len
= objd_table
.allocated_len
;
103 old_table
= objd_table
.array
;
104 if (!old_allocated_len
)
105 new_allocated_len
= 1;
107 new_allocated_len
= old_allocated_len
<< 1;
108 new_table
= zmalloc(sizeof(struct lttng_ust_obj
) * new_allocated_len
);
111 memcpy(new_table
, old_table
,
112 sizeof(struct lttng_ust_obj
) * old_allocated_len
);
114 objd_table
.array
= new_table
;
115 objd_table
.allocated_len
= new_allocated_len
;
117 obj
= &objd_table
.array
[objd_table
.len
];
120 obj
->u
.s
.private_data
= private_data
;
122 obj
->u
.s
.f_count
= 2; /* count == 1 : object is allocated */
123 /* count == 2 : allocated + hold ref */
124 obj
->u
.s
.owner
= owner
;
125 return obj
- objd_table
.array
;
129 struct lttng_ust_obj
*_objd_get(int id
)
131 if (id
>= objd_table
.len
)
133 if (!objd_table
.array
[id
].u
.s
.f_count
)
135 return &objd_table
.array
[id
];
139 void *objd_private(int id
)
141 struct lttng_ust_obj
*obj
= _objd_get(id
);
143 return obj
->u
.s
.private_data
;
147 void objd_set_private(int id
, void *private_data
)
149 struct lttng_ust_obj
*obj
= _objd_get(id
);
151 obj
->u
.s
.private_data
= private_data
;
154 const struct lttng_ust_objd_ops
*objd_ops(int id
)
156 struct lttng_ust_obj
*obj
= _objd_get(id
);
164 void objd_free(int id
)
166 struct lttng_ust_obj
*obj
= _objd_get(id
);
169 obj
->u
.freelist_next
= objd_table
.freelist_head
;
170 objd_table
.freelist_head
= obj
- objd_table
.array
;
171 assert(obj
->u
.s
.f_count
== 1);
172 obj
->u
.s
.f_count
= 0; /* deallocated */
176 void objd_ref(int id
)
178 struct lttng_ust_obj
*obj
= _objd_get(id
);
182 int lttng_ust_objd_unref(int id
)
184 struct lttng_ust_obj
*obj
= _objd_get(id
);
188 if (obj
->u
.s
.f_count
== 1) {
189 ERR("Reference counting error\n");
192 if ((--obj
->u
.s
.f_count
) == 1) {
193 const struct lttng_ust_objd_ops
*ops
= objd_ops(id
);
203 void objd_table_destroy(void)
207 for (i
= 0; i
< objd_table
.allocated_len
; i
++)
208 (void) lttng_ust_objd_unref(i
);
209 free(objd_table
.array
);
210 objd_table
.array
= NULL
;
212 objd_table
.allocated_len
= 0;
213 objd_table
.freelist_head
= -1;
216 void lttng_ust_objd_table_owner_cleanup(void *owner
)
220 for (i
= 0; i
< objd_table
.allocated_len
; i
++) {
221 struct lttng_ust_obj
*obj
;
227 continue; /* skip root handles */
228 if (obj
->u
.s
.owner
== owner
)
229 (void) lttng_ust_objd_unref(i
);
234 * This is LTTng's own personal way to create an ABI for sessiond.
235 * We send commands over a socket.
238 static const struct lttng_ust_objd_ops lttng_ops
;
239 static const struct lttng_ust_objd_ops lttng_session_ops
;
240 static const struct lttng_ust_objd_ops lttng_channel_ops
;
241 static const struct lttng_ust_objd_ops lttng_metadata_ops
;
242 static const struct lttng_ust_objd_ops lttng_enabler_ops
;
243 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops
;
244 static const struct lttng_ust_objd_ops lttng_tracepoint_list_ops
;
245 static const struct lttng_ust_objd_ops lttng_tracepoint_field_list_ops
;
252 int lttng_abi_create_root_handle(void)
256 /* root handles have NULL owners */
257 root_handle
= objd_alloc(NULL
, <tng_ops
, NULL
);
262 int lttng_abi_create_session(void *owner
)
264 struct lttng_session
*session
;
265 int session_objd
, ret
;
267 session
= lttng_session_create();
270 session_objd
= objd_alloc(session
, <tng_session_ops
, owner
);
271 if (session_objd
< 0) {
275 session
->objd
= session_objd
;
279 lttng_session_destroy(session
);
284 long lttng_abi_tracer_version(int objd
,
285 struct lttng_ust_tracer_version
*v
)
287 v
->major
= LTTNG_UST_INTERNAL_MAJOR_VERSION
;
288 v
->minor
= LTTNG_UST_INTERNAL_MINOR_VERSION
;
289 v
->patchlevel
= LTTNG_UST_INTERNAL_PATCHLEVEL_VERSION
;
294 long lttng_abi_add_context(int objd
,
295 struct lttng_ust_context
*context_param
,
296 struct lttng_ctx
**ctx
, struct lttng_session
*session
)
298 return lttng_attach_context(context_param
, ctx
, session
);
302 * lttng_cmd - lttng control through socket commands
304 * @objd: the object descriptor
307 * @uargs: UST arguments (internal)
310 * This descriptor implements lttng commands:
312 * Returns a LTTng trace session object descriptor
313 * LTTNG_UST_TRACER_VERSION
314 * Returns the LTTng kernel tracer version
315 * LTTNG_UST_TRACEPOINT_LIST
316 * Returns a file descriptor listing available tracepoints
317 * LTTNG_UST_TRACEPOINT_FIELD_LIST
318 * Returns a file descriptor listing available tracepoint fields
319 * LTTNG_UST_WAIT_QUIESCENT
320 * Returns after all previously running probes have completed
322 * The returned session will be deleted when its file descriptor is closed.
325 long lttng_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
326 union ust_args
*uargs
, void *owner
)
329 case LTTNG_UST_SESSION
:
330 return lttng_abi_create_session(owner
);
331 case LTTNG_UST_TRACER_VERSION
:
332 return lttng_abi_tracer_version(objd
,
333 (struct lttng_ust_tracer_version
*) arg
);
334 case LTTNG_UST_TRACEPOINT_LIST
:
335 return lttng_abi_tracepoint_list(owner
);
336 case LTTNG_UST_TRACEPOINT_FIELD_LIST
:
337 return lttng_abi_tracepoint_field_list(owner
);
338 case LTTNG_UST_WAIT_QUIESCENT
:
346 static const struct lttng_ust_objd_ops lttng_ops
= {
351 * We tolerate no failure in this function (if one happens, we print a dmesg
352 * error, but cannot return any error, because the channel information is
356 void lttng_metadata_create_events(int channel_objd
)
358 struct lttng_channel
*chan
= objd_private(channel_objd
);
359 struct lttng_enabler
*enabler
;
360 static struct lttng_ust_event metadata_params
= {
361 .instrumentation
= LTTNG_UST_TRACEPOINT
,
362 .name
= "lttng_ust:metadata",
363 .loglevel_type
= LTTNG_UST_LOGLEVEL_ALL
,
364 .loglevel
= TRACE_DEFAULT
,
368 * We tolerate no failure path after event creation. It will stay
369 * invariant for the rest of the session.
371 enabler
= lttng_enabler_create(LTTNG_ENABLER_EVENT
,
372 &metadata_params
, chan
);
380 return; /* not allowed to return error */
383 int lttng_abi_create_channel(int session_objd
,
384 struct lttng_ust_channel
*chan_param
,
385 enum channel_type channel_type
,
386 union ust_args
*uargs
,
389 struct lttng_session
*session
= objd_private(session_objd
);
390 const struct lttng_ust_objd_ops
*ops
;
391 const char *transport_name
;
392 struct lttng_channel
*chan
;
395 struct lttng_channel chan_priv_init
;
397 switch (channel_type
) {
398 case PER_CPU_CHANNEL
:
399 if (chan_param
->output
== LTTNG_UST_MMAP
) {
400 transport_name
= chan_param
->overwrite
?
401 "relay-overwrite-mmap" : "relay-discard-mmap";
405 ops
= <tng_channel_ops
;
407 case METADATA_CHANNEL
:
408 if (chan_param
->output
== LTTNG_UST_MMAP
)
409 transport_name
= "relay-metadata-mmap";
412 ops
= <tng_metadata_ops
;
415 transport_name
= "<unknown>";
418 chan_objd
= objd_alloc(NULL
, ops
, owner
);
423 memset(&chan_priv_init
, 0, sizeof(chan_priv_init
));
424 /* Copy of session UUID for consumer (availability through shm) */
425 memcpy(chan_priv_init
.uuid
, session
->uuid
, sizeof(session
->uuid
));
428 * We tolerate no failure path after channel creation. It will stay
429 * invariant for the rest of the session.
431 chan
= lttng_channel_create(session
, transport_name
, NULL
,
432 chan_param
->subbuf_size
,
433 chan_param
->num_subbuf
,
434 chan_param
->switch_timer_interval
,
435 chan_param
->read_timer_interval
,
436 &uargs
->channel
.shm_fd
,
437 &uargs
->channel
.wait_fd
,
438 &uargs
->channel
.memory_map_size
,
444 objd_set_private(chan_objd
, chan
);
445 chan
->objd
= chan_objd
;
446 if (channel_type
== METADATA_CHANNEL
) {
447 session
->metadata
= chan
;
448 lttng_metadata_create_events(chan_objd
);
450 /* The channel created holds a reference on the session */
451 objd_ref(session_objd
);
459 err
= lttng_ust_objd_unref(chan_objd
);
467 * lttng_session_cmd - lttng session object command
472 * @uargs: UST arguments (internal)
475 * This descriptor implements lttng commands:
477 * Returns a LTTng channel object descriptor
479 * Enables tracing for a session (weak enable)
481 * Disables tracing for a session (strong disable)
483 * Returns a LTTng metadata object descriptor
485 * The returned channel will be deleted when its file descriptor is closed.
488 long lttng_session_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
489 union ust_args
*uargs
, void *owner
)
491 struct lttng_session
*session
= objd_private(objd
);
494 case LTTNG_UST_CHANNEL
:
495 return lttng_abi_create_channel(objd
,
496 (struct lttng_ust_channel
*) arg
,
497 PER_CPU_CHANNEL
, uargs
, owner
);
498 case LTTNG_UST_SESSION_START
:
499 case LTTNG_UST_ENABLE
:
500 return lttng_session_enable(session
);
501 case LTTNG_UST_SESSION_STOP
:
502 case LTTNG_UST_DISABLE
:
503 return lttng_session_disable(session
);
504 case LTTNG_UST_METADATA
:
505 return lttng_abi_create_channel(objd
,
506 (struct lttng_ust_channel
*) arg
,
507 METADATA_CHANNEL
, uargs
, owner
);
514 * Called when the last file reference is dropped.
516 * Big fat note: channels and events are invariant for the whole session after
517 * their creation. So this session destruction also destroys all channel and
518 * event structures specific to this session (they are not destroyed when their
519 * individual file is released).
522 int lttng_release_session(int objd
)
524 struct lttng_session
*session
= objd_private(objd
);
527 lttng_session_destroy(session
);
534 static const struct lttng_ust_objd_ops lttng_session_ops
= {
535 .release
= lttng_release_session
,
536 .cmd
= lttng_session_cmd
,
540 long lttng_tracepoint_list_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
541 union ust_args
*uargs
, void *owner
)
543 struct lttng_ust_tracepoint_list
*list
= objd_private(objd
);
544 struct lttng_ust_tracepoint_iter
*tp
=
545 (struct lttng_ust_tracepoint_iter
*) arg
;
546 struct lttng_ust_tracepoint_iter
*iter
;
549 case LTTNG_UST_TRACEPOINT_LIST_GET
:
552 iter
= lttng_ust_tracepoint_list_get_iter_next(list
);
554 return -LTTNG_UST_ERR_NOENT
;
555 if (!strcmp(iter
->name
, "lttng_ust:metadata"))
557 memcpy(tp
, iter
, sizeof(*tp
));
566 int lttng_abi_tracepoint_list(void *owner
)
569 struct lttng_ust_tracepoint_list
*list
;
571 list_objd
= objd_alloc(NULL
, <tng_tracepoint_list_ops
, owner
);
576 list
= zmalloc(sizeof(*list
));
581 objd_set_private(list_objd
, list
);
583 /* populate list by walking on all registered probes. */
584 ret
= lttng_probes_get_event_list(list
);
596 err
= lttng_ust_objd_unref(list_objd
);
604 int lttng_release_tracepoint_list(int objd
)
606 struct lttng_ust_tracepoint_list
*list
= objd_private(objd
);
609 lttng_probes_prune_event_list(list
);
617 static const struct lttng_ust_objd_ops lttng_tracepoint_list_ops
= {
618 .release
= lttng_release_tracepoint_list
,
619 .cmd
= lttng_tracepoint_list_cmd
,
623 long lttng_tracepoint_field_list_cmd(int objd
, unsigned int cmd
,
624 unsigned long arg
, union ust_args
*uargs
, void *owner
)
626 struct lttng_ust_field_list
*list
= objd_private(objd
);
627 struct lttng_ust_field_iter
*tp
= &uargs
->field_list
.entry
;
628 struct lttng_ust_field_iter
*iter
;
631 case LTTNG_UST_TRACEPOINT_FIELD_LIST_GET
:
634 iter
= lttng_ust_field_list_get_iter_next(list
);
636 return -LTTNG_UST_ERR_NOENT
;
637 if (!strcmp(iter
->event_name
, "lttng_ust:metadata"))
639 memcpy(tp
, iter
, sizeof(*tp
));
648 int lttng_abi_tracepoint_field_list(void *owner
)
651 struct lttng_ust_field_list
*list
;
653 list_objd
= objd_alloc(NULL
, <tng_tracepoint_field_list_ops
, owner
);
658 list
= zmalloc(sizeof(*list
));
663 objd_set_private(list_objd
, list
);
665 /* populate list by walking on all registered probes. */
666 ret
= lttng_probes_get_field_list(list
);
678 err
= lttng_ust_objd_unref(list_objd
);
686 int lttng_release_tracepoint_field_list(int objd
)
688 struct lttng_ust_field_list
*list
= objd_private(objd
);
691 lttng_probes_prune_field_list(list
);
699 static const struct lttng_ust_objd_ops lttng_tracepoint_field_list_ops
= {
700 .release
= lttng_release_tracepoint_field_list
,
701 .cmd
= lttng_tracepoint_field_list_cmd
,
704 struct stream_priv_data
{
705 struct lttng_ust_lib_ring_buffer
*buf
;
706 struct lttng_channel
*lttng_chan
;
710 int lttng_abi_open_stream(int channel_objd
, struct lttng_ust_stream
*info
,
711 union ust_args
*uargs
, void *owner
)
713 struct lttng_channel
*channel
= objd_private(channel_objd
);
714 struct lttng_ust_lib_ring_buffer
*buf
;
715 struct stream_priv_data
*priv
;
716 int stream_objd
, ret
;
718 buf
= channel
->ops
->buffer_read_open(channel
->chan
, channel
->handle
,
719 &uargs
->stream
.shm_fd
,
720 &uargs
->stream
.wait_fd
,
721 &uargs
->stream
.memory_map_size
);
725 priv
= zmalloc(sizeof(*priv
));
731 priv
->lttng_chan
= channel
;
732 stream_objd
= objd_alloc(priv
, &lib_ring_buffer_objd_ops
, owner
);
733 if (stream_objd
< 0) {
737 /* Hold a reference on the channel object descriptor */
738 objd_ref(channel_objd
);
744 channel
->ops
->buffer_read_close(buf
, channel
->handle
);
749 int lttng_abi_create_enabler(int channel_objd
,
750 struct lttng_ust_event
*event_param
,
752 enum lttng_enabler_type type
)
754 struct lttng_channel
*channel
= objd_private(channel_objd
);
755 struct lttng_enabler
*enabler
;
758 event_param
->name
[LTTNG_UST_SYM_NAME_LEN
- 1] = '\0';
759 event_objd
= objd_alloc(NULL
, <tng_enabler_ops
, owner
);
760 if (event_objd
< 0) {
765 * We tolerate no failure path after event creation. It will stay
766 * invariant for the rest of the session.
768 enabler
= lttng_enabler_create(type
, event_param
, channel
);
773 objd_set_private(event_objd
, enabler
);
774 /* The event holds a reference on the channel */
775 objd_ref(channel_objd
);
782 err
= lttng_ust_objd_unref(event_objd
);
790 * lttng_channel_cmd - lttng control through object descriptors
792 * @objd: the object descriptor
795 * @uargs: UST arguments (internal)
798 * This object descriptor implements lttng commands:
800 * Returns an event stream object descriptor or failure.
801 * (typically, one event stream records events from one CPU)
803 * Returns an event object descriptor or failure.
805 * Prepend a context field to each event in the channel
807 * Enable recording for events in this channel (weak enable)
809 * Disable recording for events in this channel (strong disable)
811 * Channel and event file descriptors also hold a reference on the session.
814 long lttng_channel_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
815 union ust_args
*uargs
, void *owner
)
817 struct lttng_channel
*channel
= objd_private(objd
);
820 case LTTNG_UST_STREAM
:
822 struct lttng_ust_stream
*stream
;
824 stream
= (struct lttng_ust_stream
*) arg
;
825 /* stream used as output */
826 return lttng_abi_open_stream(objd
, stream
, uargs
, owner
);
828 case LTTNG_UST_EVENT
:
830 struct lttng_ust_event
*event_param
=
831 (struct lttng_ust_event
*) arg
;
832 if (event_param
->name
[strlen(event_param
->name
) - 1] == '*') {
833 /* If ends with wildcard, create wildcard. */
834 return lttng_abi_create_enabler(objd
, event_param
,
835 owner
, LTTNG_ENABLER_WILDCARD
);
837 return lttng_abi_create_enabler(objd
, event_param
,
838 owner
, LTTNG_ENABLER_EVENT
);
841 case LTTNG_UST_CONTEXT
:
842 return lttng_abi_add_context(objd
,
843 (struct lttng_ust_context
*) arg
,
844 &channel
->ctx
, channel
->session
);
845 case LTTNG_UST_ENABLE
:
846 return lttng_channel_enable(channel
);
847 case LTTNG_UST_DISABLE
:
848 return lttng_channel_disable(channel
);
849 case LTTNG_UST_FLUSH_BUFFER
:
850 return channel
->ops
->flush_buffer(channel
->chan
, channel
->handle
);
857 * lttng_metadata_cmd - lttng control through object descriptors
859 * @objd: the object descriptor
862 * @uargs: UST arguments (internal)
865 * This object descriptor implements lttng commands:
867 * Returns an event stream file descriptor or failure.
869 * Channel and event file descriptors also hold a reference on the session.
872 long lttng_metadata_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
873 union ust_args
*uargs
, void *owner
)
875 struct lttng_channel
*channel
= objd_private(objd
);
878 case LTTNG_UST_STREAM
:
880 struct lttng_ust_stream
*stream
;
882 stream
= (struct lttng_ust_stream
*) arg
;
883 /* stream used as output */
884 return lttng_abi_open_stream(objd
, stream
, uargs
, owner
);
886 case LTTNG_UST_FLUSH_BUFFER
:
887 return channel
->ops
->flush_buffer(channel
->chan
, channel
->handle
);
894 int lttng_channel_release(int objd
)
896 struct lttng_channel
*channel
= objd_private(objd
);
899 return lttng_ust_objd_unref(channel
->session
->objd
);
903 static const struct lttng_ust_objd_ops lttng_channel_ops
= {
904 .release
= lttng_channel_release
,
905 .cmd
= lttng_channel_cmd
,
908 static const struct lttng_ust_objd_ops lttng_metadata_ops
= {
909 .release
= lttng_channel_release
,
910 .cmd
= lttng_metadata_cmd
,
914 * lttng_rb_cmd - lttng ring buffer control through object descriptors
916 * @objd: the object descriptor
919 * @uargs: UST arguments (internal)
922 * This object descriptor implements lttng commands:
923 * (None for now. Access is done directly though shm.)
926 long lttng_rb_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
927 union ust_args
*uargs
, void *owner
)
936 int lttng_rb_release(int objd
)
938 struct stream_priv_data
*priv
= objd_private(objd
);
939 struct lttng_ust_lib_ring_buffer
*buf
;
940 struct lttng_channel
*channel
;
944 channel
= priv
->lttng_chan
;
947 * If we are at ABI exit, we don't want to close the
948 * buffer opened for read: it is being shared between
949 * the parent and child (right after fork), and we don't
950 * want the child to close it for the parent. For a real
951 * exit, we don't care about marking it as closed, as
952 * the consumer daemon (if there is one) will do fine
953 * even if we don't mark it as "closed" for reading on
955 * We only mark it as closed if it is being explicitely
956 * released by the session daemon with an explicit
959 if (!lttng_ust_abi_close_in_progress
)
960 channel
->ops
->buffer_read_close(buf
, channel
->handle
);
962 return lttng_ust_objd_unref(channel
->objd
);
967 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops
= {
968 .release
= lttng_rb_release
,
973 * lttng_enabler_cmd - lttng control through object descriptors
975 * @objd: the object descriptor
978 * @uargs: UST arguments (internal)
981 * This object descriptor implements lttng commands:
983 * Prepend a context field to each record of events of this
986 * Enable recording for this enabler
988 * Disable recording for this enabler
990 * Attach a filter to an enabler.
993 long lttng_enabler_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
994 union ust_args
*uargs
, void *owner
)
996 struct lttng_enabler
*enabler
= objd_private(objd
);
999 case LTTNG_UST_CONTEXT
:
1000 return lttng_enabler_attach_context(enabler
,
1001 (struct lttng_ust_context
*) arg
);
1002 case LTTNG_UST_ENABLE
:
1003 return lttng_enabler_enable(enabler
);
1004 case LTTNG_UST_DISABLE
:
1005 return lttng_enabler_disable(enabler
);
1006 case LTTNG_UST_FILTER
:
1010 ret
= lttng_enabler_attach_bytecode(enabler
,
1011 (struct lttng_ust_filter_bytecode_node
*) arg
);
1022 int lttng_enabler_release(int objd
)
1024 struct lttng_enabler
*enabler
= objd_private(objd
);
1027 return lttng_ust_objd_unref(enabler
->chan
->objd
);
1031 static const struct lttng_ust_objd_ops lttng_enabler_ops
= {
1032 .release
= lttng_enabler_release
,
1033 .cmd
= lttng_enabler_cmd
,
1036 void lttng_ust_abi_exit(void)
1038 lttng_ust_abi_close_in_progress
= 1;
1039 objd_table_destroy();
1040 lttng_ust_abi_close_in_progress
= 0;