| plan 9 kernel history: overview | file list | diff list |
1997/0327/boot/boot.c (diff list | history)
| 1992/0317/sys/src/9/boot/boot.c:1,22 – 1992/0318/sys/src/9/boot/boot.c:1,11 (short | long) | ||
| 1992/0317 | #include <u.h> #include <libc.h> | |
| 1992/0318 | #include "../boot/boot.h" | |
| 1992/0317 | #define DEFSYS "bootes" typedef struct Net Net; typedef struct Flavor Flavor; | |
| 1992/0317/sys/src/9/boot/boot.c:28,47 – 1992/0318/sys/src/9/boot/boot.c:17,33 | ||
| 1992/0317 | int fflag; int kflag; | |
| 1992/0318 | main(int argc, char *argv[]) | |
| 1992/0317 | { int fd; Method *mp; char cmd[64]; | |
| 1992/0318 | char flags[6]; | |
| 1992/0317 | int islocal; sleep(1000); | |
| 1992/0317/sys/src/9/boot/boot.c:71,84 – 1992/0318/sys/src/9/boot/boot.c:57,70 | ||
| 1992/0317 | /* * pick a method and initialize it */ | |
| 1992/0318 | mp = rootserver(argc ? *argv : 0); | |
| 1992/0317 | (*mp->config)(mp); | |
| 1992/0318 | islocal = strcmp(mp->name, "local") == 0; | |
| 1992/0317 | /* * get/set key or password */ | |
| 1992/0318 | (*pword)(islocal, mp); | |
| 1992/0317 | /* * connect to the root file system | |
| 1992/0317/sys/src/9/boot/boot.c:89,95 – 1992/0318/sys/src/9/boot/boot.c:75,82 | ||
| 1992/0317 | if(!islocal){ nop(fd); session(fd); | |
| 1992/0318 | if(cfs) fd = (*cfs)(fd); | |
| 1992/0317 | srvcreate(sys, fd); } srvcreate("boot", fd); | |
| 1992/0317/sys/src/9/boot/boot.c:104,120 – 1992/0318/sys/src/9/boot/boot.c:91,109 | ||
| 1992/0317 | close(fd); /* | |
| 1992/0318 | * if a local file server exists and it's not the * root file server, start it and mount it onto /n/kfs | |
| 1992/0317 | */ if(!islocal){ for(mp = method; mp->name; mp++) if(strcmp(mp->name, "local")==0){ | |
| 1992/0318 | (*mp->config)(mp); fd = (*mp->connect)(); if(fd < 0) | |
| 1992/0317 | break; | |
| 1992/0318 | if(mount(fd, "/n/kfs", MAFTER|MCREATE, "", "") < 0) | |
| 1992/0317 | fatal("mount"); | |
| 1992/0318 | close(fd); | |
| 1992/0317 | break; } } | |
| 1992/0317/sys/src/9/boot/boot.c:124,136 – 1992/0318/sys/src/9/boot/boot.c:113,125 | ||
| 1992/0317 | sleep(1000); sprint(cmd, "/%s/init", cputype); | |
| 1992/0318 | sprint(flags, "-%s%s", cpuflag ? "c" : "t", mflag ? "m" : ""); | |
| 1992/0317 | execl(cmd, "init", flags, 0); fatal(cmd); } /* | |
| 1992/0318 | * ask user from whence cometh the root file system | |
| 1992/0317 | */ Method* rootserver(char *arg) | |
| 1992/0317/sys/src/9/boot/boot.c:142,159 – 1992/0318/sys/src/9/boot/boot.c:131,148 | ||
| 1992/0317 | int n; mp = method; | |
| 1992/0318 | n = sprint(prompt, "root is from (%s", mp->name); | |
| 1992/0317 | for(mp++; mp->name; mp++) n += sprint(prompt+n, ", %s", mp->name); sprint(prompt+n, ")"); | |
| 1992/0318 | if(arg) strcpy(reply, arg); else | |
| 1992/0317 | strcpy(reply, method->name); | |
| 1992/0318 | for(;;){ if(arg == 0 || mflag) | |
| 1992/0317 | outin(prompt, reply, sizeof(reply)); | |
| 1992/0317/sys/src/9/boot/boot.c:168,261 – 1992/0318/sys/src/9/boot/boot.c:157,162 | ||
| 1992/0317 | } void | |
| 1992/0317/sys/src/9/boot/boot.c:267,327 – 1992/0318/sys/src/9/boot/boot.c:168,171 | ||
| 1992/0317 | } if(write(fd, "start", 5) <= 0) warning("starting swap kproc"); | |
| 1992/0318/sys/src/9/boot/boot.c:111,117 – 1992/0319/sys/src/9/boot/boot.c:111,116 (short | long) | ||
| 1992/0317 | settime(islocal); swapproc(); | |
| 1992/0318 | sprint(flags, "-%s%s", cpuflag ? "c" : "t", mflag ? "m" : ""); | |
| 1992/0317 | execl(cmd, "init", flags, 0); | |
| 1992/0319/sys/src/9/boot/boot.c:89,94 – 1992/0320/sys/src/9/boot/boot.c:89,95 (short | long) | ||
| 1992/0317 | if(mount(fd, "/", MAFTER|MCREATE, "", "") < 0) fatal("mount"); close(fd); | |
| 1992/0320 | newkernel(); | |
| 1992/0317 | /* | |
| 1992/0318 | * if a local file server exists and it's not the | |
| 1992/0320/sys/src/9/boot/boot.c:77,83 – 1992/0321/sys/src/9/boot/boot.c:77,82 (short | long) | ||
| 1992/0317 | session(fd); | |
| 1992/0318 | if(cfs) fd = (*cfs)(fd); | |
| 1992/0317 |
| |
| 1992/0321/sys/src/9/boot/boot.c:16,21 – 1992/0322/sys/src/9/boot/boot.c:16,22 (short | long) | ||
| 1992/0317 | int mflag; int fflag; int kflag; | |
| 1992/0322 | int aflag; | |
| 1992/0317 | int cache(int); void swapproc(void); | |
| 1992/0321/sys/src/9/boot/boot.c:37,42 – 1992/0322/sys/src/9/boot/boot.c:38,46 | ||
| 1992/0317 | open("#c/cons", OWRITE); ARGBEGIN{ | |
| 1992/0322 | case 'a': aflag = 1; break; | |
| 1992/0317 | case 'u': strcpy(username, ARGF()); break; | |
| 1992/0321/sys/src/9/boot/boot.c:112,118 – 1992/0322/sys/src/9/boot/boot.c:116,122 | ||
| 1992/0317 | swapproc(); sprint(cmd, "/%s/init", cputype); | |
| 1992/0318 |
| |
| 1992/0322 | sprint(flags, "-%s%s%s", cpuflag ? "c" : "t", mflag ? "m" : "", aflag ? "a" : ""); | |
| 1992/0317 | execl(cmd, "init", flags, 0); fatal(cmd); } | |
| 1992/0321/sys/src/9/boot/boot.c:128,133 – 1992/0322/sys/src/9/boot/boot.c:132,138 | ||
| 1992/0317 | Method *mp; char *cp; int n; | |
| 1992/0322 | int notfirst; | |
| 1992/0317 | mp = method; | |
| 1992/0318 | n = sprint(prompt, "root is from (%s", mp->name); | |
| 1992/0321/sys/src/9/boot/boot.c:139,148 – 1992/0322/sys/src/9/boot/boot.c:144,152 | ||
| 1992/0318 | strcpy(reply, arg); else | |
| 1992/0317 | strcpy(reply, method->name); | |
| 1992/0318 |
| |
| 1992/0322 | for(notfirst = 0;; notfirst = 1){ if(mflag || notfirst) | |
| 1992/0317 | outin(prompt, reply, sizeof(reply)); | |
| 1992/0322/sys/src/9/boot/boot.c:12,22 – 1992/0323/sys/src/9/boot/boot.c:12,24 (short | long) | ||
| 1992/0317 | char terminal[NAMELEN]; char sys[2*NAMELEN]; char username[NAMELEN]; | |
| 1992/0323 | char *sauth = ""; | |
| 1992/0317 | int mflag; int fflag; int kflag; | |
| 1992/0322 | int aflag; | |
| 1992/0323 | int pflag; | |
| 1992/0317 | int cache(int); void swapproc(void); | |
| 1992/0322/sys/src/9/boot/boot.c:48,55 – 1992/0323/sys/src/9/boot/boot.c:50,61 | ||
| 1992/0317 | kflag = 1; break; case 'm': | |
| 1992/0323 | pflag = 1; | |
| 1992/0317 | mflag = 1; break; | |
| 1992/0323 | case 'p': pflag = 1; break; | |
| 1992/0317 | case 'f': fflag = 1; break; | |
| 1992/0322/sys/src/9/boot/boot.c:89,95 – 1992/0323/sys/src/9/boot/boot.c:95,101 | ||
| 1992/0317 | */ if(bind("/", "/", MREPL) < 0) fatal("bind"); | |
| 1992/0323 | if(mount(fd, "/", MAFTER|MCREATE, "", sauth) < 0) | |
| 1992/0317 | fatal("mount"); close(fd); | |
| 1992/0320 | newkernel(); | |
| 1992/0322/sys/src/9/boot/boot.c:145,151 – 1992/0323/sys/src/9/boot/boot.c:151,157 | ||
| 1992/0318 | else | |
| 1992/0317 | strcpy(reply, method->name); | |
| 1992/0322 | for(notfirst = 0;; notfirst = 1){ | |
| 1992/0323 | if(pflag || notfirst) | |
| 1992/0317 | outin(prompt, reply, sizeof(reply)); for(mp = method; mp->name; mp++) if(*reply == *mp->name){ | |
| 1992/0323/sys/src/9/boot/boot.c:12,18 – 1992/0325/sys/src/9/boot/boot.c:12,18 (short | long) | ||
| 1992/0317 | char terminal[NAMELEN]; char sys[2*NAMELEN]; char username[NAMELEN]; | |
| 1992/0323 |
| |
| 1992/0325 | char *sauth; | |
| 1992/0317 | int mflag; int fflag; | |
| 1992/0323/sys/src/9/boot/boot.c:95,102 – 1992/0325/sys/src/9/boot/boot.c:95,106 | ||
| 1992/0317 | */ if(bind("/", "/", MREPL) < 0) fatal("bind"); | |
| 1992/0323 |
| |
| 1992/0317 |
| |
| 1992/0325 | sauth = ""; if(mount(fd, "/", MAFTER|MCREATE, "", sauth) < 0){ sauth = "any"; if(mount(fd, "/", MAFTER|MCREATE, "", sauth) < 0) fatal("mount"); } | |
| 1992/0317 | close(fd); | |
| 1992/0320 | newkernel(); | |
| 1992/0317 | ||
| 1992/0325/sys/src/9/boot/boot.c:116,122 – 1992/0327/sys/src/9/boot/boot.c:116,122 (short | long) | ||
| 1992/0318 | if(fd < 0) | |
| 1992/0317 | break; | |
| 1992/0318 | if(mount(fd, "/n/kfs", MAFTER|MCREATE, "", "") < 0) | |
| 1992/0317 |
| |
| 1992/0327 | print("failed to mount kfs\n"); | |
| 1992/0318 | close(fd); | |
| 1992/0317 | break; } | |
| 1992/0327/sys/src/9/boot/boot.c:167,172 – 1992/0520/sys/src/9/boot/boot.c:167,173 (short | long) | ||
| 1992/0317 | if(mp->name == 0) continue; } | |
| 1992/0520 | return 0; /* not reached */ | |
| 1992/0317 | } void | |
| 1992/0520/sys/src/9/boot/boot.c:13,18 – 1992/0522/sys/src/9/boot/boot.c:13,19 (short | long) | ||
| 1992/0317 | char sys[2*NAMELEN]; char username[NAMELEN]; | |
| 1992/0325 | char *sauth; | |
| 1992/0522 | char bootfile[3*NAMELEN]; | |
| 1992/0317 | int mflag; int fflag; | |
| 1992/0520/sys/src/9/boot/boot.c:25,31 – 1992/0522/sys/src/9/boot/boot.c:26,32 | ||
| 1992/0317 | Method *rootserver(char*); void | |
| 1992/0318 |
| |
| 1992/0522 | boot(int argc, char *argv[]) | |
| 1992/0317 | { int fd; Method *mp; | |
| 1992/0522/sys/src/9/boot/boot.c:14,19 – 1992/0530/sys/src/9/boot/boot.c:14,20 (short | long) | ||
| 1992/0317 | char username[NAMELEN]; | |
| 1992/0325 | char *sauth; | |
| 1992/0522 | char bootfile[3*NAMELEN]; | |
| 1992/0530 | char conffile[NAMELEN]; | |
| 1992/0317 | int mflag; int fflag; | |
| 1992/0522/sys/src/9/boot/boot.c:21,29 – 1992/0530/sys/src/9/boot/boot.c:22,29 | ||
| 1992/0322 | int aflag; | |
| 1992/0323 | int pflag; | |
| 1992/0317 |
| |
| 1992/0530 | static void swapproc(void); static Method *rootserver(char*); | |
| 1992/0317 | void | |
| 1992/0522 | boot(int argc, char *argv[]) | |
| 1992/0522/sys/src/9/boot/boot.c:64,69 – 1992/0530/sys/src/9/boot/boot.c:64,70 | ||
| 1992/0317 | readenv("cputype", cputype, sizeof(cputype)); readenv("terminal", terminal, sizeof(cputype)); | |
| 1992/0530 | getconffile(conffile, terminal); | |
| 1992/0317 | /* * pick a method and initialize it | |
| 1992/0522/sys/src/9/boot/boot.c:171,177 – 1992/0530/sys/src/9/boot/boot.c:172,178 | ||
| 1992/0520 | return 0; /* not reached */ | |
| 1992/0317 | } | |
| 1992/0530 | static void | |
| 1992/0317 | swapproc(void) { int fd; | |
| 1992/0530/sys/src/9/boot/boot.c:104,110 – 1992/0609/sys/src/9/boot/boot.c:104,111 (short | long) | ||
| 1992/0325 | fatal("mount"); } | |
| 1992/0317 | close(fd); | |
| 1992/0320 |
| |
| 1992/0609 | if(cpuflag == 0) newkernel(); | |
| 1992/0317 | /* | |
| 1992/0318 | * if a local file server exists and it's not the | |
| 1992/0609/sys/src/9/boot/boot.c:40,45 – 1992/0610/sys/src/9/boot/boot.c:40,49 (short | long) | ||
| 1992/0317 | open("#c/cons", OWRITE); open("#c/cons", OWRITE); | |
| 1992/0610 | /* for(fd = 0; fd < argc; fd++) print("%s ", argv[fd]); print("\n");/**/ | |
| 1992/0317 | ARGBEGIN{ | |
| 1992/0322 | case 'a': aflag = 1; | |
| 1992/0609/sys/src/9/boot/boot.c:62,69 – 1992/0610/sys/src/9/boot/boot.c:66,73 | ||
| 1992/0317 | break; }ARGEND | |
| 1992/0610 | readfile("#e/cputype", cputype, sizeof(cputype)); readfile("#e/terminal", terminal, sizeof(cputype)); | |
| 1992/0530 | getconffile(conffile, terminal); | |
| 1992/0317 | /* | |
| 1992/0610/sys/src/9/boot/boot.c:112,132 – 1992/0611/sys/src/9/boot/boot.c:112,133 (short | long) | ||
| 1992/0609 | newkernel(); | |
| 1992/0317 | /* | |
| 1992/0318 |
| |
| 1992/0611 | * if a local file server exists and it's not * running, start it and mount it onto /n/kfs | |
| 1992/0317 | */ | |
| 1992/0318 |
| |
| 1992/0317 |
| |
| 1992/0318 |
| |
| 1992/0327 |
| |
| 1992/0318 |
| |
| 1992/0317 |
| |
| 1992/0611 | for(mp = method; mp->name; mp++){ if(strcmp(mp->name, "local") != 0) continue; if(access("#s/kfs", ORDWR) >= 0) break; (*mp->config)(mp); fd = (*mp->connect)(); if(fd < 0) break; if(mount(fd, "/n/kfs", MAFTER|MCREATE, "", "") < 0) print("failed to mount kfs\n"); close(fd); break; | |
| 1992/0317 | } settime(islocal); | |
| 1992/0611/sys/src/9/boot/boot.c:39,45 – 1992/0725/sys/src/9/boot/boot.c:39,44 (short | long) | ||
| 1992/0317 | open("#c/cons", OREAD); open("#c/cons", OWRITE); open("#c/cons", OWRITE); | |
| 1992/0610 | /* for(fd = 0; fd < argc; fd++) print("%s ", argv[fd]); print("\n");/**/ | |
| 1992/0725/sys/src/9/boot/boot.c:39,45 – 1992/0813/sys/src/9/boot/boot.c:39,46 (short | long) | ||
| 1992/0317 | open("#c/cons", OREAD); open("#c/cons", OWRITE); open("#c/cons", OWRITE); | |
| 1992/0610 |
| |
| 1992/0813 | /**/ print("argc=%d\n", argc); for(fd = 0; fd < argc; fd++) | |
| 1992/0610 | print("%s ", argv[fd]); print("\n");/**/ | |
| 1992/0813/sys/src/9/boot/boot.c:39,45 – 1992/0814/sys/src/9/boot/boot.c:39,45 (short | long) | ||
| 1992/0317 | open("#c/cons", OREAD); open("#c/cons", OWRITE); open("#c/cons", OWRITE); | |
| 1992/0813 |
| |
| 1992/0814 | /* print("argc=%d\n", argc); | |
| 1992/0813 | for(fd = 0; fd < argc; fd++) | |
| 1992/0610 | print("%s ", argv[fd]); print("\n");/**/ | |
| 1992/0814/sys/src/9/boot/boot.c:115,133 – 1992/0902/sys/src/9/boot/boot.c:115,132 (short | long) | ||
| 1992/0611 | * if a local file server exists and it's not * running, start it and mount it onto /n/kfs | |
| 1992/0317 | */ | |
| 1992/0611 |
| |
| 1992/0902 | if(!islocal){ for(mp = method; mp->name; mp++){ if(strcmp(mp->name, "local") != 0) continue; (*mp->config)(mp); fd = (*mp->connect)(); if(fd < 0) break; mount(fd, "/n/kfs", MAFTER|MCREATE, "", "") ; close(fd); | |
| 1992/0611 | break; | |
| 1992/0902 | } | |
| 1992/0317 | } settime(islocal); | |
| 1992/0902/sys/src/9/boot/boot.c:32,38 – 1992/0909/sys/src/9/boot/boot.c:32,38 (short | long) | ||
| 1992/0317 | Method *mp; char cmd[64]; | |
| 1992/0318 | char flags[6]; | |
| 1992/0317 |
| |
| 1992/0909 | int islocal, ishybrid; | |
| 1992/0317 | sleep(1000); | |
| 1992/0902/sys/src/9/boot/boot.c:76,81 – 1992/0909/sys/src/9/boot/boot.c:76,82 | ||
| 1992/0318 | mp = rootserver(argc ? *argv : 0); | |
| 1992/0317 | (*mp->config)(mp); | |
| 1992/0318 | islocal = strcmp(mp->name, "local") == 0; | |
| 1992/0909 | ishybrid = strcmp(mp->name, "hybrid") == 0; | |
| 1992/0317 | /* * get/set key or password | |
| 1992/0902/sys/src/9/boot/boot.c:88,94 – 1992/0909/sys/src/9/boot/boot.c:89,95 | ||
| 1992/0317 | fd = (*mp->connect)(); if(fd < 0) fatal("can't connect to file server"); | |
| 1992/0909 | if(!islocal && !ishybrid){ | |
| 1992/0317 | nop(fd); session(fd); | |
| 1992/0318 | if(cfs) | |
| 1992/0902/sys/src/9/boot/boot.c:115,121 – 1992/0909/sys/src/9/boot/boot.c:116,122 | ||
| 1992/0611 | * if a local file server exists and it's not * running, start it and mount it onto /n/kfs | |
| 1992/0317 | */ | |
| 1992/0902 |
| |
| 1992/0909 | if(!islocal && !ishybrid){ | |
| 1992/0902 | for(mp = method; mp->name; mp++){ if(strcmp(mp->name, "local") != 0) continue; | |
| 1992/0909/sys/src/9/boot/boot.c:149,155 – 1992/0918/sys/src/9/boot/boot.c:149,155 (short | long) | ||
| 1992/0317 | char reply[64]; Method *mp; char *cp; | |
| 1992/0918 | int n, j; | |
| 1992/0322 | int notfirst; | |
| 1992/0317 | mp = method; | |
| 1992/0909/sys/src/9/boot/boot.c:165,173 – 1992/0918/sys/src/9/boot/boot.c:165,177 | ||
| 1992/0322 | for(notfirst = 0;; notfirst = 1){ | |
| 1992/0323 | if(pflag || notfirst) | |
| 1992/0317 | outin(prompt, reply, sizeof(reply)); | |
| 1992/0918 | cp = strchr(reply, '!'); if(cp) j = cp - reply; else j = strlen(reply); | |
| 1992/0317 | for(mp = method; mp->name; mp++) | |
| 1992/0918 | if(strncmp(reply, mp->name, j) == 0){ | |
| 1992/0317 | if(cp) strcpy(sys, cp+1); return mp; | |
| 1992/0918/sys/src/9/boot/boot.c:116,122 – 1992/1006/sys/src/9/boot/boot.c:116,122 (short | long) | ||
| 1992/0611 | * if a local file server exists and it's not * running, start it and mount it onto /n/kfs | |
| 1992/0317 | */ | |
| 1992/0909 |
| |
| 1992/1006 | if(access("#s/kfs", 0) < 0){ | |
| 1992/0902 | for(mp = method; mp->name; mp++){ if(strcmp(mp->name, "local") != 0) continue; | |
| 1992/1006/sys/src/9/boot/boot.c:44,49 – 1992/1021/sys/src/9/boot/boot.c:44,52 (short | long) | ||
| 1992/0610 | print("%s ", argv[fd]); print("\n");/**/ | |
| 1992/1021 | if(argc <= 1) pflag = 1; | |
| 1992/0317 | ARGBEGIN{ | |
| 1992/0322 | case 'a': aflag = 1; | |
| 1992/1021/sys/src/9/boot/boot.c:1,5 – 1993/0330/sys/src/9/boot/boot.c:1,6 (short | long) | ||
| 1992/0317 | #include <u.h> #include <libc.h> | |
| 1993/0330 | #include <auth.h> | |
| 1992/0318 | #include "../boot/boot.h" | |
| 1992/0317 | #define DEFSYS "bootes" | |
| 1992/1021/sys/src/9/boot/boot.c:12,18 – 1993/0330/sys/src/9/boot/boot.c:13,18 | ||
| 1992/0317 | char terminal[NAMELEN]; char sys[2*NAMELEN]; char username[NAMELEN]; | |
| 1992/0325 |
| |
| 1992/0522 | char bootfile[3*NAMELEN]; | |
| 1992/0530 | char conffile[NAMELEN]; | |
| 1992/0317 | ||
| 1992/1021/sys/src/9/boot/boot.c:21,26 – 1993/0330/sys/src/9/boot/boot.c:21,27 | ||
| 1992/0317 | int kflag; | |
| 1992/0322 | int aflag; | |
| 1992/0323 | int pflag; | |
| 1993/0330 | int afd = -1; | |
| 1992/0317 | ||
| 1992/0530 | static void swapproc(void); static Method *rootserver(char*); | |
| 1992/1021/sys/src/9/boot/boot.c:94,102 – 1993/0330/sys/src/9/boot/boot.c:95,103 | ||
| 1992/0317 | fatal("can't connect to file server"); | |
| 1992/0909 | if(!islocal && !ishybrid){ | |
| 1992/0317 | nop(fd); | |
| 1992/0318 | if(cfs) fd = (*cfs)(fd); | |
| 1993/0330 | doauthenticate(fd, mp); | |
| 1992/0317 | } srvcreate("boot", fd); | |
| 1992/1021/sys/src/9/boot/boot.c:105,116 – 1993/0330/sys/src/9/boot/boot.c:106,113 | ||
| 1992/0317 | */ if(bind("/", "/", MREPL) < 0) fatal("bind"); | |
| 1992/0325 |
| |
| 1993/0330 | if(mount(fd, "/", MAFTER|MCREATE, "") < 0) fatal("mount"); | |
| 1992/0317 | close(fd); | |
| 1992/0609 | if(cpuflag == 0) newkernel(); | |
| 1992/1021/sys/src/9/boot/boot.c:127,133 – 1993/0330/sys/src/9/boot/boot.c:124,130 | ||
| 1992/0902 | fd = (*mp->connect)(); if(fd < 0) break; | |
| 1993/0330 | mount(fd, "/n/kfs", MAFTER|MCREATE, "") ; | |
| 1992/0902 | close(fd); | |
| 1992/0611 | break; | |
| 1992/0902 | } | |
| 1992/1021/sys/src/9/boot/boot.c:134,140 – 1993/0330/sys/src/9/boot/boot.c:131,139 | ||
| 1992/0317 | } settime(islocal); | |
| 1993/0330 | close(afd); | |
| 1992/0317 | swapproc(); | |
| 1993/0330 | remove("#e/password"); | |
| 1992/0317 | sprint(cmd, "/%s/init", cputype); | |
| 1992/0322 | sprint(flags, "-%s%s%s", cpuflag ? "c" : "t", mflag ? "m" : "", aflag ? "a" : ""); | |
| 1993/0330/sys/src/9/boot/boot.c:94,100 – 1993/0402/sys/src/9/boot/boot.c:94,99 (short | long) | ||
| 1992/0317 | if(fd < 0) fatal("can't connect to file server"); | |
| 1992/0909 | if(!islocal && !ishybrid){ | |
| 1992/0317 |
| |
| 1992/0318 | if(cfs) fd = (*cfs)(fd); | |
| 1993/0330 | doauthenticate(fd, mp); | |
| 1993/0402/sys/src/9/boot/boot.c:1,14 – 1993/0501/sys/src/9/boot/boot.c:1,12 (short | long) | ||
| 1992/0317 | #include <u.h> #include <libc.h> | |
| 1993/0330 | #include <auth.h> | |
| 1993/0501 | #include <fcall.h> | |
| 1992/0318 | #include "../boot/boot.h" | |
| 1992/0317 |
| |
| 1993/0402/sys/src/9/boot/boot.c:15,29 – 1993/0501/sys/src/9/boot/boot.c:13,27 | ||
| 1992/0317 | char username[NAMELEN]; | |
| 1992/0522 | char bootfile[3*NAMELEN]; | |
| 1992/0530 | char conffile[NAMELEN]; | |
| 1992/0317 |
| |
| 1992/0322 |
| |
| 1992/0323 |
| |
| 1993/0330 |
| |
| 1992/0317 | ||
| 1993/0501 | int printcol; int mflag; int fflag; int kflag; int aflag; int pflag; int afd = -1; | |
| 1992/0530 | static void swapproc(void); | |
| 1993/0501 | static void recover(Method*); | |
| 1992/0530 | static Method *rootserver(char*); | |
| 1992/0317 | void | |
| 1993/0402/sys/src/9/boot/boot.c:87,92 – 1993/0501/sys/src/9/boot/boot.c:85,99 | ||
| 1992/0317 | */ | |
| 1992/0318 | (*pword)(islocal, mp); | |
| 1992/0317 | ||
| 1993/0501 | switch(rfork(RFPROC|RFNAMEG|RFFDG)) { case -1: print("failed to start recover: %r\n"); break; case 0: recover(mp); break; } | |
| 1992/0317 | /* * connect to the root file system */ | |
| 1993/0402/sys/src/9/boot/boot.c:93,98 – 1993/0501/sys/src/9/boot/boot.c:100,106 | ||
| 1992/0317 | fd = (*mp->connect)(); if(fd < 0) fatal("can't connect to file server"); | |
| 1993/0501 | nop(fd); | |
| 1992/0909 | if(!islocal && !ishybrid){ | |
| 1992/0318 | if(cfs) fd = (*cfs)(fd); | |
| 1993/0402/sys/src/9/boot/boot.c:132,138 – 1993/0501/sys/src/9/boot/boot.c:140,145 | ||
| 1992/0317 | settime(islocal); | |
| 1993/0330 | close(afd); | |
| 1992/0317 | swapproc(); | |
| 1993/0330 |
| |
| 1992/0317 | sprint(cmd, "/%s/init", cputype); | |
| 1992/0322 | sprint(flags, "-%s%s%s", cpuflag ? "c" : "t", mflag ? "m" : "", aflag ? "a" : ""); | |
| 1993/0402/sys/src/9/boot/boot.c:183,188 – 1993/0501/sys/src/9/boot/boot.c:190,233 | ||
| 1992/0520 | return 0; /* not reached */ | |
| 1992/0317 | } | |
| 1993/0501 | int nop(int fd) { int n; Fcall hdr; char buf[128]; print("boot: nop..."); hdr.type = Tnop; hdr.tag = NOTAG; n = convS2M(&hdr, buf); if(write(fd, buf, n) != n){ fatal("write nop"); return 0; } reread: n = read(fd, buf, sizeof buf); if(n <= 0){ fatal("read nop"); return 0; } if(n == 2) goto reread; if(convM2S(buf, &hdr, n) == 0) { fatal("format nop"); return 0; } if(hdr.type != Rnop){ fatal("not Rnop"); return 0; } if(hdr.tag != NOTAG){ fatal("tag not NOTAG"); return 0; } return 1; } | |
| 1992/0530 | static void | |
| 1992/0317 | swapproc(void) { | |
| 1993/0402/sys/src/9/boot/boot.c:195,198 – 1993/0501/sys/src/9/boot/boot.c:240,318 | ||
| 1992/0317 | } if(write(fd, "start", 5) <= 0) warning("starting swap kproc"); | |
| 1993/0501 | close(fd); } void reattach(int rec, Method *amp, char *buf) { char *mp; int fd, n, sv[2]; char tmp[64], *p; mp = strchr(buf, ' '); if(mp == 0) goto fail; *mp++ = '\0'; p = strrchr(buf, '/'); if(p == 0) goto fail; *p = '\0'; sprint(tmp, "%s/remote", buf); fd = open(tmp, OREAD); if(fd < 0) goto fail; n = read(fd, tmp, sizeof(tmp)); if(n < 0) goto fail; close(fd); tmp[n-1] = '\0'; print("boot: Service %s down, wait...\n", tmp); p = strrchr(buf, '/'); if(p == 0) goto fail; *p = '\0'; while(plumb(buf, tmp, sv, 0) < 0) sleep(30); nop(sv[1]); doauthenticate(sv[1], amp); print("boot: Service %s Ok\n", tmp); n = sprint(tmp, "%d %s", sv[1], mp); if(write(rec, tmp, n) < 0) { errstr(tmp); print("write recover: %s\n", tmp); } exits(0); fail: print("recover fail: %s\n", buf); exits(0); } void recover(Method *mp) { int fd, n; char buf[256]; fd = open("#/./recover", ORDWR); if(fd < 0) exits(0); for(;;) { n = read(fd, buf, sizeof(buf)); if(n < 0) exits(0); buf[n] = '\0'; if(fork() == 0) reattach(fd, mp, buf); } | |
| 1992/0317 | } | |
| Too many diffs (26 > 25). Stopping. | ||