Commit | Line | Data |
---|---|---|
91d76f53 DG |
1 | /* |
2 | * Copyright (C) 2011 - David Goulet <david.goulet@polymtl.ca> | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or | |
5 | * modify it under the terms of the GNU General Public License | |
82a3637f DG |
6 | * as published by the Free Software Foundation; only version 2 |
7 | * of the License. | |
91d76f53 DG |
8 | * |
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. | |
13 | * | |
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. | |
17 | */ | |
18 | ||
f6a9efaa DG |
19 | #ifndef _LTT_UST_APP_H |
20 | #define _LTT_UST_APP_H | |
91d76f53 | 21 | |
099e26bd | 22 | #include <stdint.h> |
1e307fab DG |
23 | #include <urcu/list.h> |
24 | ||
44d3bd01 DG |
25 | #include "trace-ust.h" |
26 | ||
099e26bd DG |
27 | /* |
28 | * Application registration data structure. | |
29 | */ | |
30 | struct ust_register_msg { | |
31 | uint32_t major; | |
32 | uint32_t minor; | |
33 | pid_t pid; | |
34 | pid_t ppid; | |
35 | uid_t uid; | |
36 | gid_t gid; | |
37 | char name[16]; | |
38 | }; | |
39 | ||
f6a9efaa DG |
40 | struct cds_lfht *ust_app_ht; |
41 | ||
42 | struct cds_lfht *ust_app_sock_key_map; | |
43 | ||
44 | struct ust_app_key { | |
45 | pid_t pid; | |
46 | int sock; | |
47 | struct cds_lfht_node node; | |
91d76f53 DG |
48 | }; |
49 | ||
f6a9efaa DG |
50 | /* |
51 | * Registered traceable applications. Libust registers to the session daemon | |
050349bb | 52 | * and a linked list is kept of all running traceable app. |
91d76f53 | 53 | */ |
56fff090 | 54 | struct ust_app { |
f6a9efaa DG |
55 | //int sock; |
56 | //pid_t pid; | |
099e26bd DG |
57 | pid_t ppid; |
58 | uid_t uid; /* User ID that owns the apps */ | |
59 | gid_t gid; /* Group ID that owns the apps */ | |
60 | uint32_t v_major; /* Verion major number */ | |
61 | uint32_t v_minor; /* Verion minor number */ | |
62 | char name[17]; /* Process name (short) */ | |
f6a9efaa DG |
63 | struct cds_lfht *channels; |
64 | struct cds_lfht_node node; | |
65 | struct ust_app_key key; | |
91d76f53 DG |
66 | }; |
67 | ||
3bd1e081 MD |
68 | #ifdef CONFIG_LTTNG_TOOLS_HAVE_UST |
69 | ||
56fff090 DG |
70 | int ust_app_register(struct ust_register_msg *msg, int sock); |
71 | void ust_app_unregister(int sock); | |
f6a9efaa | 72 | unsigned long ust_app_list_count(void); |
91d76f53 | 73 | |
56fff090 | 74 | void ust_app_clean_list(void); |
f6a9efaa DG |
75 | void ust_app_ht_alloc(void); |
76 | struct cds_lfht *ust_app_get_ht(void); | |
77 | struct ust_app *ust_app_find_by_pid(pid_t pid); | |
44d3bd01 | 78 | |
3bd1e081 MD |
79 | #else |
80 | ||
81 | static inline | |
82 | int ust_app_register(struct ust_register_msg *msg, int sock) | |
83 | { | |
84 | return -ENOSYS; | |
85 | } | |
86 | static inline | |
87 | void ust_app_unregister(int sock) | |
88 | { | |
89 | } | |
90 | static inline | |
91 | unsigned int ust_app_list_count(void) | |
92 | { | |
93 | return 0; | |
94 | } | |
95 | ||
96 | static inline | |
97 | void ust_app_lock_list(void) | |
98 | { | |
99 | } | |
100 | static inline | |
101 | void ust_app_unlock_list(void) | |
102 | { | |
103 | } | |
104 | static inline | |
105 | void ust_app_clean_list(void) | |
106 | { | |
107 | } | |
108 | static inline | |
109 | struct ust_app_list *ust_app_get_list(void) | |
110 | { | |
111 | return NULL; | |
112 | } | |
113 | static inline | |
114 | struct ust_app *ust_app_get_by_pid(pid_t pid) | |
115 | { | |
116 | return NULL; | |
117 | } | |
118 | ||
3bd1e081 MD |
119 | #endif |
120 | ||
f6a9efaa | 121 | #endif /* _LTT_UST_APP_H */ |