3 * Mar 07, 2010: Created (Cristiano Giuffrida)
8 /* A single error entry. */
14 /* Initialization errors. */
15 static struct errentry init_errlist
[] = {
16 { ENOSYS
, "service does not support the requested initialization type" },
17 { ERESTART
, "service requested an initialization reset" }
19 static const int init_nerr
= sizeof(init_errlist
) / sizeof(init_errlist
[0]);
21 /* Live update errors. */
22 static struct errentry lu_errlist
[] = {
23 { ENOSYS
, "service does not support live update" },
24 { EINVAL
, "service does not support the required state" },
25 { EBUSY
, "service is not able to prepare for the update now" },
26 { EGENERIC
, "generic error occurred while preparing for the update" }
28 static const int lu_nerr
= sizeof(lu_errlist
) / sizeof(lu_errlist
[0]);
30 /*===========================================================================*
32 *===========================================================================*/
33 static char * rs_strerror(int errnum
, struct errentry
*errlist
, const int nerr
)
37 for(i
=0; i
< nerr
; i
++) {
38 if(errnum
== errlist
[i
].errnum
)
39 return errlist
[i
].errstr
;
42 return strerror(-errnum
);
45 /*===========================================================================*
47 *===========================================================================*/
48 char * init_strerror(int errnum
)
50 return rs_strerror(errnum
, init_errlist
, init_nerr
);
53 /*===========================================================================*
55 *===========================================================================*/
56 char * lu_strerror(int errnum
)
58 return rs_strerror(errnum
, lu_errlist
, lu_nerr
);