]>
git.proxmox.com Git - mirror_smartmontools-debian.git/blob - os_win32/daemon_win32.h
2 * os_win32/daemon_win32.h
4 * Home page of code is: http://smartmontools.sourceforge.net
6 * Copyright (C) 2004-8 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, write to the Free
15 * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 #ifndef DAEMON_WIN32_H
20 #define DAEMON_WIN32_H
22 #define DAEMON_WIN32_H_CVSID "$Id: daemon_win32.h,v 1.7 2008/03/04 22:09:48 ballen4705 Exp $\n"
26 // Additional non-ANSI signals
27 #define SIGHUP (NSIG+1)
28 #define SIGUSR1 (NSIG+2)
29 #define SIGUSR2 (NSIG+3)
32 // Options for Windows service
33 typedef struct daemon_winsvc_options_s
{
34 const char * cmd_opt
; // argv[1] option for services
35 // For service "install" command only:
36 const char * svcname
; // Service name
37 const char * dispname
; // Service display name
38 const char * descript
; // Service description
39 } daemon_winsvc_options
;
42 // This function must be called from main()
43 int daemon_main(const char * ident
, const daemon_winsvc_options
* svc_opts
,
44 int (*main_func
)(int, char **), int argc
, char **argv
);
46 // exit(code) returned by a service
47 extern int daemon_winsvc_exitcode
;
50 void (*daemon_signal(int sig
, void (*func
)(int)))(int);
51 const char * daemon_strsignal(int sig
);
54 void daemon_sleep(int seconds
);
56 // Disable/Enable console
57 void daemon_disable_console(void);
58 int daemon_enable_console(const char * title
);
60 // Detach from console
61 int daemon_detach(const char * ident
);
63 // Display a message box
64 int daemon_messagebox(int system
, const char * title
, const char * text
);
66 // Spawn a process and redirect stdio
67 int daemon_spawn(const char * cmd
,
68 const char * inpbuf
, int inpsize
,
69 char * outbuf
, int outsize
);
71 #endif // DAEMON_WIN32_H