Changeset 12070


Ignore:
Timestamp:
05/09/09 12:50:13 (4 years ago)
Author:
BrainSlayer
Message:

should decrease startup time

Location:
src/router
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/router/rc/rc.h

    r10738 r12070  
    156156 
    157157extern void start_service( char *name ); 
     158extern void startstop( char *name ); 
    158159extern void stop_service( char *name ); 
    159160extern void *start_service_nofree( char *name, void *handle ); 
     
    163164extern int start_main( char *name, int argc, char **argv ); 
    164165extern void start_servicei( char *name, int param ); 
     166 
     167 
     168 
     169extern void startstop_f( char *name ); 
     170extern void start_service_f( char *name ); 
     171extern void stop_service_f( char *name ); 
     172extern void *start_service_nofree_f( char *name, void *handle ); 
     173extern void *stop_service_nofree_f( char *name, void *handle ); 
     174extern int startstop_main_f( int argc, char **argv ); 
     175extern void *startstop_nofree_f( char *name, void *handle ); 
     176extern int start_main_f( char *name, int argc, char **argv ); 
     177extern void start_servicei_f( char *name, int param ); 
    165178 
    166179extern int zebra_ospf_init( void ); 
  • src/router/rc/servicemanager.c

    r10737 r12070  
    2323#include <dlfcn.h> 
    2424#include <stdio.h> 
    25 // #include <shutils.h> 
     25#include <shutils.h> 
    2626 
    2727#define SERVICE_MODULE "/lib/services.so" 
    28 #define cprintf(fmt, args...) 
    29  
    30 #ifndef cprintf 
    31 #define cprintf(fmt, args...) do { \ 
    32         FILE *fp = fopen("/dev/console", "w"); \ 
    33         if (fp) { \ 
    34                 fprintf(fp,"%s (%d):%s ",__FILE__,__LINE__,__func__); \ 
    35                 fprintf(fp, fmt, ## args); \ 
    36                 fclose(fp); \ 
    37         } \ 
    38 } while (0) 
    39 #endif 
     28 
    4029 
    4130void *load_service( char *name ) 
     
    9786    return 0; 
    9887} 
     88int start_service_f( char *name ) 
     89{ 
     90    FORK(start_service(name)); 
     91} 
    9992 
    10093int start_service_fork( char *name ) 
     
    132125    return 0; 
    133126} 
    134  
     127int start_service_fork_f( char *name ) 
     128{ 
     129    FORK(start_service_fork(name)); 
     130} 
    135131void *start_service_nofree( char *name, void *handle ) 
    136132{ 
     
    167163    return handle; 
    168164} 
    169  
     165void *start_service_nofree_f( char *name, void *handle ) 
     166{ 
     167    FORK(start_service_nofree(name,handle)); 
     168} 
    170169int start_servicep( char *name, char *param ) 
    171170{ 
     
    191190    return 0; 
    192191} 
    193  
     192int start_servicep_f( char *name, char *param ) 
     193{ 
     194    FORK(start_servicep(name,param)); 
     195} 
    194196void start_servicei( char *name, int param ) 
    195197{ 
     
    216218    return; 
    217219} 
    218  
     220void start_servicei_f( char *name, int param ) 
     221{ 
     222    FORK(start_servicei(name,param)); 
     223} 
    219224void start_main( char *name, int argc, char **argv ) 
    220225{ 
     
    240245    return; 
    241246} 
    242  
     247void start_main_f( char *name, int argc, char **argv ) 
     248{ 
     249FORK(start_main(name,argc,argv)); 
     250} 
    243251void stop_service( char *name ) 
    244252{ 
     
    265273 
    266274    return; 
     275} 
     276void stop_service_f( char *name ) 
     277{ 
     278FORK(stop_service(name)); 
    267279} 
    268280 
     
    291303    return handle; 
    292304} 
    293  
     305void *stop_service_nofree_f( char *name, void *handle ) 
     306{ 
     307    FORK(stop_service_nofree(name,handle)); 
     308} 
    294309void startstop( char *name ) 
    295310{ 
     
    303318} 
    304319 
     320void startstop_f( char *name ) 
     321{ 
     322    FORK(startstop(name)); 
     323} 
     324 
    305325int startstop_main( int argc, char **argv ) 
    306326{ 
    307327    startstop( argv[1] ); 
    308328    return 0; 
     329} 
     330 
     331int startstop_main_f( int argc, char **argv ) 
     332{ 
     333    FORK(startstop_main(argc,argv)); 
    309334} 
    310335 
     
    316341    return handle; 
    317342} 
     343 
     344void *startstop_nofree_f( char *name, void *handle ) 
     345{ 
     346    FORK(startstop_nofree_f(name,handle)); 
     347} 
  • src/router/rc/services.c

    r12059 r12070  
    8787    nvram_set( "qos_done", "0" ); 
    8888#ifdef HAVE_CPUTEMP 
    89     handle = start_service_nofree( "hwmon", handle ); 
     89    handle = start_service_nofree_f( "hwmon", handle ); 
    9090#endif 
    9191#ifdef HAVE_TELNET 
    92     handle = start_service_nofree( "telnetd", handle ); 
     92    handle = start_service_nofree_f( "telnetd", handle ); 
    9393#endif 
    9494#ifdef HAVE_FTP 
    95     handle = start_service_nofree( "ftpsrv", handle ); 
     95    handle = start_service_nofree_f( "ftpsrv", handle ); 
    9696#endif 
    9797#ifdef HAVE_SAMBA_SRV 
    98     handle = start_service_nofree( "sambasrv", handle ); 
     98    handle = start_service_nofree_f( "sambasrv", handle ); 
    9999#endif 
    100100#ifdef HAVE_SYSLOG 
    101     handle = start_service_nofree( "syslog", handle ); 
     101    handle = start_service_nofree_f( "syslog", handle ); 
    102102#endif 
    103103#ifdef HAVE_TFTP 
    104     handle = start_service_nofree( "tftpd", handle ); 
    105 #endif 
    106     handle = start_service_nofree( "httpd", handle ); 
    107     handle = start_service_nofree( "udhcpd", handle ); 
     104    handle = start_service_nofree_f( "tftpd", handle ); 
     105#endif 
     106    handle = start_service_nofree_f( "httpd", handle ); 
     107    handle = start_service_nofree_f( "udhcpd", handle ); 
    108108#ifdef HAVE_DNSMASQ 
    109     handle = start_service_nofree( "dnsmasq", handle ); 
     109    handle = start_service_nofree_f( "dnsmasq", handle ); 
    110110#endif 
    111111#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    112     handle = start_service_nofree( "zebra", handle ); 
     112    handle = start_service_nofree_f( "zebra", handle ); 
    113113#endif 
    114114#ifdef HAVE_OLSRD 
    115     handle = start_service_nofree( "olsrd", handle ); 
    116 #endif 
    117  
    118     handle = start_service_nofree( "wshaper", handle ); 
    119     handle = start_service_nofree( "wland", handle ); 
    120     handle = start_service_nofree( "cron", handle ); 
     115    handle = start_service_nofree_f( "olsrd", handle ); 
     116#endif 
     117 
     118    handle = start_service_nofree_f( "wshaper", handle ); 
     119    handle = start_service_nofree_f( "wland", handle ); 
     120    handle = start_service_nofree_f( "cron", handle ); 
    121121 
    122122#ifdef HAVE_PPTPD 
    123     handle = start_service_nofree( "pptpd", handle ); 
     123    handle = start_service_nofree_f( "pptpd", handle ); 
    124124#endif 
    125125 
     
    128128    if( isregistered_real(  ) ) 
    129129#endif 
    130         handle = start_service_nofree( "sshd", handle ); 
     130        handle = start_service_nofree_f( "sshd", handle ); 
    131131#endif 
    132132 
    133133#ifdef HAVE_RADVD 
    134     handle = start_service_nofree( "radvd", handle ); 
     134    handle = start_service_nofree_f( "radvd", handle ); 
    135135#endif 
    136136 
    137137#ifdef HAVE_SNMP 
    138     handle = start_service_nofree( "snmp", handle ); 
     138    handle = start_service_nofree_f( "snmp", handle ); 
    139139#endif 
    140140 
    141141#ifdef HAVE_PPPOESERVER 
    142     handle = start_service_nofree( "pppoeserver", handle ); 
     142    handle = start_service_nofree_f( "pppoeserver", handle ); 
    143143#endif 
    144144 
    145145#ifdef HAVE_WOL 
    146     handle = start_service_nofree( "wol", handle ); 
     146    handle = start_service_nofree_f( "wol", handle ); 
    147147#endif 
    148148 
    149149#ifdef HAVE_NOCAT 
    150     handle = start_service_nofree( "splashd", handle ); 
     150    handle = start_service_nofree_f( "splashd", handle ); 
    151151#endif 
    152152 
    153153#ifdef HAVE_UPNP 
    154     handle = start_service_nofree( "upnp", handle ); 
     154    handle = start_service_nofree_f( "upnp", handle ); 
    155155#endif 
    156156 
    157157#ifdef HAVE_OPENVPN 
    158     handle = start_service_nofree( "openvpnserversys", handle ); 
     158    handle = start_service_nofree_f( "openvpnserversys", handle ); 
    159159#endif 
    160160#ifdef HAVE_VNCREPEATER 
    161     handle = start_service_nofree( "vncrepeater", handle ); 
     161    handle = start_service_nofree_f( "vncrepeater", handle ); 
    162162#endif 
    163163#ifdef HAVE_RSTATS 
    164     handle = start_service_nofree( "rstats", handle ); 
     164    handle = start_service_nofree_f( "rstats", handle ); 
    165165#endif 
    166166#ifdef HAVE_NSTX 
    167     handle = start_service_nofree( "nstxd", handle ); 
     167    handle = start_service_nofree_f( "nstxd", handle ); 
    168168#endif 
    169169#ifdef HAVE_PPPOERELAY 
    170     handle = start_service_nofree( "pppoerelay", handle ); 
     170    handle = start_service_nofree_f( "pppoerelay", handle ); 
    171171#endif 
    172172#ifdef HAVE_MILKFISH 
    173     handle = start_service_nofree( "milkfish", handle ); 
     173    handle = start_service_nofree_f( "milkfish", handle ); 
    174174#endif 
    175175    if( handle ) 
     
    281281static void handle_dhcpd( void ) 
    282282{ 
    283     startstop( "udhcpd" ); 
     283    startstop_f( "udhcpd" ); 
    284284} 
    285285 
     
    321321#endif 
    322322    handle = start_service_nofree( "wan_boot", handle ); 
    323     handle = start_service_nofree( "ttraff", handle ); 
     323    handle = start_service_nofree_f( "ttraff", handle ); 
    324324#ifdef HAVE_MADWIFI 
    325     handle = start_service_nofree( "stabridge", handle ); 
    326 #endif 
    327     handle = startstop_nofree( "udhcpd", handle ); 
     325    handle = start_service_nofree_f( "stabridge", handle ); 
     326#endif 
     327    handle = startstop_nofree_f( "udhcpd", handle ); 
    328328#ifdef HAVE_DNSMASQ 
    329     handle = startstop_nofree( "dnsmasq", handle ); 
     329    handle = startstop_nofree_f( "dnsmasq", handle ); 
    330330#endif 
    331331#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    332     handle = startstop_nofree( "zebra", handle ); 
     332    handle = startstop_nofree_f( "zebra", handle ); 
    333333#endif 
    334334#ifdef HAVE_OLSRD 
    335     handle = startstop_nofree( "olsrd", handle ); 
     335    handle = startstop_nofree_f( "olsrd", handle ); 
    336336#endif 
    337337#ifdef HAVE_VLANTAGGING 
     
    345345#endif 
    346346#endif 
    347     handle = start_service_nofree( "radio_timer", handle ); 
    348     handle = startstop_nofree( "firewall", handle ); 
    349     handle = startstop_nofree( "httpd", handle );       // httpd will not 
     347    handle = start_service_nofree_f( "radio_timer", handle ); 
     348    handle = startstop_nofree_f( "firewall", handle ); 
     349    handle = startstop_nofree_f( "httpd", handle );     // httpd will not 
    350350    // accept connection 
    351351    // anymore on wan/lan  
    352352    // ip changes changes 
    353     handle = startstop_nofree( "cron", handle );        // httpd will not 
     353    handle = startstop_nofree_f( "cron", handle );      // httpd will not 
    354354    // accept connection 
    355355    // anymore on wan/lan  
    356356    // ip changes changes 
    357     handle = start_service_nofree( "anchorfreednat", handle ); 
     357    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    358358    handle = start_service_nofree( "wan_boot", handle ); 
    359359    if( handle ) 
     
    366366 
    367367#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    368     handle = startstop_nofree( "zebra", handle ); 
     368    handle = startstop_nofree_f( "zebra", handle ); 
    369369#endif 
    370370#ifdef HAVE_OLSRD 
    371     handle = startstop_nofree( "olsrd", handle ); 
     371    handle = startstop_nofree_f( "olsrd", handle ); 
    372372#endif 
    373373    if( handle ) 
     
    378378    void *handle = NULL; 
    379379 
    380     handle = startstop_nofree( "anchorfree", handle ); 
    381     handle = start_service_nofree( "anchorfreednat", handle ); 
     380    handle = startstop_nofree_f( "anchorfree", handle ); 
     381    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    382382    if( handle ) 
    383383        dlclose( handle ); 
     
    389389 
    390390#ifdef HAVE_WIFIDOG 
    391     handle = startstop_nofree( "wifidog", handle ); 
     391    handle = startstop_nofree_f( "wifidog", handle ); 
    392392#endif 
    393393#ifdef HAVE_NOCAT 
    394     handle = startstop_nofree( "splashd", handle ); 
     394    handle = startstop_nofree_f( "splashd", handle ); 
    395395#endif 
    396396#ifdef HAVE_CHILLI 
    397     handle = startstop_nofree( "chilli", handle ); 
     397    handle = startstop_nofree_f( "chilli", handle ); 
    398398#endif 
    399399#ifdef HAVE_SPUTNIK_APD 
    400     handle = startstop_nofree( "sputnik", handle ); 
     400    handle = startstop_nofree_f( "sputnik", handle ); 
    401401#endif 
    402402    if( handle ) 
     
    414414 
    415415#ifdef HAVE_PPPOERELAY 
    416     handle = startstop_nofree( "pppoerelay", handle ); 
    417 #endif 
    418     handle = startstop_nofree( "udhcpd", handle ); 
     416    handle = startstop_nofree_f( "pppoerelay", handle ); 
     417#endif 
     418    handle = startstop_nofree_f( "udhcpd", handle ); 
    419419#ifdef HAVE_SYSLOG 
    420     handle = startstop_nofree( "syslog", handle ); 
     420    handle = startstop_nofree_f( "syslog", handle ); 
    421421#endif 
    422422#ifdef HAVE_RSTATS 
    423     handle = startstop_nofree( "rstats", handle ); 
    424 #endif 
    425     handle = startstop_nofree( "ttraff", handle ); 
     423    handle = startstop_nofree_f( "rstats", handle ); 
     424#endif 
     425    handle = startstop_nofree_f( "ttraff", handle ); 
    426426#ifdef HAVE_NSTX 
    427     handle = startstop_nofree( "nstxd", handle ); 
     427    handle = startstop_nofree_f( "nstxd", handle ); 
    428428#endif 
    429429#ifdef HAVE_PPPOESERVER 
    430     handle = startstop_nofree( "firewall", handle ); 
    431     handle = startstop_nofree( "pppoeserver", handle ); 
     430    handle = startstop_nofree_f( "firewall", handle ); 
     431    handle = startstop_nofree_f( "pppoeserver", handle ); 
    432432#endif 
    433433#ifdef HAVE_DNSMASQ 
    434     handle = startstop_nofree( "dnsmasq", handle ); 
    435 #endif 
    436     handle = startstop_nofree( "udhcpd", handle ); 
     434    handle = startstop_nofree_f( "dnsmasq", handle ); 
     435#endif 
     436    handle = startstop_nofree_f( "udhcpd", handle ); 
    437437#ifdef HAVE_CPUTEMP 
    438     handle = start_service_nofree( "hwmon", handle ); 
     438    handle = start_service_nofree_f( "hwmon", handle ); 
    439439#endif 
    440440#ifdef HAVE_TELNET 
    441     handle = startstop_nofree( "telnetd", handle ); 
     441    handle = startstop_nofree_f( "telnetd", handle ); 
    442442#endif 
    443443#ifdef HAVE_SNMP 
    444     handle = startstop_nofree( "snmp", handle ); 
     444    handle = startstop_nofree_f( "snmp", handle ); 
    445445#endif 
    446446#ifdef HAVE_OPENVPN 
    447     handle = startstop_nofree( "openvpn", handle ); 
     447    handle = startstop_nofree_f( "openvpn", handle ); 
    448448#endif 
    449449#ifdef HAVE_PPTPD 
    450     handle = startstop_nofree( "pptpd", handle ); 
     450    handle = startstop_nofree_f( "pptpd", handle ); 
    451451#endif 
    452452#ifdef HAVE_PPTP 
     
    463463    if( isregistered_real(  ) ) 
    464464#endif 
    465         handle = startstop_nofree( "sshd", handle ); 
    466 #endif 
    467     handle = startstop_nofree( "firewall", handle ); 
    468     handle = startstop_nofree( "wshaper", handle ); 
     465        handle = startstop_nofree_f( "sshd", handle ); 
     466#endif 
     467    handle = startstop_nofree_f( "firewall", handle ); 
     468    handle = startstop_nofree_f( "wshaper", handle ); 
    469469#ifdef HAVE_SYSLOG 
    470     handle = startstop_nofree( "syslog", handle ); 
     470    handle = startstop_nofree_f( "syslog", handle ); 
    471471#endif 
    472472#ifdef HAVE_VNCREPEATER 
    473     handle = startstop_nofree( "vncrepeater", handle ); 
     473    handle = startstop_nofree_f( "vncrepeater", handle ); 
    474474#endif 
    475475#ifdef HAVE_OPENVPN 
    476     handle = startstop_nofree( "openvpnserver", handle ); 
    477 #endif 
    478     handle = start_service_nofree( "anchorfreednat", handle ); 
     476    handle = startstop_nofree_f( "openvpnserver", handle ); 
     477#endif 
     478    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    479479    if( handle ) 
    480480        dlclose( handle ); 
     
    487487 
    488488#ifdef HAVE_FTP 
    489     handle = startstop_nofree( "ftpsrv", handle ); 
     489    handle = startstop_nofree_f( "ftpsrv", handle ); 
    490490#endif 
    491491#ifdef HAVE_SAMBA_SRV 
    492     handle = startstop_nofree( "sambasrv", handle ); 
     492    handle = startstop_nofree_f( "sambasrv", handle ); 
    493493#endif 
    494494    if( handle ) 
     
    509509    handle = stop_service_nofree( "cron", handle ); 
    510510    handle = stop_service_nofree( "udhcpd", handle ); 
    511     handle = start_service_nofree( "udhcpd", handle ); 
    512     handle = start_service_nofree( "cron", handle ); 
     511    handle = start_service_nofree_f( "udhcpd", handle ); 
     512    handle = start_service_nofree_f( "cron", handle ); 
    513513#ifdef HAVE_IPV6 
    514     handle = start_service_nofree( "ipv6", handle ); 
     514    handle = start_service_nofree_f( "ipv6", handle ); 
    515515#endif 
    516516#ifdef HAVE_RADVD 
    517     handle = startstop_nofree( "radvd", handle ); 
     517    handle = startstop_nofree_f( "radvd", handle ); 
    518518#endif 
    519519#ifdef HAVE_PPTPD 
    520     handle = startstop_nofree( "pptpd", handle ); 
     520    handle = startstop_nofree_f( "pptpd", handle ); 
    521521#endif 
    522522#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    523     handle = start_service_nofree( "zebra", handle ); 
    524 #endif 
    525     handle = startstop_nofree( "firewall", handle ); 
     523    handle = start_service_nofree_f( "zebra", handle ); 
     524#endif 
     525    handle = startstop_nofree_f( "firewall", handle ); 
    526526    handle = stop_service_nofree( "wland", handle ); 
    527     handle = startstop_nofree( "wshaper", handle ); 
    528     handle = start_service_nofree( "wland", handle ); 
    529     handle = startstop_nofree( "httpd", handle ); 
     527    handle = startstop_nofree_f( "wshaper", handle ); 
     528    handle = start_service_nofree_f( "wland", handle ); 
     529    handle = startstop_nofree_f( "httpd", handle ); 
    530530 
    531531#ifdef HAVE_WOL 
    532     handle = startstop_nofree( "wol", handle ); 
     532    handle = startstop_nofree_f( "wol", handle ); 
    533533#endif 
    534534#if !defined(HAVE_MADWIFI) && !defined(HAVE_RT2880) 
     
    538538#endif 
    539539#endif 
    540     handle = start_service_nofree( "anchorfreednat", handle ); 
     540    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    541541 
    542542    if( handle ) 
     
    578578#endif 
    579579    handle = start_service_nofree( "wan_boot", handle ); 
    580     handle = start_service_nofree( "ttraff", handle ); 
     580    handle = start_service_nofree_f( "ttraff", handle ); 
    581581#ifdef HAVE_MADWIFI 
    582     handle = start_service_nofree( "stabridge", handle ); 
     582    handle = start_service_nofree_f( "stabridge", handle ); 
    583583#endif 
    584584#ifdef HAVE_VLANTAGGING 
     
    592592#endif 
    593593#endif 
    594     handle = start_service_nofree( "radio_timer", handle ); 
     594    handle = start_service_nofree_f( "radio_timer", handle ); 
    595595    if( handle ) 
    596596        dlclose( handle ); 
     
    599599static void handle_spppoe( void ) 
    600600{ 
    601     stop_service( "ttraff" ); 
    602     stop_service( "wan" ); 
     601    stop_service_f( "ttraff" ); 
     602    stop_service_f( "wan" ); 
    603603} 
    604604static void handle_filters( void ) 
     
    607607 
    608608    handle = stop_service_nofree( "cron", handle ); 
    609     handle = startstop_nofree( "firewall", handle ); 
     609    handle = startstop_nofree_f( "firewall", handle ); 
    610610#ifdef HAVE_SYSLOG 
    611     handle = startstop_nofree( "syslog", handle ); 
     611    handle = startstop_nofree_f( "syslog", handle ); 
    612612#endif 
    613613    handle = stop_service_nofree( "wland", handle ); 
    614     handle = startstop_nofree( "wshaper", handle ); 
    615     handle = start_service_nofree( "wland", handle ); 
    616     handle = start_service_nofree( "cron", handle ); 
     614    handle = startstop_nofree_f( "wshaper", handle ); 
     615    handle = start_service_nofree_f( "wland", handle ); 
     616    handle = start_service_nofree_f( "cron", handle ); 
    617617#ifdef HAVE_MULTICAST 
    618     handle = startstop_nofree( "igmp_proxy", handle ); 
    619 #endif 
    620     handle = start_service_nofree( "anchorfreednat", handle ); 
     618    handle = startstop_nofree_f( "igmp_proxy", handle ); 
     619#endif 
     620    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    621621    if( handle ) 
    622622        dlclose( handle ); 
     
    629629    handle = stop_service_nofree( "zebra", handle ); 
    630630#endif 
    631     handle = startstop_nofree( "firewall", handle ); 
    632     handle = start_service_nofree( "set_routes", handle ); 
     631    handle = startstop_nofree_f( "firewall", handle ); 
     632    handle = start_service_nofree_f( "set_routes", handle ); 
    633633#if defined(HAVE_BIRD) || defined(HAVE_QUAGGA) 
    634     handle = start_service_nofree( "zebra", handle ); 
     634    handle = start_service_nofree_f( "zebra", handle ); 
    635635#endif 
    636636#ifdef HAVE_OLSRD 
    637     handle = startstop_nofree( "olsrd", handle ); 
    638 #endif 
    639     handle = start_service_nofree( "anchorfreednat", handle ); 
     637    handle = startstop_nofree_f( "olsrd", handle ); 
     638#endif 
     639    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    640640    if( handle ) 
    641641        dlclose( handle ); 
     
    656656    eval( "/etc/config/proxywatchdog.startup" ); 
    657657    } 
    658     handle = start_service_nofree( "cron", handle ); 
     658    handle = start_service_nofree_f( "cron", handle ); 
    659659    if( handle ) 
    660660        dlclose( handle ); 
     
    671671#endif 
    672672    handle = stop_service_nofree( "firewall", handle ); 
    673     handle = start_service_nofree( "firewall", handle ); 
     673    handle = start_service_nofree_f( "firewall", handle ); 
    674674#ifdef HAVE_UPNP 
    675675//    handle = start_service_nofree( "upnp", handle ); 
    676676#endif 
    677     handle = start_service_nofree( "wshaper", handle ); 
    678     handle = start_service_nofree( "wland", handle ); 
    679     handle = start_service_nofree( "anchorfreednat", handle ); 
     677    handle = start_service_nofree_f( "wshaper", handle ); 
     678    handle = start_service_nofree_f( "wland", handle ); 
     679    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    680680    if( handle ) 
    681681        dlclose( handle ); 
     
    684684static void handle_qos( void ) 
    685685{ 
    686     startstop( "wshaper" ); 
    687     startstop( "wland" ); 
     686    startstop_f( "wshaper" ); 
     687    startstop_f( "wland" ); 
    688688} 
    689689 
     
    696696#endif 
    697697    handle = stop_service_nofree( "firewall", handle ); 
    698     handle = start_service_nofree( "firewall", handle ); 
     698    handle = start_service_nofree_f( "firewall", handle ); 
    699699#ifdef HAVE_UPNP 
    700     handle = start_service_nofree( "upnp", handle ); 
     700    handle = start_service_nofree_f( "upnp", handle ); 
    701701#endif 
    702702    handle = stop_service_nofree( "wland", handle ); 
    703     handle = startstop_nofree( "wshaper", handle ); 
    704     handle = start_service_nofree( "wland", handle ); 
    705     handle = start_service_nofree( "anchorfreednat", handle ); 
     703    handle = startstop_nofree_f( "wshaper", handle ); 
     704    handle = start_service_nofree_f( "wland", handle ); 
     705    handle = start_service_nofree_f( "anchorfreednat", handle ); 
    706706    if( handle ) 
    707707        dlclose( handle ); 
     
    818818#endif 
    819819    handle = start_service_nofree( "wan", handle ); 
    820     handle = start_service_nofree( "ttraff", handle ); 
     820    handle = start_service_nofree_f( "ttraff", handle ); 
    821821#ifdef HAVE_MADWIFI 
    822     handle = start_service_nofree( "stabridge", handle ); 
     822    handle = start_service_nofree_f( "stabridge", handle ); 
    823823#endif 
    824824#ifdef HAVE_VLANTAGGING 
     
    832832#endif 
    833833#endif 
    834     handle = start_service_nofree( "radio_timer", handle ); 
     834    handle = start_service_nofree_f( "radio_timer", handle ); 
    835835    //restart dhcp as well, to fix repeater bridge save issue (dhcp disables itself here) 
    836     handle = startstop_nofree( "udhcpd", handle ); 
     836    handle = startstop_nofree_f( "udhcpd", handle ); 
    837837#ifdef HAVE_DNSMASQ 
    838     handle = startstop_nofree( "dnsmasq", handle ); 
    839 #endif 
    840     startstop( "httpd" );       // httpd will not accept connection anymore 
     838    handle = startstop_nofree_f( "dnsmasq", handle ); 
     839#endif 
     840    startstop_f( "httpd" );     // httpd will not accept connection anymore 
    841841    // on wan/lan ip changes changes 
    842842    if( handle ) 
     
    900900    { 
    901901        handle = start_service_nofree( "wan", handle ); 
    902         handle = start_service_nofree( "ttraff", handle ); 
     902        handle = start_service_nofree_f( "ttraff", handle ); 
    903903    } 
    904904#ifdef HAVE_MADWIFI 
    905     handle = start_service_nofree( "stabridge", handle ); 
     905    handle = start_service_nofree_f( "stabridge", handle ); 
    906906#endif 
    907907#ifdef HAVE_VLANTAGGING 
     
    915915#endif 
    916916#endif 
    917     handle = start_service_nofree( "radio_timer", handle ); 
     917    handle = start_service_nofree_f( "radio_timer", handle ); 
    918918    if( getSTA(  ) || getWET(  ) ) 
    919         startstop( "httpd" );   // httpd will not accept connection anymore 
     919        startstop_f( "httpd" ); // httpd will not accept connection anymore 
    920920    // on wan/lan ip changes changes 
    921921#ifdef HAVE_MADWIFI 
    922     handle = start_service_nofree( "hostapdwan", handle ); 
     922    handle = start_service_nofree_f( "hostapdwan", handle ); 
    923923#endif 
    924924    if( handle ) 
  • src/router/shared/shutils.h

    r10176 r12070  
    208208#endif 
    209209 
     210 
     211 
     212#ifndef HAVE_MICRO 
     213#define FORK(a) a; 
     214#else 
     215#define FORK(func) \ 
     216{ \ 
     217    switch ( fork(  ) ) \ 
     218    { \ 
     219        case -1: \ 
     220            return \ 
     221            break; \ 
     222        case 0: \ 
     223            ( void )setsid(  ); \ 
     224            break; \ 
     225        default: \ 
     226            return \ 
     227    } \ 
     228    func; \ 
     229    return; \ 
     230}                        
     231#endif 
     232 
    210233#ifdef vxworks 
    211234 
     
    218241#define ether_atoe(a, e) bcm_ether_atoe((a), (e)) 
    219242#define ether_etoa(e, a) bcm_ether_ntoa((e), (a)) 
     243 
    220244 
    221245/* 
Note: See TracChangeset for help on using the changeset viewer.