本文整理汇总了C++中service_start函数的典型用法代码示例。如果您正苦于以下问题:C++ service_start函数的具体用法?C++ service_start怎么用?C++ service_start使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了service_start函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: do_exec
int do_exec(int nargs, char** args) {
service* svc = make_exec_oneshot_service(nargs, args);
if (svc == NULL) {
return -1;
}
service_start(svc, NULL);
return 0;
}
示例2: service_start_if_not_disabled
static void service_start_if_not_disabled(struct service *svc)
{
if (!(svc->flags & SVC_DISABLED)) {
service_start(svc, NULL);
} else {
svc->flags |= SVC_DISABLED_START;
}
}
示例3: console_service
static void
console_service (int argc, char ** argv)
{
log_printf ("%s %s: starting in console mode",
application_name, application_version);
SetConsoleCtrlHandler (control_handler, TRUE);
service_start (argc, argv);
control_break = FALSE;
}
示例4: do_start
int do_start(int nargs, char **args)
{
struct service *svc;
svc = service_find_by_name(args[1]);
if (svc) {
service_start(svc, NULL);
}
return 0;
}
示例5: test_jsonrpc_main
static void
test_jsonrpc_main(int argc, char *argv[])
{
proctitle_init(argc, argv);
set_program_name(argv[0]);
service_start(&argc, &argv);
parse_options(argc, argv);
run_command(argc - optind, argv + optind, get_all_commands());
}
示例6: service_restart
void service_restart(struct service *svc)
{
if (svc->flags & SVC_RUNNING) {
/* Stop, wait, then start the service. */
service_stop_or_reset(svc, SVC_RESTART);
} else if (!(svc->flags & SVC_RESTARTING)) {
/* Just start the service since it's not running. */
service_start(svc, NULL);
} /* else: Service is restarting anyways. */
}
示例7: main
int main(int argc, char **argv)
{
errval_t err;
debug_printf("Xeon Phi Manager started.\n");
err = service_start();
if (err_is_fail(err)) {
USER_PANIC_ERR(err, "could not start the service\n");
}
}
示例8: scmdatabase_autostart_services
static void scmdatabase_autostart_services(struct scmdatabase *db)
{
struct service_entry **services_list;
unsigned int i = 0;
unsigned int size = 32;
struct service_entry *service;
services_list = HeapAlloc(GetProcessHeap(), 0, size * sizeof(services_list[0]));
if (!services_list)
return;
scmdatabase_lock_shared(db);
LIST_FOR_EACH_ENTRY(service, &db->services, struct service_entry, entry)
{
if (service->config.dwStartType == SERVICE_BOOT_START ||
service->config.dwStartType == SERVICE_SYSTEM_START ||
service->config.dwStartType == SERVICE_AUTO_START)
{
if (i+1 >= size)
{
struct service_entry **slist_new;
size *= 2;
slist_new = HeapReAlloc(GetProcessHeap(), 0, services_list, size * sizeof(services_list[0]));
if (!slist_new)
break;
services_list = slist_new;
}
services_list[i] = service;
service->ref_count++;
i++;
}
}
scmdatabase_unlock(db);
size = i;
for (i = 0; i < size; i++)
{
DWORD err;
const WCHAR *argv[2];
service = services_list[i];
argv[0] = service->name;
argv[1] = NULL;
err = service_start(service, 1, argv);
if (err != ERROR_SUCCESS)
WINE_FIXME("Auto-start service %s failed to start: %d\n",
wine_dbgstr_w(service->name), err);
release_service(service);
}
HeapFree(GetProcessHeap(), 0, services_list);
}
示例9: service_start
void CL_Service_Unix::service_thread_main(std::vector<CL_String> args)
{
service_start(args);
while (true)
{
int wakeup_reason = CL_Event::wait(stop_event, reload_event);
if (wakeup_reason == 1)
service_reload();
else
break;
}
service_stop();
}
示例10: service_restart
/* stop + start
*
* XXX: This should be refactored into a background job AND marked such
* so that the service monitor doesn't attempt to restart it!
*/
int service_restart(svc_t *svc)
{
int result = 0;
if (!svc)
return 1;
result += service_stop(svc);
sleep(1);
result += service_start(svc);
return result;
}
示例11: svc_dance
/* Singing and dancing ... */
static void svc_dance(svc_t *svc)
{
svc_cmd_t cmd = service_enabled(svc, 0, NULL);
if (svc->pid) {
if (SVC_STOP == cmd)
service_stop(svc);
else if (SVC_RELOAD == cmd)
service_reload(svc);
} else {
if (SVC_START == cmd || SVC_RELOAD == cmd)
service_start(svc);
}
}
示例12: do_enable
int do_enable(int nargs, char **args)
{
struct service *svc;
svc = service_find_by_name(args[1]);
if (svc) {
svc->flags &= ~(SVC_DISABLED | SVC_RC_DISABLED);
if (svc->flags & SVC_DISABLED_START) {
service_start(svc, NULL);
}
} else {
return -1;
}
return 0;
}
示例13: restart_service_if_needed
static void restart_service_if_needed(struct service *svc)
{
time_t next_start_time = svc->time_started + 5;
if (next_start_time <= gettime()) {
svc->flags &= (~SVC_RESTARTING);
service_start(svc, NULL);
return;
}
if ((next_start_time < process_needs_restart) ||
(process_needs_restart == 0)) {
process_needs_restart = next_start_time;
}
}
示例14: service_start
void Service_Unix::service_thread_main(std::vector<std::string> args)
{
service_start(args);
while (true)
{
std::unique_lock<std::mutex> lock(mutex);
event_condition.wait(lock, [&]() { return stop_flag || reload_flag; });
if (stop_flag)
break;
reload_flag = false;
service_reload();
}
service_stop();
}
示例15: wsvc_command_option
void
wsvc_command_option(const char* wopt, const char* cfgfile, int v, int c)
{
if(strcmp(wopt, "install") == 0)
wsvc_install(stdout, NULL);
else if(strcmp(wopt, "remove") == 0)
wsvc_remove(stdout);
else if(strcmp(wopt, "service") == 0)
service_start(cfgfile, v, c);
else if(strcmp(wopt, "start") == 0)
wsvc_rc_start(stdout);
else if(strcmp(wopt, "stop") == 0)
wsvc_rc_stop(stdout);
else fatal_exit("unknown option: %s", wopt);
exit(0);
}