Changeset 408 for trunk/user/ksh


Ignore:
Timestamp:
Dec 5, 2017, 4:20:07 PM (7 years ago)
Author:
alain
Message:

Fix several bugs in the fork() syscall.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/ksh/ksh.c

    r407 r408  
    268268static void cmd_load( int argc , char **argv )
    269269{
    270         unsigned int   pid;
    271     unsigned int   error;
    272         char         * pathname;
     270        unsigned int         pid;
     271    unsigned int         error;
     272        char               * pathname;
    273273
    274274        if (argc != 2)
     
    285285    if (pid == 0)  // it is the child process
    286286    {
    287 
    288 printf("\n[KSH_DBG] process %x before exec\n", getpid() );
     287        printf("CHILD\n");
     288        exit(0);
    289289
    290290        // exec system call
    291         error = exec( pathname , NULL , NULL );
    292 
    293 printf("\n[KSH_DBG] process %x after exec / error = %d\n", getpid() , error );
    294 
    295         if( error )
    296         {
    297             printf("error: new process unable to exec <%s>\n", pathname );
    298             // TODO exit();
    299         }
     291        // error = exec( pathname , NULL , NULL );
     292
     293        // if( error )
     294        // {
     295        //    printf("error: new process unable to exec <%s>\n", pathname );
     296        //    exit();
     297        // }
    300298        }
    301299    else if ( pid < 0 )  // it is a failure reported to parent
     
    305303    else                 // it is a success reported to parent
    306304    {
    307 
    308 printf("\n[KSH_DBG] process %x created for <%s>\n", pid, pathname );
    309 
     305        printf("PARENT\n");
     306        exit(0);
    310307    }
    311308
     
    590587parse("load /bin/user/sort.elf");
    591588// @@@
     589
     590
    592591   
    593592        while (1)
Note: See TracChangeset for help on using the changeset viewer.