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" }
18 static const int init_nerr
= sizeof(init_errlist
) / sizeof(init_errlist
[0]);
20 /* Live update errors. */
21 static struct errentry lu_errlist
[] = {
22 { ENOSYS
, "service does not support live update" },
23 { EINVAL
, "service does not support the required state" },
24 { EBUSY
, "service is not able to prepare for the update now" },
25 { EGENERIC
, "generic error occurred while preparing for the update" }
27 static const int lu_nerr
= sizeof(lu_errlist
) / sizeof(lu_errlist
[0]);
29 /*===========================================================================*
31 *===========================================================================*/
32 static char * rs_strerror(int errnum
, struct errentry
*errlist
, const int nerr
)
36 for(i
=0; i
< nerr
; i
++) {
37 if(errnum
== errlist
[i
].errnum
)
38 return errlist
[i
].errstr
;
41 return strerror(-errnum
);
44 /*===========================================================================*
46 *===========================================================================*/
47 char * init_strerror(int errnum
)
49 return rs_strerror(errnum
, init_errlist
, init_nerr
);
52 /*===========================================================================*
54 *===========================================================================*/
55 char * lu_strerror(int errnum
)
57 return rs_strerror(errnum
, lu_errlist
, lu_nerr
);