コード例 #1
0
ファイル: 3dTto1D.c プロジェクト: CesarCaballeroGaudes/afni
/*--------------- main routine ---------------*/
int main( int argc, char *argv[] )
{
   options_t * opts = &g_opts;
   int         rv;

   if( argc < 2 ) { show_help();  return 0; }

   mainENTRY("3dTto1D main"); machdep(); AFNI_logger("3dTto1D",argc,argv);

   /* process command line arguments (and read dataset and mask) */
   rv = process_opts(opts, argc, argv);
   if( rv ) RETURN(rv < 0); /* only a negative return is considered failure */

   if( check_dims(opts) ) RETURN(1);

   /* evaluation of rv now depends on the method, usually non-zero is bad */
   rv = compute_results(opts);

   /* for 4095_warn, return now, regardless */
   if( opts->method == T21_METH_4095_WARN ) RETURN(rv);

   /* otherwise, any non-zero return is a failure */
   if ( rv ) RETURN(1);

   if( write_results(opts) ) RETURN(1);

   RETURN(0);
}
コード例 #2
0
ファイル: tbench_srv.c プロジェクト: EuroCorp/diod
int main(int argc, char *argv[])
{
    process_opts(argc, argv);

    listener();
    return 0;
}
コード例 #3
0
ファイル: configs.c プロジェクト: Distrotech/frox
/* This is quite horrible, but it does seem to work... We make a
   shallow copy of config, and then recall read_config. config will
   now be changed with any additional options in the subsection - we
   copy it where we want it, and restore config. The copy is only a
   shallow one, but we get away with it as other funcs overwrite
   pointers not their contents. */
int store_subsect(sstr * str, struct subsect_list *subsecs)
{
	struct options tmp;
	struct subsect item;

	parse_match(str, &item.match);

	memcpy(&tmp, &config, sizeof(struct options));
	sublevel++;
	config.acls.list = NULL;
	config.subsecs.list = NULL;
	config.acls.num = config.subsecs.num = 0;

	if (read_config() == -1)
		return (-1);

	sublevel--;
	if(process_opts()==-1) return(-1);

	memcpy(&item.config, &config, sizeof(struct options));
	memcpy(&config, &tmp, sizeof(struct options));

	subsecs->list = realloc(subsecs->list,
				(subsecs->num + 1) * sizeof(struct subsect));
	memcpy(subsecs->list + subsecs->num, &item, sizeof(struct subsect));
	subsecs->num++;
	return (0);
}
コード例 #4
0
ファイル: ftptop.c プロジェクト: Nakor78/proftpd
int main(int argc, char *argv[]) {

  /* Process command line options. */
  process_opts(argc, argv);

  /* Verify that the scoreboard file is useable. */
  verify_scoreboard_file();

  /* Install signal handlers. */
  signal(SIGINT, finish);
  signal(SIGTERM, finish);

#if defined(PR_USE_NLS) && defined(HAVE_LOCALE_H)
  (void) setlocale(LC_ALL, "");
#endif

  /* Initialize the display. */
  initscr();
  cbreak();
  noecho();
#ifndef HAVE_NCURSES
  nodelay(stdscr, TRUE);
#endif
  curs_set(0);

  /* Paint the initial display. */
  show_sessions();

  /* Loop endlessly. */
  for (;;) {
    int c = -1;

#ifdef HAVE_NCURSES
    if (halfdelay(delay * 10) != ERR)
      c = getch();
#else
    sleep(delay);
    c = getch();
#endif

    if (c != -1) {
      if (tolower(c) == 'q') {
        break;
      }

      if (tolower(c) == 't') {
        toggle_mode();
      }
    }

    show_sessions();
  }

  /* done */
  finish(0);
  return 0;
}
コード例 #5
0
ファイル: 3dmask_tool.c プロジェクト: LJWilliams/Neuroimaging
/*--------------- main routine ---------------*/
int main( int argc, char *argv[] )
{
   THD_3dim_dataset * countset=NULL;
   param_t          * params = &g_params;
   int                rv, limit;

   if( argc < 1 ) { show_help();  return 0; }

   /* general stuff */
   mainENTRY("3dmask_tool"); machdep(); AFNI_logger("3dmask_tool",argc,argv);
   enable_mcw_malloc();

   /* process options: a negative return is considered an error */
   rv = process_opts(params, argc, argv);
   if( rv ) RETURN(rv < 0);

   /* open, convert to byte, zeropad, dilate, unzeropad */
   if( process_input_dsets(params) ) RETURN(1);

   /* create mask count dataset and return num volumes (delete old dsets) */
   if( count_masks(params->dsets, params->ndsets, params->verb,
                   &countset, &params->nvols) ) RETURN(1);

   /* limit to frac of nvols (if not counting, convert to 0/1 mask) */
   limit = ceil((params->frac>1) ? params->frac : params->nvols*params->frac );
   if( params->verb )
      INFO_message("frac %g over %d volumes gives min count %d\n",
                   params->frac, params->nvols, limit);
   if( limit <= 0 ) limit = 1;

   /* if not counting, result is binary 0/1 */
   if( limit_to_frac(countset, limit, params->count, params->verb) )
      RETURN(1);

   /* maybe apply dilations to output */
   if( params->RESD.num > 0 ) {
      countset = apply_dilations(countset, &params->RESD, 0, params->verb);
      if( !countset ) RETURN(1);
   }

   /* maybe fill any remaining holes */
   if( params->fill )
      if ( fill_holes(countset, params->verb) ) RETURN(1);

   /* create output */
   if( write_result(params, countset, argc, argv) ) RETURN(1);

   /* clean up a little memory */
   DSET_delete(countset);
   free(params->dsets);

   RETURN(0);
}
コード例 #6
0
ファイル: configs.c プロジェクト: Distrotech/frox
int read_config()
{
	struct option_array *opt;
	sstr *buf;

	if (!fp) {
		if (config.config_file == NULL) fp = fopen(CONFIG_FILE, "r");
		else fp = fopen(config.config_file, "r");
		if (fp == NULL) return (-1);
		line_no=0;
	}

	buf = sstr_init(0);
	while (sstr_fgets(buf, fp) != NULL) {
		line_no++;
		switch (parse_line(buf)) {
		case -1:
			sstr_free(buf);
			if (sublevel == 0) fclose(fp);
			return (-1);
		case 0:
			break;

		case 1:	/* end subsection */
			sstr_free(buf);
			return (0);
		}
	};
	sstr_free(buf);
	fclose(fp);
	fp = NULL;

	opt = opts;
	while (opt->name != NULL && !opt->essential)
		opt++;
	if (opt->name != NULL) {
		fprintf(stderr, "Essential option \"%s\" not specified.\n",
			opt->name);
		return (-1);
	}
	process_opts();
#ifdef DEBUG
	if(!config.inetd) print_config();
#endif
	return (0);
}
コード例 #7
0
ファイル: fource.c プロジェクト: danmey/fource
int main(int argc, void* argv)
{
sigset_t emptyset;
    //  sigsegv_init(&ss_dispatcher);
  sigsegv_install_handler(ss_handler);
/* Save the current signal mask.  */
  sigemptyset (&emptyset);
  sigprocmask (SIG_BLOCK, &emptyset, &mainsigset);

  enable_memory_block(&Vm_image_start, &Vm_image_end);
  process_opts(argc,argv);
  install_exception_handler(kernel_exception_handler);
  if ( opts.image_file != 0 )
    load_image(opts.image_file);

  run_repl();
  return 0;
}
コード例 #8
0
 int main(int argc, char *argv[])
{
	int nprocs;
	double t;
	double total_bytes = 0;
	int i;

	if (!process_opts(argc, argv, &nprocs))
		show_usage();

	t = create_procs(nprocs, child_run);

	for (i=0;i<nprocs;i++) {
		total_bytes += children[i].bytes_in + children[i].bytes_out;
	}

	t = end_timer();

	printf("Throughput %g MB/sec%s%s %d procs\n",
	       1.0e-6 * total_bytes / t,
	       sync_open ? " (sync open)" : "",
	       sync_dirs ? " (sync dirs)" : "", nprocs);
	return 0;
}
コード例 #9
0
ファイル: std_main.c プロジェクト: CliffsDover/graphicsmagick
int	main (int argc, char *argv[])
{
GEN_PAR	Pg;
IN_PAR	Pi;
OUT_PAR	Po;
int	i;

char	*shortopts = "a:c:d:D:f:h:l:m:o:O:p:P:r:s:S:V:w:x:X:y:Y:CFHinqtvN";
struct	option longopts[] =
{
	{"mode",	1, NULL,	'm'},
	{"pencolors",	1, NULL,	'c'},
	{"pensizes",	1, NULL,	'p'},
	{"pages",	1, NULL,	'P'},
	{"quiet",	0, NULL,	'q'},
	{"nofill",	0, NULL,	'n'},
	{"no_ps",	0, NULL,	'N'},

	{"DPI",		1, NULL,	'd'},
	{"DPI_x",	1, NULL,	'd'},
	{"DPI_y",	1, NULL,	'D'},

	{"PCL_formfeed",0, NULL,	'F'},
	{"PCL_init",	0, NULL,	'i'},
	{"PCL_Deskjet",	1, NULL,	'S'},

	{"outfile",	1, NULL,	'f'},
	{"logfile",	1, NULL,	'l'},
	{"swapfile",	1, NULL,	's'},

	{"aspectfactor",1, NULL,	'a'},
	{"height",	1, NULL,	'h'},
	{"width",	1, NULL,	'w'},
	{"truesize",	0, NULL,	't'},

	{"x0",		1, NULL,	'x'},
	{"x1",		1, NULL,	'X'},
	{"y0",		1, NULL,	'y'},
	{"y1",		1, NULL,	'Y'},

	{"xoffset",	1, NULL,	'o'},
	{"yoffset",	1, NULL,	'O'},
	{"center",	0, NULL,	'C'},

#ifdef DOS
	{"VGAmodebyte",	1, NULL,	'V'},
#endif
	{"help",	0, NULL,	'H'},
	{"version",	0, NULL,	'v'},
	{NULL,		0, NULL,	'\0'}
};


  preset_par (&Pg, &Pi, &Po);
  if (argc == 1)
  {
	usage_msg (&Pg, &Pi, &Po);
	exit (ERROR);
  }
#ifdef WIN32
   /* set stdin and stdout to binary mode: */
   _setmode( _fileno(stdin), _O_BINARY );
   _setmode( _fileno(stdout), _O_BINARY );
#endif /* WIN32 */
  process_opts (argc, argv, shortopts, longopts, &Pg, &Pi, &Po);

/**
 ** Determine internal mode code
 **/

  for (i=0; ModeList[i].mode != XX_TERM; i++)
/*	if (strncmp(Pg.mode, ModeList[i].modestr,
		strlen(ModeList[i].modestr)) == 0)*/
	if (strcmp(Pg.mode, ModeList[i].modestr)==0)
	{
		Pg.xx_mode = ModeList[i].mode;
		break;
	}
/**
 ** Place consistency checks & adjustments here if you like
 **/

  if (Po.dpi_y == 0)
	Po.dpi_y = Po.dpi_x;

/**
 ** Action loop over all input files
 **/

  if (optind == argc)		/* No  filename: use stdin	*/
  {
	Pi.in_file = "-";
	autoset_outfile_name (Pg.mode, Pi.in_file, &Po.outfile);
	action_oldstyle (&Pg, &Pi, &Po);
  }
  else	for ( ; optind < argc; optind++)
	{			/* Multiple-input file handling: */
		Pi.in_file = argv[optind];
		autoset_outfile_name (Pg.mode, Pi.in_file, &Po.outfile);
		action_oldstyle (&Pg, &Pi, &Po);
		reset_par (&Pi);
	}

  cleanup (&Pg, &Pi, &Po);
  if (*Pg.logfile)
	fclose (stderr);
  return NOERROR;
}
コード例 #10
0
int main(int argc, char *argv[])
{
    FILE *log = stdout;
    struct timeval tv;
    option_block options;
    int i;

    g_plugin = NULL;
    sfuzz_setsearchpath(
#ifndef __WIN32__
        "./:"PREFIX"/share/sfuzz-db"
#else
        "./"
#endif
    );
    memset(&options, 0, sizeof(options));

    gettimeofday(&tv, NULL);
    birth = tv.tv_sec;

    options.pFilename = malloc(MAX_FILENAME_SIZE);
    options.pLogFilename = malloc(MAX_FILENAME_SIZE);
    options.host_spec = malloc(MAX_HOSTSPEC_SIZE);
    options.port_spec = malloc(MAX_PORTSPEC_SIZE);
    options.repl_pol = 2; /* once ! for always, choose 1. */
    memset(options.pFilename, 0, MAX_FILENAME_SIZE-1);
    memset(options.pLogFilename, 0, MAX_FILENAME_SIZE-1);

    /*default line terminator*/
    options.line_term[0]         = '\n';
    options.line_terminator_size = 1;

    options.state     = CMD_LINE_OPTS;
    process_opts(argc, argv, &options);

    options.state     = INIT_READ;
    read_config(&options);

    if(options.pLogFilename[0] != 0)
    {
        if(options.new_logfile)
        {
            strncat(options.pLogFilename, ".0", MAX_FILENAME_SIZE);
        }

        log = fopen(options.pLogFilename, "w");
        if(log != NULL)
        {
            options.fp_log = log;
        } else
        {
            fprintf(stderr, "[%s] error: using stdout - unable to open log.\n",
                    get_time_as_log());
            log = stdout;
        }

    }

    if(options.verbosity == VERBOSE)
        dump_options(&options);

    if(options.verbosity != QUIET)
    {
        fprintf(log, "[%s] info: beginning fuzz - method:", get_time_as_log());
        if(options.tcp_flag)
        {
            fprintf(log, " tcp,");
        } else if(options.udp_flag)
        {
            fprintf(log, " udp,");
        }
        else
        {
            fprintf(log, " io,");
        }

        fprintf(log, " config from: [%s], out: [%s:%d]\n",
                options.pFilename, options.host_spec, options.port);
    }

    options.state     = FUZZ;
    execute_fuzz(&options);

    if(options.verbosity != QUIET)
        fprintf(log, "[%s] completed fuzzing.\n", get_time_as_log());

    free( options.pFilename    );
    free( options.pLogFilename );
    free( options.host_spec    );

    for(i = 0; i < options.num_litr; ++i)
    {
        free(options.litr[i]);
    }
    free(options.litr);
    free(options.litr_lens);

    for(i = 0; i < options.num_seq; ++i)
    {
        free(options.seq[i]);
    }
    free(options.seq);
    free(options.seq_lens);

    /*this might be the better way of doing things =)*/
    if(options.sym_count)
        free(options.syms_array);

    return 0;
}
コード例 #11
0
ファイル: autod_autofs.c プロジェクト: AlainODea/illumos-gate
int
mount_autofs(
	struct mapent *me,
	char *mntpnt,
	action_list *alp,
	char *rootp,
	char *subdir,
	char *key
)
{
	int mntflags = 0;
	struct utsname utsname;
	autofs_args *fnip = NULL;
	int mount_timeout = AUTOFS_MOUNT_TIMEOUT;
	int sawnest, len, error = 0;
	char *buf, rel_mntpnt[MAXPATHLEN];

	if (trace > 1)
		trace_prt(1, "  mount_autofs %s on %s\n",
		me->map_fs->mfs_dir, mntpnt);

	if (strcmp(mntpnt, "/-") == 0) {
		syslog(LOG_ERR, "invalid mountpoint: /-");
		return (ENOENT);
	}

	/*
	 * get relative mountpoint
	 */
	sprintf(rel_mntpnt, ".%s", mntpnt+strlen(rootp));

	if (trace > 2)
		trace_prt(1, "rel_mntpnt = %s\n", rel_mntpnt);

	if (uname(&utsname) < 0) {
		error = errno;
		syslog(LOG_ERR, "uname %s", strerror(error));
		return (error);
	}

	if ((fnip = (autofs_args *)
	    malloc(sizeof (autofs_args))) == NULL) {
		goto free_mem;
	}
	(void) memset((void *) fnip, 0, sizeof (*fnip));

	if ((fnip->addr.buf = (char *)malloc(MAXADDRLEN)) == NULL)
		goto free_mem;

	(void) strcpy(fnip->addr.buf, utsname.nodename);
	(void) strcat(fnip->addr.buf, ".autofs");

	if ((fnip->opts = malloc(MAX_MNTOPT_STR)) == NULL)
		goto free_mem;
	strcpy(fnip->opts, me->map_mntopts);

	if (process_opts(fnip->opts, &fnip->direct, &sawnest) != 0)
		goto free_mem;

	fnip->addr.len = strlen(fnip->addr.buf);
	fnip->addr.maxlen = fnip->addr.len;

	/*
	 * get absolute mountpoint
	 */
	if ((fnip->path = strdup(mntpnt)) == NULL)
		goto free_mem;
	if ((fnip->map = strdup(me->map_fs->mfs_dir)) == NULL)
		goto free_mem;
	if ((fnip->subdir = strdup(subdir)) == NULL)
		goto free_mem;

	/*
	 * This timeout is really ignored by autofs, it uses the
	 * parent directory's timeout since it's really the one
	 * specified/inherited from the original mount by 'automount'
	 */
	fnip->mount_to = mount_timeout;	/* IGNORED */
	fnip->rpc_to = AUTOFS_RPC_TIMEOUT;

	if (fnip->direct) {
		if (me->map_modified == TRUE || me->map_faked == TRUE) {
			if ((fnip->key = strdup(key)) == NULL)
				goto free_mem;
		} else {
			/* wierd case of a direct map pointer in another map */
			if ((fnip->key = strdup(fnip->path)) == NULL)
				goto free_mem;
		}
	} else {
		fnip->key = NULL;
	}

	/*
	 * Fill out action list.
	 */
	alp->action.action = AUTOFS_MOUNT_RQ;
	if ((alp->action.action_list_entry_u.mounta.spec =
	    strdup(me->map_fs->mfs_dir)) == NULL)
		goto free_mem;
	if ((alp->action.action_list_entry_u.mounta.dir =
	    strdup(rel_mntpnt)) == NULL)
		goto free_mem;

	len = strlen(fnip->opts);
	/*
	 * Get a buffer for the option string, it holds the map options plus
	 * space for "nest" if it isn't already in the option string
	 */
	if ((buf = (char *)malloc(MAX_MNTOPT_STR)) == NULL)
		goto free_mem;
	strcpy(buf, fnip->opts);
	if (!sawnest) {
		if (len + strlen(",nest") + 1 > MAX_MNTOPT_STR)
			goto free_mem;
		if (len)
			(void) strcat(buf, ",");
		(void) strcat(buf, "nest");
	}
	alp->action.action_list_entry_u.mounta.optptr = buf;
	alp->action.action_list_entry_u.mounta.optlen = strlen(buf) + 1;
	alp->action.action_list_entry_u.mounta.flags =
		mntflags | MS_DATA | MS_OPTIONSTR;
	if ((alp->action.action_list_entry_u.mounta.fstype =
	    strdup(MNTTYPE_AUTOFS)) == NULL)
		goto free_mem;
	alp->action.action_list_entry_u.mounta.dataptr = (char *)fnip;
	alp->action.action_list_entry_u.mounta.datalen = sizeof (*fnip);

	return (0);

free_mem:
	/*
	 * We got an error, free the memory we allocated.
	 */
	syslog(LOG_ERR, "mount_autofs: memory allocation failure");
	free_autofs_args(fnip);
	alp->action.action_list_entry_u.mounta.dataptr = NULL;
	alp->action.action_list_entry_u.mounta.datalen = 0;
	free_mounta(&alp->action.action_list_entry_u.mounta);

	return (error ? error : ENOMEM);
}
コード例 #12
0
ファイル: pbs_rsub.c プロジェクト: A9-William/pbspro
/**
 * @brief
 *	The main function in C - entry point
 *
 * @param[in]  argc - argument count
 * @param[in]  argv - pointer to argument array
 * @param[in]  envp - pointer to environment values
 *
 * @return  int
 * @retval  0 - success
 * @retval  !0 - error
 */
int
main(int argc, char *argv[], char *envp[])
{
	int errflg;			/* command line option error */
	int connect;			/* return from pbs_connect */
	char *errmsg;			/* return from pbs_geterrmsg */
	char destbuf[256];		/* buffer for option server */
	struct attrl *attrib;		/* the attrib list */
	char *new_resvname;		/* the name returned from pbs_submit_resv */
	struct ecl_attribute_errors *err_list;
	char *interactive = NULL;

	/*test for real deal or just version and exit*/

	execution_mode(argc, argv);

#ifdef WIN32
	winsock_init();
#endif

	destbuf[0] = '\0';
	errflg = process_opts(argc, argv, &attrib, destbuf); /* get cmdline options */

	if (errflg || ((optind+1) < argc) || argc == 1) {
		print_usage();
		exit(2);
	}

	/* Get any required environment variables needing to be sent. */
	if (! set_resv_env(envp)) {
		fprintf(stderr, "pbs_rsub: can't send environment with the reservation\n");
		exit(3);
	}

	/*perform needed security library initializations (including none)*/

	if (CS_client_init() != CS_SUCCESS) {
		fprintf(stderr, "pbs_rsub: unable to initialize security library.\n");
		exit(1);
	}

	/* Connect to the server */
	connect = cnt2server(destbuf);
	if (connect <= 0) {
		fprintf(stderr, "pbs_rsub: cannot connect to server %s (errno=%d)\n",
			pbs_server, pbs_errno);
		CS_close_app();
		exit(pbs_errno);
	}

	if (qmoveflg == TRUE) {
		qmoveflg = FALSE;
		interactive = get_attr(attrib, ATTR_inter, NULL);
		if (interactive == NULL) {
			set_attr(&attrib, ATTR_inter, DEFAULT_INTERACTIVE);
		} else {
			if (atoi(interactive) > -1) {
				fprintf(stderr, "pbs_rsub: -I <timeout> value must be negative when used with -Wqmove option.\n");
				CS_close_app();
				exit(2);
			}
		}
		errflg = cnvrt_proc_attrib(connect, &attrib, destbuf);
		if (errflg) {
			fprintf(stderr, "pbs_rsub: can't make a reservation with the qmove option\n");
			CS_close_app();
			exit(2);
		}
	}

	pbs_errno = 0;
	new_resvname = pbs_submit_resv(connect, (struct attropl *)attrib, NULL);
	if (new_resvname == NULL) {
		if ((err_list = pbs_get_attributes_in_error(connect)))
			handle_attribute_errors(err_list);

		errmsg = pbs_geterrmsg(connect);
		if (errmsg != NULL) {
			fprintf(stderr, "pbs_rsub: %s\n", errmsg);
		}
		else
			fprintf(stderr, "pbs_rsub: Error (%d) submitting reservation\n", pbs_errno);
		CS_close_app();
		exit(pbs_errno);
	} else {
		printf("%s\n", new_resvname);
		free(new_resvname);
	}

	/* Disconnet from the server. */
	pbs_disconnect(connect);

	CS_close_app();
	exit(0);
}
コード例 #13
0
ファイル: harness_common.c プロジェクト: DBMSRmutl/MaxScale
int harness_init(int argc, char** argv, HARNESS_INSTANCE** inst){


	int i = 0,rval = 0;  
	MYSQL_session* mysqlsess;
	DCB* dcb;
	char cwd[1024];
	char tmp[2048];

	if(!(argc == 2 && strcmp(argv[1],"-h") == 0)){
		mxs_log_init(NULL,NULL,MXS_LOG_TARGET_DEFAULT);
	}
 
	if(!(instance.head = calloc(1,sizeof(FILTERCHAIN))))
		{
			printf("Error: Out of memory\n");
			MXS_ERROR("Out of memory\n");
      
			return 1;
		}

	*inst = &instance;
	instance.running = 1;
	instance.infile = -1;
	instance.outfile = -1;
	instance.expected = -1;
	instance.buff_ind = -1;
	instance.last_ind = -1;
	instance.sess_ind = -1;
    instance.session = calloc(1,sizeof(SESSION));
	dcb = calloc(1,sizeof(DCB));
	mysqlsess = calloc(1,sizeof(MYSQL_session));

	sprintf(mysqlsess->user,"dummyuser");
	sprintf(mysqlsess->db,"dummydb");		
	dcb->func.write = dcbfun;
	dcb->remote = strdup("0.0.0.0");
	dcb->user = strdup("user");
	instance.session->client = (void*)dcb;
	instance.session->data = (void*)mysqlsess;

	getcwd(cwd,sizeof(cwd));
	sprintf(tmp,"%s",cwd);

	mxs_log_init(NULL, tmp, MXS_LOG_TARGET_DEFAULT);
	
	rval = process_opts(argc,argv);
	
	if(!(instance.thrpool = malloc(instance.thrcount * sizeof(pthread_t)))){
		printf("Error: Out of memory\n");
		MXS_ERROR("Out of memory\n");
		return 1;
	}
  
	/**Initialize worker threads*/
	pthread_mutex_lock(&instance.work_mtx);
	size_t thr_num = 1;
	for(i = 0;i<instance.thrcount;i++){
		rval |= pthread_create(&instance.thrpool[i],NULL,(void*)work_buffer,(void*)thr_num++);
	}

	return rval;
}