Example #1
0
File: signal.c Project: ggwpez/sxlb
void default_handler(int sig)
{
	switch(sig)
	{
		case SIGTERM:
			break;
		case SIGSEGV:
			break;
		case SIGINT:
			break;
		case SIGILL:
			break;
		case SIGABRT:
			SYSCALL0(SYSCNUM_TASK_EXIT);
			break;
		case SIGFPE:
			break;
	}
}
Example #2
0
//------------------------------------------------------------------------------
// Start the show
//------------------------------------------------------------------------------
int main(int argc, char **argv)
{
  tbthread_init();
  tbthread_attr_t  attr[10];
  int              st = 0;

  //----------------------------------------------------------------------------
  // Warn about not being root
  //----------------------------------------------------------------------------
  if(SYSCALL0(__NR_getuid) != 0)
    tbprint("[!!!] You should run this test as root\n");

  //----------------------------------------------------------------------------
  // Run the threads with normal policy
  //----------------------------------------------------------------------------
  for(int i = 0; i < 10; ++i)
    tbthread_attr_init(&attr[i]);

  if((st = run(attr)))
    goto exit;

  //----------------------------------------------------------------------------
  // Run the threads with FIFO policy
  //----------------------------------------------------------------------------
  tbthread_setschedparam(tbthread_self(), SCHED_FIFO, 99);
  for(int i = 0; i < 10; ++i) {
    int priority = 10-i/3;
    tbthread_attr_setschedpolicy(&attr[i], SCHED_FIFO);
    tbthread_attr_setschedpriority(&attr[i], priority);
    tbthread_attr_setinheritsched(&attr[i], TBTHREAD_EXPLICIT_SCHED);
  }

  if((st = run(attr)))
    goto exit;

exit:
  tbthread_finit();
  return st;
};