]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - os_win32/daemon_win32.h
import smartmontools 7.0
[mirror_smartmontools-debian.git] / os_win32 / daemon_win32.h
CommitLineData
832b75ed
GG
1/*
2 * os_win32/daemon_win32.h
3 *
a86ec89e 4 * Home page of code is: http://www.smartmontools.org
832b75ed 5 *
ff28b140 6 * Copyright (C) 2004-18 Christian Franke
832b75ed 7 *
ff28b140 8 * SPDX-License-Identifier: GPL-2.0-or-later
832b75ed
GG
9 */
10
11#ifndef DAEMON_WIN32_H
12#define DAEMON_WIN32_H
13
ff28b140 14#define DAEMON_WIN32_H_CVSID "$Id: daemon_win32.h 4818 2018-10-17 05:32:17Z chrfranke $"
832b75ed
GG
15
16#include <signal.h>
17
18// Additional non-ANSI signals
19#define SIGHUP (NSIG+1)
20#define SIGUSR1 (NSIG+2)
21#define SIGUSR2 (NSIG+3)
22
23
24// Options for Windows service
25typedef struct daemon_winsvc_options_s {
26 const char * cmd_opt; // argv[1] option for services
27 // For service "install" command only:
28 const char * svcname; // Service name
29 const char * dispname; // Service display name
30 const char * descript; // Service description
31} daemon_winsvc_options;
32
33
34// This function must be called from main()
35int daemon_main(const char * ident, const daemon_winsvc_options * svc_opts,
36 int (*main_func)(int, char **), int argc, char **argv );
37
38// exit(code) returned by a service
39extern int daemon_winsvc_exitcode;
40
41// Simulate signal()
42void (*daemon_signal(int sig, void (*func)(int)))(int);
43const char * daemon_strsignal(int sig);
44
45// Simulate sleep()
46void daemon_sleep(int seconds);
47
48// Disable/Enable console
49void daemon_disable_console(void);
50int daemon_enable_console(const char * title);
51
52// Detach from console
53int daemon_detach(const char * ident);
54
832b75ed 55#endif // DAEMON_WIN32_H