]> Zhao Yanbai Git Server - minix.git/commitdiff
service: nonfatally ignore unknown call keywords
authorBen Gras <ben@minix3.org>
Tue, 8 Jan 2013 18:07:43 +0000 (18:07 +0000)
committerBen Gras <ben@minix3.org>
Tue, 8 Jan 2013 18:54:04 +0000 (18:54 +0000)
. makes switching between revisions with new system.conf
  keywords less risky

commands/service/parse.c
commands/service/proto.h
commands/service/util.c

index 847379976e6f3e4bef4d29f69d0bea135787f62a..a18ebef3e071b1e2b975ad6a1d2312c0086b1db4 100644 (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;
        }
 }
index 48cfb78b2d06dbddcc03d843e7effb14640b1be9..dd938b8fa3abc34246d0298466fe186705e7149b 100644 (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);
index 6a36a8dadf31be59443bdc7cb8784441d4a3cda4..71b4f75708d24611e26f03cd21bd6ec1de4e8d85 100644 (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");
+}