Esempio n. 1
0
static void s_advance() {
  twiQ.doneCmd();
  if ( twiQ.hasCmd() )
    init_start();
  else
    init_stop();
}
Esempio n. 2
0
int
main(int argc, char ** argv)
{
	int req_restart = FALSE;
	int req_status  = FALSE;
	int req_stop    = FALSE;
	
	int argerr = 0;
	int flag;
	char * inherit_debuglevel;

	while ((flag = getopt(argc, argv, OPTARGS)) != EOF) {
		switch(flag) {
			case 'h':		/* Help message */
				usage(QUORUMD, LSB_EXIT_OK);
				break;
			case 'v':		/* Debug mode, more logs*/
				++debug_level;
				break;
			case 's':		/* Status */
				req_status = TRUE;
				break;
			case 'k':		/* Stop (kill) */
				req_stop = TRUE;
				break;
			case 'r':		/* Restart */
				req_restart = TRUE;
				break;
			default:
				++argerr;
				break;
		}
	}

	if (optind > argc) {
		quorum_log(LOG_ERR,"WHY WE ARE HERE?");
		++argerr;
	}

	if (argerr) {
 		usage(QUORUMD, LSB_EXIT_GENERIC);
	}

	inherit_debuglevel = getenv(HADEBUGVAL);
	if (inherit_debuglevel != NULL) {
		debug_level = atoi(inherit_debuglevel);
		if (debug_level > 2) {
			debug_level = 2;
		}
	}

	cl_log_set_entity(QUORUMD);
	cl_log_enable_stderr(FALSE);
	cl_log_set_facility(HA_LOG_FACILITY);

	cl_inherit_logging_environment(0);

	if (req_status){
		return init_status(PID_FILE, QUORUMD);
	}

	if (req_stop){
		return init_stop(PID_FILE);
	}

	if (req_restart) {
		init_stop(PID_FILE);
	}

	return init_start();
}
Esempio n. 3
0
// see "Miscellaneous States" in the datasheet; it seems to indicate that one ought to
// _only_ set the TWSTO and TWINT flags (because it says the result of doing that is to
// set the TWI bus into "the not addressed Slave mode"); it seems acceptable to just send
// a normal TWI master stop
static void s_advance_bus_error() {
  twiQ.doneCmd();
  init_stop();
  if ( twiQ.hasCmd() )
    init_start();
}