本文整理汇总了C++中report_status函数的典型用法代码示例。如果您正苦于以下问题:C++ report_status函数的具体用法?C++ report_status怎么用?C++ report_status使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了report_status函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: control_thread
static void WINAPI control_thread( DWORD action)
{
/**************************************
*
* c o n t r o l _ t h r e a d
*
**************************************
*
* Functional description
* Process a service control request.
*
**************************************/
const DWORD state = SERVICE_RUNNING;
switch (action)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, 3000);
SetEvent(stop_event_handle);
return;
case SERVICE_CONTROL_INTERROGATE:
break;
default:
break;
}
report_status(state, NO_ERROR, 0, 0);
}
示例2: check_data_dir
/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit()
*
*/
static void
check_data_dir(const char *pg_data)
{
char subDirName[MAXPGPATH];
int subdirnum;
/* start check with top-most directory */
const char *requiredSubdirs[] = {"", "base", "global", "pg_clog",
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
"pg_xlog"};
for (subdirnum = 0;
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
++subdirnum)
{
struct stat statBuf;
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
/* Win32 can't stat() a directory with a trailing slash. */
*requiredSubdirs[subdirnum] ? "/" : "",
requiredSubdirs[subdirnum]);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, getErrorText(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
}
示例3: check_data_dir
/*
* check_data_dir()
*
* This function validates the given cluster directory - we search for a
* small set of subdirectories that we expect to find in a valid $PGDATA
* directory. If any of the subdirectories are missing (or secured against
* us) we display an error message and exit()
*
*/
static void
check_data_dir(const char *pg_data)
{
char subDirName[MAXPGPATH];
int subdirnum;
const char *requiredSubdirs[] = {"base", "global", "pg_clog",
"pg_multixact", "pg_subtrans", "pg_tblspc", "pg_twophase",
"pg_xlog"};
for (subdirnum = 0;
subdirnum < sizeof(requiredSubdirs) / sizeof(requiredSubdirs[0]);
++subdirnum)
{
struct stat statBuf;
snprintf(subDirName, sizeof(subDirName), "%s/%s", pg_data,
requiredSubdirs[subdirnum]);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for %s failed: %s\n",
requiredSubdirs[subdirnum], getErrorText(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
requiredSubdirs[subdirnum]);
}
}
示例4: CNTL_main_thread
void WINAPI CNTL_main_thread( DWORD /*argc*/, char* /*argv*/[])
{
/**************************************
*
* C N T L _ m a i n _ t h r e a d
*
**************************************
*
* Functional description
*
**************************************/
service_handle =
RegisterServiceCtrlHandler(service_name->c_str(), control_thread);
if (!service_handle)
return;
// start everything, and wait here for ever, or at
// least until we get the stop event indicating that
// the service is stoping.
bool failure = true;
DWORD temp = 0;
if (report_status(SERVICE_START_PENDING, NO_ERROR, 1, 3000) &&
(stop_event_handle = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL &&
report_status(SERVICE_START_PENDING, NO_ERROR, 2, 3000) &&
!gds__thread_start(main_handler, NULL, 0, 0, 0) &&
report_status(SERVICE_RUNNING, NO_ERROR, 0, 0))
{
failure = false;
temp = WaitForSingleObject(stop_event_handle, INFINITE);
}
DWORD last_error = 0;
if (failure || temp == WAIT_FAILED)
last_error = GetLastError();
if (stop_event_handle)
CloseHandle(stop_event_handle);
// Once we are stopped, we will tell the server to
// do the same. We could not do this in the control_thread
// since the Services Control Manager is single threaded,
// and thus can only process one request at the time.
SERVICE_STATUS status_info;
SC_HANDLE hScManager = 0, hService = 0;
hScManager =
OpenSCManager(NULL, NULL, GENERIC_READ);
hService = OpenService(hScManager, remote_name->c_str(),
GENERIC_READ | GENERIC_EXECUTE);
ControlService(hService, SERVICE_CONTROL_STOP, &status_info);
CloseServiceHandle(hScManager);
CloseServiceHandle(hService);
report_status(SERVICE_STOPPED, last_error, 0, 0);
}
示例5: report_status
void
TAO_NT_Notify_Service::handle_control (DWORD control_code)
{
if (control_code == SERVICE_CONTROL_SHUTDOWN
|| control_code == SERVICE_CONTROL_STOP)
{
report_status (SERVICE_STOP_PENDING);
TAO_ORB_Core_instance ()->reactor ()->end_reactor_event_loop ();
TAO_ORB_Core_instance ()->orb ()->shutdown (1);
report_status (SERVICE_STOPPED);
}
else
ACE_NT_Service::handle_control (control_code);
}
示例6: report_status
/**
* We do almost the same thing as we do in run_standalone () except that
* we update the report_status after init.
*/
int
Activator_NT_Service::svc (void)
{
ImR_Activator_i server;
Activator_Options opts;
if (opts.init_from_registry() != 0)
{
report_status (SERVICE_STOPPED);
return -1;
}
try
{
int status = server.init (opts);
if (status == -1)
{
report_status (SERVICE_STOPPED);
return -1;
}
else
{
report_status (SERVICE_RUNNING);
server.run ();
status = server.fini ();
report_status (SERVICE_STOPPED);
}
if (status != -1)
return 0;
}
catch (const CORBA::SystemException& sysex)
{
sysex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
catch (const CORBA::UserException& userex)
{
userex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
catch (const CORBA::Exception& ex)
{
ex._tao_print_exception (IMR_ACTIVATOR_DISPLAY_NAME);
}
report_status (SERVICE_STOPPED);
return -1;
}
示例7: CNTL_main_thread
void WINAPI CNTL_main_thread( DWORD /*argc*/, char* /*argv*/[])
{
/**************************************
*
* C N T L _ m a i n _ t h r e a d
*
**************************************
*
* Functional description
*
**************************************/
service_handle = RegisterServiceCtrlHandler(service_name->c_str(), control_thread);
if (!service_handle)
return;
int status = 1;
DWORD temp = 0;
if (report_status(SERVICE_START_PENDING, NO_ERROR, 1, 3000) &&
(stop_event_handle = CreateEvent(NULL, TRUE, FALSE, NULL)) != NULL &&
report_status(SERVICE_START_PENDING, NO_ERROR, 2, 3000))
{
try
{
Thread::start(main_handler, NULL, THREAD_medium);
if (report_status(SERVICE_RUNNING, NO_ERROR, 0, 0))
{
status = 0;
temp = WaitForSingleObject(stop_event_handle, INFINITE);
}
}
catch (const Firebird::Exception& ex)
{
iscLogException("CNTL: cannot start service handler thread", ex);
}
}
DWORD last_error = 0;
if (temp == WAIT_FAILED || status)
last_error = GetLastError();
if (stop_event_handle)
CloseHandle(stop_event_handle);
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, SHUTDOWN_TIMEOUT);
fb_shutdown(SHUTDOWN_TIMEOUT, fb_shutrsn_svc_stopped);
report_status(SERVICE_STOPPED, last_error, 0, 0);
}
示例8: check_ok
void
check_ok(migratorContext *ctx)
{
/* all seems well */
report_status(ctx, PG_REPORT, "ok");
fflush(stdout);
}
示例9: check_ok
void
check_ok(void)
{
/* all seems well */
report_status(PG_REPORT, "ok");
fflush(stdout);
}
示例10: waitforubanchor
/** wait for unbound-anchor process to finish */
static void
waitforubanchor(PROCESS_INFORMATION* pinfo)
{
/* we have 5 seconds scheduled for it, usually it will be very fast,
* with only a UDP message or two (100 msec or so), but the https
* connections could take some time */
DWORD count = 7900;
DWORD ret = WAIT_TIMEOUT;
/* decrease timer every 1/10 second, we are still starting up */
while(ret == WAIT_TIMEOUT) {
ret = WaitForSingleObject(pinfo->hProcess, 100);
if(count > 4000) count -= 100;
else count--; /* go slow, it is taking long */
if(count > 3000)
report_status(SERVICE_START_PENDING, NO_ERROR, count);
}
verbose(VERB_ALGO, "unbound-anchor done");
if(ret != WAIT_OBJECT_0) {
return; /* did not end successfully */
}
if(!GetExitCodeProcess(pinfo->hProcess, &ret)) {
log_err("GetExitCodeProcess failed");
return;
}
verbose(VERB_ALGO, "unbound-anchor exit code is %d", (int)ret);
if(ret != 0) {
log_info("The root trust anchor has been updated.");
}
}
示例11: handle_report
bool handle_report()
{
tm_p current = now();
checkin_status(db_handler, current, NULL, NULL);
printf("####################\n");
report_status();
return true;
}
示例12: hdlr
/**
* Service control handler. Called by serviceControlManager when a control
* code is sent to the service (with ControlService).
* @param ctrl: control code
*/
static void
hdlr(DWORD ctrl)
{
if(ctrl == SERVICE_CONTROL_STOP) {
report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);
service_stop_shutdown = 1;
/* send signal to stop */
if(!WSASetEvent(service_stop_event))
log_err("Could not WSASetEvent: %s",
wsa_strerror(WSAGetLastError()));
return;
} else {
/* ctrl == SERVICE_CONTROL_INTERROGATE or whatever */
/* update status */
report_status(service_status.dwCurrentState, NO_ERROR, 0);
}
}
示例13: while
void xc::xsim::main()
{
while (true) {
XsiStatus status = xsi_clock(instance);
report_status(status);
wait();
std::vector<package *>::iterator pkg;
for (pkg = packages.begin();pkg != packages.end();pkg++) {
std::map<std::string, sc_inout_resolved *>::iterator it;
const char *pkg_name = ((*pkg)->id).c_str();
for (it = (*pkg)->pins.begin(); it != (*pkg)->pins.end(); it++) {
sc_inout_resolved *p = (it->second);
const char *pin_name = (it->first).c_str();
unsigned int is_driving;
report_status(xsi_is_pin_driving(instance,
pkg_name,
pin_name,
&is_driving));
if (is_driving) {
unsigned int value;
report_status(xsi_sample_pin(instance,
pkg_name,
pin_name,
&value));
(*p)->write(sc_logic((int) value));
}
else {
sc_logic bit = (*p)->read();
if (bit != 'z' && bit != 'x') {
report_status(xsi_drive_pin(instance,
pkg_name,
pin_name,
bit.to_bool()));
}
}
}
}
}
}
示例14: check_single_dir
/*
* check_single_dir()
*
* Check for the presence of a single directory in PGDATA, and fail if
* is it missing or not accessible.
*/
static void
check_single_dir(const char *pg_data, const char *subdir)
{
struct stat statBuf;
char subDirName[MAXPGPATH];
snprintf(subDirName, sizeof(subDirName), "%s%s%s", pg_data,
/* Win32 can't stat() a directory with a trailing slash. */
*subdir ? "/" : "",
subdir);
if (stat(subDirName, &statBuf) != 0)
report_status(PG_FATAL, "check for \"%s\" failed: %s\n",
subDirName, strerror(errno));
else if (!S_ISDIR(statBuf.st_mode))
report_status(PG_FATAL, "%s is not a directory\n",
subDirName);
}
示例15: control_thread
static void WINAPI control_thread( DWORD action)
{
/**************************************
*
* c o n t r o l _ t h r e a d
*
**************************************
*
* Functional description
* Process a service control request.
*
**************************************/
const DWORD state = SERVICE_RUNNING;
switch (action)
{
case SERVICE_CONTROL_STOP:
case SERVICE_CONTROL_SHUTDOWN:
report_status(SERVICE_STOP_PENDING, NO_ERROR, 1, 3000);
if (hMutex)
ReleaseMutex(hMutex);
SetEvent(stop_event_handle);
return;
case SERVICE_CONTROL_INTERROGATE:
break;
case SERVICE_CREATE_GUARDIAN_MUTEX:
hMutex = OpenMutex(SYNCHRONIZE, FALSE, mutex_name->c_str());
if (hMutex)
{
UINT error_mode = SEM_FAILCRITICALERRORS | SEM_NOGPFAULTERRORBOX |
SEM_NOOPENFILEERRORBOX | SEM_NOALIGNMENTFAULTEXCEPT;
SetErrorMode(error_mode);
WaitForSingleObject(hMutex, INFINITE);
}
break;
default:
break;
}
report_status(state, NO_ERROR, 0, 0);
}