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"
28 * Application registration data structure.
30 struct ust_register_msg
{
41 * Global applications HT used by the session daemon.
43 struct cds_lfht
*ust_app_ht
;
45 struct cds_lfht
*ust_app_sock_key_map
;
50 struct cds_lfht_node node
;
53 struct ust_app_event
{
56 struct lttng_ust_object_data
*obj
;
57 char name
[LTTNG_UST_SYM_NAME_LEN
];
59 struct cds_lfht_node node
;
62 struct ust_app_channel
{
65 char name
[LTTNG_UST_SYM_NAME_LEN
];
66 struct lttng_ust_channel attr
;
67 struct lttng_ust_object_data
*obj
;
68 struct ltt_ust_stream_list streams
;
70 struct cds_lfht
*events
;
71 struct cds_lfht_node node
;
74 struct ust_app_session
{
76 int handle
; /* Used has unique identifier */
78 struct ltt_ust_metadata
*metadata
;
79 struct lttng_ust_object_data
*obj
;
80 struct cds_lfht
*channels
; /* Registered channels */
81 struct cds_lfht_node node
;
85 * Registered traceable applications. Libust registers to the session daemon
86 * and a linked list is kept of all running traceable app.
90 uid_t uid
; /* User ID that owns the apps */
91 gid_t gid
; /* Group ID that owns the apps */
92 uint32_t v_major
; /* Verion major number */
93 uint32_t v_minor
; /* Verion minor number */
94 char name
[17]; /* Process name (short) */
95 struct cds_lfht
*sessions
;
96 struct cds_lfht_node node
;
97 struct ust_app_key key
;
100 #ifdef HAVE_LIBLTTNG_UST_CTL
102 int ust_app_register(struct ust_register_msg
*msg
, int sock
);
103 void ust_app_unregister(int sock
);
104 int ust_app_add_channel(struct ltt_ust_session
*usess
,
105 struct ltt_ust_channel
*uchan
);
106 int ust_app_add_event(struct ltt_ust_session
*usess
,
107 struct ltt_ust_channel
*uchan
, struct ltt_ust_event
*uevent
);
108 unsigned long ust_app_list_count(void);
109 int ust_app_start_trace(struct ltt_ust_session
*usess
);
111 void ust_app_clean_list(void);
112 void ust_app_ht_alloc(void);
113 struct cds_lfht
*ust_app_get_ht(void);
114 struct ust_app
*ust_app_find_by_pid(pid_t pid
);
116 #else /* HAVE_LIBLTTNG_UST_CTL */
119 int ust_app_register(struct ust_register_msg
*msg
, int sock
)
124 void ust_app_unregister(int sock
)
128 unsigned int ust_app_list_count(void)
134 void ust_app_lock_list(void)
138 void ust_app_unlock_list(void)
142 void ust_app_clean_list(void)
146 struct ust_app_list
*ust_app_get_list(void)
151 struct ust_app
*ust_app_get_by_pid(pid_t pid
)
157 int ust_app_add_channel(struct ltt_ust_session
*usess
,
158 struct ltt_ust_channel
*uchan
)
163 #endif /* HAVE_LIBLTTNG_UST_CTL */
165 #endif /* _LTT_UST_APP_H */