vm: don't force physical addresses to be nonzero.
[minix.git] / servers / rs / error.c
blob088dea463bb2676a5917c75bb07efe81973664df
1 /*
2 * Changes:
3 * Mar 07, 2010: Created (Cristiano Giuffrida)
4 */
6 #include "inc.h"
8 /* A single error entry. */
9 struct errentry {
10 int errnum;
11 char* errstr;
14 /* Initialization errors. */
15 PRIVATE struct errentry init_errlist[] = {
16 { ENOSYS, "service does not support the requested initialization type" }
18 PRIVATE const int init_nerr = sizeof(init_errlist) / sizeof(init_errlist[0]);
20 /* Live update errors. */
21 PRIVATE 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 PRIVATE const int lu_nerr = sizeof(lu_errlist) / sizeof(lu_errlist[0]);
29 /*===========================================================================*
30 * rs_strerror *
31 *===========================================================================*/
32 PRIVATE char * rs_strerror(int errnum, struct errentry *errlist, const int nerr)
34 int i;
36 for(i=0; i < nerr; i++) {
37 if(errnum == errlist[i].errnum)
38 return errlist[i].errstr;
41 return strerror(-errnum);
44 /*===========================================================================*
45 * init_strerror *
46 *===========================================================================*/
47 PUBLIC char * init_strerror(int errnum)
49 return rs_strerror(errnum, init_errlist, init_nerr);
52 /*===========================================================================*
53 * lu_strerror *
54 *===========================================================================*/
55 PUBLIC char * lu_strerror(int errnum)
57 return rs_strerror(errnum, lu_errlist, lu_nerr);