YAZ
5.34.0
|
Windows Service Control. More...
#include <stdio.h>
#include <string.h>
#include <yaz/xmalloc.h>
#include <yaz/log.h>
#include <yaz/sc.h>
#include <yaz/wrbuf.h>
Go to the source code of this file.
Data Structures | |
struct | sc_s |
Functions | |
yaz_sc_t | yaz_sc_create (const char *service_name, const char *display_name) |
creates service handle More... | |
void | yaz_sc_running (yaz_sc_t s) |
signals that sc_main applicatio starts running More... | |
int | yaz_sc_program (yaz_sc_t s, int argc, char **argv, int(*sc_main)(yaz_sc_t s, int argc, char **argv), void(*sc_stop)(yaz_sc_t s)) |
registers service controlled program More... | |
void | yaz_sc_destroy (yaz_sc_t *s) |
frees service control handle More... | |
Windows Service Control.
Definition in file sc.c.
yaz_sc_t yaz_sc_create | ( | const char * | service_name, |
const char * | display_name | ||
) |
creates service handle
service_name | Service Name |
display_name | Display Name |
This function does not activate the service. Only creates handle.
Definition at line 44 of file sc.c.
References sc_s::display_name, sc_s::install_flag, sc_s::remove_flag, sc_s::run_flag, sc_s::sc_main, sc_s::sc_stop, sc_s::service_name, sc_s::start_flag, xmalloc, and xstrdup.
Referenced by statserv_main().
void yaz_sc_destroy | ( | yaz_sc_t * | s | ) |
frees service control handle
s | service control handle |
Definition at line 371 of file sc.c.
References xfree.
Referenced by statserv_main().
int yaz_sc_program | ( | yaz_sc_t | s, |
int | argc, | ||
char ** | argv, | ||
int(*)(yaz_sc_t s, int argc, char **argv) | sc_main, | ||
void(*)(yaz_sc_t s) | sc_stop | ||
) |
registers service controlled program
s | service control handle |
argc | argc as given from main |
argv | argv as given from main |
sc_main | service main function |
sc_stop | service stop function |
sc_main is the main program of the application. It should initialize the application.. Function yaz_sc_running MUST be called before the application operates (after initialization)
Definition at line 233 of file sc.c.
References sc_s::argc, sc_s::argv, sc_s::display_name, sc_s::install_flag, sc_s::remove_flag, sc_s::run_flag, sc_s::sc_main, sc_s::sc_stop, sc_s::service_name, sc_s::start_flag, wrbuf_alloc(), wrbuf_cstr(), wrbuf_destroy(), wrbuf_puts(), yaz_log(), YLOG_ERRNO, YLOG_FATAL, and YLOG_LOG.
Referenced by statserv_main().
void yaz_sc_running | ( | yaz_sc_t | s | ) |
signals that sc_main applicatio starts running
s | service control handle |
Definition at line 226 of file sc.c.
Referenced by statserv_sc_main().