@@ -135,6 +135,7 @@ static struct ini_value_parser_s ini_fpm_pool_options[] = {
135
135
{ "pm.process_idle_timeout" , & fpm_conf_set_time , WPO (pm_process_idle_timeout ) },
136
136
{ "pm.max_requests" , & fpm_conf_set_integer , WPO (pm_max_requests ) },
137
137
{ "pm.status_path" , & fpm_conf_set_string , WPO (pm_status_path ) },
138
+ { "pm.status_listen" , & fpm_conf_set_string , WPO (pm_status_listen ) },
138
139
{ "ping.path" , & fpm_conf_set_string , WPO (ping_path ) },
139
140
{ "ping.response" , & fpm_conf_set_string , WPO (ping_response ) },
140
141
{ "access.log" , & fpm_conf_set_string , WPO (access_log ) },
@@ -682,6 +683,57 @@ int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc) /* {{{ */
682
683
}
683
684
/* }}} */
684
685
686
+ #define FPM_WPC_STR_CP_EX (_cfg , _scfg , _sf , _df ) \
687
+ do { \
688
+ if (_scfg->_df && !(_cfg->_sf = strdup(_scfg->_df))) { \
689
+ return -1; \
690
+ } \
691
+ } while (0)
692
+ #define FPM_WPC_STR_CP (_cfg , _scfg , _field ) FPM_WPC_STR_CP_EX(_cfg, _scfg, _field, _field)
693
+
694
+ static int fpm_worker_pool_shared_status_alloc (struct fpm_worker_pool_s * shared_wp ) { /* {{{ */
695
+ struct fpm_worker_pool_config_s * config , * shared_config ;
696
+ config = fpm_worker_pool_config_alloc ();
697
+ if (!config ) {
698
+ return -1 ;
699
+ }
700
+ shared_config = shared_wp -> config ;
701
+
702
+ config -> name = malloc (strlen (shared_config -> name ) + sizeof ("_status" ));
703
+ if (!config -> name ) {
704
+ return -1 ;
705
+ }
706
+ strcpy (config -> name , shared_config -> name );
707
+ strcpy (config -> name + strlen (shared_config -> name ), "_status" );
708
+
709
+ if (!shared_config -> pm_status_path ) {
710
+ shared_config -> pm_status_path = strdup ("/" );
711
+ }
712
+
713
+ FPM_WPC_STR_CP_EX (config , shared_config , listen_address , pm_status_listen );
714
+ #ifdef HAVE_FPM_ACL
715
+ FPM_WPC_STR_CP (config , shared_config , listen_acl_groups );
716
+ FPM_WPC_STR_CP (config , shared_config , listen_acl_users );
717
+ #endif
718
+ FPM_WPC_STR_CP (config , shared_config , listen_allowed_clients );
719
+ FPM_WPC_STR_CP (config , shared_config , listen_group );
720
+ FPM_WPC_STR_CP (config , shared_config , listen_owner );
721
+ FPM_WPC_STR_CP (config , shared_config , listen_mode );
722
+ FPM_WPC_STR_CP (config , shared_config , user );
723
+ FPM_WPC_STR_CP (config , shared_config , group );
724
+ FPM_WPC_STR_CP (config , shared_config , pm_status_path );
725
+
726
+ config -> pm = PM_STYLE_ONDEMAND ;
727
+ config -> pm_max_children = 2 ;
728
+ /* set to 1 to not warn about max children for shared pool */
729
+ shared_wp -> warn_max_children = 1 ;
730
+
731
+ current_wp -> shared = shared_wp ;
732
+
733
+ return 0 ;
734
+ }
735
+ /* }}} */
736
+
685
737
static int fpm_evaluate_full_path (char * * path , struct fpm_worker_pool_s * wp , char * default_prefix , int expand ) /* {{{ */
686
738
{
687
739
char * prefix = NULL ;
@@ -856,6 +908,10 @@ static int fpm_conf_process_all_pools() /* {{{ */
856
908
}
857
909
858
910
/* status */
911
+ if (wp -> config -> pm_status_listen && fpm_worker_pool_shared_status_alloc (wp )) {
912
+ zlog (ZLOG_ERROR , "[pool %s] failed to initialize a status listener pool" , wp -> config -> name );
913
+ }
914
+
859
915
if (wp -> config -> pm_status_path && * wp -> config -> pm_status_path ) {
860
916
size_t i ;
861
917
char * status = wp -> config -> pm_status_path ;
@@ -865,7 +921,7 @@ static int fpm_conf_process_all_pools() /* {{{ */
865
921
return -1 ;
866
922
}
867
923
868
- if (strlen (status ) < 2 ) {
924
+ if (! wp -> config -> pm_status_listen && ! wp -> shared && strlen (status ) < 2 ) {
869
925
zlog (ZLOG_ERROR , "[pool %s] the status path '%s' is not long enough" , wp -> config -> name , status );
870
926
return -1 ;
871
927
}
@@ -1634,7 +1690,11 @@ static void fpm_conf_dump() /* {{{ */
1634
1690
1635
1691
for (wp = fpm_worker_all_pools ; wp ; wp = wp -> next ) {
1636
1692
struct key_value_s * kv ;
1637
- if (!wp -> config ) continue ;
1693
+
1694
+ if (!wp -> config || wp -> shared ) {
1695
+ continue ;
1696
+ }
1697
+
1638
1698
zlog (ZLOG_NOTICE , "[%s]" , STR2STR (wp -> config -> name ));
1639
1699
zlog (ZLOG_NOTICE , "\tprefix = %s" , STR2STR (wp -> config -> prefix ));
1640
1700
zlog (ZLOG_NOTICE , "\tuser = %s" , STR2STR (wp -> config -> user ));
@@ -1663,6 +1723,7 @@ static void fpm_conf_dump() /* {{{ */
1663
1723
zlog (ZLOG_NOTICE , "\tpm.process_idle_timeout = %d" , wp -> config -> pm_process_idle_timeout );
1664
1724
zlog (ZLOG_NOTICE , "\tpm.max_requests = %d" , wp -> config -> pm_max_requests );
1665
1725
zlog (ZLOG_NOTICE , "\tpm.status_path = %s" , STR2STR (wp -> config -> pm_status_path ));
1726
+ zlog (ZLOG_NOTICE , "\tpm.status_listen = %s" , STR2STR (wp -> config -> pm_status_listen ));
1666
1727
zlog (ZLOG_NOTICE , "\tping.path = %s" , STR2STR (wp -> config -> ping_path ));
1667
1728
zlog (ZLOG_NOTICE , "\tping.response = %s" , STR2STR (wp -> config -> ping_response ));
1668
1729
zlog (ZLOG_NOTICE , "\taccess.log = %s" , STR2STR (wp -> config -> access_log ));
0 commit comments