From f70f13e6203670616eb0f2c02dcf9100791cfeb3 Mon Sep 17 00:00:00 2001 From: Andy Piper Date: Fri, 4 Sep 2020 19:56:17 +0100 Subject: [PATCH] AP_Filesystem: add support for @SYS/tasks.txt --- libraries/AP_Filesystem/AP_Filesystem_Sys.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp b/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp index 9fa2438481..3cbc3505a8 100644 --- a/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp +++ b/libraries/AP_Filesystem/AP_Filesystem_Sys.cpp @@ -21,6 +21,7 @@ #include "AP_Filesystem_Sys.h" #include #include +#include extern const AP_HAL::HAL& hal; @@ -53,6 +54,17 @@ int AP_Filesystem_Sys::open(const char *fname, int flags) r.data->length = hal.util->thread_info(r.data->data, max_size); } } + if (strcmp(fname, "tasks.txt") == 0) { + const uint32_t max_size = 6144; + r.data->data = (char *)malloc(max_size); + if (r.data->data) { + r.data->length = AP::scheduler().task_info(r.data->data, max_size); + if (r.data->length == 0) { // the feature may be disabled + free(r.data->data); + r.data->data = nullptr; + } + } + } #if HAL_MAX_CAN_PROTOCOL_DRIVERS int8_t can_stats_num = -1; if (strcmp(fname, "can_log.txt") == 0) {