Ejemplo n.º 1
0
int
main (void)
{
  int i;
  wchar_t narrow = 97;
  wchar_t single = 0xbeef;
  wchar_t simple[] = L"facile";
  wchar_t difficile[] = { 0xdead, 0xbeef, 0xfeed, 0xface};
  wchar_t mixed[] = {L'f', 0xdead, L'a', L'c', 0xfeed, 0xface};
  wchar_t *cent = L"\242";
  wchar_t repeat[128];
  wchar_t *repeat_p = repeat;

  repeat[0] = 0;
  wcscat (repeat, L"A");
  for (i = 0; i < 21; ++i)
    wcscat (repeat, cent);
  wcscat (repeat, L"B");

  do_nothing (&narrow); /* START */
  do_nothing (&single);
  do_nothing (simple);
  do_nothing (difficile);
  do_nothing (mixed);
}
Ejemplo n.º 2
0
/* check block lock configuration and display status of 64 blocks, 1=locked, 0=unlocked */
void check_lock_bit_status (void)
{

	int block;

	volatile FLASH_TYPE *block_addr;

	/* address bit A0 is not used when obtaining identifier codes */

/* 11/01/00 */
/*	unsigned long addr = 0x2<<1; */
	unsigned long addr = 0x4;

	unsigned char block_lock_status[64];

	block_addr = (volatile FLASH_TYPE *) addr; 

/*	printf("Checking lock status of %d blocks, 1=locked, 0=unlocked...\n", block ); */

		/* address bit A0 is not used when obtaining identifier codes */
	for (block=0; block<=63; block++)
	{

		*FLASH_P2V(block_addr) = READ_ID_CMD; 

		block_lock_status[block] = *FLASH_P2V(block_addr);

		*FLASH_P2V(block_addr) = RESET_CMD;
		
		do_nothing();

/* 11/01/00 */
		do_nothing();

		block_lock_status[block] &= 0x01;	/* Checking lock status of block, 1=locked, 0=unlocked */

		block_addr = (volatile FLASH_TYPE *)((unsigned long)block_addr + (unsigned long)FLASH_BLOCK_SIZE); /* block address offset for byte wide data storage */
	}


	for (block=0; block<=63; block++)
	{
		if (block == 32)
		{
			printf("\n\r");
		}
		printf("%d ", block_lock_status[block] );
	}
	printf("\nDone!\n\n" );

/**	return; **/
}
Ejemplo n.º 3
0
int main(int argc, char *argv[]) {
	int pid, j, status;

	for (j=0; j<NFORKS; j++) {

		/*** error handling ***/
		if ((pid = fork()) < 0 ) {
			printf ("fork failed with error code= %d\n", pid);
			exit(0);
		}

		/*** this is the child of the fork ***/
		else if (pid ==0) {
			do_nothing();
			exit(0);
		}

		/*** this is the parent of the fork ***/
		else {
			waitpid(pid, status, 0);
		}
	}
	
	return 0;
}  
Ejemplo n.º 4
0
int main (int argc, char *argv[])
{
  jmp_buf env;
  int foo = 5;
  int bar = 42;
  int i, j;

  if (argc == 2 && strcmp (argv[1], "exit") == 0)
    return 0;

  do_nothing ();

  i = 0;
  /* Break at increase.  */
  increase (&i);
  increase (&i);
  increase (&i);

  for (i = 0; i < 10; i++)
    {
      j += 1; /* Condition Break.  */
    }

  if (setjmp (env) == 0) /* longjmp caught */
    {
      call_longjmp (&env);
    }
  else
    j += 1; /* after longjmp.  */

  test_exec_exit (argv[0]);

  return j; /* Break at end.  */
}
Ejemplo n.º 5
0
int main ()
{
    // Use a simple count to simulate a barrier.
    pseudo_barrier_init(g_barrier, 2);

    // Create a thread to hit the breakpoint.
    std::thread thread_1(step_thread_func);

    // Wait until the step thread is stepping
    while (g_test < 1)
        do_nothing();

    // Create a thread to exit while we're stepping.
    std::thread thread_2(create_thread_func, &thread_1);

    // Wait until that thread is started
    pseudo_barrier_wait(g_barrier);

    // Let the stepping thread know the other thread is there
    g_thread_created = 1;

    // Wait for the threads to finish.
    thread_2.join();
    thread_1.join();

    return 0;
}
int main(int argc, char** argv)
{
        int err;
        err = do_nothing2();
        if (err) return err;
        return do_nothing();
}
Ejemplo n.º 7
0
int main(int argc, const char* argv[])
{
    void* p = msrv_alloc(50);
    /* leak it */
    do_nothing(p);
    return 0;
}
Ejemplo n.º 8
0
int main()
{
    do_nothing();
    one();
    printf("Hello, world\n");
    return 0;
}
Ejemplo n.º 9
0
int first(){
  int i;

  for (i = 0; i < 2; i++)
    do_nothing ();

  return second();
}
Ejemplo n.º 10
0
/* sec 0073 */
void print_err (const char * s)
{
  if (interaction == error_stop_mode)
    do_nothing();
  
  print_nl("! ");
  prints(s);
}
Ejemplo n.º 11
0
void delay_and_flush (void)
{

	do_nothing(); 

	_flushICache();

}
Ejemplo n.º 12
0
int
main ()
{
  int i;

  for (i = 0; i < 2; i++)
    do_nothing ();
  return 0;
}
Ejemplo n.º 13
0
int main(int argc,char** argv) {
  int st;

  if (!fork()) {
    do_nothing(time(0));
    read(0,c,4);
    if (c[0] == 0x00) dostuff1();
  } else wait(&st);

}
Ejemplo n.º 14
0
static void execute_location(void *dst)
{
	void (*func)(void) = dst;

	pr_info("attempting ok execution at %p\n", do_nothing);
	do_nothing();

	memcpy(dst, do_nothing, EXEC_SIZE);
	flush_icache_range((unsigned long)dst, (unsigned long)dst + EXEC_SIZE);
	pr_info("attempting bad execution at %p\n", func);
	func();
}
Ejemplo n.º 15
0
/**
 * Writes the file statistics in a line "line"
 */
static bool get_file_info(const char *file_name, char *line){
	if(line==NULL)
		return FALSE;
	struct stat s_buff;
	if(is_special_dir(file_name))
		do_nothing();//return FALSE;
	int status = stat(file_name,&s_buff);
	if(status==0) {
		return get_file_info_stat(file_name,line,&s_buff);
	}
	return FALSE;
}
Ejemplo n.º 16
0
int main( int argc, char * argv[] )
{
    char * buffer;

    buffer = (char *)malloc( 64 );
    strcpy( buffer, "abc" );
    printf("%s\n", buffer );
    do_nothing();
    printf("returned from do_nothing.\n");
    free( buffer );
    return 0;
}
Ejemplo n.º 17
0
int main ()
{
  callee1 (2, "A string argument.", 3.5);
  callee1 (2, "A string argument.", 3.5);

  do_nothing (); /* Hello, World! */

  callme (1);
  callme (2);

  return 0;
}
Ejemplo n.º 18
0
void *
exit_thread_func (void *input)
{
    // Wait until both threads are started.
    pseudo_barrier_wait(g_barrier);

    // Wait until the other thread is stepping.
    while (g_test == 0)
      do_nothing();

    // Return
    return NULL;
}
Ejemplo n.º 19
0
static void execute_user_location(void *dst)
{
	/* Intentionally crossing kernel/user memory boundary. */
	void (*func)(void) = dst;

	pr_info("attempting ok execution at %p\n", do_nothing);
	do_nothing();

	if (copy_to_user((void __user *)dst, do_nothing, EXEC_SIZE))
		return;
	flush_icache_range((unsigned long)dst, (unsigned long)dst + EXEC_SIZE);
	pr_info("attempting bad execution at %p\n", func);
	func();
}
Ejemplo n.º 20
0
void
test1(int denom)
{
    double r1, r2;
    int t1, t2;
    
    r1 = recip(denom); /* Stored in memory */
    r2 = recip(denom); /* Stored in register */
    t1 = r1 == r2;     /* Compares register to memory */
    do_nothing();      /* Forces register save to memory */
    t2 = r1 == r2;     /* Compares memory to memory */
    printf("test1 t1: r1 %f %c= r2 %f\n", r1, t1 ? '=' : '!', r2);
    printf("test1 t2: r1 %f %c= r2 %f\n", r1, t2 ? '=' : '!', r2);
}
Ejemplo n.º 21
0
static noinline void execute_location(void *dst, bool write)
{
	void (*func)(void) = dst;

	pr_info("attempting ok execution at %p\n", do_nothing);
	do_nothing();

	if (write == CODE_WRITE) {
		memcpy(dst, do_nothing, EXEC_SIZE);
		flush_icache_range((unsigned long)dst,
				   (unsigned long)dst + EXEC_SIZE);
	}
	pr_info("attempting bad execution at %p\n", func);
	func();
}
Ejemplo n.º 22
0
void
test3(int denom)
{
    long double r1, r2;
    int t1, t2, t3;
    
    r1 = recip_1(denom);
    r2 = recip_1(denom); /* Stored in register */
    t1 = r1 == r2;     /* Compares register to memory */
    do_nothing();      /* Forces register save to memory */
    t2 = r1 == r2;     /* Compares memory to memory */
    t3 = r1 == 1.0 / (long double) denom;
    printf("test3 t1: r1 %f %c= r2 %f\n", (double) r1, t1 ? '=' : '!', (double) r2);
    printf("test3 t2: r1 %f %c= r2 %f\n", (double) r1, t2 ? '=' : '!', (double) r2);
    printf("test3 t3: r1 %f %c= 1.0/10.0\n", (double) r1, t2 ? '=' : '!');
}
Ejemplo n.º 23
0
int main(int argc, char ** argv)
{
	int pid[NRTASKS], i, parm[NRTASKS], ret;

	test_init(argc, argv);

	parm[0] = -20;
	parm[1] = 19;
	parm[2] = 1;

	for (i = 0; i < NRTASKS; i++) {
		pid[i] = fork();
		if (!pid[i])
			return do_nothing();

		if (setpriority(PRIO_PROCESS, pid[i], parm[i])) {
			pr_perror("Can't set prio %d", i);
			kill_all(pid, i);
			return -1;
		}
	}

	test_daemon();
	test_waitsig();

	for (i = 0; i < NRTASKS; i++) {
		errno = 0;
		ret = getpriority(PRIO_PROCESS, pid[i]);
		if (errno) {
			fail("No prio for task %d", i);
			break;
		}

		if (ret != parm[i]) {
			fail("Broken nice for %d", i);
			break;
		}
	}

	if (i == NRTASKS)
		pass();

	kill_all(pid, NRTASKS);
	return 0;
}
void main(int args, char **stuff) {
	int i=0;
	for(;i<NUMFORKS;i++) {
		int pid = fork();
		if (pid == 0) {
			do_nothing();
			exit(0);
		}
		else if (pid>0) {
			int status = -1;
			waitpid(pid, status, 0);
		}
		else {
			printf("ERROR");
			exit(1);
		}
	}
}
Ejemplo n.º 25
0
void 
open_view(void)
{
	switch(command_type){
		case IS_LS:
			RenderLs(ls_type);
			break;
		case IS_GREP:
			RenderGrep();
			break;
		case IS_FIND:
			RenderFind();
			break;
		default:
			do_nothing();
			break;
	}
}
Ejemplo n.º 26
0
/*
 *This function is use to update the line
 * which will show in highlight.
 * The render function is depend on the 
 * command_type
 * */
void 
Redraw_view(void)
{
	switch(command_type){
		case IS_LS:
			Draw_LS_OutPut();
			break;
		case IS_GREP:
			Draw_Grep_OutPut();
			break;
		case IS_FIND:
			Draw_Find_OutPut();
			break;
		default:
			do_nothing();
			break;
	}
	redrawwin(stdscr);
	wrefresh(stdscr);
}
Ejemplo n.º 27
0
void
Reload_info(void)
{
	switch(command_type){
		case IS_LS:
			RenderLs(ls_type);
			break;
		case IS_GREP:
			RenderGrep();
			break;
		case IS_FIND:
			RenderFind();
			break;
		default:
			do_nothing();
			break;
	}
	redrawwin(stdscr);
	wrefresh(stdscr);
}
Ejemplo n.º 28
0
void FMEMultipoleKernel::multipoleApproxSingleThreaded(ArrayPartition& nodePointPartition)
{
	FMELocalContext*  localContext	= m_pLocalContext;
	FMEGlobalContext* globalContext = m_pGlobalContext;
	LinearQuadtree&	tree			= *globalContext->pQuadtree;
	if (isMainThread())
	{									
		tree.bottom_up_traversal(					// do a bottom up traversal M2M pass
			if_then_else(tree.is_leaf_condition(),	// if the current node is a leaf
				p2m_function(localContext),			// then calculate the multipole coeff. due to the points in the leaf
				m2m_function(localContext)			// else shift the coefficents of all children to center of the inner node
			)
		)(tree.root());
	
		tree.forall_well_separated_pairs(				// do a wspd traversal M2L direct eval
			pair_vice_versa(m2l_function(localContext)),// M2L for a well-separated pair
			p2p_function(localContext),					// direct evaluation
			p2p_function(localContext)					// direct evaluation
		)(tree.root());
	
		tree.top_down_traversal(						// top down traversal 
			if_then_else( tree.is_leaf_condition(),		// if the node is a leaf
				do_nothing(),							// then do nothing, we will deal with this case later
				l2l_function(localContext)				// else shift the nodes local coeffs to the children
			)
		)(tree.root());// start at the root 

		// evaluate all leaves and store the forces in the threads array
		for_loop(nodePointPartition,				// loop over points
			func_comp(								// composition of two statements
				l2p_function(localContext),			// evaluate the forces due to the local expansion in the corresponding leaf
				collect_force_function				// collect the forces of all threads with the following options:
				<
					COLLECT_REPULSIVE_FACTOR | 		// multiply by the repulsive factor stored in the global options
					COLLECT_TREE_2_GRAPH_ORDER |	// threads data is stored in quadtree leaf order, transform it into graph order
					COLLECT_ZERO_THREAD_ARRAY		// reset threads array
				>(localContext)
			)
		);
	};
};
Ejemplo n.º 29
0
int main(int argc, char ** argv)
{
	int pid, ret, err = 0;
	struct sched_param p;

	test_init(argc, argv);

	pid = fork();
	if (!pid)
		return do_nothing();

	p.sched_priority = parm;
	if (sched_setscheduler(pid, SCHED_RR, &p)) {
		err("Can't set policy");
		kill(pid, SIGKILL);
		return -1;
	}

	test_daemon();
	test_waitsig();

	ret = sched_getscheduler(pid);
	if (ret != SCHED_RR) {
		fail("Broken/No policy");
		err++;
	}

	ret = sched_getparam(pid, &p);
	if (ret < 0 || p.sched_priority != parm) {
		fail("Broken prio");
		err++;
	}

	if (!err)
		pass();

	kill(pid, SIGKILL);
	return err;
}
Ejemplo n.º 30
0
int main (){
  do_nothing();
  return first();
}