File revision-1498.patch of Package openais
x
1
Index: exec/util.c
2
===================================================================
3
--- exec/util.c (revision 1497)
4
+++ exec/util.c (revision 1498)
5
6
return time_now;
7
}
8
9
+struct error_code_entry {
10
+ enum e_ais_done code;
11
+ char *string;
12
+};
13
14
+static struct error_code_entry error_code_map[] = {
15
+ {
16
+ .code = AIS_DONE_EXIT,
17
+ .string = "finished, exiting normally"
18
+ },
19
+ {
20
+ .code = AIS_DONE_UID_DETERMINE,
21
+ .string = "could not determine the process UID"
22
+ },
23
+ {
24
+ .code = AIS_DONE_GID_DETERMINE,
25
+ .string = "could not determine the process GID"
26
+ },
27
+ {
28
+ .code = AIS_DONE_MEMPOOL_INIT,
29
+ .string = "could not initialize the memory pools"
30
+ },
31
+ {
32
+ .code = AIS_DONE_FORK,
33
+ .string = "could not fork"
34
+ },
35
+ {
36
+ .code = AIS_DONE_LIBAIS_SOCKET,
37
+ .string = "could not create a socket"
38
+ },
39
+ {
40
+ .code = AIS_DONE_LIBAIS_BIND,
41
+ .string = "could not bind to an address"
42
+ },
43
+ {
44
+ .code = AIS_DONE_READKEY,
45
+ .string = "could not read the security key"
46
+ },
47
+ {
48
+ .code = AIS_DONE_MAINCONFIGREAD,
49
+ .string = "could not read the main configuration file"
50
+ },
51
+ {
52
+ .code = AIS_DONE_LOGSETUP,
53
+ .string = "could not setup the logging system"
54
+ },
55
+ {
56
+ .code = AIS_DONE_AMFCONFIGREAD,
57
+ .string = "could not read the AMF configuration"
58
+ },
59
+ {
60
+ .code = AIS_DONE_DYNAMICLOAD,
61
+ .string = "could not load a dynamic object"
62
+ },
63
+ { .code = AIS_DONE_OBJDB,
64
+ .string = "could not use the object database"
65
+ },
66
+ {
67
+ .code = AIS_DONE_INIT_SERVICES,
68
+ .string = "could not initlalize services"
69
+ },
70
+ {
71
+ .code = AIS_DONE_OUT_OF_MEMORY,
72
+ .string = "Out of memory"
73
+ },
74
+ {
75
+ .code = AIS_DONE_FATAL_ERR,
76
+ .string = "Unknown fatal error"
77
+ },
78
+};
79
+
80
void openais_exit_error (enum e_ais_done err)
81
{
82
- log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting (%d).\n", err);
83
+ char *error_string = "Error code not available";
84
+ int i;
85
+
86
+ for (i = 0; i < (sizeof (error_code_map) / sizeof (struct error_code_entry)); i++) {
87
+ if (err == error_code_map[i].code) {
88
+ error_string = error_code_map[i].string;
89
+ }
90
+ }
91
+ log_printf (LOG_LEVEL_ERROR, "AIS Executive exiting (reason: %s).\n", error_string);
92
log_flush();
93
exit (err);
94
}
95