mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-20 18:23:34 +08:00
VOXL2 board support updates (#21426)
This commit is contained in:
@@ -93,8 +93,13 @@ extern "C" {
|
||||
|
||||
if (name == NULL) { return -1; }
|
||||
|
||||
memcpy(attr->name, name, PTHREAD_NAME_LEN);
|
||||
attr->name[PTHREAD_NAME_LEN - 1] = 0;
|
||||
size_t name_len = strlen(name);
|
||||
|
||||
if (name_len > PX4_TASK_MAX_NAME_LENGTH) { name_len = PX4_TASK_MAX_NAME_LENGTH; }
|
||||
|
||||
memcpy(attr->name, name, name_len);
|
||||
attr->name[name_len] = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -424,14 +429,20 @@ int px4_sem_timedwait(px4_sem_t *sem, const struct timespec *ts)
|
||||
int px4_prctl(int option, const char *arg2, px4_task_t pid)
|
||||
{
|
||||
int rv = -1;
|
||||
|
||||
if (option != PR_SET_NAME) { return rv; }
|
||||
|
||||
pthread_mutex_lock(&task_mutex);
|
||||
|
||||
for (int i = 0; i < PX4_MAX_TASKS; i++) {
|
||||
if (taskmap[i].isused && taskmap[i].tid == (pthread_t) pid) {
|
||||
rv = pthread_attr_setthreadname(&taskmap[i].attr, arg2);
|
||||
pthread_mutex_unlock(&task_mutex);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
||||
pthread_mutex_unlock(&task_mutex);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
@@ -1,30 +1,33 @@
|
||||
|
||||
#include <time.h>
|
||||
|
||||
void qurt_free(void *ptr);
|
||||
#include <px4_log.h>
|
||||
#include <qurt_alloc.h>
|
||||
|
||||
__attribute__((visibility("default"))) void free(void *ptr)
|
||||
{
|
||||
qurt_free(ptr);
|
||||
// ptr = 0;
|
||||
ptr = 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *malloc(size_t size)
|
||||
{
|
||||
return (void *) 0;
|
||||
return qurt_malloc(size);
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *calloc(size_t nmemb, size_t size)
|
||||
{
|
||||
PX4_ERR("Undefined calloc called");
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) void *realloc(void *ptr, size_t size)
|
||||
{
|
||||
PX4_ERR("Undefined realloc called");
|
||||
return (void *) 0;
|
||||
}
|
||||
|
||||
__attribute__((visibility("default"))) int nanosleep(const struct timespec *req, struct timespec *rem)
|
||||
{
|
||||
PX4_ERR("Undefined nanosleep called");
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user