- switch (msg.component) {
- case LTTNG_HEALTH_CONSUMERD_CHANNEL:
- reply.ret_code = health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_CHANNEL);
- break;
- case LTTNG_HEALTH_CONSUMERD_METADATA:
- reply.ret_code = health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA);
- break;
- case LTTNG_HEALTH_CONSUMERD_DATA:
- reply.ret_code = health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_DATA);
- break;
- case LTTNG_HEALTH_CONSUMERD_SESSIOND:
- reply.ret_code = health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_SESSIOND);
- break;
- case LTTNG_HEALTH_CONSUMERD_METADATA_TIMER:
- reply.ret_code = health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA_TIMER);
- break;
-
- case LTTNG_HEALTH_CONSUMERD_ALL:
- reply.ret_code =
- health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_CHANNEL) &&
- health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA) &&
- health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_DATA) &&
- health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_SESSIOND) &&
- health_check_state(health_consumerd, HEALTH_CONSUMERD_TYPE_METADATA_TIMER);
- break;
- default:
- reply.ret_code = LTTNG_ERR_UND;
- break;
- }
-
- /*
- * Flip ret value since 0 is a success and 1 indicates a bad health for
- * the client where in the sessiond it is the opposite. Again, this is
- * just to make things easier for us poor developer which enjoy a lot
- * lazyness.
- */
- if (reply.ret_code == 0 || reply.ret_code == 1) {
- reply.ret_code = !reply.ret_code;
+ memset(&reply, 0, sizeof(reply));
+ for (i = 0; i < NR_HEALTH_CONSUMERD_TYPES; i++) {
+ /*
+ * health_check_state return 0 if thread is in
+ * error.
+ */
+ if (!health_check_state(health_consumerd, i)) {
+ reply.ret_code |= 1ULL << i;
+ }