/*
 * kill the selected connection connection
 */
static void gtkui_connection_kill(void *conn)
{
   GtkTreeIter iter;
   GtkTreeModel *model;
   struct conn_tail *c = NULL;

   DEBUG_MSG("gtkui_connection_kill");

   model = GTK_TREE_MODEL (ls_conns);

   if (gtk_tree_selection_get_selected (GTK_TREE_SELECTION (selection), &model, &iter)) {
      gtk_tree_model_get (model, &iter, 9, &c, -1);
   } else
      return; /* nothing is selected */

   if (!c || !c->co)
      return;
   
   /* kill it */
   switch (user_kill(c->co)) {
      case ESUCCESS:
         /* set the status */
         c->co->status = CONN_KILLED;
         gtkui_message("The connection was killed !!");
         break;
      case -EFATAL:
         gtkui_message("Cannot kill UDP connections !!");
         break;
   }
}
Exemple #2
0
/*!*****************************************************************************
 *******************************************************************************
\note  stop
\date  August 7, 1992 
   
\remarks 

       send pump into low pressure and terminate loops

 *******************************************************************************
 Function Parameters: [in]=input,[out]=output

    none

 ******************************************************************************/
int
stop(char *msg)
{

  int i;

  user_kill();
  zero_integrator();
  dms();
  beep(1);
  printf("%s\n",msg);
  
  return TRUE;

}
/*
 * call the specialized funtion as this is a callback 
 * without the parameter
 */
static void gtkui_connection_kill_curr_conn(void)
{
   DEBUG_MSG("gtkui_connection_kill_curr_conn");
   
   /* kill it */
   switch (user_kill(curr_conn)) {
      case ESUCCESS:
         /* set the status */
         curr_conn->status = CONN_KILLED;
         gtkui_message("The connection was killed !!");
         break;
      case -EFATAL:
         gtkui_message("Cannot kill UDP connections !!");
         break;
   }
}
/*
 * kill the selected connection connection
 */
static void curses_connection_kill(void *conn)
{
   struct conn_tail *c = (struct conn_tail *)conn;
   
   DEBUG_MSG("curses_connection_kill");
  
   /* kill it */
   switch (user_kill(c->co)) {
      case E_SUCCESS:
         /* set the status */
         c->co->status = CONN_KILLED;
         curses_message("The connection was killed !!");
         break;
      case -E_FATAL:
         curses_message("Cannot kill UDP connections !!");
         break;
   }
   
}
Exemple #5
0
/**
 * @ingroup shell
 *
 * Take a system call number and run that system call.  This is only for
 * demonstration.
 * @param nargs number of arguments
 * @param args  array of arguments
 * @return non-zero value on error
 */
shellcmd xsh_user(int nargs, char **args)
{
    static mailbox mybox;
    int call_num;
    char buffer[BUF_LENGTH];

    if (nargs != 2)
    {
        printf("Insufficient arguments.\n");
        printf("Try again later.\n");
        return 1;
    }

    call_num = atoi(args[1]);

    switch (call_num)
    {
    case 0:
        user_none();
        break;
    case 1:
        user_yield();
        break;
    case 2:
        user_sleep(4000);
        break;
    case 3:
        user_kill(5);           // pick a better number
        break;
    case 4:
        user_open(LOOP, 0);
        break;
    case 5:
        user_control(LOOP, 0, 1, 2);
        break;
    case 6:
        sprintf(buffer, "Process %d\n", gettid());
        user_write(LOOP, buffer, BUF_LENGTH);
        break;
    case 7:
        user_read(LOOP, buffer, BUF_LENGTH);
        printf("%s\n", buffer);
        break;
    case 8:
        user_putc(LOOP, 'm');
        break;
    case 9:
        printf("%c\n", user_getc(LOOP));
        break;
    case 10:
        user_seek(LOOP, 5);
        break;
    case 11:
        user_close(LOOP);
        break;
    case 12:
        printf("%d\n", user_getdev("LOOP"));
        break;
    case 13:
        mybox = user_mboxalloc(50);
        printf("Mailbox %d assigned.\n", mybox);
        break;
    case 14:
        user_mboxfree(mybox);
        break;
    case 15:
        user_mboxsend(mybox, 0xa5a5a5a5);
        break;
    case 16:
        printf("0x%08x\n", user_mboxrecv(mybox));
        break;
    default:
        printf("No corresponding call.\n");
    }

    return 0;
}