]>
git.proxmox.com Git - mirror_smartmontools-debian.git/blob - os_win32/daemon_win32.h
e87d0025dc46d68d637826200f33df6f90f7f167
2 * os_win32/daemon_win32.h
4 * Home page of code is: http://www.smartmontools.org
6 * Copyright (C) 2004-12 Christian Franke <smartmontools-support@lists.sourceforge.net>
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2, or (at your option)
13 * You should have received a copy of the GNU General Public License
14 * (for example COPYING); If not, see <http://www.gnu.org/licenses/>.
18 #ifndef DAEMON_WIN32_H
19 #define DAEMON_WIN32_H
21 #define DAEMON_WIN32_H_CVSID "$Id: daemon_win32.h 4120 2015-08-27 16:12:21Z samm2 $"
25 // Additional non-ANSI signals
26 #define SIGHUP (NSIG+1)
27 #define SIGUSR1 (NSIG+2)
28 #define SIGUSR2 (NSIG+3)
31 // Options for Windows service
32 typedef struct daemon_winsvc_options_s
{
33 const char * cmd_opt
; // argv[1] option for services
34 // For service "install" command only:
35 const char * svcname
; // Service name
36 const char * dispname
; // Service display name
37 const char * descript
; // Service description
38 } daemon_winsvc_options
;
41 // This function must be called from main()
42 int daemon_main(const char * ident
, const daemon_winsvc_options
* svc_opts
,
43 int (*main_func
)(int, char **), int argc
, char **argv
);
45 // exit(code) returned by a service
46 extern int daemon_winsvc_exitcode
;
49 void (*daemon_signal(int sig
, void (*func
)(int)))(int);
50 const char * daemon_strsignal(int sig
);
53 void daemon_sleep(int seconds
);
55 // Disable/Enable console
56 void daemon_disable_console(void);
57 int daemon_enable_console(const char * title
);
59 // Detach from console
60 int daemon_detach(const char * ident
);
62 // Spawn a process and redirect stdio
63 int daemon_spawn(const char * cmd
,
64 const char * inpbuf
, int inpsize
,
65 char * outbuf
, int outsize
);
67 #endif // DAEMON_WIN32_H