2 * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; only version 2
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 #ifndef _LTT_UST_APP_H
20 #define _LTT_UST_APP_H
23 #include <urcu/list.h>
25 #include "trace-ust.h"
27 #define UST_APP_EVENT_LIST_SIZE 32
29 extern int ust_consumer_fd
;
32 * Application registration data structure.
34 struct ust_register_msg
{
45 * Global applications HT used by the session daemon.
47 struct cds_lfht
*ust_app_ht
;
49 struct cds_lfht
*ust_app_sock_key_map
;
54 struct cds_lfht_node node
;
57 struct ust_app_event
{
60 struct lttng_ust_object_data
*obj
;
61 struct lttng_ust_event attr
;
62 char name
[LTTNG_UST_SYM_NAME_LEN
];
64 struct cds_lfht_node node
;
67 struct ust_app_channel
{
70 char name
[LTTNG_UST_SYM_NAME_LEN
];
71 struct lttng_ust_channel attr
;
72 struct lttng_ust_object_data
*obj
;
73 struct ltt_ust_stream_list streams
;
75 struct cds_lfht
*events
;
76 struct cds_lfht_node node
;
79 struct ust_app_session
{
81 int handle
; /* Used has unique identifier */
83 struct ltt_ust_metadata
*metadata
;
84 struct lttng_ust_object_data
*obj
;
85 struct cds_lfht
*channels
; /* Registered channels */
86 struct cds_lfht_node node
;
91 * Registered traceable applications. Libust registers to the session daemon
92 * and a linked list is kept of all running traceable app.
96 uid_t uid
; /* User ID that owns the apps */
97 gid_t gid
; /* Group ID that owns the apps */
98 uint32_t v_major
; /* Verion major number */
99 uint32_t v_minor
; /* Verion minor number */
100 char name
[17]; /* Process name (short) */
101 struct cds_lfht
*sessions
;
102 struct cds_lfht_node node
;
103 struct ust_app_key key
;
106 #ifdef HAVE_LIBLTTNG_UST_CTL
108 int ust_app_register(struct ust_register_msg
*msg
, int sock
);
109 void ust_app_unregister(int sock
);
110 int ust_app_create_channel_all(struct ltt_ust_session
*usess
,
111 struct ltt_ust_channel
*uchan
);
112 int ust_app_create_event_all(struct ltt_ust_session
*usess
,
113 struct ltt_ust_channel
*uchan
, struct ltt_ust_event
*uevent
);
114 unsigned long ust_app_list_count(void);
115 int ust_app_start_trace(struct ltt_ust_session
*usess
, struct ust_app
*app
);
116 int ust_app_start_trace_all(struct ltt_ust_session
*usess
);
117 int ust_app_list_events(struct lttng_event
**events
);
118 void ust_app_global_update(struct ltt_ust_session
*usess
, int sock
);
120 void ust_app_clean_list(void);
121 void ust_app_ht_alloc(void);
122 struct cds_lfht
*ust_app_get_ht(void);
123 struct ust_app
*ust_app_find_by_pid(pid_t pid
);
125 #else /* HAVE_LIBLTTNG_UST_CTL */
128 int ust_app_start_trace(struct ltt_ust_session
*usess
, struct ust_app
*app
)
133 int ust_app_start_trace_all(struct ltt_ust_session
*usess
)
138 int ust_app_list_events(struct lttng_event
**events
)
143 int ust_app_register(struct ust_register_msg
*msg
, int sock
)
148 void ust_app_unregister(int sock
)
152 unsigned int ust_app_list_count(void)
157 void ust_app_lock_list(void)
161 void ust_app_unlock_list(void)
165 void ust_app_clean_list(void)
169 struct ust_app_list
*ust_app_get_list(void)
174 struct ust_app
*ust_app_get_by_pid(pid_t pid
)
179 int ust_app_add_channel_all(struct ltt_ust_session
*usess
,
180 struct ltt_ust_channel
*uchan
)
185 int ust_app_add_event_all(struct ltt_ust_session
*usess
,
186 struct ltt_ust_channel
*uchan
, struct ltt_ust_event
*uevent
)
191 struct cds_lfht
*ust_app_get_ht(void)
196 void ust_app_ht_alloc(void)
200 void ust_app_global_update(struct ltt_ust_session
*usess
, int sock
)
204 #endif /* HAVE_LIBLTTNG_UST_CTL */
206 #endif /* _LTT_UST_APP_H */