Index: soft/giet_vm/applications/shell/shell.c
===================================================================
--- soft/giet_vm/applications/shell/main.c	(revision 703)
+++ soft/giet_vm/applications/shell/shell.c	(revision 708)
@@ -1,4 +1,4 @@
 ///////////////////////////////////////////////////////////////////////////////////////
-// File   : main.c   (for shell application)
+// File   : shell.c   
 // Date   : july 2015
 // author : ClÃ©ment GuÃ©rin
@@ -17,4 +17,5 @@
 {
     char *name;
+    char *desc;
     void (*fn)(int, char**);
 };
@@ -35,12 +36,12 @@
     for (i = 0; cmd[i].name; i++)
     {
-        giet_tty_printf("\t%s\n", cmd[i].name);
-    }
-}
-
-///////////////////////////////////////////////
-static void cmd_proctime(int argc, char** argv)
-{
-    giet_tty_printf("%u\n", giet_proctime());
+        giet_tty_printf("\t%s\t : %s\n", cmd[i].name , cmd[i].desc );
+    }
+}
+
+///////////////////////////////////////////
+static void cmd_time(int argc, char** argv)
+{
+    giet_tty_printf("%d\n", giet_proctime());
 }
 
@@ -52,11 +53,14 @@
 
     if (argc < 2)
-        fd = giet_fat_opendir("/");
-    else
-        fd = giet_fat_opendir(argv[1]);
+    {
+        giet_tty_printf("  usage : %s <pathname>\n", argv[0]);
+        return;
+    }
+
+    fd = giet_fat_opendir(argv[1]);
 
     if (fd < 0)
     {
-        giet_tty_printf("can't list directory (err=%d)\n", fd);
+        giet_tty_printf("  error : cannot open %s / err = %d)\n", argv[1], fd);
         return;
     }
@@ -81,12 +85,13 @@
     if (argc < 2)
     {
-        giet_tty_printf("%s <path>\n", argv[0]);
+        giet_tty_printf("  usage : %s <path>\n", argv[0]);
         return;
     }
 
     int ret = giet_fat_mkdir(argv[1]);
+
     if (ret < 0)
     {
-        giet_tty_printf("can't create directory (err=%d)\n", ret);
+        giet_tty_printf("  error : cannot create directory %s / err = %d\n", argv[1], ret);
     }
 }
@@ -97,5 +102,5 @@
     if (argc < 3)
     {
-        giet_tty_printf("%s <src> <dst>\n", argv[0]);
+        giet_tty_printf("  usage : %s <src> <dst>\n", argv[0]);
         return;
     }
@@ -111,27 +116,31 @@
     if (src_fd < 0)
     {
-        giet_tty_printf("can't open %s (err=%d)\n", argv[1], src_fd);
+        giet_tty_printf("  error : cannot open %s / err = %d\n", argv[1], src_fd);
         goto exit;
     }
 
     giet_fat_file_info(src_fd, &info);
+
     if (info.is_dir)
     {
-        giet_tty_printf("can't copy a directory\n");
+        giet_tty_printf("  error : %s is a directory\n", argv[1] );
         goto exit;
     }
+
     size = info.size;
 
     dst_fd = giet_fat_open( argv[2] , O_CREATE | O_TRUNC );
+
     if (dst_fd < 0)
     {
-        giet_tty_printf("can't open %s (err=%d)\n", argv[2], dst_fd);
+        giet_tty_printf("  error : cannot open %s / err = %d\n", argv[2], dst_fd);
         goto exit;
     }
 
     giet_fat_file_info(dst_fd, &info);
+
     if (info.is_dir)
     {
-        giet_tty_printf("can't copy to a directory\n"); // TODO
+        giet_tty_printf("error : %s is a directory\n", argv[2] );  // TODO
         goto exit;
     }
@@ -149,5 +158,5 @@
         if (wlen != len)
         {
-            giet_tty_printf("\nwrite error\n");
+            giet_tty_printf("  error : cannot write on device\n");
             goto exit;
         }
@@ -168,12 +177,13 @@
     if (argc < 2)
     {
-        giet_tty_printf("%s <file>\n", argv[0]);
+        giet_tty_printf("  usage : %s <file>\n", argv[0]);
         return;
     }
 
     int ret = giet_fat_remove(argv[1], 0);
+
     if (ret < 0)
     {
-        giet_tty_printf("can't remove %s (err=%d)\n", argv[1], ret);
+        giet_tty_printf("  error : cannot remove %s / err = %d\n", argv[1], ret );
     }
 }
@@ -184,5 +194,5 @@
     if (argc < 2)
     {
-        giet_tty_printf("%s <path>\n", argv[0]);
+        giet_tty_printf("  usage : %s <pathname>\n", argv[0]);
         return;
     }
@@ -191,5 +201,5 @@
     if (ret < 0)
     {
-        giet_tty_printf("can't remove %s (err=%d)\n", argv[1], ret);
+        giet_tty_printf("  error : cannot remove %s / err = %d\n", argv[1], ret );
     }
 }
@@ -200,5 +210,5 @@
     if (argc < 3)
     {
-        giet_tty_printf("%s <src> <dst>\n", argv[0]);
+        giet_tty_printf("  usage : %s <src> <dst>\n", argv[0]);
         return;
     }
@@ -207,5 +217,5 @@
     if (ret < 0)
     {
-        giet_tty_printf("can't move %s to %s (err=%d)\n", argv[1], argv[2], ret);
+        giet_tty_printf("error : cannot move %s to %s / err = %d\n", argv[1], argv[2], ret );
     }
 }
@@ -216,5 +226,5 @@
     if (argc < 2)
     {
-        giet_tty_printf("%s <pathname>\n", argv[0]);
+        giet_tty_printf("  usage : %s <vspace_name>\n", argv[0]);
         return;
     }
@@ -223,5 +233,5 @@
     if ( ret == -1 )
     {
-        giet_tty_printf("\n  error : %s not found\n", argv[1] );
+        giet_tty_printf("  error : %s not found\n", argv[1] );
     }
 }
@@ -232,5 +242,5 @@
     if (argc < 2)
     {
-        giet_tty_printf("%s <pathname>\n", argv[0]);
+        giet_tty_printf("  usage : %s <vspace_name>\n", argv[0]);
         return;
     }
@@ -239,53 +249,105 @@
     if ( ret == -1 )
     {
-        giet_tty_printf("\n  error : %s not found\n", argv[1] );
+        giet_tty_printf("  error : %s not found\n", argv[1] );
     }
     if ( ret == -2 )
     {
-        giet_tty_printf("\n  error : %s cannot be killed\n", argv[1] );
-    }
-}
-
-///////////////////////////////////////////////
+        giet_tty_printf("  error : %s cannot be killed\n", argv[1] );
+    }
+}
+
+/////////////////////////////////////////
 static void cmd_ps(int argc, char** argv)
 {
-    giet_tasks_status();
-}
-
-///////////////////////////////////////////////
-static void cmd_sleep(int argc, char** argv)
-{
-    int start = giet_proctime();
-
-    if (argc < 2)
-    {
-        giet_tty_printf("%s <cycles>\n", argv[0]);
-        return;
-    }
-
-    while (giet_proctime() < start + atoi(argv[1]));
-}
+    giet_applications_status();
+}
+
+////////////////////////////////////////////
+static void cmd_pause(int argc, char** argv)
+{
+    if (argc < 3)
+    {
+        giet_tty_printf("  usage : %s <vspace_name> <thread_name>\n", argv[0] );
+        return;
+    }
+
+    int ret = giet_pthread_pause( argv[1] , argv[2] );
+
+    if ( ret == -1 )
+    {
+        giet_tty_printf("  error : vspace %s not found\n", argv[1] );
+    }
+    if ( ret == -2 )
+    {
+        giet_tty_printf("  error : thread %s not found\n", argv[2] );
+    }
+}
+
+/////////////////////////////////////////////
+static void cmd_resume(int argc, char** argv)
+{
+    if (argc < 3)
+    {
+        giet_tty_printf("  usage : %s <vspace_name> <thread_name>\n", argv[0] );
+        return;
+    }
+
+    int ret = giet_pthread_resume( argv[1] , argv[2] );
+
+    if ( ret == -1 )
+    {
+        giet_tty_printf("  error : vspace %s not found\n", argv[1] );
+    }
+    if ( ret == -2 )
+    {
+        giet_tty_printf("  error : thread %s not found\n", argv[2] );
+    }
+}
+
+/////////////////////////////////////////////
+static void cmd_context(int argc, char** argv)
+{
+    if (argc < 3)
+    {
+        giet_tty_printf("  usage : %s <vspace_name> <thread_name>\n", argv[0] );
+        return;
+    }
+
+    int ret = giet_pthread_context( argv[1] , argv[2] );
+
+    if ( ret == -1 )
+    {
+        giet_tty_printf("  error : vspace %s not found\n", argv[1] );
+    }
+    if ( ret == -2 )
+    {
+        giet_tty_printf("  error : thread %s not found\n", argv[2] );
+    }
+}
+
 
 ////////////////////////////////////////////////////////////////////
 struct command_t cmd[] =
 {
-    { "help",       cmd_help },
-    { "proctime",   cmd_proctime },
-    { "ls",         cmd_ls },
-    { "mkdir",      cmd_mkdir },
-    { "cp",         cmd_cp },
-    { "rm",         cmd_rm },
-    { "rmdir",      cmd_rmdir },
-    { "mv",         cmd_mv },
-    { "exec",       cmd_exec },
-    { "kill",       cmd_kill },
-    { "ps",         cmd_ps },
-    { "sleep",      cmd_sleep },
-    { NULL,         NULL }
+    { "help",       "list available commands",              cmd_help },
+    { "time",       "return current date",                  cmd_time },
+    { "ls",         "list content of a directory",          cmd_ls },
+    { "mkdir",      "create a new directory",               cmd_mkdir },
+    { "cp",         "replicate a file in file system",      cmd_cp },
+    { "rm",         "remove a file from file system",       cmd_rm },
+    { "rmdir",      "remove a directory from file system",  cmd_rmdir },
+    { "mv",         "move a file in file system",           cmd_mv },
+    { "exec",       "start an application",                 cmd_exec },
+    { "kill",       "kill an application (all threads)",    cmd_kill },
+    { "ps",         "list all mapped applications status",  cmd_ps },
+    { "pause",      "pause a thread",                       cmd_pause },
+    { "resume",     "resume a thread",                      cmd_resume },
+    { "context",    "display a thread context",             cmd_context },
+    { NULL,         NULL,                                   NULL }
 };
 
 // shell
 
-///////////////////////////////////////
+////////////////////////////
 static void parse(char *buf)
 {
@@ -351,5 +413,5 @@
     // get a private TTY
     giet_tty_alloc( 0 );
-    giet_tty_printf( "~~~ shell ~~~\n" );
+    giet_tty_printf( "~~~ shell ~~~\n\n" );
 
     // display first prompt
