The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/boot/embed.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #include <u.h>
    2 #include <libc.h>
    3 #include <../boot/boot.h>
    4 
    5 static char *paqfile;
    6 
    7 void
    8 configembed(Method *m)
    9 {
   10         if(*sys == '/' || *sys == '#'){
   11                 /*
   12                  *  if the user specifies the disk in the boot cmd or
   13                  * 'root is from' prompt, use it
   14                  */
   15                 paqfile = sys;
   16         } else if(m->arg){
   17                 /*
   18                  *  a default is supplied when the kernel is made
   19                  */
   20                 paqfile = m->arg;
   21         }
   22 }
   23 
   24 int
   25 connectembed(void)
   26 {
   27         int i, p[2];
   28         Dir *dir;
   29         char **arg, **argp;
   30 
   31         dir = dirstat("/boot/paqfs");
   32         if(dir == nil)
   33                 return -1;
   34         free(dir);
   35 
   36         dir = dirstat(paqfile);
   37         if(dir == nil || dir->mode & DMDIR)
   38                 return -1;
   39         free(dir);
   40 
   41         print("paqfs...");
   42         if(bind("#c", "/dev", MREPL) < 0)
   43                 fatal("bind #c");
   44         if(bind("#p", "/proc", MREPL) < 0)
   45                 fatal("bind #p");
   46         if(pipe(p)<0)
   47                 fatal("pipe");
   48         switch(fork()){
   49         case -1:
   50                 fatal("fork");
   51         case 0:
   52                 arg = malloc((bargc+5)*sizeof(char*));
   53                 argp = arg;
   54                 *argp++ = "/boot/paqfs";
   55                 *argp++ = "-iv";
   56                 *argp++ = paqfile;
   57                 for(i=1; i<bargc; i++)
   58                         *argp++ = bargv[i];
   59                 *argp = 0;
   60 
   61                 dup(p[0], 0);
   62                 dup(p[1], 1);
   63                 close(p[0]);
   64                 close(p[1]);
   65                 exec("/boot/paqfs", arg);
   66                 fatal("can't exec paqfs");
   67         default:
   68                 break;
   69         }
   70         waitpid();
   71 
   72         close(p[1]);
   73         return p[0];
   74 }

Cache object: 40f7b8839cf662e4d59944e469295b9a


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.