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 #define OBJ_NAME_LEN 16
54 static int lttng_ust_abi_close_in_progress
;
57 int lttng_abi_tracepoint_list(void *owner
);
59 int lttng_abi_tracepoint_field_list(void *owner
);
62 * Object descriptor table. Should be protected from concurrent access
66 struct lttng_ust_obj
{
70 const struct lttng_ust_objd_ops
*ops
;
73 char name
[OBJ_NAME_LEN
];
75 int freelist_next
; /* offset freelist. end is -1. */
79 struct lttng_ust_objd_table
{
80 struct lttng_ust_obj
*array
;
81 unsigned int len
, allocated_len
;
82 int freelist_head
; /* offset freelist head. end is -1 */
85 static struct lttng_ust_objd_table objd_table
= {
90 int objd_alloc(void *private_data
, const struct lttng_ust_objd_ops
*ops
,
91 void *owner
, const char *name
)
93 struct lttng_ust_obj
*obj
;
95 if (objd_table
.freelist_head
!= -1) {
96 obj
= &objd_table
.array
[objd_table
.freelist_head
];
97 objd_table
.freelist_head
= obj
->u
.freelist_next
;
101 if (objd_table
.len
>= objd_table
.allocated_len
) {
102 unsigned int new_allocated_len
, old_allocated_len
;
103 struct lttng_ust_obj
*new_table
, *old_table
;
105 old_allocated_len
= objd_table
.allocated_len
;
106 old_table
= objd_table
.array
;
107 if (!old_allocated_len
)
108 new_allocated_len
= 1;
110 new_allocated_len
= old_allocated_len
<< 1;
111 new_table
= zmalloc(sizeof(struct lttng_ust_obj
) * new_allocated_len
);
114 memcpy(new_table
, old_table
,
115 sizeof(struct lttng_ust_obj
) * old_allocated_len
);
117 objd_table
.array
= new_table
;
118 objd_table
.allocated_len
= new_allocated_len
;
120 obj
= &objd_table
.array
[objd_table
.len
];
123 obj
->u
.s
.private_data
= private_data
;
125 obj
->u
.s
.f_count
= 2; /* count == 1 : object is allocated */
126 /* count == 2 : allocated + hold ref */
127 obj
->u
.s
.owner
= owner
;
128 strncpy(obj
->u
.s
.name
, name
, OBJ_NAME_LEN
);
129 obj
->u
.s
.name
[OBJ_NAME_LEN
- 1] = '\0';
130 return obj
- objd_table
.array
;
134 struct lttng_ust_obj
*_objd_get(int id
)
136 if (id
>= objd_table
.len
)
138 if (!objd_table
.array
[id
].u
.s
.f_count
)
140 return &objd_table
.array
[id
];
144 void *objd_private(int id
)
146 struct lttng_ust_obj
*obj
= _objd_get(id
);
148 return obj
->u
.s
.private_data
;
152 void objd_set_private(int id
, void *private_data
)
154 struct lttng_ust_obj
*obj
= _objd_get(id
);
156 obj
->u
.s
.private_data
= private_data
;
159 const struct lttng_ust_objd_ops
*objd_ops(int id
)
161 struct lttng_ust_obj
*obj
= _objd_get(id
);
169 void objd_free(int id
)
171 struct lttng_ust_obj
*obj
= _objd_get(id
);
174 obj
->u
.freelist_next
= objd_table
.freelist_head
;
175 objd_table
.freelist_head
= obj
- objd_table
.array
;
176 assert(obj
->u
.s
.f_count
== 1);
177 obj
->u
.s
.f_count
= 0; /* deallocated */
181 void objd_ref(int id
)
183 struct lttng_ust_obj
*obj
= _objd_get(id
);
187 int lttng_ust_objd_unref(int id
)
189 struct lttng_ust_obj
*obj
= _objd_get(id
);
193 if (obj
->u
.s
.f_count
== 1) {
194 ERR("Reference counting error\n");
197 if ((--obj
->u
.s
.f_count
) == 1) {
198 const struct lttng_ust_objd_ops
*ops
= objd_ops(id
);
208 void objd_table_destroy(void)
212 for (i
= 0; i
< objd_table
.allocated_len
; i
++)
213 (void) lttng_ust_objd_unref(i
);
214 free(objd_table
.array
);
215 objd_table
.array
= NULL
;
217 objd_table
.allocated_len
= 0;
218 objd_table
.freelist_head
= -1;
221 void lttng_ust_objd_table_owner_cleanup(void *owner
)
225 for (i
= 0; i
< objd_table
.allocated_len
; i
++) {
226 struct lttng_ust_obj
*obj
;
232 continue; /* skip root handles */
233 if (obj
->u
.s
.owner
== owner
)
234 (void) lttng_ust_objd_unref(i
);
239 * This is LTTng's own personal way to create an ABI for sessiond.
240 * We send commands over a socket.
243 static const struct lttng_ust_objd_ops lttng_ops
;
244 static const struct lttng_ust_objd_ops lttng_session_ops
;
245 static const struct lttng_ust_objd_ops lttng_channel_ops
;
246 static const struct lttng_ust_objd_ops lttng_metadata_ops
;
247 static const struct lttng_ust_objd_ops lttng_enabler_ops
;
248 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops
;
249 static const struct lttng_ust_objd_ops lttng_tracepoint_list_ops
;
250 static const struct lttng_ust_objd_ops lttng_tracepoint_field_list_ops
;
257 int lttng_abi_create_root_handle(void)
261 /* root handles have NULL owners */
262 root_handle
= objd_alloc(NULL
, <tng_ops
, NULL
, "root");
267 int lttng_abi_create_session(void *owner
)
269 struct lttng_session
*session
;
270 int session_objd
, ret
;
272 session
= lttng_session_create();
275 session_objd
= objd_alloc(session
, <tng_session_ops
, owner
, "session");
276 if (session_objd
< 0) {
280 session
->objd
= session_objd
;
284 lttng_session_destroy(session
);
289 long lttng_abi_tracer_version(int objd
,
290 struct lttng_ust_tracer_version
*v
)
292 v
->major
= LTTNG_UST_INTERNAL_MAJOR_VERSION
;
293 v
->minor
= LTTNG_UST_INTERNAL_MINOR_VERSION
;
294 v
->patchlevel
= LTTNG_UST_INTERNAL_PATCHLEVEL_VERSION
;
299 long lttng_abi_add_context(int objd
,
300 struct lttng_ust_context
*context_param
,
301 struct lttng_ctx
**ctx
, struct lttng_session
*session
)
303 return lttng_attach_context(context_param
, ctx
, session
);
307 * lttng_cmd - lttng control through socket commands
309 * @objd: the object descriptor
312 * @uargs: UST arguments (internal)
315 * This descriptor implements lttng commands:
317 * Returns a LTTng trace session object descriptor
318 * LTTNG_UST_TRACER_VERSION
319 * Returns the LTTng kernel tracer version
320 * LTTNG_UST_TRACEPOINT_LIST
321 * Returns a file descriptor listing available tracepoints
322 * LTTNG_UST_TRACEPOINT_FIELD_LIST
323 * Returns a file descriptor listing available tracepoint fields
324 * LTTNG_UST_WAIT_QUIESCENT
325 * Returns after all previously running probes have completed
327 * The returned session will be deleted when its file descriptor is closed.
330 long lttng_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
331 union ust_args
*uargs
, void *owner
)
334 case LTTNG_UST_SESSION
:
335 return lttng_abi_create_session(owner
);
336 case LTTNG_UST_TRACER_VERSION
:
337 return lttng_abi_tracer_version(objd
,
338 (struct lttng_ust_tracer_version
*) arg
);
339 case LTTNG_UST_TRACEPOINT_LIST
:
340 return lttng_abi_tracepoint_list(owner
);
341 case LTTNG_UST_TRACEPOINT_FIELD_LIST
:
342 return lttng_abi_tracepoint_field_list(owner
);
343 case LTTNG_UST_WAIT_QUIESCENT
:
351 static const struct lttng_ust_objd_ops lttng_ops
= {
356 * We tolerate no failure in this function (if one happens, we print a dmesg
357 * error, but cannot return any error, because the channel information is
361 void lttng_metadata_create_events(int channel_objd
)
363 struct lttng_channel
*chan
= objd_private(channel_objd
);
364 struct lttng_enabler
*enabler
;
365 static struct lttng_ust_event metadata_params
= {
366 .instrumentation
= LTTNG_UST_TRACEPOINT
,
367 .name
= "lttng_ust:metadata",
368 .loglevel_type
= LTTNG_UST_LOGLEVEL_ALL
,
369 .loglevel
= TRACE_DEFAULT
,
373 * We tolerate no failure path after event creation. It will stay
374 * invariant for the rest of the session.
376 enabler
= lttng_enabler_create(LTTNG_ENABLER_EVENT
,
377 &metadata_params
, chan
);
385 return; /* not allowed to return error */
388 int lttng_abi_create_channel(int session_objd
,
389 struct lttng_ust_channel
*chan_param
,
390 enum channel_type channel_type
,
391 union ust_args
*uargs
,
394 struct lttng_session
*session
= objd_private(session_objd
);
395 const struct lttng_ust_objd_ops
*ops
;
396 const char *transport_name
;
397 struct lttng_channel
*chan
;
400 struct lttng_channel chan_priv_init
;
402 switch (channel_type
) {
403 case PER_CPU_CHANNEL
:
404 if (chan_param
->output
== LTTNG_UST_MMAP
) {
405 transport_name
= chan_param
->overwrite
?
406 "relay-overwrite-mmap" : "relay-discard-mmap";
410 ops
= <tng_channel_ops
;
412 case METADATA_CHANNEL
:
413 if (chan_param
->output
== LTTNG_UST_MMAP
)
414 transport_name
= "relay-metadata-mmap";
417 ops
= <tng_metadata_ops
;
420 transport_name
= "<unknown>";
423 chan_objd
= objd_alloc(NULL
, ops
, owner
, "channel");
428 memset(&chan_priv_init
, 0, sizeof(chan_priv_init
));
429 /* Copy of session UUID for consumer (availability through shm) */
430 memcpy(chan_priv_init
.uuid
, session
->uuid
, sizeof(session
->uuid
));
433 * We tolerate no failure path after channel creation. It will stay
434 * invariant for the rest of the session.
436 chan
= lttng_channel_create(session
, transport_name
, NULL
,
437 chan_param
->subbuf_size
,
438 chan_param
->num_subbuf
,
439 chan_param
->switch_timer_interval
,
440 chan_param
->read_timer_interval
,
441 &uargs
->channel
.shm_fd
,
442 &uargs
->channel
.wait_fd
,
443 &uargs
->channel
.memory_map_size
,
449 objd_set_private(chan_objd
, chan
);
450 chan
->objd
= chan_objd
;
451 if (channel_type
== METADATA_CHANNEL
) {
452 session
->metadata
= chan
;
453 lttng_metadata_create_events(chan_objd
);
455 /* The channel created holds a reference on the session */
456 objd_ref(session_objd
);
464 err
= lttng_ust_objd_unref(chan_objd
);
472 * lttng_session_cmd - lttng session object command
477 * @uargs: UST arguments (internal)
480 * This descriptor implements lttng commands:
482 * Returns a LTTng channel object descriptor
484 * Enables tracing for a session (weak enable)
486 * Disables tracing for a session (strong disable)
488 * Returns a LTTng metadata object descriptor
490 * The returned channel will be deleted when its file descriptor is closed.
493 long lttng_session_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
494 union ust_args
*uargs
, void *owner
)
496 struct lttng_session
*session
= objd_private(objd
);
499 case LTTNG_UST_CHANNEL
:
500 return lttng_abi_create_channel(objd
,
501 (struct lttng_ust_channel
*) arg
,
502 PER_CPU_CHANNEL
, uargs
, owner
);
503 case LTTNG_UST_SESSION_START
:
504 case LTTNG_UST_ENABLE
:
505 return lttng_session_enable(session
);
506 case LTTNG_UST_SESSION_STOP
:
507 case LTTNG_UST_DISABLE
:
508 return lttng_session_disable(session
);
509 case LTTNG_UST_METADATA
:
510 return lttng_abi_create_channel(objd
,
511 (struct lttng_ust_channel
*) arg
,
512 METADATA_CHANNEL
, uargs
, owner
);
519 * Called when the last file reference is dropped.
521 * Big fat note: channels and events are invariant for the whole session after
522 * their creation. So this session destruction also destroys all channel and
523 * event structures specific to this session (they are not destroyed when their
524 * individual file is released).
527 int lttng_release_session(int objd
)
529 struct lttng_session
*session
= objd_private(objd
);
532 lttng_session_destroy(session
);
539 static const struct lttng_ust_objd_ops lttng_session_ops
= {
540 .release
= lttng_release_session
,
541 .cmd
= lttng_session_cmd
,
545 long lttng_tracepoint_list_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
546 union ust_args
*uargs
, void *owner
)
548 struct lttng_ust_tracepoint_list
*list
= objd_private(objd
);
549 struct lttng_ust_tracepoint_iter
*tp
=
550 (struct lttng_ust_tracepoint_iter
*) arg
;
551 struct lttng_ust_tracepoint_iter
*iter
;
554 case LTTNG_UST_TRACEPOINT_LIST_GET
:
557 iter
= lttng_ust_tracepoint_list_get_iter_next(list
);
559 return -LTTNG_UST_ERR_NOENT
;
560 if (!strcmp(iter
->name
, "lttng_ust:metadata"))
562 memcpy(tp
, iter
, sizeof(*tp
));
571 int lttng_abi_tracepoint_list(void *owner
)
574 struct lttng_ust_tracepoint_list
*list
;
576 list_objd
= objd_alloc(NULL
, <tng_tracepoint_list_ops
, owner
, "tp_list");
581 list
= zmalloc(sizeof(*list
));
586 objd_set_private(list_objd
, list
);
588 /* populate list by walking on all registered probes. */
589 ret
= lttng_probes_get_event_list(list
);
601 err
= lttng_ust_objd_unref(list_objd
);
609 int lttng_release_tracepoint_list(int objd
)
611 struct lttng_ust_tracepoint_list
*list
= objd_private(objd
);
614 lttng_probes_prune_event_list(list
);
622 static const struct lttng_ust_objd_ops lttng_tracepoint_list_ops
= {
623 .release
= lttng_release_tracepoint_list
,
624 .cmd
= lttng_tracepoint_list_cmd
,
628 long lttng_tracepoint_field_list_cmd(int objd
, unsigned int cmd
,
629 unsigned long arg
, union ust_args
*uargs
, void *owner
)
631 struct lttng_ust_field_list
*list
= objd_private(objd
);
632 struct lttng_ust_field_iter
*tp
= &uargs
->field_list
.entry
;
633 struct lttng_ust_field_iter
*iter
;
636 case LTTNG_UST_TRACEPOINT_FIELD_LIST_GET
:
639 iter
= lttng_ust_field_list_get_iter_next(list
);
641 return -LTTNG_UST_ERR_NOENT
;
642 if (!strcmp(iter
->event_name
, "lttng_ust:metadata"))
644 memcpy(tp
, iter
, sizeof(*tp
));
653 int lttng_abi_tracepoint_field_list(void *owner
)
656 struct lttng_ust_field_list
*list
;
658 list_objd
= objd_alloc(NULL
, <tng_tracepoint_field_list_ops
, owner
,
664 list
= zmalloc(sizeof(*list
));
669 objd_set_private(list_objd
, list
);
671 /* populate list by walking on all registered probes. */
672 ret
= lttng_probes_get_field_list(list
);
684 err
= lttng_ust_objd_unref(list_objd
);
692 int lttng_release_tracepoint_field_list(int objd
)
694 struct lttng_ust_field_list
*list
= objd_private(objd
);
697 lttng_probes_prune_field_list(list
);
705 static const struct lttng_ust_objd_ops lttng_tracepoint_field_list_ops
= {
706 .release
= lttng_release_tracepoint_field_list
,
707 .cmd
= lttng_tracepoint_field_list_cmd
,
710 struct stream_priv_data
{
711 struct lttng_ust_lib_ring_buffer
*buf
;
712 struct lttng_channel
*lttng_chan
;
716 int lttng_abi_open_stream(int channel_objd
, struct lttng_ust_stream
*info
,
717 union ust_args
*uargs
, void *owner
)
719 struct lttng_channel
*channel
= objd_private(channel_objd
);
720 struct lttng_ust_lib_ring_buffer
*buf
;
721 struct stream_priv_data
*priv
;
722 int stream_objd
, ret
;
724 buf
= channel
->ops
->buffer_read_open(channel
->chan
, channel
->handle
,
725 &uargs
->stream
.shm_fd
,
726 &uargs
->stream
.wait_fd
,
727 &uargs
->stream
.memory_map_size
);
731 priv
= zmalloc(sizeof(*priv
));
737 priv
->lttng_chan
= channel
;
738 stream_objd
= objd_alloc(priv
, &lib_ring_buffer_objd_ops
, owner
, "open_stream");
739 if (stream_objd
< 0) {
743 /* Hold a reference on the channel object descriptor */
744 objd_ref(channel_objd
);
750 channel
->ops
->buffer_read_close(buf
, channel
->handle
);
755 int lttng_abi_create_enabler(int channel_objd
,
756 struct lttng_ust_event
*event_param
,
758 enum lttng_enabler_type type
)
760 struct lttng_channel
*channel
= objd_private(channel_objd
);
761 struct lttng_enabler
*enabler
;
764 event_param
->name
[LTTNG_UST_SYM_NAME_LEN
- 1] = '\0';
765 event_objd
= objd_alloc(NULL
, <tng_enabler_ops
, owner
, "enabler");
766 if (event_objd
< 0) {
771 * We tolerate no failure path after event creation. It will stay
772 * invariant for the rest of the session.
774 enabler
= lttng_enabler_create(type
, event_param
, channel
);
779 objd_set_private(event_objd
, enabler
);
780 /* The event holds a reference on the channel */
781 objd_ref(channel_objd
);
788 err
= lttng_ust_objd_unref(event_objd
);
796 * lttng_channel_cmd - lttng control through object descriptors
798 * @objd: the object descriptor
801 * @uargs: UST arguments (internal)
804 * This object descriptor implements lttng commands:
806 * Returns an event stream object descriptor or failure.
807 * (typically, one event stream records events from one CPU)
809 * Returns an event object descriptor or failure.
811 * Prepend a context field to each event in the channel
813 * Enable recording for events in this channel (weak enable)
815 * Disable recording for events in this channel (strong disable)
817 * Channel and event file descriptors also hold a reference on the session.
820 long lttng_channel_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
821 union ust_args
*uargs
, void *owner
)
823 struct lttng_channel
*channel
= objd_private(objd
);
826 case LTTNG_UST_STREAM
:
828 struct lttng_ust_stream
*stream
;
830 stream
= (struct lttng_ust_stream
*) arg
;
831 /* stream used as output */
832 return lttng_abi_open_stream(objd
, stream
, uargs
, owner
);
834 case LTTNG_UST_EVENT
:
836 struct lttng_ust_event
*event_param
=
837 (struct lttng_ust_event
*) arg
;
838 if (event_param
->name
[strlen(event_param
->name
) - 1] == '*') {
839 /* If ends with wildcard, create wildcard. */
840 return lttng_abi_create_enabler(objd
, event_param
,
841 owner
, LTTNG_ENABLER_WILDCARD
);
843 return lttng_abi_create_enabler(objd
, event_param
,
844 owner
, LTTNG_ENABLER_EVENT
);
847 case LTTNG_UST_CONTEXT
:
848 return lttng_abi_add_context(objd
,
849 (struct lttng_ust_context
*) arg
,
850 &channel
->ctx
, channel
->session
);
851 case LTTNG_UST_ENABLE
:
852 return lttng_channel_enable(channel
);
853 case LTTNG_UST_DISABLE
:
854 return lttng_channel_disable(channel
);
855 case LTTNG_UST_FLUSH_BUFFER
:
856 return channel
->ops
->flush_buffer(channel
->chan
, channel
->handle
);
863 * lttng_metadata_cmd - lttng control through object descriptors
865 * @objd: the object descriptor
868 * @uargs: UST arguments (internal)
871 * This object descriptor implements lttng commands:
873 * Returns an event stream file descriptor or failure.
875 * Channel and event file descriptors also hold a reference on the session.
878 long lttng_metadata_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
879 union ust_args
*uargs
, void *owner
)
881 struct lttng_channel
*channel
= objd_private(objd
);
884 case LTTNG_UST_STREAM
:
886 struct lttng_ust_stream
*stream
;
888 stream
= (struct lttng_ust_stream
*) arg
;
889 /* stream used as output */
890 return lttng_abi_open_stream(objd
, stream
, uargs
, owner
);
892 case LTTNG_UST_FLUSH_BUFFER
:
893 return channel
->ops
->flush_buffer(channel
->chan
, channel
->handle
);
900 int lttng_channel_release(int objd
)
902 struct lttng_channel
*channel
= objd_private(objd
);
905 return lttng_ust_objd_unref(channel
->session
->objd
);
909 static const struct lttng_ust_objd_ops lttng_channel_ops
= {
910 .release
= lttng_channel_release
,
911 .cmd
= lttng_channel_cmd
,
914 static const struct lttng_ust_objd_ops lttng_metadata_ops
= {
915 .release
= lttng_channel_release
,
916 .cmd
= lttng_metadata_cmd
,
920 * lttng_rb_cmd - lttng ring buffer control through object descriptors
922 * @objd: the object descriptor
925 * @uargs: UST arguments (internal)
928 * This object descriptor implements lttng commands:
929 * (None for now. Access is done directly though shm.)
932 long lttng_rb_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
933 union ust_args
*uargs
, void *owner
)
942 int lttng_rb_release(int objd
)
944 struct stream_priv_data
*priv
= objd_private(objd
);
945 struct lttng_ust_lib_ring_buffer
*buf
;
946 struct lttng_channel
*channel
;
950 channel
= priv
->lttng_chan
;
953 * If we are at ABI exit, we don't want to close the
954 * buffer opened for read: it is being shared between
955 * the parent and child (right after fork), and we don't
956 * want the child to close it for the parent. For a real
957 * exit, we don't care about marking it as closed, as
958 * the consumer daemon (if there is one) will do fine
959 * even if we don't mark it as "closed" for reading on
961 * We only mark it as closed if it is being explicitely
962 * released by the session daemon with an explicit
965 if (!lttng_ust_abi_close_in_progress
)
966 channel
->ops
->buffer_read_close(buf
, channel
->handle
);
968 return lttng_ust_objd_unref(channel
->objd
);
973 static const struct lttng_ust_objd_ops lib_ring_buffer_objd_ops
= {
974 .release
= lttng_rb_release
,
979 * lttng_enabler_cmd - lttng control through object descriptors
981 * @objd: the object descriptor
984 * @uargs: UST arguments (internal)
987 * This object descriptor implements lttng commands:
989 * Prepend a context field to each record of events of this
992 * Enable recording for this enabler
994 * Disable recording for this enabler
996 * Attach a filter to an enabler.
999 long lttng_enabler_cmd(int objd
, unsigned int cmd
, unsigned long arg
,
1000 union ust_args
*uargs
, void *owner
)
1002 struct lttng_enabler
*enabler
= objd_private(objd
);
1005 case LTTNG_UST_CONTEXT
:
1006 return lttng_enabler_attach_context(enabler
,
1007 (struct lttng_ust_context
*) arg
);
1008 case LTTNG_UST_ENABLE
:
1009 return lttng_enabler_enable(enabler
);
1010 case LTTNG_UST_DISABLE
:
1011 return lttng_enabler_disable(enabler
);
1012 case LTTNG_UST_FILTER
:
1016 ret
= lttng_enabler_attach_bytecode(enabler
,
1017 (struct lttng_ust_filter_bytecode_node
*) arg
);
1028 int lttng_enabler_release(int objd
)
1030 struct lttng_enabler
*enabler
= objd_private(objd
);
1033 return lttng_ust_objd_unref(enabler
->chan
->objd
);
1037 static const struct lttng_ust_objd_ops lttng_enabler_ops
= {
1038 .release
= lttng_enabler_release
,
1039 .cmd
= lttng_enabler_cmd
,
1042 void lttng_ust_abi_exit(void)
1044 lttng_ust_abi_close_in_progress
= 1;
1045 objd_table_destroy();
1046 lttng_ust_abi_close_in_progress
= 0;