diff --git a/platforms/posix/src/px4/common/main.cpp b/platforms/posix/src/px4/common/main.cpp index f277a6b996..e8c29bb3e7 100644 --- a/platforms/posix/src/px4/common/main.cpp +++ b/platforms/posix/src/px4/common/main.cpp @@ -178,13 +178,13 @@ int main(int argc, char **argv) return client.process_args(argc, (const char **)argv); } else { -#if (_POSIX_MEMLOCK > 0) +#if (_POSIX_MEMLOCK > 0) && !defined(ENABLE_LOCKSTEP_SCHEDULER) // try to lock address space into RAM, to avoid page swap delay // TODO: Check CAP_IPC_LOCK instead of euid if (geteuid() == 0) { // root user - if (mlockall(MCL_CURRENT) + mlockall(MCL_FUTURE)) { // check if both works - PX4_ERR("mlockall() failed! errno: %d", errno); + if (mlockall(MCL_CURRENT | MCL_FUTURE)) { // check if both works + PX4_ERR("mlockall() failed! errno: %d (%s)", errno, strerror(errno)); munlockall(); // avoid mlock limitation caused alloc failure in future } else { @@ -192,7 +192,7 @@ int main(int argc, char **argv) } } -#endif +#endif // (_POSIX_MEMLOCK > 0) && !ENABLE_LOCKSTEP_SCHEDULER /* Server/daemon apps need to parse the command line arguments. */ diff --git a/platforms/posix/src/px4/common/tasks.cpp b/platforms/posix/src/px4/common/tasks.cpp index e54c83b9cc..1d1e70569b 100644 --- a/platforms/posix/src/px4/common/tasks.cpp +++ b/platforms/posix/src/px4/common/tasks.cpp @@ -252,7 +252,7 @@ px4_task_t px4_task_spawn_cmd(const char *name, int scheduler, int priority, int rv = pthread_create(&taskmap[taskid].pid, nullptr, &entry_adapter, (void *) taskdata); if (rv != 0) { - PX4_ERR("px4_task_spawn_cmd: failed to create thread %d %d\n", rv, errno); + PX4_ERR("px4_task_spawn_cmd: failed to create thread for %s (%i): %s", name, rv, strerror(rv)); taskmap[taskid].isused = false; pthread_attr_destroy(&attr); pthread_mutex_unlock(&task_mutex);