RTEMS  5.1
Macros | Typedefs | Functions | Variables
error.h File Reference

RTEMS Error Reporting. More...

#include <rtems/rtems/status.h>
#include <rtems/fatal.h>
#include <stdarg.h>

Go to the source code of this file.

Macros

#define RTEMS_ERROR_ERRNO   (0x40000000) /* hi bit; use 'errno' */
 
#define RTEMS_ERROR_PANIC   (0x20000000) /* err fatal; no return */
 
#define RTEMS_ERROR_ABORT   (0x10000000) /* err is fatal; panic */
 
#define RTEMS_ERROR_MASK   (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | RTEMS_ERROR_PANIC) /* all */
 

Typedefs

typedef Internal_errors_t rtems_error_code_t
 

Functions

int rtems_error (rtems_error_code_t error_code, const char *printf_format,...)
 Report an Error. More...
 
int rtems_verror (rtems_error_code_t error_code, const char *printf_format, va_list arglist)
 Report an Error. More...
 

Variables

int rtems_panic_in_progress
 

Detailed Description

RTEMS Error Reporting.

Defines and externs for rtems error reporting

These routines provide general purpose error reporting. rtems_error reports an error to stderr and allows use of printf style formatting. A newline is appended to all messages.

error_flag can be specified as any of the following:

RTEMS_ERROR_ERRNO – include errno text in output RTEMS_ERROR_PANIC – halts local system after output RTEMS_ERROR_ABORT – abort after output

It can also include a rtems_status value which can be OR'd with the above flags. *

Example 1:

#include <rtems.h>
#include <rtems/error.h>
rtems_error(0, "stray interrupt %d", intr);

Example 2:

if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
{
rtems_error(status | RTEMS_ERROR_ABORT,
"could not create task");
}

Example 3:

if ((fd = open(pathname, O_RDNLY)) < 0)
{
rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
goto failed;
}

Function Documentation

◆ rtems_error()

int rtems_error ( rtems_error_code_t  error_code,
const char *  printf_format,
  ... 
)

Report an Error.

Parameters
[in]error_codecan be specified as any of the following: RTEMS_ERROR_ERRNO – include errno text in output RTEMS_ERROR_PANIC – halts local system after output RTEMS_ERROR_ABORT – abort after output
[in]printf_formatis a normal printf(3) format string, with its concommitant arguments
Returns
the number of characters written.

◆ rtems_verror()

int rtems_verror ( rtems_error_code_t  error_code,
const char *  printf_format,
va_list  arglist 
)

Report an Error.

Parameters
[in]error_codecan be specified as any of the following: RTEMS_ERROR_ERRNO – include errno text in output RTEMS_ERROR_PANIC – halts local system after output RTEMS_ERROR_ABORT – abort after output
[in]printf_formatis a normal printf(3) format string, with its concommitant arguments
[in]arglistis a varargs list corresponding to printf_format
Returns
the number of characters written.