Changeset 1662

Show
Ignore:
Timestamp:
02/19/2007 01:33:28 PM (20 months ago)
Author:
jan
Message:

added support for daemontools and the -I option (patch by
dermoth@…)

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/base.h

    r1653 r1662  
    453453 
    454454        unsigned short dont_daemonize; 
     455        unsigned short daemonize_on_shutdown; 
    455456        buffer *changeroot; 
    456457        buffer *username; 
  • trunk/src/server.c

    r1653 r1662  
    478478" -t         test the config-file, and exit\n" \ 
    479479" -D         don't go to background (default: go to background)\n" \ 
     480" -I         go to background on SIGINT (useful with -D)\n" \ 
     481"            has no effect when using kqueue or /dev/poll\n" \ 
    480482" -v         show version\n" \ 
    481483" -V         show compile-time features\n" \ 
     
    814816                                                srv_socket->sock->fd = -1; 
    815817 
     818#ifdef HAVE_FORK 
     819                                                /* FreeBSD kqueue could possibly work with rfork(RFFDG) 
     820                                                * while Solaris /dev/poll would require re-registering 
     821                                                * all fd */ 
     822                                                if (srv->srvconf.daemonize_on_shutdown && 
     823                                                        srv->event_handler != FDEVENT_HANDLER_FREEBSD_KQUEUE && 
     824                                                        srv->event_handler != FDEVENT_HANDLER_SOLARIS_DEVPOLL) { 
     825                                                        daemonize(); 
     826                                                } 
     827#endif 
     828 
    816829                                                /* network_close() will cleanup after us */ 
    817830                                        } 
     
    10591072#endif 
    10601073        srv->srvconf.dont_daemonize = 0; 
     1074        srv->srvconf.daemonize_on_shutdown = 0; 
    10611075        srv->srvconf.max_stat_threads = 4; 
    10621076        srv->srvconf.max_read_threads = 8; 
    10631077 
    1064         while(-1 != (o = getopt(argc, argv, "f:m:hvVDpt"))) { 
     1078        while(-1 != (o = getopt(argc, argv, "f:m:hvVDIpt"))) { 
    10651079                switch(o) { 
    10661080                case 'f': 
     
    10761090                case 't': test_config = 1; break; 
    10771091                case 'D': srv->srvconf.dont_daemonize = 1; break; 
     1092                case 'I': srv->srvconf.daemonize_on_shutdown = 1; break; 
    10781093                case 'v': show_version(); return 0; 
    10791094                case 'V': show_features(); return 0;