Changeset c98e6ee in mainline for uspace/app


Ignore:
Timestamp:
2008-07-08T16:05:45Z (17 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)

Location:
uspace/app
Files:
2 added
2 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}
  • uspace/app/tester/tester.c

    rb7f9087 rc98e6ee  
    108108}
    109109
    110 int main(void)
     110int main(int argc, char **argv)
    111111{
     112        printf("Number of arguments: %d\n", argc);
     113        if (argv) {
     114                printf("Arguments:");
     115                while (*argv) {
     116                        printf(" '%s'", *argv++);
     117                }
     118                printf("\n");
     119        }
     120
    112121        while (1) {
    113122                char c;
Note: See TracChangeset for help on using the changeset viewer.