service: nonfatally ignore unknown call keywords

. makes switching between revisions with new system.conf
	  keywords less risky
This commit is contained in:
Ben Gras 2013-01-08 18:07:43 +00:00
parent 4c3a751f9b
commit a5f09d5196
3 changed files with 22 additions and 8 deletions

View file

@ -787,11 +787,10 @@ static void do_vm(config_t *cpe, struct rs_start *rs_start)
for (i = 0; vm_table[i].label != NULL; i++)
if (!strcmp(cpe->word, vm_table[i].label))
break;
if (vm_table[i].label == NULL)
fatal("do_vm: unknown call '%s' at %s:%d",
if (vm_table[i].label == NULL) {
warning("do_vm: ignoring unknown call '%s' at %s:%d",
cpe->word, cpe->file, cpe->line);
if(vm_table[i].call_nr) {
} else if(vm_table[i].call_nr) {
SET_BIT(rs_start->rss_vm,
vm_table[i].call_nr - VM_RQ_BASE);
}
@ -881,10 +880,13 @@ static void do_system(config_t *cpe, struct rs_start *rs_start)
for (i = 0; system_tab[i].label != NULL; i++)
if (!strcmp(cpe->word, system_tab[i].label))
break;
if (system_tab[i].label == NULL)
fatal("do_system: unknown call '%s' at %s:%d",
if (system_tab[i].label == NULL) {
warning("do_system: ignoring unknown call '%s' at %s:%d",
cpe->word, cpe->file, cpe->line);
SET_BIT(rs_start->rss_system, system_tab[i].call_nr - KERNEL_CALL);
} else {
SET_BIT(rs_start->rss_system,
system_tab[i].call_nr - KERNEL_CALL);
}
first = FALSE;
}
}

View file

@ -1,3 +1,4 @@
void fatal(char *fmt, ...);
void warning(char *fmt, ...);
const char *parse_config(char *progname, int custom, char *configname,
struct rs_config *config);

View file

@ -7,7 +7,7 @@ void fatal(char *fmt, ...)
{
va_list ap;
fprintf(stderr, "fatal error: ");
fprintf(stderr, "service: fatal error: ");
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
@ -15,3 +15,14 @@ void fatal(char *fmt, ...)
exit(1);
}
void warning(char *fmt, ...)
{
va_list ap;
fprintf(stderr, "service: warning: ");
va_start(ap, fmt);
vfprintf(stderr, fmt, ap);
va_end(ap);
fprintf(stderr, "\n");
}