Source-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: CVS commit: src/sys/kern



perry%piermont.com@localhost wrote:

> > I think so, but do you have any exact idea how it should look like?
> > "init path (default %s), or ddb, reboot, halt:" etc?
> 
> That looks good.

I wrote later:

> - if input strings are started with "/", try to exec it
> - if input strings are not startd with "/" check option keywords
> - if none matches show
> use absolute path, ddb, halt, or reboot

What about this one?

---
boot device: wd0
root on wd0a dumps on wd0b
root file system type: ffs
exec /sbin/init: error 2
init: trying /sbin/oinit
exec /sbin/oinit: error 2
init: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init path (default /sbin/init): 
init: trying /sbin/init
exec /sbin/init: error 2
init path (default /sbin/oinit): 
init: trying /sbin/oinit
exec /sbin/oinit: error 2
init path (default /sbin/init.bak): 
init: trying /sbin/init.bak
exec /sbin/init.bak: error 2
init path: 
use absolute path, ddb, halt or reboot
init path: help
use absolute path, ddb, halt or reboot
init path: what?
use absolute path, ddb, halt or reboot
init path: /foo
init: trying /foo
exec /foo: error 2
init path: ddb
Stopped in pid 1.1 (init) at    netbsd:cpu_Debugger+0x4:        jr      ra
                bdslot: nop
db> c 
init path: reboot
syncing disks... done
unmounting file systems... done
rebooting...


---
Index: init_main.c
===================================================================
RCS file: /cvsroot/src/sys/kern/init_main.c,v
retrieving revision 1.370
diff -u -r1.370 init_main.c
--- init_main.c 25 Oct 2008 15:40:59 -0000      1.370
+++ init_main.c 25 Oct 2008 18:19:28 -0000
@@ -806,12 +806,7 @@
                                printf(" (default %s)", initpaths[ipx]);
                        printf(": ");
                        len = cngetsn(ipath, sizeof(ipath)-1);
-                       if (len == 0) {
-                               if (initpaths[ipx])
-                                       path = initpaths[ipx++];
-                               else
-                                       continue;
-                       } else if (len == 4 && strcmp(ipath, "halt") == 0) {
+                       if (len == 4 && strcmp(ipath, "halt") == 0) {
                                cpu_reboot(RB_HALT, NULL);
                        } else if (len == 6 && strcmp(ipath, "reboot") == 0) {
                                cpu_reboot(0, NULL);
@@ -820,9 +815,18 @@
                                console_debugger();
                                continue;
 #endif
-                       } else {
+                       } else if (len > 0 && ipath[0] == '/') {
                                ipath[len] = '\0';
                                path = ipath;
+                       } else if (len == 0 && initpaths[ipx] != NULL) {
+                               path = initpaths[ipx++];
+                       } else {
+                               printf("use absolute path, ");
+#if defined(DDB)
+                               printf("ddb, ");
+#endif
+                               printf("halt or reboot\n");
+                               continue;
                        }
                } else {
                        if ((path = initpaths[ipx++]) == NULL) {

---


Home | Main Index | Thread Index | Old Index