RTEMS 6.1-rc1
error.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: BSD-2-Clause */
2
49/*
50 * Copyright (C) 1995 Tony Bennett <tbennett@divnc.com>
51 *
52 * Redistribution and use in source and binary forms, with or without
53 * modification, are permitted provided that the following conditions
54 * are met:
55 * 1. Redistributions of source code must retain the above copyright
56 * notice, this list of conditions and the following disclaimer.
57 * 2. Redistributions in binary form must reproduce the above copyright
58 * notice, this list of conditions and the following disclaimer in the
59 * documentation and/or other materials provided with the distribution.
60 *
61 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
62 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
63 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
64 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
65 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
66 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
67 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
68 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
69 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
70 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
71 * POSSIBILITY OF SUCH DAMAGE.
72 */
73
74#ifndef _RTEMS_RTEMS_ERROR_H
75#define _RTEMS_RTEMS_ERROR_H
76
77#include <rtems/rtems/status.h>
78#include <rtems/fatal.h>
79
80#include <stdarg.h>
81
82#ifdef __cplusplus
83extern "C" {
84#endif
85
94typedef Internal_errors_t rtems_error_code_t;
95
96/*
97 * rtems_error(), rtems_verror() and rtems_panic() support
98 */
99
100#if 0
101/* not 16bit-int host clean */
102#define RTEMS_ERROR_ERRNO (1<<((sizeof(rtems_error_code_t) * CHAR_BIT) - 2)) /* hi bit; use 'errno' */
103#define RTEMS_ERROR_PANIC (RTEMS_ERROR_ERRNO / 2) /* err fatal; no return */
104#define RTEMS_ERROR_ABORT (RTEMS_ERROR_ERRNO / 4) /* err is fatal; panic */
105#else
106#define RTEMS_ERROR_ERRNO (0x40000000) /* hi bit; use 'errno' */
107#define RTEMS_ERROR_PANIC (0x20000000) /* err fatal; no return */
108#define RTEMS_ERROR_ABORT (0x10000000) /* err is fatal; panic */
109#endif
110
111#define RTEMS_ERROR_MASK \
112 (RTEMS_ERROR_ERRNO | RTEMS_ERROR_ABORT | RTEMS_ERROR_PANIC) /* all */
113
127int rtems_error(
128 rtems_error_code_t error_code,
129 const char *printf_format,
130 ...
131);
132
148int rtems_verror(
149 rtems_error_code_t error_code,
150 const char *printf_format,
151 va_list arglist
152);
153
154extern int rtems_panic_in_progress;
155
156#ifdef __cplusplus
157}
158#endif
159
160
161#endif
162/* end of include file */
This header file defines the Fatal Error Manager API.
int rtems_verror(rtems_error_code_t error_code, const char *printf_format, va_list arglist)
Report an Error.
Definition: error.c:53
int rtems_error(rtems_error_code_t error_code, const char *printf_format,...)
Report an Error.
Definition: error.c:103
This header file provides the status codes of Classic API directives and support functions.