Changeset 440 for trunk/user/ksh


Ignore:
Timestamp:
May 3, 2018, 5:51:22 PM (6 years ago)
Author:
alain
Message:

1/ Fix a bug in the Multithreaded "sort" applicationr:
The pthread_create() arguments must be declared as global variables.
2/ The exit syscall can be called by any thread of a process..

Location:
trunk/user/ksh
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/user/ksh/Makefile

    r439 r440  
    2525
    2626clean:
    27         rm -rf build/*.o build/*.elf build/*.o.txt
     27        rm -rf build/*.o build/*.elf build/*.txt
    2828
    2929.PHONY: dirs clean
  • trunk/user/ksh/ksh.c

    r437 r440  
    380380    if( pid == 0 )
    381381    {
    382                 printf("  error: ilegal pid format\n" );
     382                printf("  error: kernel process 0 cannot be killed\n" );
    383383        }
    384384
    385385        if( kill( pid , SIGKILL ) )
    386386    {
    387                 printf("  error: unable to kill process %x\n", pid );
     387                printf("  error: process %x cannot be killed\n", pid );
    388388        }
    389389}   // end cmd_kill()
     
    421421    {
    422422        printf("  error: ksh process unable to fork\n");
     423        return;
    423424    }
    424425    else if (ret_fork == 0)      // it is the CHILD process
     
    433434        {
    434435            printf("  error: new process unable to exec <%s>\n", pathname );
    435             exit(0);
     436            return;
    436437        }   
    437438        }
     
    445446        if( rcv_pid == new_pid )
    446447        {
    447             printf("\n\n   exit %s / status = %x\n\n", pathname, (status &0xFF) );
     448            printf("\n\n   %s normal termination / status = %x\n\n",
     449            pathname , (status &0xFF) );
     450            return;
    448451        }
    449452        else
    450453        {
    451             printf("\n\n   abnormal termination for %s \n\n", pathname );
     454            printf("\n\n   %s abnormal termination / status = %x\n\n",
     455            pathname , (status &0xFF) );
     456            return;
    452457        }
    453458    }
    454                  
    455459}   // end cmd_load
    456460
     
    689693        ptr   = 0;
    690694
    691         printf( "~~~ shell ~~~\n\n" );
     695        printf( "\n\n~~~ shell ~~~\n\n" );
    692696
    693697        // command buffer initialisation
Note: See TracChangeset for help on using the changeset viewer.