]> git.proxmox.com Git - mirror_smartmontools-debian.git/blame - os_win32/daemon_win32.h
Imported Upstream version 5.38
[mirror_smartmontools-debian.git] / os_win32 / daemon_win32.h
CommitLineData
832b75ed
GG
1/*
2 * os_win32/daemon_win32.h
3 *
4 * Home page of code is: http://smartmontools.sourceforge.net
5 *
34ad0c5f 6 * Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net>
832b75ed
GG
7 *
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)
11 * any later version.
12 *
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.
16 *
17 */
18
19#ifndef DAEMON_WIN32_H
20#define DAEMON_WIN32_H
21
34ad0c5f 22#define DAEMON_WIN32_H_CVSID "$Id: daemon_win32.h,v 1.7 2008/03/04 22:09:48 ballen4705 Exp $\n"
832b75ed
GG
23
24#include <signal.h>
25
26// Additional non-ANSI signals
27#define SIGHUP (NSIG+1)
28#define SIGUSR1 (NSIG+2)
29#define SIGUSR2 (NSIG+3)
30
31
32// Options for Windows service
33typedef 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;
40
41
42// This function must be called from main()
43int daemon_main(const char * ident, const daemon_winsvc_options * svc_opts,
44 int (*main_func)(int, char **), int argc, char **argv );
45
46// exit(code) returned by a service
47extern int daemon_winsvc_exitcode;
48
49// Simulate signal()
50void (*daemon_signal(int sig, void (*func)(int)))(int);
51const char * daemon_strsignal(int sig);
52
53// Simulate sleep()
54void daemon_sleep(int seconds);
55
56// Disable/Enable console
57void daemon_disable_console(void);
58int daemon_enable_console(const char * title);
59
60// Detach from console
61int daemon_detach(const char * ident);
62
63// Display a message box
64int daemon_messagebox(int system, const char * title, const char * text);
65
66// Spawn a process and redirect stdio
67int daemon_spawn(const char * cmd,
68 const char * inpbuf, int inpsize,
69 char * outbuf, int outsize );
70
71#endif // DAEMON_WIN32_H