RTEMS 6.1-rc4
Loading...
Searching...
No Matches
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.
 
int rtems_verror (rtems_error_code_t error_code, const char *printf_format, va_list arglist)
 Report an Error.
 

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);
RTEMS Error Reporting.
int rtems_error(rtems_error_code_t error_code, const char *printf_format,...)
Report an Error.
Definition: error.c:103
This header file defines the RTEMS Classic API.

Example 2:

if ((status = rtems_task_create(...)) != RTEMS_SUCCCESSFUL)
{
rtems_error(status | RTEMS_ERROR_ABORT,
"could not create task");
}
rtems_status_code rtems_task_create(rtems_name name, rtems_task_priority initial_priority, size_t stack_size, rtems_mode initial_modes, rtems_attribute attribute_set, rtems_id *id)
Creates a task.
Definition: taskcreate.c:66

Example 3:

if ((fd = open(pathname, O_RDNLY)) < 0)
{
rtems_error(RTEMS_ERROR_ERRNO, "open of '%s' failed", pathname);
goto failed;
}
int open(const char *path, int oflag,...)
Definition: open.c:181

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.