From: Ben Gras Date: Tue, 8 Jan 2013 18:07:43 +0000 (+0000) Subject: service: nonfatally ignore unknown call keywords X-Git-Tag: v3.2.1~130 X-Git-Url: http://zhaoyanbai.com/repos/%22http:/www.isc.org/icons/zlib_tech.html?a=commitdiff_plain;h=a5f09d5196db4f6dd3520b271e68c63f8aab699c;p=minix.git service: nonfatally ignore unknown call keywords . makes switching between revisions with new system.conf keywords less risky --- diff --git a/commands/service/parse.c b/commands/service/parse.c index 847379976..a18ebef3e 100644 --- a/commands/service/parse.c +++ b/commands/service/parse.c @@ -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; } } diff --git a/commands/service/proto.h b/commands/service/proto.h index 48cfb78b2..dd938b8fa 100644 --- a/commands/service/proto.h +++ b/commands/service/proto.h @@ -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); diff --git a/commands/service/util.c b/commands/service/util.c index 6a36a8dad..71b4f7570 100644 --- a/commands/service/util.c +++ b/commands/service/util.c @@ -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"); +}