コード例 #1
0
ファイル: lib-osmesa.c プロジェクト: bobek/aranym-debian
static void InitNatfeat(void)
{
	long ver;
	
	nfOps = nf_init();
	if (!nfOps) {
		err_init("__NF cookie not present on this system");
		return;
	}

	nfOSMesaId=nfOps->get_id("OSMESA");
	if (nfOSMesaId==0) {
		err_init("NF OSMesa functions not present on this system");
		return;
	}
	ver = nfOps->call(nfOSMesaId+GET_VERSION, 0l, 0l);
	if (ver < ARANFOSMESA_NFAPI_VERSION)
	{
		if (err_old_nfapi())
		{
			err_init("NF OSMesa functions in ARAnyM too old");
			nfOSMesaId = 0;
			return;
		}
	}
	if (ver > ARANFOSMESA_NFAPI_VERSION)
	{
		/*
		 * they should be backward compatible, but give a warning
		 */
	    (void) Cconws("Warning: NF OSMesa functions in ARAnyM newer than library\r\n");
	}
}
コード例 #2
0
ファイル: conf.c プロジェクト: alarcher/illumos-gate
/*
 * test main for conf module, usage: a.out conffile
 */
int
main(int argc, char *argv[])
{
	struct opts *opts;

	err_init(argv[0]);
	setbuf(stdout, NULL);
	opts_init(Opttable, Opttable_cnt);

	opts = opts_parse(NULL, NULL, 0);

	if (argc != 2)
		err(EF_RAW, "usage: %s conffile\n", argv[0]);

	conf_open(argv[1], argv[1], opts);

	printf("conffile <%s>:\n", argv[1]);
	conf_print(stdout, NULL);

	conf_close(opts);

	err_done(0);
	/* NOTREACHED */
	return (0);
}
コード例 #3
0
ファイル: video.c プロジェクト: 0359xiaodong/OpenAtlas
zbar_video_t *zbar_video_create ()
{
    zbar_video_t *vdo = calloc(1, sizeof(zbar_video_t));
    int i;
    if(!vdo)
        return(NULL);
    err_init(&vdo->err, ZBAR_MOD_VIDEO);
    vdo->fd = -1;

    (void)_zbar_mutex_init(&vdo->qlock);

    /* pre-allocate images */
    vdo->num_images = ZBAR_VIDEO_IMAGES_MAX;
    vdo->images = calloc(ZBAR_VIDEO_IMAGES_MAX, sizeof(zbar_image_t*));
    if(!vdo->images) {
        zbar_video_destroy(vdo);
        return(NULL);
    }

    for(i = 0; i < ZBAR_VIDEO_IMAGES_MAX; i++) {
        zbar_image_t *img = vdo->images[i] = zbar_image_create();
        if(!img) {
            zbar_video_destroy(vdo);
            return(NULL);
        }
        img->refcnt = 0;
        img->cleanup = _zbar_video_recycle_image;
        img->srcidx = i;
        img->src = vdo;
    }

    return(vdo);
}
コード例 #4
0
ファイル: ipmidetectd.c プロジェクト: chu11/freeipmi-mirror
int
main (int argc, char **argv)
{
  err_init (argv[0]);
  err_set_flags (ERROR_STDERR);

  ipmidetectd_argp_parse (argc, argv, &cmd_args);

  ipmidetectd_config_setup (argc, argv);

  if (!cmd_args.debug)
    {
      daemonize_common (IPMIDETECTD_PIDFILE);
      err_set_flags (ERROR_SYSLOG);
    }
  else
    err_set_flags (ERROR_STDERR);

  daemon_signal_handler_setup (_signal_handler_callback);

  /* Call after daemonization, since daemonization closes currently
   * open fds
   */
  openlog (argv[0], LOG_ODELAY | LOG_PID, LOG_DAEMON);

  _ipmidetectd_loop ();

  return (0);
}
コード例 #5
0
ファイル: kw.c プロジェクト: AlainODea/illumos-gate
/*
 * test main for kw module, usage: a.out fname [template...]
 */
int
main(int argc, char *argv[])
{
	int i;
	struct fn *src = fn_new(NULL);
	struct fn *dst = fn_new(NULL);

	err_init(argv[0]);
	setbuf(stdout, NULL);

	Now = time(0);

	if (argc < 2)
		err(0, "first arg must be fname");

	kw_init(fn_new(argv[1]), NULL);

	kw_print(stdout);

	for (i = 2; i < argc; i++) {
		int n;

		for (n = -1; n < 2; n++) {
			fn_renew(src, argv[i]);
			fn_renew(dst, NULL);
			printf("expand<%s> n %d hasn %d ",
			    argv[i], n, kw_expand(src, dst, n, B_FALSE));
			printf("result <%s>\n", fn_s(dst));
		}
	}

	err_done(0);
	/* NOTREACHED */
	return (0);
}
コード例 #6
0
ファイル: dbcertify.c プロジェクト: CeperaCPP/fis-gtm
int UNIX_ONLY(main)VMS_ONLY(dbcertify)(int argc, char **argv)
{
	DCL_THREADGBL_ACCESS;

	/* Initialization of scaffolding we run on */
	GTM_THREADGBL_INIT;
	gtm_imagetype_init(DBCERTIFY_IMAGE);
	gtm_env_init();
	gtm_utf8_mode = FALSE; 		/* Only ever runs in V4 database so NO utf8 mode -- ever */
	psa_gbl = malloc(SIZEOF(*psa_gbl));
	memset(psa_gbl, 0, SIZEOF(*psa_gbl));
	UNIX_ONLY(err_init(dbcertify_base_ch));
	UNIX_ONLY(sig_init(dbcertify_signal_handler, dbcertify_signal_handler, NULL));
	VMS_ONLY(util_out_open(0));
	VMS_ONLY(SET_EXIT_HANDLER(exi_blk, dbcertify_exit_handler, exi_condition));	/* Establish exit handler */
	VMS_ONLY(ESTABLISH(dbcertify_base_ch));
	process_id = getpid();

	/* Structure checks .. */
	assert((24 * 1024) == SIZEOF(v15_sgmnt_data));	/* Verify V4 file header hasn't suddenly increased for some odd reason */

	/* Platform dependent method to get the option scan going and invoke necessary driver routine */
	dbcertify_parse_and_dispatch(argc, argv);
	return SS_NORMAL;
}
コード例 #7
0
int 
main(int argc, char *argv[]) 
{
  err_init(argv[0]);
  err_set_flags(ERROR_STDERR);
#if CEREBRO_DEBUG
  cerebro_err_init(argv[0]);
#endif /* CEREBRO_DEBUG */

  _init_cerebro_stat();

  _cmdline_parse(argc, argv);
  
  /* Checks in _cmdline_parse ensure only one of four below will be called */

  if (event_list_flag 
      || (event_name && !strcmp(event_name, CEREBRO_EVENT_NAMES)))
    _event_list();

  if (metric_list_flag 
      || (metric_name && !strcmp(metric_name, CEREBRO_METRIC_METRIC_NAMES)))
    _metric_list();

  if (metric_name && strcmp(metric_name, CEREBRO_METRIC_METRIC_NAMES))
    _metric_data();

  if (event_name)
    _event_data();

  _cleanup_cerebro_stat();
  exit(0);
}
コード例 #8
0
ファイル: check_line.c プロジェクト: Fusiow/msh
int		check_line(char *str)
{
	t_error		err;
	int			i;

	err_init(&err);
	i = 0;
	while (str[i])
	{
		if (str[i] == '"' && str[i - 1] != '\\')
			err.dquote = dquote_check(str, &i);
		else if (str[i] == '\'' && str[i] != '\\')
			err.squote = squote_check(str, &i);
		else if (str[i] == '`' && str[i - 1] != '\\')
			err.bquote = bquote_check(str, &i);
		else if (str[i] == '|' && str[i - 1] != '\\')
			err.pipe = p_check(str, &i);
		else if (str[i] == '(' || str[i] == ')')
			err.par = check_par(str, &i);
		++i;
	}
	if (err.par == 2 || err.redir == 2)
		return (2);
	if (err.dquote == 1 || err.squote == 1 || err.pipe == 1
			|| err.bquote == 1 || err.par == 1)
		return (1);
	return (0);
}
コード例 #9
0
ファイル: processor.c プロジェクト: dev2dev/itemshelf
zebra_processor_t *zebra_processor_create (int threaded)
{
    zebra_processor_t *proc = calloc(1, sizeof(zebra_processor_t));
    if(!proc)
        return(NULL);
    err_init(&proc->err, ZEBRA_MOD_PROCESSOR);
    proc->kick_fds[0] = proc->kick_fds[1] = -1;

    proc->scanner = zebra_image_scanner_create();
    if(!proc->scanner) {
        free(proc);
        return(NULL);
    }

    if(threaded) {
#ifdef HAVE_LIBPTHREAD
        proc->threaded = 1;
        proc->sem = 1;
        /* FIXME check errors */
        pthread_mutex_init(&proc->mutex, NULL);
        pthread_cond_init(&proc->cond, NULL);
        pthread_cond_init(&proc->event, NULL);
        pipe(proc->kick_fds);
        add_poll(proc, proc->kick_fds[0], NULL);
#else
    /* FIXME record warning */
#endif
    }

    return(proc);
}
コード例 #10
0
ファイル: lut.c プロジェクト: andreiw/polaris
/*
 * test main for lut module, usage: a.out [lhs[=rhs]...]
 */
int
main(int argc, char *argv[])
{
	struct lut *r = NULL;
	struct lut *dupr = NULL;
	char *equals;

	err_init(argv[0]);
	setbuf(stdout, NULL);

	for (argv++; *argv; argv++)
		if ((equals = strchr(*argv, '=')) != NULL) {
			*equals++ = '\0';
			r = lut_add(r, *argv, equals);
		} else
			r = lut_add(r, *argv, "NULL");

	printf("lut contains:\n");
	lut_walk(r, printer, r);

	dupr = lut_dup(r);

	lut_free(r, NULL);

	printf("dup lut contains:\n");
	lut_walk(dupr, printer, dupr);

	lut_free(dupr, NULL);

	err_done(0);
	/* NOTREACHED */
	return (0);
}
コード例 #11
0
ファイル: dse.c プロジェクト: CeperaCPP/fis-gtm
int main(int argc, char *argv[])
{
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	set_blocksig();
	gtm_imagetype_init(DSE_IMAGE);
	gtm_wcswidth_fnptr = gtm_wcswidth;
	gtm_env_init();	/* read in all environment variables */
	licensed = TRUE;
	TREF(transform) = TRUE;
	op_open_ptr = op_open;
	patch_curr_blk = get_dir_root();
	err_init(util_base_ch);
	GTM_ICU_INIT_IF_NEEDED;	/* Note: should be invoked after err_init (since it may error out) and before CLI parsing */
	sig_init(generic_signal_handler, dse_ctrlc_handler, suspsigs_handler);
	atexit(util_exit_handler);
	SET_LATCH_GLOBAL(&defer_latch, LOCK_AVAILABLE);
	get_page_size();
	stp_init(STP_INITSIZE);
	rts_stringpool = stringpool;
	getjobname();
	INVOKE_INIT_SECSHR_ADDRS;
	getzdir();
	prealloc_gt_timers();
	initialize_pattern_table();
	gvinit();
	region_init(FALSE);
	INIT_GBL_ROOT(); /* Needed for GVT initialization */
	getjobnum();
	util_out_print("!/File  !_!AD", TRUE, DB_LEN_STR(gv_cur_region));
	util_out_print("Region!_!AD!/", TRUE, REG_LEN_STR(gv_cur_region));
	cli_lex_setup(argc, argv);
	CREATE_DUMMY_GBLDIR(gd_header, original_header, gv_cur_region, gd_map, gd_map_top);
	gtm_chk_dist(argv[0]);
#	ifdef DEBUG
	if ((gtm_white_box_test_case_enabled && (WBTEST_SEMTOOLONG_STACK_TRACE == gtm_white_box_test_case_number) ))
	{
		sgmnt_addrs     * csa;
		node_local_ptr_t cnl;
		csa = &FILE_INFO(gv_cur_region)->s_addrs;
		cnl = csa->nl;
		cnl->wbox_test_seq_num  = 1; /*Signal the first step and wait here*/
		while (2 != cnl->wbox_test_seq_num) /*Wait for another process to get hold of the semaphore and signal next step*/
			LONG_SLEEP(10);
	}
#	endif
	if (argc < 2)
                display_prompt();
	io_init(TRUE);
	while (1)
	{
		if (!dse_process(argc))
			break;
		display_prompt();
	}
	dse_exit();
	REVERT;
}
コード例 #12
0
ファイル: nftiny_gl.c プロジェクト: bobek/aranym-debian
int main(void)
{
	if (ldg_init(&LibLdg) != 0)
	{
		err_init("This program is a LDG library");
	}
	return 0;
}
コード例 #13
0
ファイル: mysql.c プロジェクト: KnightKu/lmt
static int
_setup (void)
{
    err_init (MONITOR_NAME);
    err_set_dest ("cerebro");
    lmt_conf_init (0, NULL);
    return 0;
}
コード例 #14
0
ファイル: main.c プロジェクト: berkus/moto
int main (int argc, char **argv) {
   int i;
   char *target = NULL;
   char *mxdir = NULL;
   char *propfile = NULL; 
   FILE *file;
   shared_init(32*1024*1024);
   err_init();	
   log_init(LOG_LEVEL);
   mman_init();

   while (1) {
      char c = getopt(argc, argv, "n:d:p:");
      if (c == -1) {
         break;
      }
      switch (c) {
         case 'd':
            mxdir = optarg;
            break;
         case 'n':
            target = optarg;
            break;
         case 'p':
            propfile = optarg;
            break;
      }
   }

   if (argc < 2) {
      usage();
   }
   else {
      c = mxc_create();
      c->mxdir = mxdir;
      c->target = target;
      prop_addFromFile(c->props,  propfile);
      for (i = optind; i < argc; i++) {      
         c->filename = argv[i];
         file = fopen(argv[i], "r");
         err_assert(file != NULL, err_f("IOError"));
         yyin = file;
         yylineno = 1;
         yyparse();	
      }

      mxc_emitIncludes(c);
      mxc_emitExports(c);
      mxc_emitInterface(c);
      mxc_emitCode(c);
      mxc_emitBuildScript(c);
      //mxc_free(c);
   }
   
   shared_cleanup();

   return 0;
}
コード例 #15
0
ファイル: gtmci.c プロジェクト: h4ck3rm1k3/FIS-GT.M
int gtm_init()
{
	rhdtyp          	*base_addr;
	unsigned char   	*transfer_addr;
	error_def(ERR_CITPNESTED);
	error_def(ERR_CIMAXLEVELS);

	if (!gtm_startup_active)
	{ /* call-in invoked from C as base. GT.M hasn't been started up yet. */
		image_type = GTM_IMAGE;
		gtm_env_init();	/* read in all environment variables */
		err_init(stop_image_conditional_core);
		cli_lex_setup(0, NULL);
		/* Initialize msp to the maximum so if errors occur during GT.M startup below,
		 * the unwind logic in gtmci_ch() will get rid of the whole stack. */
		msp = (unsigned char*)-1;
	}
	ESTABLISH_RET(gtmci_ch, mumps_status);
	if (!gtm_startup_active)
	{ /* GT.M is not active yet. Create GT.M startup environment */
		invocation_mode = MUMPS_CALLIN;
		init_gtm();
		gtm_savetraps(); /* nullify default $ZTRAP handling */
		assert(gtm_startup_active);
		assert(frame_pointer->flags & SFF_CI);
		nested_level = 1;
	}
	else if (!(frame_pointer->flags & SFF_CI))
	{ /* Nested call-in: setup a new CI environment (SFF_CI frame on top of base-frame) */
		/* Mark the beginning of the new stack so that initialization errors in
		 * call-in frame do not unwind entries of the previous stack (see gtmci_ch).*/
		fgncal_stack = msp;
		/* Report if condition handlers stack may overrun during this callin level.
		 * Every underlying level can not have more than 2 active condition handlers,
		 * plus extra MAX_HANDLERS are reserved for this level. */
		if (chnd_end - ctxt <= MAX_HANDLERS)
			rts_error(VARLSTCNT(3) ERR_CIMAXLEVELS, 1, nested_level);
		/* Disallow call-ins within a TP boundary since TP restarts are not supported
		 * currently across nested call-ins. When we implement TP restarts across call-ins,
		 * this error needs be changed to a Warning or Notification */
		if (0 < dollar_tlevel)
			rts_error(VARLSTCNT(1) ERR_CITPNESTED);
		base_addr = make_cimode();
		transfer_addr = PTEXT_ADR(base_addr);
		gtm_init_env(base_addr, transfer_addr);
		SET_CI_ENV(ci_ret_code_exit);
		gtmci_isv_save();
		nested_level++;
	}
	/* Now that GT.M is initialized. Mark the new stack pointer (msp) so that errors
	 * while executing an M routine do not unwind stack below this mark. It important that
	 * the call-in frames (SFF_CI), that hold nesting information (eg. $ECODE/$STACK data
	 * of the previous stack), are kept from being unwound. */
	fgncal_stack = msp;
	REVERT;
	return 0;
}
コード例 #16
0
ファイル: window.c プロジェクト: radityaprawira/MoSync
zbar_window_t *zbar_window_create (void)
{
    zbar_window_t *w = calloc(1, sizeof(zbar_window_t));
    if(!w)
        return(NULL);
    err_init(&w->err, ZBAR_MOD_WINDOW);
    w->overlay = 1;
    (void)_zbar_mutex_init(&w->imglock);
    return(w);
}
コード例 #17
0
/* On OSF/1 (Digital Unix), pointers are 64 bits wide; the only exception to this is C programs for which one may
 * specify compiler and link editor options in order to use (and allocate) 32-bit pointers.  However, since C is
 * the only exception and, in particular because the operating system does not support such an exception, the argv
 * array passed to the main program is an array of 64-bit pointers.  Thus the C program needs to declare argv[]
 * as an array of 64-bit pointers and needs to do the same for any pointer it sets to an element of argv[].
 */
int main(int argc, char_ptr_t argv[])
{
	omi_conn_ll	conns;
	bool	  	set_pset();
	int 		ret_val;
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	ctxt = NULL;
	common_startup_init(GTCM_SERVER_IMAGE);
	SPRINTF(image_id,"%s=gtcm_server", image_id);
#	ifdef SEQUOIA
	if (!set_pset())
		exit(-1);
#	endif
	/*  Initialize everything but the network */
	err_init(gtcm_exit_ch);
	gtm_chk_dist(argv[0]);
	omi_errno = OMI_ER_NO_ERROR;
	ctxt = ctxt;
	ESTABLISH_RET(omi_dbms_ch, -1);	/* any return value to signify error return */
	gtcm_init(argc, argv);
	gtcm_ltime = gtcm_stime = (int4)time(0);
#	ifdef GTCM_RC
	rc_create_cpt();
#	endif
	REVERT;
	if (OMI_ER_NO_ERROR != omi_errno)
		exit(omi_errno);
	/*  Initialize the network interface */
	if (0 != (ret_val = gtcm_bgn_net(&conns)))	/* Warning - assignment */
	{
		gtcm_rep_err("Error initializing TCP", ret_val);
		gtcm_exi_condition = ret_val;
		gtcm_exit();
	}
	SPRINTF(image_id,"%s(pid=%d) %s %s %s -id %d -service %s",
		image_id,
		omi_pid,
		( history ? "-hist" : "" ),
		( authenticate ? "-auth" : "" ),
		( ping_keepalive ? "-ping" : "" ),
		rc_server_id,
		omi_service
		);
	OPERATOR_LOG_MSG;
	omi_conns = &conns;
	/*  Should be forever, unless an error occurs */
	gtcm_loop(&conns);
	/*  Clean up */
	gtcm_end_net(&conns);
	gtcm_exit();
	return 0;
}
コード例 #18
0
ファイル: tparse.c プロジェクト: LLNL/lmt
int
main (int argc, char *argv[])
{
    err_init (argv[0]);
    lmt_conf_init (1, NULL);

    lmt_conf_set_proto_debug (1);

    parse_utils ();
    parse_legacy ();
    parse_current ();
    parse_current_short ();
    parse_current_long ();
    exit (0);
}
コード例 #19
0
ファイル: ox.c プロジェクト: sriedel/ox
/* call-seq: parse_obj(xml) => Object
 *
 * Parses an XML document String that is in the object format and returns an
 * Object of the type represented by the XML. This function expects an
 * optimized XML formated String. For other formats use the more generic
 * Ox.load() method.  Raises an exception if the XML is malformed or the
 * classes specified in the file are not valid.
 * @param [String] xml XML String in optimized Object format.
 * @return [Object] deserialized Object.
 */
static VALUE
to_obj(VALUE self, VALUE ruby_xml) {
    char		*xml, *x;
    size_t		len;
    VALUE		obj;
    struct _Options	options = ox_default_options;
    struct _Err		err;

    err_init(&err);
    Check_Type(ruby_xml, T_STRING);
    /* the xml string gets modified so make a copy of it */
    len = RSTRING_LEN(ruby_xml) + 1;
    x = defuse_bom(StringValuePtr(ruby_xml), &options);
    if (SMALL_XML < len) {
	xml = ALLOC_N(char, len);
    } else {
コード例 #20
0
ファイル: processor.c プロジェクト: lamhx393/zbar-redux
zbar_processor_t *zbar_processor_create (int threaded)
{
    zbar_processor_t *proc = calloc(1, sizeof(zbar_processor_t));
    if(!proc)
        return(NULL);
    err_init(&proc->err, ZBAR_MOD_PROCESSOR);

    proc->scanner = zbar_image_scanner_create();
    if(!proc->scanner) {
        free(proc);
        return(NULL);
    }

    proc->threaded = !_zbar_mutex_init(&proc->mutex) && threaded;
    _zbar_processor_init(proc);
    return(proc);
}
コード例 #21
0
ファイル: mupip.c プロジェクト: duck57/fis-gtm-freebsd
int main (int argc, char **argv)
{
	int		res;
	DCL_THREADGBL_ACCESS;

	GTM_THREADGBL_INIT;
	set_blocksig();
	gtm_imagetype_init(MUPIP_IMAGE);
	invocation_mode = MUMPS_UTILTRIGR;
	gtm_wcswidth_fnptr = gtm_wcswidth;
	gtm_env_init();	/* read in all environment variables */
	err_init(util_base_ch);
	UNICODE_ONLY(gtm_strToTitle_ptr = &gtm_strToTitle);
	GTM_ICU_INIT_IF_NEEDED;	/* Note: should be invoked after err_init (since it may error out) and before CLI parsing */
	sig_init(generic_signal_handler, NULL, suspsigs_handler, continue_handler);	/* Note: no ^C handler is defined (yet) */
	atexit(mupip_exit_handler);
	licensed = TRUE;
	in_backup = FALSE;
	op_open_ptr = mu_op_open;
	mu_get_term_characterstics();
	cli_lex_setup(argc,argv);
	if (argc < 2)			/* Interactive mode */
		display_prompt();
	/*      this call should be after cli_lex_setup() due to S390 A/E conversion    */
	gtm_chk_dist(argv[0]);
	INIT_GBL_ROOT(); /* Needed for GVT initialization */
	init_gtm();
	while (TRUE)
	{	func = 0;
		if ((res = parse_cmd()) == EOF)
			break;
		else if (res)
		{
			if (1 < argc)
				rts_error(VARLSTCNT(4) res, 2, LEN_AND_STR(cli_err_str));
			else
				gtm_putmsg(VARLSTCNT(4) res, 2, LEN_AND_STR(cli_err_str));
		}
		if (func)
			func();
		if (argc > 1)		/* Non-interactive mode, exit after command */
			break;
		display_prompt();
	}
	mupip_exit(SS_NORMAL);
}
コード例 #22
0
ファイル: cerebro-admin.c プロジェクト: chaos/cerebro
int 
main(int argc, char *argv[]) 
{
  const char *func = __FUNCTION__;
  int rv = 0;

  err_init(argv[0]);
  err_set_flags(ERROR_STDERR);
#if CEREBRO_DEBUG
  cerebro_err_init(argv[0]);
#endif /* CEREBRO_DEBUG */

  _init_cerebro_admin();

  _cmdline_parse(argc, argv);
  
  if (operation == CEREBRO_ADMIN_REGISTER)
    rv = cerebro_register_metric(handle, metric_name);
  else if (operation == CEREBRO_ADMIN_UNREGISTER)
    rv = cerebro_unregister_metric(handle, metric_name);
  else if (operation == CEREBRO_ADMIN_UPDATE)
    rv = cerebro_update_metric_value(handle, 
                                     metric_name,
                                     metric_value_type,
                                     metric_value_len,
                                     metric_value_ptr);
  else if (operation == CEREBRO_ADMIN_RESEND)
    rv = cerebro_resend_metric(handle, metric_name);
  else if (operation == CEREBRO_ADMIN_FLUSH)
    rv = cerebro_flush_metric(handle, metric_name);
  
  if (rv < 0)
    {
      char *msg = cerebro_strerror(cerebro_errnum(handle));
      
      _clean_err_exit(cerebro_errnum(handle));
      err_exit("%s: %s", func, msg);
    }
  
  _cleanup_cerebro_stat();
  exit(0);
}
コード例 #23
0
ファイル: core.c プロジェクト: ataceyhun/libdhcore
result_t core_init(uint flags)
{
    if (BIT_CHECK(flags, CORE_INIT_CRASHDUMP))  {
        if (IS_FAIL(crash_init()))
            return RET_FAIL;
    }

    if (IS_FAIL(mem_init(BIT_CHECK(flags, CORE_INIT_TRACEMEM))))
        return RET_FAIL;

    if (IS_FAIL(log_init()))
        return RET_FAIL;

    if (BIT_CHECK(flags, CORE_INIT_ERRORS)) {
        if (IS_FAIL(err_init()))
            return RET_FAIL;
    }

    rand_seed();

    if (BIT_CHECK(flags, CORE_INIT_JSON))   {
        if (IS_FAIL(json_init()))
            return RET_FAIL;
    }

    if (BIT_CHECK(flags, CORE_INIT_FILEIO)) {
        if (IS_FAIL(fio_initmgr()))
            return RET_FAIL;
    }

    if (BIT_CHECK(flags, CORE_INIT_TIMER)) {
        if (IS_FAIL(timer_initmgr()))
            return RET_FAIL;
    }

    if (BIT_CHECK(flags, CORE_INIT_SOCKET)) {
        if (IS_FAIL(sock_init()))
            return RET_FAIL;
    }

    return RET_OK;
}
コード例 #24
0
ファイル: conf.c プロジェクト: andreiw/polaris
/*
 * test main for conf module, usage: a.out conffile
 */
int
main(int argc, char *argv[])
{
	err_init(argv[0]);
	setbuf(stdout, NULL);

	if (argc != 2)
		err(EF_RAW, "usage: %s conffile\n", argv[0]);

	conf_open(argv[1], 1);

	printf("conffile <%s>:\n", argv[1]);
	conf_print(stdout);

	conf_close(opts_parse(NULL, 0));

	err_done(0);
	/* NOTREACHED */
	return (0);
}
コード例 #25
0
ファイル: bmc-watchdog.c プロジェクト: NodePrime/freeipmi
int
main (int argc, char **argv)
{
  err_init (argv[0]);
  err_set_flags (ERROR_STDERR);

  ipmi_disable_coredump ();

  bmc_watchdog_argp_parse (argc, argv, &cmd_args);

  /* Early initialization.  Daemon must do all initialization in
   * daemon_init() b/c daemon_init() needs to close all formerly open
   * file descriptors.
   */
  if (!cmd_args.daemon)
    _init_bmc_watchdog ();

  if (cmd_args.set)
    _set_cmd ();
  else if (cmd_args.get)
    _get_cmd ();
  else if (cmd_args.reset)
    _reset_cmd ();
  else if (cmd_args.start)
    _start_cmd ();
  else if (cmd_args.stop)
    _stop_cmd ();
  else if (cmd_args.clear)
    _clear_cmd ();
  else if (cmd_args.daemon)
    _daemon_cmd (argv[0]);
  else
    err_exit ("internal error, command not set");

  ipmi_ctx_close (ipmi_ctx);
  ipmi_ctx_destroy (ipmi_ctx);
  closelog ();
  exit (EXIT_SUCCESS);
}
コード例 #26
0
ファイル: httppower.c プロジェクト: kmddd59/powerman
int
main(int argc, char *argv[])
{
    CURL *h;
    int c;

    err_init(basename(argv[0]));

    while ((c = getopt_long(argc, argv, OPTIONS, longopts, NULL)) != EOF) {
        switch (c) {
            case 'u': /* --url */
                url = xstrdup(optarg);
                break;
            default:
                usage();
                break;
        }
    }
    if (optind < argc)
        usage();

    if (curl_global_init(CURL_GLOBAL_ALL) != 0)
        err_exit(FALSE, "curl_global_init failed");
    if ((h = curl_easy_init()) == NULL)
        err_exit(FALSE, "curl_easy_init failed");

    curl_easy_setopt(h, CURLOPT_TIMEOUT, 5);
    curl_easy_setopt(h, CURLOPT_ERRORBUFFER, errbuf);
    curl_easy_setopt(h, CURLOPT_FAILONERROR, 1);

    shell(h);

    curl_easy_cleanup(h);    	
    if (userpwd)
        xfree(userpwd);
    if (url)
        xfree(url);
    exit(0);
}
コード例 #27
0
ファイル: core.C プロジェクト: gildafnai82/craq
void
amain ()
{
  static bool amain_called;
  if (amain_called)
    panic ("amain called recursively\n");
  amain_called = true;

  // It's cheap to initialize the profiler, just do it here even
  // if we'll never use it.
  sfs_profiler::init ();

  START_ACHECK_TIMER ();

  ainit ();
  err_init ();

  timecb_check ();
  STOP_ACHECK_TIMER ();
  for (;;)
    _acheck ();
}
コード例 #28
0
ファイル: lke.c プロジェクト: indera/fis-gtm
int main (int argc, char *argv[])
{
    DCL_THREADGBL_ACCESS;

    GTM_THREADGBL_INIT;
    set_blocksig();
    gtm_imagetype_init(LKE_IMAGE);
    gtm_wcswidth_fnptr = gtm_wcswidth;
    gtm_env_init();	/* read in all environment variables */
    licensed = TRUE;
    err_init(util_base_ch);
    GTM_ICU_INIT_IF_NEEDED;	/* Note: should be invoked after err_init (since it may error out) and before CLI parsing */
    sig_init(generic_signal_handler, lke_ctrlc_handler, suspsigs_handler);
    atexit(util_exit_handler);
    SET_LATCH_GLOBAL(&defer_latch, LOCK_AVAILABLE);
    get_page_size();
    stp_init(STP_INITSIZE);
    rts_stringpool = stringpool;
    getjobname();
    INVOKE_INIT_SECSHR_ADDRS;
    getzdir();
    prealloc_gt_timers();
    initialize_pattern_table();
    gvinit();
    region_init(TRUE);
    getjobnum();

    cli_lex_setup(argc, argv);
    /*      this should be after cli_lex_setup() due to S390 A/E conversion    */
    gtm_chk_dist(argv[0]);

    while (1)
    {
        if (!lke_process(argc) || 2 <= argc)
            break;
    }
    lke_exit();
}
コード例 #29
0
/*
 *   Initialize the error subsystem for the compiler 
 */
void CTcMain::tc_err_init(size_t param_stack_size,
                          CResLoader *res_loader)
{
    /* initialize the error stack */
    err_init(1024);

    /* if this is the first initializer, set things up */
    if (err_refs_ == 0)
    {
        /* if we haven't loaded external compiler messages, load them */
        if (!err_no_extern_messages_
            && tc_messages == &tc_messages_english[0])
        {
            osfildef *fp;
            
            /* try finding a message file */
            fp = res_loader->open_res_file("t3make.msg", 0, "XMSG");
            if (fp != 0)
            {
                /* try loading it */
                err_load_message_file(fp, &tc_messages, &tc_message_count,
                                      &tc_messages_english[0],
                                      tc_message_count_english);
                
                /* done with the file */
                osfcls(fp);
            }
            else
            {
                /* note the failure, so we don't try again */
                err_no_extern_messages_ = FALSE;
            }
        }
    }

    /* count the reference depth */
    ++err_refs_;
}
コード例 #30
0
/*=========================================================================*/
sns_err_code_e sns_init_dsps( void )
{
  MSG(MSG_SSID_QDSP6, DBG_HIGH_PRIO, "DSPS INIT");
  sns_err_code_e rv = SNS_SUCCESS; // Return Value
#ifdef DALSYS_UCOS_SHIM
  DALSYS_InitMod(NULL);
  OS_CPU_INT_FREE(); // Make sure interrupts are enabled
#endif
#ifdef FEATURE_SMDL
  smem_init();
  smsm_init();
  err_init();
  smd_init();
  if( 0 != smdl_init( 0 ) ) {
    rv = SNS_ERR_FAILED;
  }
#endif
#if !defined (SNS_PCSIM) && !defined (QDSP6)
  timetick_offset_init();
#endif
  smr_set_qmi_service_obj ();
  sns_init_done();
  return rv;
}