コード例 #1
0
ファイル: core.c プロジェクト: philg666/Latest_eAmod
/*======================================
 *	CORE : Signal Sub Function
 *--------------------------------------*/
static void sig_proc(int sn)
{
	static int is_called = 0;

	switch (sn) {
	case SIGINT:
	case SIGTERM:
		if (++is_called > 3)
			exit(EXIT_SUCCESS);
		if( shutdown_callback != NULL )
			shutdown_callback();
		else
			runflag = CORE_ST_STOP;// auto-shutdown
		break;
	case SIGSEGV:
	case SIGFPE:
		do_abort();
		// Pass the signal to the system's default handler
		compat_signal(sn, SIG_DFL);
		raise(sn);
		break;
#ifndef _WIN32
	case SIGXFSZ:
		// ignore and allow it to set errno to EFBIG
		ShowWarning ("Max file size reached!\n");
		//run_flag = 0;	// should we quit?
		break;
	case SIGPIPE:
		//ShowInfo ("Broken pipe found... closing socket\n");	// set to eof in socket.c
		break;	// does nothing here
#endif
	}
}
コード例 #2
0
ファイル: system.c プロジェクト: alejandromagnorsky/so2010
/*===========================================================================*
 *				sys_task				     *
 *===========================================================================*/
PUBLIC sys_task()
{
/* Main entry point of sys_task.  Get the message and dispatch on type. */

  register int r;

  while (TRUE) {
	receive(ANY, &m);

	switch (m.m_type) {	/* which system call */
	    case SYS_FORK:	r = do_fork(&m);	break;
	    case SYS_NEWMAP:	r = do_newmap(&m);	break;
	    case SYS_EXEC:	r = do_exec(&m);	break;
	    case SYS_XIT:	r = do_xit(&m);		break;
	    case SYS_GETSP:	r = do_getsp(&m);	break;
	    case SYS_TIMES:	r = do_times(&m);	break;
	    case SYS_ABORT:	r = do_abort(&m);	break;
	    case SYS_SIG:	r = do_sig(&m);		break;
	    case SYS_COPY:	r = do_copy(&m);	break;
	    default:		r = E_BAD_FCN;
	}

	m.m_type = r;		/* 'r' reports status of call */
	send(m.m_source, &m);	/* send reply to caller */
  }
}
コード例 #3
0
ファイル: pgxc_clean.c プロジェクト: kisehiroshi/postgres-xc
static void
recover2PC(PGconn *conn, txn_info *txn)
{
	TXN_STATUS txn_stat;

	txn_stat = check_txn_global_status(txn);
	if (verbose_opt)
	{
		fprintf(outf, "    Recovering TXN: gxid: %d, xid: \"%s\", owner: \"%s\", global status: %s\n",
				txn->gxid, txn->xid, txn->owner, str_txn_stat(txn_stat));
	}
	switch (txn_stat)
	{
		case TXN_STATUS_FAILED:
			if (verbose_opt)
				fprintf(outf, "        Recovery not needed.\n");
			return;
		case TXN_STATUS_PREPARED:
			if (verbose_opt)
				fprintf(outf, "        Recovery not needed.\n");
			return;
		case TXN_STATUS_COMMITTED:
			do_commit(conn, txn);
			return;
		case TXN_STATUS_ABORTED:
			do_abort(conn, txn);
			return;
		default:
			fprintf(stderr, "        Unknown TXN status, pgxc_clean error.\n");
			exit(1);
	}
	return;
}
コード例 #4
0
ファイル: bounds_chk.c プロジェクト: manojxantony/compiler
void
_BOUNDS_ERROR(
	char	*file,		/* Fortran routine containing error */
	int	*line,		/* Line number in Fortran routine */
	char	*variable,	/* arrayname with out-of-bounds subscript */
	int	*dim,		/* Dimension number of the array */
	int	*lowerbnd,	/* Lower bound of dimension dim */
	int	*upperbnd,	/* Upper bound of dimension dim */
	int	sub[1],		/* Out-of-bounds subscript value */
	int	*count)		/* Count/flag for number of messages */
{
	int	*retcnt;	/* ptr to static arg count word */
	int	intcnt = 0;	/* local count if no count passed */
#ifdef	_UNICOS
	/* Use local variable if count argument not passed. */
	if (_numargs() < 8)
		retcnt	= &intcnt;
	else
#endif
		retcnt	= count;
	if ((*retcnt)++ == 0) {
#ifdef KEY /* Bug 7969 */
		if (want_abort()) {
		  (void) _lerror(_LELVL_MSG, FWARGSBV, sub[0], *dim, variable,
		     *line, file, *lowerbnd, *upperbnd);
		  do_abort();
		}
#endif /* KEY Bug 7969 */
		(void) _fwarn(FWARGSBV, sub[0], *dim, variable, *line,
		   file, *lowerbnd, *upperbnd);
	}
	return;
}
コード例 #5
0
ファイル: system.c プロジェクト: EmmanuelKasper/minix-st-1.5
/*===========================================================================*
 *				sys_task				     *
 *===========================================================================*/
PUBLIC void sys_task()
{
/* Main entry point of sys_task.  Get the message and dispatch on type. */

  register int r;

  while (TRUE) {
	receive(ANY, &m);

	switch (m.m_type) {	/* which system call */
	    case SYS_FORK:	r = do_fork(&m);	break;
	    case SYS_NEWMAP:	r = do_newmap(&m);	break;
	    case SYS_EXEC:	r = do_exec(&m);	break;
	    case SYS_XIT:	r = do_xit(&m);		break;
	    case SYS_GETSP:	r = do_getsp(&m);	break;
	    case SYS_TIMES:	r = do_times(&m);	break;
	    case SYS_ABORT:	r = do_abort(&m);	break;
#if (CHIP == M68000)
	    case SYS_FRESH:	r = do_fresh(&m);	break;
#endif
	    case SYS_SIG:	r = do_sig(&m);		break;
	    case SYS_KILL:	r = do_kill(&m);	break;
	    case SYS_COPY:	r = do_copy(&m);	break;
	    case SYS_GBOOT:	r = do_gboot(&m);	break;
	    case SYS_UMAP:	r = do_umap(&m);	break;
	    case SYS_MEM:	r = do_mem(&m);		break;
	    case SYS_TRACE:	r = do_trace(&m);	break;
	    default:		r = E_BAD_FCN;
	}

	m.m_type = r;		/* 'r' reports status of call */
	send(m.m_source, &m);	/* send reply to caller */
  }
}
コード例 #6
0
ファイル: operations.c プロジェクト: GCrean/sitecopy
/* Leave critical section */
void fe_enable_abort( struct site *site ) {
  in_critical_section = 0;
  /* Carry out the abort if we were aborted while in the
   * critical section */
  if( want_abort ) {
     do_abort();
  }
}
コード例 #7
0
ファイル: operations.c プロジェクト: GCrean/sitecopy
/* Signal handler */
void handle_abort( int sig ) {
   if( in_critical_section ) {
      /* Can't abort now, so remember we want to for later */
      want_abort = 1;
   } else {
      do_abort();
   }
}
コード例 #8
0
/*
15.6.2.2531 [ELSE]
“bracket-else”
TOOLS EXT
Compilation: Perform the execution semantics given below.
Execution: ( “hspacesiname ...” -- )
Skipping leading spaces, parse and discard space-delimited words from the parse area,
including nested occurrences of [IF] ...
[THEN] and [IF] ...
[ELSE] ...
[THEN], until the word [THEN] has been parsed and discarded. If the parse area be-
comes exhausted, it is refilled as with REFILL. [ELSE] is an immediate word.
See: 3.4.1 Parsing, A.15.6.2.2531 [ELSE].
15.6.2.2532 [IF]
“bracket-if”
TOOLS EXT
*/
static void do_bracket_else(void)
{
/*

: [else]
	1 ( initialize [if]/[else]/[then] nesting level)
	begin
	bl word count dup 
	0= ( refill input buffer) if drop drop refill 0= if ( refill failed) drop ( drop nesting level) ." error: input exhausted" cr exit then [ over ] ( continue loop) again then
	0 if 2dup ." found word: " type cr then
	2dup s" [if]" compare 0= if ( increase nesting level) rot 1+ rot rot then
	2dup s" [else]" compare 0= if ( special-case for the nesting level) rot dup 1 = if 1- then rot rot then
	s" [then]" compare 0= if ( decrease nesting level) 1- then
	dup 0= until
	drop ; immediate

: [if] 0= if postpone [else] then ; immediate

: [then] ; immediate
*/
	/* initialize [if]/[else]/[then] nesting level */
	sf_push(1);
	do
	{
		do_bl(); do_word(); do_count();
		if (!sf_top())
		{
			/* input exhausted, refill input buffer */
			do_drop(); do_drop(); do_refill();
			if (!sf_pop()) { /* 'refill' failed */ /* drop nesting level */ do_drop(); print_str(__func__);
				print_str("(): input exhausted; aborting\n"); do_abort(); }
			continue;
		}

		do_two_to_r();

		do_two_r_fetch();
		//sf_push((cell) "\04[if]"); do_count(); sf_push((cell) compare_word_xt); do_execute();
		if (sf_pop() == 4) { if (!xmemcmp((void *) sf_pop(), "[if]", 4)) /* increase nesting level */ do_one_plus(); }
		else do_drop();

		do_two_r_fetch();
		//sf_push((cell) "\06[else]"); do_count(); sf_push((cell) compare_word_xt); do_execute();
		if (sf_pop() == 6) { if (!xmemcmp((void *) sf_pop(), "[else]", 6)) /* see if an [if] block should be terminated */ if (sf_top() == 1) do_one_minus(); }
		else do_drop();

		do_two_r_from();
		//sf_push((cell) "\06[then]"); do_count(); sf_push((cell) compare_word_xt); do_execute();
		if (sf_pop() == 6) { if (!xmemcmp((void *) sf_pop(), "[then]", 6)) /* decrease nesting level */ do_one_minus(); }
		else do_drop();
	}
	while (sf_top());
	/* drop nesting level */
	do_drop();

}
コード例 #9
0
ファイル: rtl_sched.c プロジェクト: akshar100/SPaRK_x86
static inline void do_signal(pthread_t t)
{
	if (test_and_clear_bit(RTL_SIGNAL_SUSPEND, &t->pending)) 
	{
		do_abort(t);
		RTL_MARK_SUSPENDED(t);
	}

	if (test_and_clear_bit(RTL_SIGNAL_WAKEUP, &t->pending)) 
	{
		RTL_MARK_READY(t);
		do_abort(t);
	}

	if (test_and_clear_bit(RTL_SIGNAL_TIMER, &t->pending)) 
	{
		RTL_MARK_READY(t);
		do_abort(t);
	}

}
コード例 #10
0
ファイル: bounds_chk.c プロジェクト: manojxantony/compiler
/*
 *  Error handler for an of out of bounds substring.
 *
 *  Input:
 *    file     - File name in which error occurred.
 *    line     - Line number in file.
 *    variable - Name of array which had an out of bounds substring.
 *    size     - Substring size.
 *    start    - Out of bounds substring start.
 *    length   - Out of bounds substring length.
 *    count    - Static count/flag to indicate if this message was
 *               already given for this statement.
 */
void
_SBOUNDS_ERROR(
		char *file,
		int *line,
		char *variable,
		int *size,
                int *subst,
                int *subln,
                int *count )
{
	int	*retcnt;	/* ptr to static arg count word */
	int	intcnt = 0;	/* local count if no count passed */
	int	endst;
#ifdef	_UNICOS
	/* Use local variable if count argument not passed. */
	if (_numargs() < 7)
		retcnt	= &intcnt;
	else
#endif
		retcnt	= count;

	/* if substring length is zero or negative, not incorrect */
	if ( *subln > 0) {
		if ((*retcnt)++ == 0) {

			/* calculate substring end.
			 * subln is calculated by (ln = s2 - s1 + 1)
			 * endst is calculated by (s2 = ln + s1 - 1)
			 */
			endst	= *subln + *subst - 1;
#ifdef KEY /* Bug 7969 */
		if (want_abort()) {
		  (void) _lerror(_LELVL_MSG, FWARGSTR, *subst, endst, variable,
		    *line, file, *size);
		  do_abort();
		}
#endif /* KEY Bug 7969 */
			(void) _fwarn (FWARGSTR, *subst, endst, variable,
			   *line, file, *size);
		}
	}
	return;
}
コード例 #11
0
ファイル: phase3.c プロジェクト: djwong/xfsprogs
void
phase3(
	struct xfs_mount *mp,
	int		scan_threads)
{
	int			i, j;
	int			*counts;
	work_queue_t		wq;

	do_log(_("Phase 3 - for each AG...\n"));
	if (!no_modify)
		do_log(_("        - scan and clear agi unlinked lists...\n"));
	else
		do_log(_("        - scan (but don't clear) agi unlinked lists...\n"));

	set_progress_msg(PROG_FMT_AGI_UNLINKED, (__uint64_t) glob_agcount);

	/* first clear the agi unlinked AGI list */
	if (!no_modify) {
		for (i = 0; i < mp->m_sb.sb_agcount; i++)
			process_agi_unlinked(mp, i);
	}

	/* now look at possibly bogus inodes */
	for (i = 0; i < mp->m_sb.sb_agcount; i++)  {
		check_uncertain_aginodes(mp, i);
		PROG_RPT_INC(prog_rpt_done[i], 1);
	}
	print_final_rpt();

	/* ok, now that the tree's ok, let's take a good look */

	do_log(_(
	    "        - process known inodes and perform inode discovery...\n"));

	set_progress_msg(PROG_FMT_PROCESS_INO, (__uint64_t) mp->m_sb.sb_icount);

	process_ags(mp);

	print_final_rpt();

	/*
	 * process newly discovered inode chunks
	 */
	do_log(_("        - process newly discovered inodes...\n"));
	set_progress_msg(PROG_FMT_NEW_INODES, (__uint64_t) glob_agcount);

	counts = calloc(sizeof(*counts), mp->m_sb.sb_agcount);
	if (!counts) {
		do_abort(_("no memory for uncertain inode counts\n"));
		return;
	}

	do  {
		/*
		 * have to loop until no ag has any uncertain
		 * inodes
		 */
		j = 0;
		memset(counts, 0, mp->m_sb.sb_agcount * sizeof(*counts));

		create_work_queue(&wq, mp, scan_threads);

		for (i = 0; i < mp->m_sb.sb_agcount; i++)
			queue_work(&wq, do_uncertain_aginodes, i, &counts[i]);

		destroy_work_queue(&wq);

		/* tally up the counts */
		for (i = 0; i < mp->m_sb.sb_agcount; i++)
			j += counts[i];

	} while (j != 0);

	free(counts);

	print_final_rpt();
}
コード例 #12
0
ファイル: System.cpp プロジェクト: KevinHopps/klib
	void System::abort()
	{
		do_abort();
	}