2 * Copyright (C) 2013 - David Goulet <dgoulet@efficios.com>
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License, version 2 only, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * You should have received a copy of the GNU General Public License along with
14 * this program; if not, write to the Free Software Foundation, Inc., 51
15 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20 #include <urcu/uatomic.h>
22 #include <common/common.h>
23 #include <common/sessiond-comm/agent.h>
25 #include <common/compat/endian.h>
32 #define AGENT_RET_CODE_INDEX(code) (code - AGENT_RET_CODE_SUCCESS)
35 * Human readable agent return code.
37 static const char *error_string_array
[] = {
38 [ AGENT_RET_CODE_INDEX(AGENT_RET_CODE_SUCCESS
) ] = "Success",
39 [ AGENT_RET_CODE_INDEX(AGENT_RET_CODE_INVALID
) ] = "Invalid command",
40 [ AGENT_RET_CODE_INDEX(AGENT_RET_CODE_UNKNOWN_NAME
) ] = "Unknown logger name",
43 [ AGENT_RET_CODE_INDEX(AGENT_RET_CODE_NR
) ] = "Unknown code",
47 void log_reply_code(uint32_t in_reply_ret_code
)
49 int level
= PRINT_DBG3
;
51 * reply_ret_code and in_reply_ret_code are kept separate to have a
52 * sanitized value (used to retrieve the human readable string) and the
53 * original value which is logged as-is.
55 uint32_t reply_ret_code
= in_reply_ret_code
;
57 if (reply_ret_code
< AGENT_RET_CODE_SUCCESS
||
58 reply_ret_code
>= AGENT_RET_CODE_NR
) {
59 reply_ret_code
= AGENT_RET_CODE_NR
;
63 LOG(level
, "Agent replied with retcode: %s (%"PRIu32
")",
64 error_string_array
[AGENT_RET_CODE_INDEX(
70 * Match function for the events hash table lookup by name.
72 static int ht_match_event_by_name(struct cds_lfht_node
*node
,
75 struct agent_event
*event
;
76 const struct agent_ht_key
*key
;
81 event
= caa_container_of(node
, struct agent_event
, node
.node
);
84 /* Match 1 elements of the key: name. */
87 if (strncmp(event
->name
, key
->name
, sizeof(event
->name
)) != 0) {
98 * Match function for the events hash table lookup by name and loglevel.
100 static int ht_match_event(struct cds_lfht_node
*node
,
103 struct agent_event
*event
;
104 const struct agent_ht_key
*key
;
110 event
= caa_container_of(node
, struct agent_event
, node
.node
);
113 /* Match 2 elements of the key: name and loglevel. */
116 if (strncmp(event
->name
, key
->name
, sizeof(event
->name
)) != 0) {
120 /* Event loglevel value and type. */
121 ll_match
= loglevels_match(event
->loglevel_type
,
122 event
->loglevel_value
, key
->loglevel_type
,
123 key
->loglevel_value
, LTTNG_EVENT_LOGLEVEL_ALL
);
136 * Add unique agent event based on the event name and loglevel.
138 static void add_unique_agent_event(struct lttng_ht
*ht
,
139 struct agent_event
*event
)
141 struct cds_lfht_node
*node_ptr
;
142 struct agent_ht_key key
;
148 key
.name
= event
->name
;
149 key
.loglevel_value
= event
->loglevel_value
;
150 key
.loglevel_type
= event
->loglevel_type
;
152 node_ptr
= cds_lfht_add_unique(ht
->ht
,
153 ht
->hash_fct(event
->node
.key
, lttng_ht_seed
),
154 ht_match_event
, &key
, &event
->node
.node
);
155 assert(node_ptr
== &event
->node
.node
);
159 * URCU delayed agent event reclaim.
161 static void destroy_event_agent_rcu(struct rcu_head
*head
)
163 struct lttng_ht_node_str
*node
=
164 caa_container_of(head
, struct lttng_ht_node_str
, head
);
165 struct agent_event
*event
=
166 caa_container_of(node
, struct agent_event
, node
);
168 agent_destroy_event(event
);
172 * URCU delayed agent app reclaim.
174 static void destroy_app_agent_rcu(struct rcu_head
*head
)
176 struct lttng_ht_node_ulong
*node
=
177 caa_container_of(head
, struct lttng_ht_node_ulong
, head
);
178 struct agent_app
*app
=
179 caa_container_of(node
, struct agent_app
, node
);
185 * Communication with the agent. Send the message header to the given socket in
188 * Return 0 on success or else a negative errno message of sendmsg() op.
190 static int send_header(struct lttcomm_sock
*sock
, uint64_t data_size
,
191 uint32_t cmd
, uint32_t cmd_version
)
195 struct lttcomm_agent_hdr msg
;
199 memset(&msg
, 0, sizeof(msg
));
200 msg
.data_size
= htobe64(data_size
);
201 msg
.cmd
= htobe32(cmd
);
202 msg
.cmd_version
= htobe32(cmd_version
);
204 size
= sock
->ops
->sendmsg(sock
, &msg
, sizeof(msg
), 0);
205 if (size
< sizeof(msg
)) {
216 * Communication call with the agent. Send the payload to the given socket. The
217 * header MUST be sent prior to this call.
219 * Return 0 on success or else a negative errno value of sendmsg() op.
221 static int send_payload(struct lttcomm_sock
*sock
, void *data
,
230 len
= sock
->ops
->sendmsg(sock
, data
, size
, 0);
242 * Communication call with the agent. Receive reply from the agent using the
245 * Return 0 on success or else a negative errno value from recvmsg() op.
247 static int recv_reply(struct lttcomm_sock
*sock
, void *buf
, size_t size
)
255 len
= sock
->ops
->recvmsg(sock
, buf
, size
, 0);
267 * Internal event listing for a given app. Populate events.
269 * Return number of element in the list or else a negative LTTNG_ERR* code.
270 * On success, the caller is responsible for freeing the memory
271 * allocated for "events".
273 static ssize_t
list_events(struct agent_app
*app
, struct lttng_event
**events
)
275 int ret
, i
, len
= 0, offset
= 0;
278 uint32_t reply_ret_code
;
279 struct lttng_event
*tmp_events
= NULL
;
280 struct lttcomm_agent_list_reply
*reply
= NULL
;
281 struct lttcomm_agent_list_reply_hdr reply_hdr
;
287 DBG2("Agent listing events for app pid: %d and socket %d", app
->pid
,
290 ret
= send_header(app
->sock
, 0, AGENT_CMD_LIST
, 0);
295 /* Get list header so we know how much we'll receive. */
296 ret
= recv_reply(app
->sock
, &reply_hdr
, sizeof(reply_hdr
));
301 reply_ret_code
= be32toh(reply_hdr
.ret_code
);
302 log_reply_code(reply_ret_code
);
303 switch (reply_ret_code
) {
304 case AGENT_RET_CODE_SUCCESS
:
305 data_size
= be32toh(reply_hdr
.data_size
) + sizeof(*reply
);
312 reply
= zmalloc(data_size
);
314 ret
= LTTNG_ERR_NOMEM
;
318 /* Get the list with the appropriate data size. */
319 ret
= recv_reply(app
->sock
, reply
, data_size
);
324 nb_event
= be32toh(reply
->nb_event
);
325 tmp_events
= zmalloc(sizeof(*tmp_events
) * nb_event
);
327 ret
= LTTNG_ERR_NOMEM
;
331 for (i
= 0; i
< nb_event
; i
++) {
333 strncpy(tmp_events
[i
].name
, reply
->payload
+ offset
,
334 sizeof(tmp_events
[i
].name
));
335 tmp_events
[i
].pid
= app
->pid
;
336 tmp_events
[i
].enabled
= -1;
337 len
= strlen(reply
->payload
+ offset
) + 1;
340 *events
= tmp_events
;
346 ret
= LTTNG_ERR_UST_LIST_FAIL
;
355 * Internal enable agent event on a agent application. This function
356 * communicates with the agent to enable a given event.
358 * Return LTTNG_OK on success or else a LTTNG_ERR* code.
360 static int enable_event(struct agent_app
*app
, struct agent_event
*event
)
365 size_t filter_expression_length
;
366 uint32_t reply_ret_code
;
367 struct lttcomm_agent_enable msg
;
368 struct lttcomm_agent_generic_reply reply
;
374 DBG2("Agent enabling event %s for app pid: %d and socket %d", event
->name
,
375 app
->pid
, app
->sock
->fd
);
378 * Calculate the payload's size, which is the fixed-size struct followed
379 * by the variable-length filter expression (+1 for the ending \0).
381 if (!event
->filter_expression
) {
382 filter_expression_length
= 0;
384 filter_expression_length
= strlen(event
->filter_expression
) + 1;
386 data_size
= sizeof(msg
) + filter_expression_length
;
388 ret
= send_header(app
->sock
, data_size
, AGENT_CMD_ENABLE
, 0);
393 memset(&msg
, 0, sizeof(msg
));
394 msg
.loglevel_value
= event
->loglevel_value
;
395 msg
.loglevel_type
= event
->loglevel_type
;
396 strncpy(msg
.name
, event
->name
, sizeof(msg
.name
));
397 msg
.filter_expression_length
= filter_expression_length
;
399 bytes_to_send
= zmalloc(data_size
);
400 if (!bytes_to_send
) {
401 ret
= LTTNG_ERR_NOMEM
;
405 memcpy(bytes_to_send
, &msg
, sizeof(msg
));
406 if (filter_expression_length
> 0) {
407 memcpy(bytes_to_send
+ sizeof(msg
), event
->filter_expression
,
408 filter_expression_length
);
411 ret
= send_payload(app
->sock
, bytes_to_send
, data_size
);
417 ret
= recv_reply(app
->sock
, &reply
, sizeof(reply
));
422 reply_ret_code
= be32toh(reply
.ret_code
);
423 log_reply_code(reply_ret_code
);
424 switch (reply_ret_code
) {
425 case AGENT_RET_CODE_SUCCESS
:
427 case AGENT_RET_CODE_UNKNOWN_NAME
:
428 ret
= LTTNG_ERR_UST_EVENT_NOT_FOUND
;
438 ret
= LTTNG_ERR_UST_ENABLE_FAIL
;
444 * Internal disable agent event call on a agent application. This function
445 * communicates with the agent to disable a given event.
447 * Return LTTNG_OK on success or else a LTTNG_ERR* code.
449 static int disable_event(struct agent_app
*app
, struct agent_event
*event
)
453 uint32_t reply_ret_code
;
454 struct lttcomm_agent_disable msg
;
455 struct lttcomm_agent_generic_reply reply
;
461 DBG2("Agent disabling event %s for app pid: %d and socket %d", event
->name
,
462 app
->pid
, app
->sock
->fd
);
464 data_size
= sizeof(msg
);
466 ret
= send_header(app
->sock
, data_size
, AGENT_CMD_DISABLE
, 0);
471 memset(&msg
, 0, sizeof(msg
));
472 strncpy(msg
.name
, event
->name
, sizeof(msg
.name
));
473 ret
= send_payload(app
->sock
, &msg
, sizeof(msg
));
478 ret
= recv_reply(app
->sock
, &reply
, sizeof(reply
));
483 reply_ret_code
= be32toh(reply
.ret_code
);
484 log_reply_code(reply_ret_code
);
485 switch (reply_ret_code
) {
486 case AGENT_RET_CODE_SUCCESS
:
488 case AGENT_RET_CODE_UNKNOWN_NAME
:
489 ret
= LTTNG_ERR_UST_EVENT_NOT_FOUND
;
499 ret
= LTTNG_ERR_UST_DISABLE_FAIL
;
505 * Send back the registration DONE command to a given agent application.
507 * Return 0 on success or else a negative value.
509 int agent_send_registration_done(struct agent_app
*app
)
514 DBG("Agent sending registration done to app socket %d", app
->sock
->fd
);
516 return send_header(app
->sock
, 0, AGENT_CMD_REG_DONE
, 0);
520 * Enable agent event on every agent applications registered with the session
523 * Return LTTNG_OK on success or else a LTTNG_ERR* code.
525 int agent_enable_event(struct agent_event
*event
,
526 enum lttng_domain_type domain
)
529 struct agent_app
*app
;
530 struct lttng_ht_iter iter
;
536 cds_lfht_for_each_entry(agent_apps_ht_by_sock
->ht
, &iter
.iter
, app
,
538 if (app
->domain
!= domain
) {
542 /* Enable event on agent application through TCP socket. */
543 ret
= enable_event(app
, event
);
544 if (ret
!= LTTNG_OK
) {
558 * Disable agent event on every agent applications registered with the session
561 * Return LTTNG_OK on success or else a LTTNG_ERR* code.
563 int agent_disable_event(struct agent_event
*event
,
564 enum lttng_domain_type domain
)
567 struct agent_app
*app
;
568 struct lttng_ht_iter iter
;
571 if (!event
->enabled
) {
577 cds_lfht_for_each_entry(agent_apps_ht_by_sock
->ht
, &iter
.iter
, app
,
579 if (app
->domain
!= domain
) {
583 /* Enable event on agent application through TCP socket. */
584 ret
= disable_event(app
, event
);
585 if (ret
!= LTTNG_OK
) {
599 * Ask every agent for the list of possible event. Events is allocated with the
600 * events of every agent application.
602 * Return the number of events or else a negative value.
604 int agent_list_events(struct lttng_event
**events
,
605 enum lttng_domain_type domain
)
608 size_t nbmem
, count
= 0;
609 struct agent_app
*app
;
610 struct lttng_event
*tmp_events
= NULL
;
611 struct lttng_ht_iter iter
;
615 DBG2("Agent listing events for domain %d", domain
);
617 nbmem
= UST_APP_EVENT_LIST_SIZE
;
618 tmp_events
= zmalloc(nbmem
* sizeof(*tmp_events
));
620 PERROR("zmalloc agent list events");
626 cds_lfht_for_each_entry(agent_apps_ht_by_sock
->ht
, &iter
.iter
, app
,
629 struct lttng_event
*agent_events
;
631 /* Skip domain not asked by the list. */
632 if (app
->domain
!= domain
) {
636 nb_ev
= list_events(app
, &agent_events
);
642 if (count
+ nb_ev
> nbmem
) {
643 /* In case the realloc fails, we free the memory */
644 struct lttng_event
*new_tmp_events
;
647 new_nbmem
= max_t(size_t, count
+ nb_ev
, nbmem
<< 1);
648 DBG2("Reallocating agent event list from %zu to %zu entries",
650 new_tmp_events
= realloc(tmp_events
,
651 new_nbmem
* sizeof(*new_tmp_events
));
652 if (!new_tmp_events
) {
653 PERROR("realloc agent events");
658 /* Zero the new memory */
659 memset(new_tmp_events
+ nbmem
, 0,
660 (new_nbmem
- nbmem
) * sizeof(*new_tmp_events
));
662 tmp_events
= new_tmp_events
;
664 memcpy(tmp_events
+ count
, agent_events
,
665 nb_ev
* sizeof(*tmp_events
));
672 *events
= tmp_events
;
683 * Create a agent app object using the given PID.
685 * Return newly allocated object or else NULL on error.
687 struct agent_app
*agent_create_app(pid_t pid
, enum lttng_domain_type domain
,
688 struct lttcomm_sock
*sock
)
690 struct agent_app
*app
;
694 app
= zmalloc(sizeof(*app
));
696 PERROR("zmalloc agent create");
701 app
->domain
= domain
;
703 lttng_ht_node_init_ulong(&app
->node
, (unsigned long) app
->sock
->fd
);
710 * Lookup agent app by socket in the global hash table.
712 * RCU read side lock MUST be acquired.
714 * Return object if found else NULL.
716 struct agent_app
*agent_find_app_by_sock(int sock
)
718 struct lttng_ht_node_ulong
*node
;
719 struct lttng_ht_iter iter
;
720 struct agent_app
*app
;
724 lttng_ht_lookup(agent_apps_ht_by_sock
, (void *)((unsigned long) sock
), &iter
);
725 node
= lttng_ht_iter_get_node_ulong(&iter
);
729 app
= caa_container_of(node
, struct agent_app
, node
);
731 DBG3("Agent app pid %d found by sock %d.", app
->pid
, sock
);
735 DBG3("Agent app NOT found by sock %d.", sock
);
740 * Add agent application object to the global hash table.
742 void agent_add_app(struct agent_app
*app
)
746 DBG3("Agent adding app sock: %d and pid: %d to ht", app
->sock
->fd
, app
->pid
);
747 lttng_ht_add_unique_ulong(agent_apps_ht_by_sock
, &app
->node
);
751 * Delete agent application from the global hash table.
753 * rcu_read_lock() must be held by the caller.
755 void agent_delete_app(struct agent_app
*app
)
758 struct lttng_ht_iter iter
;
762 DBG3("Agent deleting app pid: %d and sock: %d", app
->pid
, app
->sock
->fd
);
764 iter
.iter
.node
= &app
->node
.node
;
765 ret
= lttng_ht_del(agent_apps_ht_by_sock
, &iter
);
770 * Destroy an agent application object by detaching it from its corresponding
771 * UST app if one is connected by closing the socket. Finally, perform a
772 * delayed memory reclaim.
774 void agent_destroy_app(struct agent_app
*app
)
779 app
->sock
->ops
->close(app
->sock
);
780 lttcomm_destroy_sock(app
->sock
);
783 call_rcu(&app
->node
.head
, destroy_app_agent_rcu
);
787 * Initialize an already allocated agent object.
789 * Return 0 on success or else a negative errno value.
791 int agent_init(struct agent
*agt
)
797 agt
->events
= lttng_ht_new(0, LTTNG_HT_TYPE_STRING
);
802 lttng_ht_node_init_u64(&agt
->node
, agt
->domain
);
811 * Add agent object to the given hash table.
813 void agent_add(struct agent
*agt
, struct lttng_ht
*ht
)
818 DBG3("Agent adding from domain %d", agt
->domain
);
820 lttng_ht_add_unique_u64(ht
, &agt
->node
);
824 * Create an agent object for the given domain.
826 * Return the allocated agent or NULL on error.
828 struct agent
*agent_create(enum lttng_domain_type domain
)
833 agt
= zmalloc(sizeof(struct agent
));
837 agt
->domain
= domain
;
839 ret
= agent_init(agt
);
851 * Create a newly allocated agent event data structure.
852 * Ownership of filter_expression is taken.
854 * Return a new object else NULL on error.
856 struct agent_event
*agent_create_event(const char *name
,
857 enum lttng_loglevel_type loglevel_type
, int loglevel_value
,
858 struct lttng_filter_bytecode
*filter
, char *filter_expression
)
860 struct agent_event
*event
= NULL
;
862 DBG3("Agent create new event with name %s, loglevel type %d and loglevel value %d",
863 name
, loglevel_type
, loglevel_value
);
866 ERR("Failed to create agent event; no name provided.");
870 event
= zmalloc(sizeof(*event
));
875 strncpy(event
->name
, name
, sizeof(event
->name
));
876 event
->name
[sizeof(event
->name
) - 1] = '\0';
877 lttng_ht_node_init_str(&event
->node
, event
->name
);
879 event
->loglevel_value
= loglevel_value
;
880 event
->loglevel_type
= loglevel_type
;
881 event
->filter
= filter
;
882 event
->filter_expression
= filter_expression
;
888 * Unique add of a agent event to an agent object.
890 void agent_add_event(struct agent_event
*event
, struct agent
*agt
)
896 DBG3("Agent adding event %s", event
->name
);
897 add_unique_agent_event(agt
->events
, event
);
902 * Find multiple agent events sharing the given name.
904 * RCU read side lock MUST be acquired. It must be held for the
905 * duration of the iteration.
907 * Sets the given iterator.
909 void agent_find_events_by_name(const char *name
, struct agent
*agt
,
910 struct lttng_ht_iter
* iter
)
913 struct agent_ht_key key
;
923 cds_lfht_lookup(ht
->ht
, ht
->hash_fct((void *) name
, lttng_ht_seed
),
924 ht_match_event_by_name
, &key
, &iter
->iter
);
928 * Get the next agent event duplicate by name. This should be called
929 * after a call to agent_find_events_by_name() to iterate on events.
931 * The RCU read lock must be held during the iteration and for as long
932 * as the object the iterator points to remains in use.
934 void agent_event_next_duplicate(const char *name
,
935 struct agent
*agt
, struct lttng_ht_iter
* iter
)
937 struct agent_ht_key key
;
941 cds_lfht_next_duplicate(agt
->events
->ht
, ht_match_event_by_name
,
946 * Find a agent event in the given agent using name and loglevel.
948 * RCU read side lock MUST be acquired. It must be kept for as long as
949 * the returned agent_event is used.
951 * Return object if found else NULL.
953 struct agent_event
*agent_find_event(const char *name
,
954 enum lttng_loglevel_type loglevel_type
, int loglevel_value
,
957 struct lttng_ht_node_str
*node
;
958 struct lttng_ht_iter iter
;
960 struct agent_ht_key key
;
968 key
.loglevel_value
= loglevel_value
;
969 key
.loglevel_type
= loglevel_type
;
971 cds_lfht_lookup(ht
->ht
, ht
->hash_fct((void *) name
, lttng_ht_seed
),
972 ht_match_event
, &key
, &iter
.iter
);
973 node
= lttng_ht_iter_get_node_str(&iter
);
978 DBG3("Agent event found %s.", name
);
979 return caa_container_of(node
, struct agent_event
, node
);
982 DBG3("Agent event NOT found %s.", name
);
987 * Free given agent event. This event must not be globally visible at this
988 * point (only expected to be used on failure just after event creation). After
989 * this call, the pointer is not usable anymore.
991 void agent_destroy_event(struct agent_event
*event
)
996 free(event
->filter_expression
);
997 free(event
->exclusion
);
1002 * Destroy an agent completely.
1004 void agent_destroy(struct agent
*agt
)
1006 struct lttng_ht_node_str
*node
;
1007 struct lttng_ht_iter iter
;
1011 DBG3("Agent destroy");
1014 cds_lfht_for_each_entry(agt
->events
->ht
, &iter
.iter
, node
, node
) {
1016 struct agent_event
*event
;
1019 * When destroying an event, we have to try to disable it on the agent
1020 * side so the event stops generating data. The return value is not
1021 * important since we have to continue anyway destroying the object.
1023 event
= caa_container_of(node
, struct agent_event
, node
);
1024 (void) agent_disable_event(event
, agt
->domain
);
1026 ret
= lttng_ht_del(agt
->events
, &iter
);
1028 call_rcu(&node
->head
, destroy_event_agent_rcu
);
1032 ht_cleanup_push(agt
->events
);
1037 * Allocate agent_apps_ht_by_sock.
1039 int agent_app_ht_alloc(void)
1043 agent_apps_ht_by_sock
= lttng_ht_new(0, LTTNG_HT_TYPE_ULONG
);
1044 if (!agent_apps_ht_by_sock
) {
1052 * Destroy a agent application by socket.
1054 void agent_destroy_app_by_sock(int sock
)
1056 struct agent_app
*app
;
1061 * Not finding an application is a very important error that should NEVER
1062 * happen. The hash table deletion is ONLY done through this call when the
1063 * main sessiond thread is torn down.
1066 app
= agent_find_app_by_sock(sock
);
1069 /* RCU read side lock is assumed to be held by this function. */
1070 agent_delete_app(app
);
1072 /* The application is freed in a RCU call but the socket is closed here. */
1073 agent_destroy_app(app
);
1078 * Clean-up the agent app hash table and destroy it.
1080 void agent_app_ht_clean(void)
1082 struct lttng_ht_node_ulong
*node
;
1083 struct lttng_ht_iter iter
;
1085 if (!agent_apps_ht_by_sock
) {
1089 cds_lfht_for_each_entry(agent_apps_ht_by_sock
->ht
, &iter
.iter
, node
, node
) {
1090 struct agent_app
*app
;
1092 app
= caa_container_of(node
, struct agent_app
, node
);
1093 agent_destroy_app_by_sock(app
->sock
->fd
);
1097 lttng_ht_destroy(agent_apps_ht_by_sock
);
1101 * Update a agent application (given socket) using the given agent.
1103 * Note that this function is most likely to be used with a tracing session
1104 * thus the caller should make sure to hold the appropriate lock(s).
1106 void agent_update(struct agent
*agt
, int sock
)
1109 struct agent_app
*app
;
1110 struct agent_event
*event
;
1111 struct lttng_ht_iter iter
;
1116 DBG("Agent updating app socket %d", sock
);
1119 cds_lfht_for_each_entry(agt
->events
->ht
, &iter
.iter
, event
, node
.node
) {
1120 /* Skip event if disabled. */
1121 if (!event
->enabled
) {
1125 app
= agent_find_app_by_sock(sock
);
1127 * We are in the registration path thus if the application is gone,
1128 * there is a serious code flow error.
1132 ret
= enable_event(app
, event
);
1133 if (ret
!= LTTNG_OK
) {
1134 DBG2("Agent update unable to enable event %s on app pid: %d sock %d",
1135 event
->name
, app
->pid
, app
->sock
->fd
);
1136 /* Let's try the others here and don't assume the app is dead. */