Annotation of embedaddon/smartmontools/os_win32/daemon_win32.h, revision 1.1.1.1

1.1       misho       1: /*
                      2:  * os_win32/daemon_win32.h
                      3:  *
                      4:  * Home page of code is: http://smartmontools.sourceforge.net
                      5:  *
                      6:  * Copyright (C) 2004-8 Christian Franke <smartmontools-support@lists.sourceforge.net>
                      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: 
                     22: #define DAEMON_WIN32_H_CVSID "$Id: daemon_win32.h,v 1.7 2008/03/04 22:09:48 ballen4705 Exp $\n"
                     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
                     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;
                     40: 
                     41: 
                     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      );
                     45: 
                     46: // exit(code) returned by a service
                     47: extern int daemon_winsvc_exitcode;
                     48: 
                     49: // Simulate signal()
                     50: void (*daemon_signal(int sig, void (*func)(int)))(int);
                     51: const char * daemon_strsignal(int sig);
                     52: 
                     53: // Simulate sleep()
                     54: void daemon_sleep(int seconds);
                     55: 
                     56: // Disable/Enable console
                     57: void daemon_disable_console(void);
                     58: int daemon_enable_console(const char * title);
                     59: 
                     60: // Detach from console
                     61: int daemon_detach(const char * ident);
                     62: 
                     63: // Display a message box
                     64: int daemon_messagebox(int system, const char * title, const char * text);
                     65: 
                     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 );
                     70: 
                     71: #endif // DAEMON_WIN32_H

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>