@@ -169,6 +169,34 @@ static int ht_match_ust_app_event(struct cds_lfht_node *node, const void *_key)
169
169
return 0 ;
170
170
}
171
171
172
+ /*
173
+ * Match function for the hash table lookup.
174
+ *
175
+ * Matches an ust app event based on its name only.
176
+ */
177
+ static int ht_match_ust_app_event_by_name (struct cds_lfht_node * node ,
178
+ const void * _key )
179
+ {
180
+ struct ust_app_event * event ;
181
+ const char * name ;
182
+
183
+ assert (node );
184
+ assert (_key );
185
+
186
+ event = caa_container_of (node , struct ust_app_event , node .node );
187
+ name = _key ;
188
+
189
+ if (strncmp (event -> attr .name , name , sizeof (event -> attr .name ))) {
190
+ goto no_match ;
191
+ }
192
+
193
+ /* Match. */
194
+ return 1 ;
195
+
196
+ no_match :
197
+ return 0 ;
198
+ }
199
+
172
200
/*
173
201
* Unique add of an ust app event in the given ht. This uses the custom
174
202
* ht_match_ust_app_event match function and the event name as hash.
@@ -3873,11 +3901,9 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
3873
3901
{
3874
3902
int ret = 0 ;
3875
3903
struct lttng_ht_iter iter , uiter ;
3876
- struct lttng_ht_node_str * ua_chan_node , * ua_event_node ;
3904
+ struct lttng_ht_node_str * ua_chan_node ;
3877
3905
struct ust_app * app ;
3878
- struct ust_app_session * ua_sess ;
3879
3906
struct ust_app_channel * ua_chan ;
3880
- struct ust_app_event * ua_event ;
3881
3907
3882
3908
DBG ("UST app disabling event %s for all apps in channel "
3883
3909
"%s for session id %" PRIu64 ,
@@ -3887,10 +3913,13 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
3887
3913
3888
3914
/* For all registered applications */
3889
3915
cds_lfht_for_each_entry (ust_app_ht -> ht , & iter .iter , app , pid_n .node ) {
3916
+ struct ust_app_session * ua_sess ;
3917
+ struct cds_lfht_node * ua_event_node ;
3918
+
3890
3919
if (!app -> compatible ) {
3891
3920
/*
3892
- * TODO: In time, we should notice the caller of this error by
3893
- * telling him that this is a version error.
3921
+ * TODO: In time, we should notice the caller of this
3922
+ * error by telling him that this is a version error.
3894
3923
*/
3895
3924
continue ;
3896
3925
}
@@ -3901,28 +3930,35 @@ int ust_app_disable_event_glb(struct ltt_ust_session *usess,
3901
3930
}
3902
3931
3903
3932
/* Lookup channel in the ust app session */
3904
- lttng_ht_lookup (ua_sess -> channels , (void * )uchan -> name , & uiter );
3933
+ lttng_ht_lookup (ua_sess -> channels , (void * ) uchan -> name ,
3934
+ & uiter );
3905
3935
ua_chan_node = lttng_ht_iter_get_node_str (& uiter );
3906
- if (ua_chan_node == NULL ) {
3936
+ if (! ua_chan_node ) {
3907
3937
DBG2 ("Channel %s not found in session id %" PRIu64 " for app pid %d."
3908
- "Skipping" , uchan -> name , usess -> id , app -> pid );
3938
+ "Skipping" , uchan -> name , usess -> id ,
3939
+ app -> pid );
3909
3940
continue ;
3910
3941
}
3911
3942
ua_chan = caa_container_of (ua_chan_node , struct ust_app_channel , node );
3912
3943
3913
- lttng_ht_lookup (ua_chan -> events , (void * )uevent -> attr .name , & uiter );
3914
- ua_event_node = lttng_ht_iter_get_node_str (& uiter );
3915
- if (ua_event_node == NULL ) {
3916
- DBG2 ("Event %s not found in channel %s for app pid %d."
3917
- "Skipping" , uevent -> attr .name , uchan -> name , app -> pid );
3918
- continue ;
3919
- }
3920
- ua_event = caa_container_of (ua_event_node , struct ust_app_event , node );
3921
-
3922
- ret = disable_ust_app_event (ua_sess , ua_event , app );
3923
- if (ret < 0 ) {
3924
- /* XXX: Report error someday... */
3925
- continue ;
3944
+ cds_lfht_for_each_duplicate (ua_chan -> events -> ht ,
3945
+ ua_chan -> events -> hash_fct (uevent -> attr .name ,
3946
+ lttng_ht_seed ),
3947
+ ht_match_ust_app_event_by_name ,
3948
+ (void * ) uevent -> attr .name , & uiter .iter ,
3949
+ ua_event_node ) {
3950
+ struct ust_app_event * ua_event ;
3951
+
3952
+ ua_event = caa_container_of (ua_event_node ,
3953
+ struct ust_app_event , node );
3954
+ ret = disable_ust_app_event (ua_sess , ua_event , app );
3955
+ if (ret < 0 ) {
3956
+ DBG ("Failed to disable event %s in channel %s "
3957
+ "of app pid %d." ,
3958
+ uevent -> attr .name ,
3959
+ uchan -> name , app -> pid );
3960
+ continue ;
3961
+ }
3926
3962
}
3927
3963
}
3928
3964
0 commit comments