コード例 #1
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_init_stat_reinitializes_if_already_initialized() {
  assert_true( init_stat() );
  assert_true( init_stat() );
  assert_true( stats != NULL );

  assert_true( finalize_stat() );
}
コード例 #2
0
ファイル: testalign.c プロジェクト: deniskin82/chapel
void oneway_nb_test(int iters, int nbytes, int alignment)
{GASNET_BEGIN_FUNCTION();
    int i;
    int64_t begin, end;
    stat_struct_t st;
    gasnet_handle_t *handles;
    int pad = (alignment % PAGESZ);

	/* initialize statistics */
	init_stat(&st, nbytes, alignment);
	
	handles = (gasnet_handle_t*) test_malloc(sizeof(gasnet_handle_t) * iters);
	
	memset(locbuf+pad, 1, nbytes);

	BARRIER();
	
	if (iamsender) {
		/* measure the throughput of sending a message */
		begin = TIME();
                for (i = 0; i < iters; i++) {
                        handles[i] = gasnet_put_nb_bulk(peerproc, rembuf, locbuf+pad, nbytes);
                }
		gasnet_wait_syncnb_all(handles, iters); 
		end = TIME();
	 	update_stat(&st, (end - begin), iters);
	}
	
	BARRIER();
	
	if (iamsender) {
		print_stat(myproc, &st, "put_nb_bulk throughput", PRINT_THROUGHPUT);
	}	
	
	/* initialize statistics */
	init_stat(&st, nbytes, alignment);

	if (iamsender) {
		/* measure the throughput of receiving a message */
		begin = TIME();
                for (i = 0; i < iters; i++) {
                    handles[i] = gasnet_get_nb_bulk(locbuf, peerproc, rembuf+pad, nbytes);
                } 
		gasnet_wait_syncnb_all(handles, iters); 
		end = TIME();
	 	update_stat(&st, (end - begin), iters);
	}
	
	BARRIER();
	
	if (iamsender) {
		print_stat(myproc, &st, "get_nb_bulk throughput", PRINT_THROUGHPUT);
	}	
	
	test_free(handles);
}
コード例 #3
0
ファイル: testalign.c プロジェクト: deniskin82/chapel
void oneway_nbi_test(int iters, int nbytes, int alignment)
{GASNET_BEGIN_FUNCTION();
    int i;
    int64_t begin, end;
    stat_struct_t st;
    int pad = (alignment % PAGESZ);

	/* initialize statistics */
	init_stat(&st, nbytes, alignment);
	
	memset(locbuf+pad, 1, nbytes);

	BARRIER();
	
	if (iamsender) {
		/* measure the throughput of nonblocking implicit bulk put */
		begin = TIME();
		for (i = 0; i < iters; i++) {
			gasnet_put_nbi_bulk(peerproc, rembuf, locbuf+pad, nbytes);
		}
		gasnet_wait_syncnbi_puts();
		end = TIME();
	 	update_stat(&st, (end - begin), iters);
	}
	
	BARRIER();
	
	if (iamsender) {
		print_stat(myproc, &st, "put_nbi_bulk throughput", PRINT_THROUGHPUT);
	}	

	/* initialize statistics */
	init_stat(&st, nbytes, alignment);

	if (iamsender) {
		/* measure the throughput of nonblocking implicit bulk get */
		begin = TIME();
		for (i = 0; i < iters; i++) {
	 		gasnet_get_nbi_bulk(locbuf, peerproc, rembuf+pad, nbytes);
		}
		gasnet_wait_syncnbi_gets();
		end = TIME();
	 	update_stat(&st, (end - begin), iters);
	}
	
	BARRIER();
	
	if (iamsender) {
		print_stat(myproc, &st, "get_nbi_bulk throughput", PRINT_THROUGHPUT);
	}	
}
コード例 #4
0
ファイル: chibach.c プロジェクト: aigamo/trema
void
init_chibach( int *argc, char ***argv ) {
  assert( argc != NULL );
  assert( argv != NULL );

  chibach_log = NULL;
  initialized = false;
  chibach_started = false;
  run_as_daemon = false;

  chibach_name = xstrdup( basename( *argv[ 0 ] ) );

  parse_argv( argc, argv );
  set_chibach_home();
  set_chibach_tmp();
  check_chibach_tmp();
  if ( run_as_daemon ) {
    init_log( get_chibach_name(), get_chibach_log(), LOGGING_TYPE_FILE );
  }
  else {
    init_log( get_chibach_name(), get_chibach_log(), LOGGING_TYPE_FILE | LOGGING_TYPE_STDOUT );
  }
  ignore_sigpipe();
  set_exit_handler();
  set_usr1_handler();
  init_stat();
  init_timer();
  init_messenger( get_chibach_tmp() );
  if ( datapath_id != 0 ) {
    init_openflow_switch_interface( datapath_id, controller.ip, controller.port );
  }

  initialized = true;
}
コード例 #5
0
ファイル: testmemset.c プロジェクト: deniskin82/chapel
void bulk_test(int iters) {GASNET_BEGIN_FUNCTION();
    int i;
    int64_t begin, end;
    stat_struct_t stput;
    int payload;
    
	for (payload = min_payload; payload <= max_payload && payload > 0; payload *= 2) {
		init_stat(&stput, payload);

		BARRIER();
	
		if (iamsender) {
			/* measure the throughput of sending a message */
			begin = TIME();
			for (i = 0; i < iters; i++) {
				gasnet_memset(peerproc, tgtmem, 0xaa, payload);
			}
			end = TIME();
		 	update_stat(&stput, (end - begin), iters);
		}
	
		BARRIER();

		if (iamsender) {
			print_stat(myproc, &stput, "memset throughput", PRINT_THROUGHPUT);
		}	
	
	}

}
コード例 #6
0
ファイル: testmemset.c プロジェクト: deniskin82/chapel
void bulk_test_nb(int iters) {GASNET_BEGIN_FUNCTION();
    int i;
    int64_t begin, end;
    stat_struct_t stput;
    gasnet_handle_t *handles;
    int payload;
    
	handles = (gasnet_handle_t *) test_malloc(sizeof(gasnet_handle_t) * iters);

	for (payload = min_payload; payload <= max_payload && payload > 0; payload *= 2) {
		init_stat(&stput, payload);

		BARRIER();
	
		if (iamsender) {
			/* measure the throughput of sending a message */
			begin = TIME();
			for (i = 0; i < iters; i++) {
				handles[i] = gasnet_memset_nb(peerproc, tgtmem, 0x5a, payload);
			}
			gasnet_wait_syncnb_all(handles, iters);
			end = TIME();
		 	update_stat(&stput, (end - begin), iters);
		}
	
		BARRIER();
       
		if (iamsender) {
			print_stat(myproc, &stput, "memset_nb throughput", PRINT_THROUGHPUT);
		}	
	
	}

	test_free(handles);
}
コード例 #7
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_increment_stat_fails_if_key_is_NULL() {
  assert_true( init_stat() );

  expect_assert_failure( increment_stat( NULL ) );

  assert_true( finalize_stat() );
}
コード例 #8
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_foreach_stat_succeeds_without_entries() {
  assert_true( init_stat() );

  foreach_stat( mock_callback, NULL );

  assert_true( finalize_stat() );
}
コード例 #9
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_foreach_stat_fails_if_callback_function_is_NULL() {
  assert_true( init_stat() );

  expect_assert_failure( foreach_stat( NULL, NULL ) );

  assert_true( finalize_stat() );
}
コード例 #10
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_add_stat_entry_fails_with_duplicated_key() {
  assert_true( init_stat() );

  const char *key = "key";
  assert_true( add_stat_entry( key ) );
  assert_false( add_stat_entry( key ) );

  assert_true( finalize_stat() );
}
コード例 #11
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_dump_stats_succeeds_without_entries() {
  assert_true( init_stat() );

  expect_string( mock_info, message, "Statistics:" );
  expect_string( mock_info, message, "No statistics found." );
  dump_stats();

  assert_true( finalize_stat() );
}
コード例 #12
0
ファイル: firm.c プロジェクト: lu-zero/libfirm
void ir_init(void)
{
	/* for historical reasons be_init must be run first */
	firm_be_init();

	/* initialize firm flags */
	firm_init_flags();
	/* initialize all ident stuff */
	init_ident();
	/* Edges need hooks. */
	init_edges();
	/* create the type kinds. */
	init_tpop();
	/* create an obstack and put all tarvals in a pdeq */
	init_tarval_1(0l, /* support_quad_precision */0);
	/* Builds a basic program representation, so modes can be added. */
	init_irprog_1();
	/* initialize all modes an ir node can consist of */
	init_mode();
	/* initialize tarvals, and floating point arithmetic */
	init_tarval_2();
	/* initialize node opcodes */
	firm_init_op();
	/* init graph construction */
	firm_init_irgraph();
	/* kind of obstack initialization */
	firm_init_mangle();
	/* initialize reassociation */
	firm_init_reassociation();
	/* initialize function call optimization */
	firm_init_funccalls();
	/* initialize function inlining */
	firm_init_inline();
	/* initialize scalar replacement */
	firm_init_scalar_replace();
	/* Builds a construct allowing to access all information to be constructed
	   later. */
	init_irprog_2();
	/* memory disambiguation */
	firm_init_memory_disambiguator();
	firm_init_loop_opt();

	/* Init architecture dependent optimizations. */
	arch_dep_set_opts(arch_dep_none);

	init_execfreq();

	init_stat();

#ifdef DEBUG_libfirm
	/* integrated debugger extension */
	firm_init_debugger();
#endif
}
コード例 #13
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_add_stat_entry_succeeds() {
  assert_true( init_stat() );

  const char *key = "key";
  assert_true( add_stat_entry( key ) );
  stat_entry *entry = lookup_hash_entry( stats, key );
  assert_string_equal( entry->key, key );
  uint64_t expected_value = 0;
  assert_memory_equal( &entry->value, &expected_value, sizeof( uint64_t ) );

  assert_true( finalize_stat() );
}
コード例 #14
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_dump_stats_succeeds() {
  assert_true( init_stat() );

  const char *key = "key";
  increment_stat( key );

  expect_string( mock_info, message, "Statistics:" );
  expect_string( mock_info, message, "key: 1" );
  dump_stats();

  assert_true( finalize_stat() );
}
コード例 #15
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_increment_stat_succeeds_with_undefined_key() {
  assert_true( init_stat() );

  const char *key = "key";
  increment_stat( key );

  stat_entry *entry = lookup_hash_entry( stats, key );
  assert_string_equal( entry->key, key );
  uint64_t expected_value = 1;
  assert_memory_equal( &entry->value, &expected_value, sizeof( uint64_t ) );

  assert_true( finalize_stat() );
}
コード例 #16
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_reset_stats_succeeds_without_entries() {
  assert_true( init_stat() );

  reset_stats();

  hash_iterator iter;
  hash_entry *e = NULL;
  init_hash_iterator( stats, &iter );
  int n_entries = 0;
  while ( ( e = iterate_hash_next( &iter ) ) != NULL ) {
    n_entries++;
  }
  assert_int_equal( n_entries, 0 );

  assert_true( finalize_stat() );
}
コード例 #17
0
ファイル: glue.c プロジェクト: chazu/btmux
void LoadSpecialObjects(void)
{
	dbref i;
	int id, brand;
	int type;
	void *tmpdat;

	init_btdb_state(get_specialobjectsize);
	init_xcode_tree();

	muxevent_initialize();
	muxevent_count_initialize();
	init_stat();
	initialize_partname_tables();
	for(i = 0; MissileHitTable[i].key != -1; i++) {
		if(find_matching_vlong_part(MissileHitTable[i].name, NULL, &id,
									&brand))
			MissileHitTable[i].key = Weapon2I(id);
		else
			MissileHitTable[i].key = -2;
	}
	/* Loop through the entire database, and if it has the special */
	/* object flag, add it to our linked list. */
	DO_WHOLE_DB(i)
		if(Hardcode(i) && !Going(i) && !Halted(i)) {
			type = WhichSpecialS(i);
			if(type >= 0) {
				if(SpecialObjects[type].datasize > 0)
					tmpdat = NewSpecialObject(i, type);
				else
					tmpdat = NULL;
			} else
				c_Hardcode(i);	/* Reset the flag */
		}
	for(i = 0; i < NUM_SPECIAL_OBJECTS; i++) {
		InitSpecialHash(i);
		if(!SpecialObjects[i].updatefunc)
			SpecialObjects[i].updateTime = 0;
	}
	init_btechstats();
	load_xcode();
	zap_unneccessary_hcode();
}
コード例 #18
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_reset_stats_succeeds_with_single_entry() {
  assert_true( init_stat() );

  const char *key = "key";
  increment_stat( key );

  reset_stats();

  hash_iterator iter;
  hash_entry *e = NULL;
  init_hash_iterator( stats, &iter );
  int n_entries = 0;
  while ( ( e = iterate_hash_next( &iter ) ) != NULL ) {
    n_entries++;
  }
  assert_int_equal( n_entries, 0 );

  assert_true( finalize_stat() );
}
コード例 #19
0
ファイル: sys.c プロジェクト: jonludlam/xen-arm
int fstat(int fd, struct stat *buf)
{
    init_stat(buf);
    switch (files[fd].type) {
	case FTYPE_SAVEFILE:
	case FTYPE_CONSOLE:
	case FTYPE_SOCKET: {
            if (files[fd].type == FTYPE_CONSOLE)
                buf->st_mode = S_IFCHR|S_IRUSR|S_IWUSR;
            else if (files[fd].type == FTYPE_SOCKET)
                buf->st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
            else if (files[fd].type == FTYPE_SAVEFILE)
                buf->st_mode = S_IFREG|S_IRUSR|S_IWUSR;
	    buf->st_uid = 0;
	    buf->st_gid = 0;
	    buf->st_size = 0;
	    buf->st_atime = 
	    buf->st_mtime = 
	    buf->st_ctime = time(NULL);
	    return 0;
	}
#ifdef CONFIG_BLKFRONT
	case FTYPE_BLK:
	   return blkfront_posix_fstat(fd, buf);
#endif
#ifdef CONFIG_TPMFRONT
	case FTYPE_TPMFRONT:
	   return tpmfront_posix_fstat(fd, buf);
#endif
#ifdef CONFIG_TPM_TIS
	case FTYPE_TPM_TIS:
	   return tpm_tis_posix_fstat(fd, buf);
#endif
	default:
	    break;
    }

    printk("statf(%d): Bad descriptor\n", fd);
    errno = EBADF;
    return -1;
}
コード例 #20
0
ファイル: sys.c プロジェクト: carriercomm/minios-hacks
int fstat(int fd, struct stat *buf)
{
    if (fd < 0 || fd >= NOFILE) {
	fd = EBADF;
	return -1;
    }
    init_stat(buf);
    switch (files[fd].type) {
	case FTYPE_SAVEFILE:
	case FTYPE_CONSOLE:
	case FTYPE_SOCKET: {
            if (files[fd].type == FTYPE_CONSOLE)
                buf->st_mode = S_IFCHR|S_IRUSR|S_IWUSR;
            else if (files[fd].type == FTYPE_SOCKET)
                buf->st_mode = S_IFSOCK|S_IRUSR|S_IWUSR;
            else if (files[fd].type == FTYPE_SAVEFILE)
                buf->st_mode = S_IFREG|S_IRUSR|S_IWUSR;
	    buf->st_uid = 0;
	    buf->st_gid = 0;
	    buf->st_size = 0;
	    buf->st_atime = 
	    buf->st_mtime = 
	    buf->st_ctime = time(NULL);
	    return 0;
	}
	case FTYPE_COMPILED_FILE: {
	    buf->st_mode = S_IFREG | S_IRUSR;
	    buf->st_size = files[fd].compiled_file.size - 1;
	    buf->st_blocks = 1;
	    return 0;
	}
	default:
	    break;
    }

    printk("statf(%d): Bad descriptor\n", fd);
    errno = EBADF;
    return -1;
}
コード例 #21
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_foreach_stat_succeeds() {
  assert_true( init_stat() );

  const char *keys[] = { "key0", "key1" };
  increment_stat( keys[ 0 ] );
  increment_stat( keys[ 1 ] );
  increment_stat( keys[ 1 ] );

  void *user_data = ( void * ) ( intptr_t ) 0x1;

  expect_string( mock_callback, key, keys[ 1 ] );
  expect_value( mock_callback, value, 2 );
  expect_value( mock_callback, user_data, user_data );

  expect_string( mock_callback, key, keys[ 0 ] );
  expect_value( mock_callback, value, 1 );
  expect_value( mock_callback, user_data, user_data );

  foreach_stat( mock_callback, user_data );

  assert_true( finalize_stat() );
}
コード例 #22
0
ファイル: oscam.c プロジェクト: westaus/oscam
int32_t main (int32_t argc, char *argv[])
{
	int32_t i, j;
	prog_name = argv[0];
	if (pthread_key_create(&getclient, NULL)) {
		fprintf(stderr, "Could not create getclient, exiting...");
		exit(1);
	}

  void (*mod_def[])(struct s_module *)=
  {
#ifdef MODULE_MONITOR
           module_monitor,
#endif
#ifdef MODULE_CAMD33
           module_camd33,
#endif
#ifdef MODULE_CAMD35
           module_camd35,
#endif
#ifdef MODULE_CAMD35_TCP
           module_camd35_tcp,
#endif
#ifdef MODULE_NEWCAMD
           module_newcamd,
#endif
#ifdef MODULE_CCCAM
           module_cccam,
#endif
#ifdef MODULE_PANDORA
           module_pandora,
#endif
#ifdef MODULE_GHTTP
           module_ghttp,
#endif
#ifdef CS_CACHEEX
           module_csp,
#endif
#ifdef MODULE_GBOX
           module_gbox,
#endif
#ifdef MODULE_CONSTCW
           module_constcw,
#endif
#ifdef MODULE_RADEGAST
           module_radegast,
#endif
#ifdef MODULE_SERIAL
           module_serial,
#endif
#ifdef HAVE_DVBAPI
	   module_dvbapi,
#endif
           0
  };

  void (*cardsystem_def[])(struct s_cardsystem *)=
  {
#ifdef READER_NAGRA
	reader_nagra,
#endif
#ifdef READER_IRDETO
	reader_irdeto,
#endif
#ifdef READER_CONAX
	reader_conax,
#endif
#ifdef READER_CRYPTOWORKS
	reader_cryptoworks,
#endif
#ifdef READER_SECA
	reader_seca,
#endif
#ifdef READER_VIACCESS
	reader_viaccess,
#endif
#ifdef READER_VIDEOGUARD
	reader_videoguard1,
	reader_videoguard2,
	reader_videoguard12,
#endif
#ifdef READER_DRE
	reader_dre,
#endif
#ifdef READER_TONGFANG
	reader_tongfang,
#endif
#ifdef READER_BULCRYPT
	reader_bulcrypt,
#endif
#ifdef READER_GRIFFIN
	reader_griffin,
#endif
#ifdef READER_DGCRYPT
	reader_dgcrypt,
#endif
	0
  };

  void (*cardreader_def[])(struct s_cardreader *)=
  {
#ifdef CARDREADER_DB2COM
	cardreader_db2com,
#endif
#if defined(CARDREADER_INTERNAL_AZBOX)
	cardreader_internal_azbox,
#elif defined(CARDREADER_INTERNAL_COOLAPI)
	cardreader_internal_cool,
#elif defined(CARDREADER_INTERNAL_SCI)
	cardreader_internal_sci,
#endif
#ifdef CARDREADER_PHOENIX
	cardreader_mouse,
#endif
#ifdef CARDREADER_MP35
	cardreader_mp35,
#endif
#ifdef CARDREADER_PCSC
	cardreader_pcsc,
#endif
#ifdef CARDREADER_SC8IN1
	cardreader_sc8in1,
#endif
#ifdef CARDREADER_SMARGO
	cardreader_smargo,
#endif
#ifdef CARDREADER_SMART
	cardreader_smartreader,
#endif
#ifdef CARDREADER_STAPI
	cardreader_stapi,
#endif
	0
  };

  parse_cmdline_params(argc, argv);

  if (bg && do_daemon(1,0))
  {
    printf("Error starting in background (errno=%d: %s)", errno, strerror(errno));
    cs_exit(1);
  }

  get_random_bytes_init();

#ifdef WEBIF
  if (cs_restart_mode)
    restart_daemon();
#endif

  memset(&cfg, 0, sizeof(struct s_config));
  cfg.max_pending = max_pending;

  if (cs_confdir[strlen(cs_confdir) - 1] != '/') strcat(cs_confdir, "/");
  init_signal_pre(); // because log could cause SIGPIPE errors, init a signal handler first
  init_first_client();
  cs_lock_create(&system_lock, 5, "system_lock");
  cs_lock_create(&config_lock, 10, "config_lock");
  cs_lock_create(&gethostbyname_lock, 10, "gethostbyname_lock");
  cs_lock_create(&clientlist_lock, 5, "clientlist_lock");
  cs_lock_create(&readerlist_lock, 5, "readerlist_lock");
  cs_lock_create(&fakeuser_lock, 5, "fakeuser_lock");
  cs_lock_create(&ecmcache_lock, 5, "ecmcache_lock");
  cs_lock_create(&readdir_lock, 5, "readdir_lock");
  cs_lock_create(&cwcycle_lock, 5, "cwcycle_lock");
  cs_lock_create(&hitcache_lock, 5, "hitcache_lock");
  coolapi_open_all();
  init_config();
  cs_init_log();
  if (!oscam_pidfile && cfg.pidfile)
    oscam_pidfile = cfg.pidfile;
  if (!oscam_pidfile) {
    oscam_pidfile = get_tmp_dir_filename(default_pidfile, sizeof(default_pidfile), "oscam.pid");
  }
  if (oscam_pidfile)
    pidfile_create(oscam_pidfile);
  cs_init_statistics();
  init_check();
  init_stat();

  // These initializations *MUST* be called after init_config()
  // because modules depend on config values.
  for (i=0; mod_def[i]; i++)
  {
	struct s_module *module = &modules[i];
	mod_def[i](module);
  }
  for (i=0; cardsystem_def[i]; i++)
  {
	memset(&cardsystems[i], 0, sizeof(struct s_cardsystem));
	cardsystem_def[i](&cardsystems[i]);
  }
  for (i=0; cardreader_def[i]; i++)
  {
	memset(&cardreaders[i], 0, sizeof(struct s_cardreader));
	cardreader_def[i](&cardreaders[i]);
  }

  init_sidtab();
  init_readerdb();
  cfg.account = init_userdb();
  init_signal();
  init_srvid();
  init_tierid();
  init_provid();

  start_garbage_collector(gbdb);

  cacheex_init();

  init_len4caid();
  init_irdeto_guess_tab();

  write_versionfile(false);

  led_init();
  led_status_default();

  azbox_init();

  mca_init();

  global_whitelist_read();
  cacheex_load_config_file();

	for (i = 0; i < CS_MAX_MOD; i++) {
		struct s_module *module = &modules[i];
		if ((module->type & MOD_CONN_NET)) {
			for (j = 0; j < module->ptab.nports; j++) {
				start_listener(module, &module->ptab.ports[j]);
			}
		}
	}

	//set time for server to now to avoid 0 in monitor/webif
	first_client->last=time((time_t *)0);

	webif_init();

	start_thread((void *) &reader_check, "reader check");
	cw_process_thread_start();

	lcd_thread_start();

	do_report_emm_support();

	init_cardreader();

	cs_waitforcardinit();

	led_status_starting();

	ac_init();

	for (i = 0; i < CS_MAX_MOD; i++) {
		struct s_module *module = &modules[i];
		if ((module->type & MOD_CONN_SERIAL) && module->s_handler)
			module->s_handler(NULL, NULL, i);
	}

	// main loop function
	process_clients();

	cw_process_thread_wakeup(); // Stop cw_process thread
	pthread_cond_signal(&reader_check_sleep_cond); // Stop reader_check thread

	// Cleanup
	webif_close();
	azbox_close();
	coolapi_close_all();
	mca_close();

	led_status_stopping();
	led_stop();
	lcd_thread_stop();

	remove_versionfile();

	stat_finish();
	cccam_done_share();

	kill_all_clients();
	kill_all_readers();

	if (oscam_pidfile)
		unlink(oscam_pidfile);

	webif_tpls_free();
	init_free_userdb(cfg.account);
	cfg.account = NULL;
	init_free_sidtab();
	free_readerdb();
	free_irdeto_guess_tab();
	config_free();

	cs_log("cardserver down");
	log_free();

	stop_garbage_collector();

	free(first_client->account);
	free(first_client);

	// This prevents the compiler from removing config_mak from the final binary
	syslog_ident = config_mak;

	return exit_oscam;
}
コード例 #23
0
ファイル: stat_test.c プロジェクト: Milstein/trema
static void
test_init_stat_succeeds() {
  assert_true( init_stat() );
  assert_true( stats != NULL );
  assert_true( finalize_stat() );
}
コード例 #24
0
ファイル: oscam.c プロジェクト: franz1994/oscam
int32_t main(int32_t argc, char *argv[])
{
	fix_stacksize();
		
	run_tests();
	int32_t i, j;
	prog_name = argv[0];
	struct timespec start_ts;
	cs_gettime(&start_ts); // Initialize clock_type

	if(pthread_key_create(&getclient, NULL))
	{
		fprintf(stderr, "Could not create getclient, exiting...");
		exit(1);
	}

	void (*mod_def[])(struct s_module *) =
	{
#ifdef MODULE_MONITOR
		module_monitor,
#endif
#ifdef MODULE_CAMD33
		module_camd33,
#endif
#ifdef MODULE_CAMD35
		module_camd35,
#endif
#ifdef MODULE_CAMD35_TCP
		module_camd35_tcp,
#endif
#ifdef MODULE_NEWCAMD
		module_newcamd,
#endif
#ifdef MODULE_CCCAM
		module_cccam,
#endif
#ifdef MODULE_PANDORA
		module_pandora,
#endif
#ifdef MODULE_GHTTP
		module_ghttp,
#endif
#ifdef CS_CACHEEX
		module_csp,
#endif
#ifdef MODULE_GBOX
		module_gbox,
#endif
#ifdef MODULE_CONSTCW
		module_constcw,
#endif
#ifdef MODULE_RADEGAST
		module_radegast,
#endif
#ifdef MODULE_SCAM
		module_scam,
#endif
#ifdef MODULE_SERIAL
		module_serial,
#endif
#ifdef HAVE_DVBAPI
		module_dvbapi,
#endif
		0
	};
	
	find_conf_dir();

	parse_cmdline_params(argc, argv);

	if(bg && do_daemon(1, 0))
	{
		printf("Error starting in background (errno=%d: %s)", errno, strerror(errno));
		cs_exit(1);
	}

	get_random_bytes_init();

#ifdef WEBIF
	if(cs_restart_mode)
		{ restart_daemon(); }
#endif

	memset(&cfg, 0, sizeof(struct s_config));
	cfg.max_pending = max_pending;

	if(cs_confdir[strlen(cs_confdir) - 1] != '/') { strcat(cs_confdir, "/"); }
	init_signal_pre(); // because log could cause SIGPIPE errors, init a signal handler first
	init_first_client();
	cs_lock_create(__func__, &system_lock, "system_lock", 5000);
	cs_lock_create(__func__, &config_lock, "config_lock", 10000);
	cs_lock_create(__func__, &gethostbyname_lock, "gethostbyname_lock", 10000);
	cs_lock_create(__func__, &clientlist_lock, "clientlist_lock", 5000);
	cs_lock_create(__func__, &readerlist_lock, "readerlist_lock", 5000);
	cs_lock_create(__func__, &fakeuser_lock, "fakeuser_lock", 5000);
	cs_lock_create(__func__, &ecmcache_lock, "ecmcache_lock", 5000);
	cs_lock_create(__func__, &ecm_pushed_deleted_lock, "ecm_pushed_deleted_lock", 5000);
	cs_lock_create(__func__, &readdir_lock, "readdir_lock", 5000);
	cs_lock_create(__func__, &cwcycle_lock, "cwcycle_lock", 5000);
	init_cache();
	cacheex_init_hitcache();
	init_config();
	cs_init_log();
	init_machine_info();
	init_check();
	if(!oscam_pidfile && cfg.pidfile)
		{ oscam_pidfile = cfg.pidfile; }
	if(!oscam_pidfile)
	{
		oscam_pidfile = get_tmp_dir_filename(default_pidfile, sizeof(default_pidfile), "oscam.pid");
	}
	if(oscam_pidfile)
		{ pidfile_create(oscam_pidfile); }
	cs_init_statistics();
	coolapi_open_all();
	init_stat();
	ssl_init();

	// These initializations *MUST* be called after init_config()
	// because modules depend on config values.
	for(i = 0; mod_def[i]; i++)
	{
		struct s_module *module = &modules[i];
		mod_def[i](module);
	}

	init_sidtab();
	init_readerdb();
	cfg.account = init_userdb();
	init_signal();
	init_provid();
	init_srvid();
	init_tierid();
	init_fakecws();

	start_garbage_collector(gbdb);

	cacheex_init();

	init_len4caid();
	init_irdeto_guess_tab();

	write_versionfile(false);

	led_init();
	led_status_default();

	azbox_init();

	mca_init();

	global_whitelist_read();
	ratelimit_read();

	for(i = 0; i < CS_MAX_MOD; i++)
	{
		struct s_module *module = &modules[i];
		if((module->type & MOD_CONN_NET))
		{
			for(j = 0; j < module->ptab.nports; j++)
			{
				start_listener(module, &module->ptab.ports[j]);
			}
		}
	}

	//set time for server to now to avoid 0 in monitor/webif
	first_client->last = time((time_t *)0);

	webif_init();

	start_thread("reader check", (void *) &reader_check, NULL, NULL, 1, 1);
	cw_process_thread_start();
	checkcache_process_thread_start();

	lcd_thread_start();

	do_report_emm_support();

	init_cardreader();

	cs_waitforcardinit();
	
	emm_load_cache();
	load_emmstat_from_file();

	led_status_starting();

	ac_init();

	start_thread("card poll", (void *) &card_poll, NULL, NULL, 1, 1);

	for(i = 0; i < CS_MAX_MOD; i++)
	{
		struct s_module *module = &modules[i];
		if((module->type & MOD_CONN_SERIAL) && module->s_handler)
			{ module->s_handler(NULL, NULL, i); }
	}

	// main loop function
	process_clients();

	SAFE_COND_SIGNAL(&card_poll_sleep_cond); // Stop card_poll thread
	cw_process_thread_wakeup(); // Stop cw_process thread
	SAFE_COND_SIGNAL(&reader_check_sleep_cond); // Stop reader_check thread

	// Cleanup
#ifdef MODULE_GBOX	
	stop_sms_sender();
#endif
	webif_close();
	azbox_close();
	coolapi_close_all();
	mca_close();

	led_status_stopping();
	led_stop();
	lcd_thread_stop();

	remove_versionfile();

	stat_finish();
	dvbapi_stop_all_descrambling();
	dvbapi_save_channel_cache();
	emm_save_cache();
	save_emmstat_to_file();
	
	cccam_done_share();
	gbox_send_good_night(); 

	kill_all_clients();
	kill_all_readers();
	for(i = 0; i < CS_MAX_MOD; i++)
	{
		struct s_module *module = &modules[i];
		if((module->type & MOD_CONN_NET))
		{
			for(j = 0; j < module->ptab.nports; j++)
			{
				struct s_port *port = &module->ptab.ports[j];
				if(port->fd)
				{
					shutdown(port->fd, SHUT_RDWR);
					close(port->fd);
					port->fd = 0;
				}
			}
		}
	}

	if(oscam_pidfile)
		{ unlink(oscam_pidfile); }

	// sleep a bit, so hopefully all threads are stopped when we continue
	cs_sleepms(200);

	free_cache();
	cacheex_free_hitcache();
	webif_tpls_free();
	init_free_userdb(cfg.account);
	cfg.account = NULL;
	init_free_sidtab();
	free_readerdb();
	free_irdeto_guess_tab();
	config_free();
	ssl_done();

	detect_valgrind();
	if (!running_under_valgrind)
		cs_log("cardserver down");
	else
		cs_log("running under valgrind, waiting 5 seconds before stopping cardserver");
	log_free();

	if (running_under_valgrind) sleep(5); // HACK: Wait a bit for things to settle

	stop_garbage_collector();

	NULLFREE(first_client->account);
	NULLFREE(first_client);
	free(stb_boxtype);
	free(stb_boxname);

	// This prevents the compiler from removing config_mak from the final binary
	syslog_ident = config_mak;

	return exit_oscam;
}
コード例 #25
0
ファイル: cygwin.c プロジェクト: julesbowden/git
static int cygwin_lstat_stub(const char *file_name, struct stat *buf)
{
	return (init_stat() ? lstat : *cygwin_lstat_fn)(file_name, buf);
}
コード例 #26
0
ファイル: dns.cpp プロジェクト: keminming/local-dns
void Batch_resolver::run(int nthreads)
{
	printf("Starting batch mode with %d threads...\n",nthreads);
	
	init_stat();
	HANDLE* handles = (HANDLE*)malloc(sizeof(HANDLE) * nthreads);
	//vector<HANDLE> handles;
	parameter p; 
	queue<string> questions;
	queue<string> answers;
	unsigned long entries = 0;
	while(!f.eof())
	{
		string line;
		getline(f,line);
		questions.push(line);
		entries++;
		//printf("%s",line.c_str());
	}
	printf("Reading input file... found %d entries\n",entries);
	printf("...\n");
	int start = GetTickCount();
	p.questions = &questions;
	p.answers = &answers;
	p.cs = &this->f_lock;
    for(int i=0;i<nthreads;i++)
	{
	    handles[i] = CreateThread(NULL,0,batch_handler,&p,0,0);
		if(handles[i] == NULL)
		{
			printf("Cant create more thread = %d",GetLastError());
			break;
		}
		//handles.push_back(R_handle);
	}
	
	for(int i=0; i<= nthreads/MAXIMUM_WAIT_OBJECTS;i++)
	{
		if(i<nthreads/MAXIMUM_WAIT_OBJECTS)
		{
			if(WaitForMultipleObjects(MAXIMUM_WAIT_OBJECTS,handles + i*MAXIMUM_WAIT_OBJECTS,true, INFINITE) == -1)
			{
				printf("WaitForMultipleObjects = %d",GetLastError());
				return;
			}
		}
		else
		{
		    if(WaitForMultipleObjects(nthreads - i*MAXIMUM_WAIT_OBJECTS,handles + i*MAXIMUM_WAIT_OBJECTS,true, INFINITE) == -1)
			{
				printf("WaitForMultipleObjects = %d",GetLastError());
				return;
			}
		}
	}

	int end = GetTickCount();
	
	CPU cpu;
	Sleep (500);
	double util = cpu.GetCpuUtilization (NULL);

	printf("Completed %d queries\n",entries);
	printf("       Successful: %f%%\n",100 * (double)stat.sucess/stat.total_queries);
	printf("       No DNS record: %f%%\n",100*(double)stat.no_dns_record/stat.total_queries);
	printf("       No auth DNS server: %f%%\n",100*(double)stat.no_auth_server/stat.total_queries);
	printf("       Local DNS timeout: %f%%\n",100*(double)stat.local_dns_timeout/stat.total_queries);
	
	ofstream o("result.csv");
	o<<nthreads<<","<<stat.total_queries<<","<<stat.sucess<<","<<100 * (double)stat.sucess/stat.total_queries<<","<<(end-start)/1000<<","<<(double)stat.total_queries/((end-start)/1000)<<","<<util<<"\n";
	o.flush();
    o.close();
	
	int sum_delay = 0;
	ofstream o1("delay.csv");
	for(auto e: stat.delays)
	{
		sum_delay += e;
		o1<<e<<"\n";
	}
	o1.flush();
    o1.close();
	printf("       Average delay: %fms\n",(double)sum_delay/stat.delays.size());
	int sum_rx = 0;
	for(auto e: stat.retx)
	{
		sum_rx += e;
	}
	printf("       Average retx attempts: %f\n",(double)sum_rx/stat.retx.size());
	printf("Writing output file... finished with %d answers",answers.size());

	while(!answers.empty())
	{
		fo<<answers.front();
        answers.pop();
	}
	
}
コード例 #27
0
void
gmm_compute(void *data, utt_res_t * ur, int32 sf, int32 ef, char *uttid)
{
    kb_t *kb;
    kbcore_t *kbcore;
    mdef_t *mdef;
    dict_t *dict;
    dict2pid_t *d2p;
    mgau_model_t *mgau;
    subvq_t *svq;
    gs_t *gs;


    int32 ptranskip;
    int32 s, f, t;
    int32 single_el_list[2];
    stats_t cur_ci_st;
    stats_t cur_cd_st;
    stats_t cur_cd_Nbest_st;
    stats_t *stptr;
    char str[100];
    int32 *idx;

    int32 *cur_bstidx;
    int32 *last_bstidx;
    int32 *cur_scr;
    int32 *last_scr;
    int32 tmpint;
    s3senid_t *cd2cisen;

    int32 pheurtype;
    E_INFO("Processing: %s\n", uttid);

    kb = (kb_t *) data;
    kbcore = kb->kbcore;
    mdef = kbcore_mdef(kbcore);
    dict = kbcore_dict(kbcore);
    d2p = kbcore_dict2pid(kbcore);
    mgau = kbcore_mgau(kbcore);
    svq = kbcore_svq(kbcore);
    gs = kbcore_gs(kbcore);
    kb->uttid = uttid;

    ptranskip = kb->beam->ptranskip;

    pheurtype = kb->pl->pheurtype;

    single_el_list[0] = -1;
    single_el_list[1] = -1;


    /* Read mfc file and build feature vectors for entire utterance */
    kb->stat->nfr =
        feat_s2mfc2feat(kbcore_fcb(kbcore), ur->uttfile,
                        cmd_ln_str("-cepdir"), ".mfc", sf, ef, kb->feat,
                        S3_MAX_FRAMES);

    cd2cisen = mdef_cd2cisen(mdef);
    /*This should be a procedure instead of just logic */

    init_stat(&cur_cd_st, "Current CD Senone");
    init_stat(&cur_ci_st, "Current CI Senone");
    init_stat(&cur_cd_Nbest_st, "Current CD NBest Senone");

    for (s = 0; s < mdef->n_ci_sen; s++) {
        sprintf(str, "Cur Senone %d", s);
        init_stat(&cur_sen_st[s], str);
    }

    for (t = 0; t < (int32) (mdef->n_sen - mdef->n_ci_sen) / NBEST_STEP;
         t++) {
        sprintf(str, " %d -Cur Best Senone", t * NBEST_STEP);
        init_stat(&cur_sen_Nbest_st[t], str);
    }

    idx = ckd_calloc(mdef->n_sen - mdef->n_ci_sen, sizeof(int32));
    /* Allocate temporary array for CurScr and Curbst indx and Lat index */

    cur_bstidx = ckd_calloc(mdef->n_sen, sizeof(int32));
    last_bstidx = ckd_calloc(mdef->n_sen, sizeof(int32));
    cur_scr = ckd_calloc(mdef->n_sen, sizeof(int32));
    last_scr = ckd_calloc(mdef->n_sen, sizeof(int32));



    for (f = 0; f < kb->stat->nfr; f++) {
        for (s = 0; s < mgau->n_mgau; s++) {
            /*1, Compute the approximate scores with the last best index. */

            if (mgau->mgau[s].bstidx != NO_BSTIDX) {
                single_el_list[0] = mgau->mgau[s].bstidx;
                last_bstidx[s] = mgau->mgau[s].bstidx;
                last_scr[s] =
                    mgau_eval(mgau, s, single_el_list, kb->feat[f][0], f,
                              0);
            }
            else {
                last_bstidx[s] = NO_BSTIDX;
            }

            /*2, Compute the exact scores and sort them and get the ranking. */

            kb->ascr->senscr[s] =
                mgau_eval(mgau, s, NULL, kb->feat[f][0], f, 1);

            /*3, Compute the approximate scores with the current best index */
            if (mgau->mgau[s].bstidx != NO_BSTIDX) {
                single_el_list[0] = mgau->mgau[s].bstidx;
                cur_bstidx[s] = mgau->mgau[s].bstidx;
                cur_scr[s] =
                    mgau_eval(mgau, s, single_el_list, kb->feat[f][0], f,
                              0);
            }
            else {
                cur_bstidx[s] = NO_BSTIDX;

            }

            /* Only test for CD senones, test for best index hit */

            /*Update either CI senone and CD senone) */


            if (!mdef_is_cisenone(mdef, s))
                stptr = &cur_cd_st;
            else
                stptr = &cur_ci_st;

            increment_stat(stptr,
                           abs(last_scr[s] - kb->ascr->senscr[s]),
                           abs(cur_scr[s] - kb->ascr->senscr[s]),
                           abs(kb->ascr->senscr[cd2cisen[s]] -
                               kb->ascr->senscr[s]),
                           (cur_bstidx[s] == last_bstidx[s]));


            if (!mdef_is_cisenone(mdef, s)) {
                stptr = &cur_sen_st[cd2cisen[s]];
                increment_stat(stptr,
                               abs(last_scr[s] - kb->ascr->senscr[s]),
                               abs(cur_scr[s] - kb->ascr->senscr[s]),
                               abs(kb->ascr->senscr[cd2cisen[s]] -
                                   kb->ascr->senscr[s]),
                               (cur_bstidx[s] == last_bstidx[s]));

                stptr->total_senone += 1;
            }
        }

        cur_cd_st.total_fr++;
        cur_cd_st.total_senone += mdef->n_sen - mdef->n_ci_sen;
        cur_ci_st.total_fr++;
        cur_ci_st.total_senone += mdef->n_ci_sen;

        for (s = 0; s < mdef->n_ci_sen; s++) {
            cur_sen_st[s].total_fr++;
        }

        /*This is the part we need to do sorting */
        /*1, sort the scores in the current frames */
        /*E_INFO("At frame %d\n",f); */

        /*Pointer trick at here. */
        for (s = 0; s < mdef->n_sen - mdef->n_ci_sen; s++) {
            idx[s] = s;
        }

        cd = &(kb->ascr->senscr[mdef->n_ci_sen]);
        qsort(idx, mdef->n_sen - mdef->n_ci_sen, sizeof(int32),
              intcmp_gmm_compute);

        /*This loop is stupid and it is just a hack. */
        for (s = 0; s < mdef->n_sen - mdef->n_ci_sen; s++) {
            tmpint = idx[s] + mdef->n_ci_sen;

            for (t = 0;
                 t <
                 (int32) ((float) (mdef->n_sen - mdef->n_ci_sen) /
                          (float) NBEST_STEP); t++) {

                if (s < t * NBEST_STEP) {

                    increment_stat(&cur_sen_Nbest_st[t],
                                   abs(last_scr[tmpint] -
                                       kb->ascr->senscr[tmpint]),
                                   abs(cur_scr[tmpint] -
                                       kb->ascr->senscr[tmpint]),
                                   abs(kb->ascr->senscr[cd2cisen[tmpint]] -
                                       kb->ascr->senscr[tmpint]),
                                   (cur_bstidx[tmpint] ==
                                    last_bstidx[tmpint]));

                    cur_sen_Nbest_st[t].total_senone += 1;

                }
            }

        }

        for (t = 0;
             t <
             (int32) ((float) (mdef->n_sen - mdef->n_ci_sen) /
                      (float) NBEST_STEP); t++) {
            cur_sen_Nbest_st[t].total_fr++;
        }
    }

    print_stat(&cur_cd_st);
    print_stat(&cur_ci_st);
    print_stat(&cur_sen_Nbest_st[1]);   /*Only show the first NBEST_STEP best */




    add_stat(&cd_st, &cur_cd_st);
    add_stat(&ci_st, &cur_ci_st);

    for (s = 0; s < mdef->n_ci_sen; s++) {
        add_stat(&sen_st[s], &cur_sen_st[s]);
    }

    for (s = 0; s < (int32) (mdef->n_sen - mdef->n_ci_sen) / NBEST_STEP;
         s++) {
        add_stat(&sen_Nbest_st[s], &cur_sen_Nbest_st[s]);
    }

    ckd_free(idx);
    ckd_free(cur_bstidx);
    ckd_free(last_bstidx);
    ckd_free(cur_scr);
    ckd_free(last_scr);
}
コード例 #28
0
ファイル: c_out.c プロジェクト: leloulight/micro_omega_4
static int c_prog_int(void)
{
   int breaker;
   int i;
   long dfirst;
      
   if(nin+nout<=4) sumDiag=1; else sumDiag=0;   

   memerror=zeroHeep;
   mark_(&heapbeg);

   initvararray(0,'c',3);
  /* ======= Initialisation parth ======= */

   firstVar=nmodelvar;
   if(!strcmp( modelvars[firstVar].varname,strongconst))  firstVar--;
   prepareprocinform();
   calc_nvars_nfunc();
  /* ======= End of Initialisation ====== */

   {  outFileOpen("%sresults%cservice.c",pathtouser,f_slash); 
      labl();
      writeF("#include<math.h>\n");
      writeF("#include<complex.h>\n");                 
      writeF("#include\"num_out.h\"\n");
      writeF("#include\"num_in.h\"\n");

      writeF("double BWrange_ext=2.7;\n");
      writeF("int twidth_ext=0;\n");
      writeF("int gtwidth_ext=0;\n");
      writeF("int gswidth_ext=0;\n");
      writeF(" REAL va_ext[%d]={0};\n",nvars+nfunc+1); 
   }
   geninf("nin_ext",nin);
   geninf("nout_ext",nout);
   geninf("nprc_ext",subproc_sq);
   make_pinf();
   geninf("nvar_ext",nvars);
   geninf("nfunc_ext",nfunc);
    
   make_vinf();
   
   { 
      make_den_info();
      fprintf(outFile,"\nCalcHEP_interface interface_ext={ %d,\n\"%s\"\n,%d, %d, varName_ext,va_ext,"
          "%d, %d, %d, &pinf_ext, &pinfAux_ext, polarized_ext, &calcFunc_ext, &BWrange_ext,&twidth_ext,"
          "&gtwidth_ext,&gswidth_ext, &aWidth_ext, &sqme_ext,&den_info_ext,&build_cb_ext, &cb_pow_ext,"
          "&cb_nc_ext, &cb_chains_ext, &cb_coeff_ext, &destroy_cb_ext};\n", 
      forceUG, pathtocalchep,nvars, nfunc, nin,nout,subproc_sq);

      writeF("\nCalcHEP_interface * PtrInterface_ext=&interface_ext;\n");

      outFileClose();
      outFileOpen("%sresults%csqme.c",pathtouser,f_slash); 
      labl();
      writeF("#include<stdio.h>\n");
      writeF("#include<math.h>\n");
      writeF("#include<complex.h>\n");
      writeF("#include\"num_out.h\"\n");
      writeF("#include\"num_in.h\"\n");
   }
   writeF("static int calcall[%d];\n",subproc_sq+1);

   {
   writeF("static int particles[%d]={0",1+nin+nout); 
   for(i=0;i<nin+nout;i++) writeF(",0");
   writeF("};\n");
   }
   writeF("extern DNN ");
   for(i=1;i<subproc_sq;i++)  writeF("S%d_ext,",i); 
   writeF("S%d_ext;\n",subproc_sq); 
   
   writeF("static  DNN * darr[%d]={",subproc_sq);
   for(i=1;i<subproc_sq;i++)  writeF("&S%d_ext,",i);
   writeF("&S%d_ext};\n",subproc_sq);
   fseek(catalog,0,SEEK_END);
   ndiagrtot = ftell(catalog)/sizeof(catrec);
   
   writesubroutineinit();
   
   {  make_infbasis();
      writeF("#include\"sqme.inc\"\n");
      outFileClose();
   }
   diagrcount = 0;
   inftmp = inf;
   init_stat();
   for (nsub = 1,dfirst=1; nsub <= subproc_sq; nsub++)
   {  int colors[MAXINOUT];

      if (inftmp->tot != 0)   /*  this subprocess IN archive  */
      {

         for(i=0;i<nin+nout;i++) 
         {  int l;
            locateinbase(inftmp->p_name[i], &l);
            colors[i]=prtclbase[l-1].cdim;
         }
         for(i=0;i<nin; i++) 
         if(colors[i]==3) colors[i]=-3; else if(colors[i]==-3) colors[i]=3;
         if(noCChain) for(i=0;i<nin+nout; i++) colors[i]=1; 
         infCbases(nin+nout,colors,&nC,&cBasisPower,&cChains);
         if(cBasisPower)
         { 
            cCoefN=malloc(cBasisPower*sizeof(long));
            cCoefD=malloc(cBasisPower*sizeof(long));
         }

         writesubprocess(nsub,dfirst,inftmp->tot, &breaker);
         dfirst+=inftmp->tot;
         if (breaker) goto exi;
      
         if(cBasisPower)
         {
            if(cChains){free(cChains); cChains=NULL;} 
            free(cCoefN); free(cCoefD);
         }

      } else writesubprocess(nsub,dfirst,0, NULL);
      inftmp = inftmp->next;
   }
   
exi:
   clearstatistic();
   release_(&heapbeg);
   return !breaker;
}