5
Last change
on this file since 4408603 was
f59d435d,
checked in by Chris Johns <chrisj@…>, on 04/12/18 at 07:46:49
|
libdl: Remove _t from all structures as this is reserved for the standards
|
-
Property mode set to
100644
|
File size:
1.1 KB
|
Line | |
---|
1 | /* |
---|
2 | * COPYRIGHT (c) 2012-2018 Chris Johns <chrisj@rtems.org> |
---|
3 | * |
---|
4 | * The license and distribution terms for this file may be |
---|
5 | * found in the file LICENSE in this distribution or at |
---|
6 | * http://www.rtems.org/license/LICENSE. |
---|
7 | */ |
---|
8 | /** |
---|
9 | * @file |
---|
10 | * |
---|
11 | * @ingroup rtl |
---|
12 | * |
---|
13 | * @brief RTEMS Run-Time Linker Error |
---|
14 | */ |
---|
15 | |
---|
16 | #if HAVE_CONFIG_H |
---|
17 | #include "config.h" |
---|
18 | #endif |
---|
19 | |
---|
20 | #include <errno.h> |
---|
21 | #include <stdio.h> |
---|
22 | #include <string.h> |
---|
23 | #include <stdarg.h> |
---|
24 | |
---|
25 | #include <rtems/rtl/rtl.h> |
---|
26 | #include "rtl-error.h" |
---|
27 | |
---|
28 | void |
---|
29 | rtems_rtl_set_error (int error, const char* format, ...) |
---|
30 | { |
---|
31 | rtems_rtl_data* rtl = rtems_rtl_lock (); |
---|
32 | va_list ap; |
---|
33 | va_start (ap, format); |
---|
34 | rtl->last_errno = error; |
---|
35 | vsnprintf (rtl->last_error, sizeof (rtl->last_error), format, ap); |
---|
36 | rtems_rtl_unlock (); |
---|
37 | va_end (ap); |
---|
38 | } |
---|
39 | |
---|
40 | int |
---|
41 | rtems_rtl_get_error (char* message, size_t max_message) |
---|
42 | { |
---|
43 | rtems_rtl_data* rtl = rtems_rtl_lock (); |
---|
44 | if (rtl != NULL) |
---|
45 | { |
---|
46 | int last_errno = rtl->last_errno; |
---|
47 | strlcpy (message, rtl->last_error, max_message); |
---|
48 | rtems_rtl_unlock (); |
---|
49 | return last_errno; |
---|
50 | } |
---|
51 | |
---|
52 | strncpy(message, "RTL init error", max_message); |
---|
53 | |
---|
54 | return EIO; |
---|
55 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.