Changeset c98e6ee in mainline for uspace/app/init/init.c


Ignore:
Timestamp:
2008-07-08T16:05:45Z (16 years ago)
Author:
Jiri Svoboda <jirik.svoboda@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
f93f168
Parents:
b7f9087
Message:

Merge program-loader related stuff from dynload branch to trunk. (huge)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/init/init.c

    rb7f9087 rc98e6ee  
    4646#include "version.h"
    4747
    48 #define BUF_SIZE 150000
    49 
    50 static char *buf;
    51 
    5248static void console_wait(void)
    5349{
     
    8379static void spawn(char *fname)
    8480{
     81        char *argv[2];
     82
    8583        printf(NAME ": Spawning %s\n", fname);
    86        
    87         int fd = open(fname, O_RDONLY);
    88         if (fd >= 0) {
    89        
    90                 ssize_t rd;
    91                 size_t len = 0;
    92                
    93                 // FIXME: cannot do long reads yet
    94                 do {
    95                         rd = read(fd, buf + len, 1024);
    96                         if (rd > 0)
    97                                 len += rd;
    98                        
    99                 } while (rd > 0);
    100                
    101                 if (len > 0) {
    102                         task_spawn(buf, len);
    103                         sleep(1);       // FIXME
    104                 }
    105                
    106                 close(fd);
     84
     85        argv[0] = fname;
     86        argv[1] = NULL;
     87
     88        if (task_spawn(fname, argv) != 0) {
     89                /* Success */
     90                sleep(1);
    10791        }
    10892}
     
    118102        }
    119103       
    120         buf = malloc(BUF_SIZE);
    121        
    122104        // FIXME: spawn("/sbin/pci");
    123105        spawn("/sbin/fb");
     
    130112        spawn("/sbin/fat");
    131113        spawn("/sbin/tetris");
     114        spawn("/sbin/cli");
    132115        // FIXME: spawn("/sbin/tester");
    133116        spawn("/sbin/klog");
    134117       
    135         free(buf);
    136118        return 0;
    137119}
Note: See TracChangeset for help on using the changeset viewer.