Browse Source

err: we need to use exit on NuttX

px4_task_exit doesn't seem to be available for NuttX, so it had no
effect and broke the init because the return values of the tasks were
wrong.
sbg
Julian Oes 9 years ago committed by Lorenz Meier
parent
commit
04083cff3d
  1. 15
      src/modules/systemlib/err.h

15
src/modules/systemlib/err.h

@ -66,6 +66,7 @@ @@ -66,6 +66,7 @@
#define _SYSTEMLIB_ERR_H
#include <px4_log.h>
#include <px4_tasks.h>
#include <stdarg.h>
#include <errno.h>
#include "visibility.h"
@ -75,18 +76,22 @@ __BEGIN_DECLS @@ -75,18 +76,22 @@ __BEGIN_DECLS
__EXPORT const char *getprogname(void);
#include <errno.h>
#include <px4_tasks.h>
#ifdef __PX4_NUTTX
#define EXIT(eval) exit(eval)
#else
#define EXIT(eval) px4_task_exit(eval)
#endif
#define err(eval, ...) do { \
PX4_ERR(__VA_ARGS__); \
PX4_ERR("Task exited with errno=%i\n", errno); \
px4_task_exit(eval); } \
while(0)
EXIT(eval); \
} while(0)
#define errx(eval, ...) do { \
PX4_ERR(__VA_ARGS__); \
px4_task_exit(eval); \
EXIT(eval); \
} while(0)
#define warn(...) PX4_WARN(__VA_ARGS__)

Loading…
Cancel
Save