YAZ  5.23.1
Typedefs | Functions
sc.h File Reference

Header for Windows Service Control utility. More...

#include <yaz/yconfig.h>

Go to the source code of this file.

Typedefs

typedef struct sc_syaz_sc_t
 

Functions

yaz_sc_t yaz_sc_create (const char *service_name, const char *display_name)
 creates service handle 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_running (yaz_sc_t s)
 signals that sc_main applicatio starts running More...
 
void yaz_sc_destroy (yaz_sc_t *s)
 frees service control handle More...
 

Detailed Description

Header for Windows Service Control utility.

This is a simple wrapper for the Windows Service Control system. It also operates on Unix in which case the user supplied main function (sc_main) is is called immediately. See sc_test.c for an example.

Definition in file sc.h.

Typedef Documentation

typedef struct sc_s* yaz_sc_t

service control handle (opaque type)

Definition at line 41 of file sc.h.

Function Documentation

yaz_sc_t yaz_sc_create ( const char *  service_name,
const char *  display_name 
)

creates service handle

Parameters
service_nameService Name
display_nameDisplay Name
Returns
service control handle

This function does not activate the service. Only creates handle.

Definition at line 44 of file sc.c.

References sc_s::argc, sc_s::argv, sc_s::display_name, sc_s::install_flag, log_file, opt, 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, xstrdup, yaz_log(), yaz_log_init_file(), YLOG_ERRNO, YLOG_FATAL, and YLOG_LOG.

Referenced by main(), and statserv_main().

void yaz_sc_destroy ( yaz_sc_t s)

frees service control handle

Parameters
sservice control handle

Definition at line 371 of file sc.c.

References xfree.

Referenced by main(), and 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

Parameters
sservice control handle
argcargc as given from main
argvargv as given from main
sc_mainservice main function
sc_stopservice stop function
Returns
sc_main return value

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 main(), and statserv_main().

void yaz_sc_running ( yaz_sc_t  s)

signals that sc_main applicatio starts running

Parameters
sservice control handle

Definition at line 226 of file sc.c.

Referenced by statserv_sc_main().