1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
|
diff --git a/arch/unix/fcgid_pm_unix.c b/arch/unix/fcgid_pm_unix.c
index 01932aa..2c0c4c4 100644
--- a/arch/unix/fcgid_pm_unix.c
+++ b/arch/unix/fcgid_pm_unix.c
@@ -386,6 +386,7 @@ void procmgr_init_spawn_cmd(fcgid_command * command, request_rec * r,
command->deviceid = deviceid;
command->inode = inode;
command->share_grp_id = share_grp_id;
+ command->virtualhost = r->server->server_hostname;
/* Update fcgid_command with wrapper info */
command->wrapperpath[0] = '\0';
diff --git a/arch/unix/fcgid_proctbl_unix.c b/arch/unix/fcgid_proctbl_unix.c
index bb8a46b..852c0c4 100644
--- a/arch/unix/fcgid_proctbl_unix.c
+++ b/arch/unix/fcgid_proctbl_unix.c
@@ -279,7 +279,7 @@ void proctable_print_debug_info(server_rec * main_server)
current_node != g_proc_array;
current_node = &g_proc_array[current_node->next_index]) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, main_server,
- "mod_fcgid: idle node index: %td",
+ "mod_fcgid: idle node index: %d",
current_node - g_proc_array);
}
@@ -287,7 +287,7 @@ void proctable_print_debug_info(server_rec * main_server)
current_node != g_proc_array;
current_node = &g_proc_array[current_node->next_index]) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, main_server,
- "mod_fcgid: busy node index: %td",
+ "mod_fcgid: busy node index: %d",
current_node - g_proc_array);
}
@@ -295,7 +295,7 @@ void proctable_print_debug_info(server_rec * main_server)
current_node != g_proc_array;
current_node = &g_proc_array[current_node->next_index]) {
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, main_server,
- "mod_fcgid: error node index: %td",
+ "mod_fcgid: error node index: %d",
current_node - g_proc_array);
}
}
diff --git a/fcgid_bridge.c b/fcgid_bridge.c
index e4fc184..5a960ff 100644
--- a/fcgid_bridge.c
+++ b/fcgid_bridge.c
@@ -34,6 +34,7 @@ static fcgid_procnode *apply_free_procnode(server_rec * main_server,
uid_t uid = command->uid;
gid_t gid = command->gid;
apr_size_t share_grp_id = command->share_grp_id;
+ char *virtualhost = command->virtualhost;
proc_table = proctable_get_table_array();
previous_node = proctable_get_idle_list();
@@ -47,6 +48,7 @@ static fcgid_procnode *apply_free_procnode(server_rec * main_server,
if (current_node->inode == inode
&& current_node->deviceid == deviceid
&& current_node->share_grp_id == share_grp_id
+ && current_node->virtualhost == virtualhost
&& current_node->uid == uid && current_node->gid == gid) {
/* Unlink from idle list */
previous_node->next_index = current_node->next_index;
@@ -124,6 +126,7 @@ count_busy_processes(server_rec * main_server, fcgid_command * command)
if (current_node->inode == command->inode
&& current_node->deviceid == command->deviceid
&& current_node->share_grp_id == command->share_grp_id
+ && current_node->virtualhost == command->virtualhost
&& current_node->uid == command->uid
&& current_node->gid == command->gid) {
result++;
diff --git a/fcgid_pm.h b/fcgid_pm.h
index a157156..0c34f78 100644
--- a/fcgid_pm.h
+++ b/fcgid_pm.h
@@ -11,6 +11,7 @@ typedef struct {
apr_ino_t inode;
dev_t deviceid;
apr_size_t share_grp_id;
+ char *virtualhost; /* Virtualhost granularity */
uid_t uid; /* For suEXEC */
gid_t gid; /* For suEXEC */
int userdir; /* For suEXEC */
diff --git a/fcgid_pm_main.c b/fcgid_pm_main.c
index 9618aec..fddab47 100644
--- a/fcgid_pm_main.c
+++ b/fcgid_pm_main.c
@@ -386,7 +386,7 @@ fastcgi_spawn(fcgid_command * command, server_rec * main_server,
if (free_list_header->next_index == 0) {
safe_unlock(main_server);
ap_log_error(APLOG_MARK, APLOG_WARNING, 0, main_server,
- "mod_fcgid: too much proecess, please increase FCGID_MAX_APPLICATION");
+ "mod_fcgid: too much processes, please increase FCGID_MAX_APPLICATION");
return;
}
procnode = &proctable_array[free_list_header->next_index];
@@ -398,12 +398,14 @@ fastcgi_spawn(fcgid_command * command, server_rec * main_server,
procnode->deviceid = command->deviceid;
procnode->inode = command->inode;
procnode->share_grp_id = command->share_grp_id;
+ procnode->virtualhost = command->virtualhost;
procnode->uid = command->uid;
procnode->gid = command->gid;
procnode->start_time = procnode->last_active_time = apr_time_now();
procnode->requests_handled = 0;
procnode->diewhy = FCGID_DIE_KILLSELF;
procnode->proc_pool = NULL;
+
procinfo.cgipath = command->cgipath;
procinfo.configpool = configpool;
procinfo.main_server = main_server;
@@ -447,8 +449,8 @@ fastcgi_spawn(fcgid_command * command, server_rec * main_server,
link_node_to_list(main_server, idle_list_header,
procnode, proctable_array);
ap_log_error(APLOG_MARK, APLOG_INFO, 0, main_server,
- "mod_fcgid: server %s(%" APR_PID_T_FMT ") started",
- command->cgipath, procnode->proc_id->pid);
+ "mod_fcgid: server %s:%s(%" APR_PID_T_FMT ") started",
+ command->virtualhost, command->cgipath, procnode->proc_id->pid);
register_spawn(main_server, procnode);
}
}
diff --git a/fcgid_proctbl.h b/fcgid_proctbl.h
index 04d954b..f1807ba 100644
--- a/fcgid_proctbl.h
+++ b/fcgid_proctbl.h
@@ -28,6 +28,7 @@ typedef struct {
gid_t gid; /* for suEXEC */
uid_t uid; /* for suEXEC */
apr_size_t share_grp_id; /* cgi wrapper share group id */
+ char *virtualhost; /* the virtualhost this process belongs to */
apr_time_t start_time; /* the time of this process create */
apr_time_t last_active_time; /* the time this process last active */
int requests_handled; /* number of requests process has handled */
diff --git a/fcgid_spawn_ctl.c b/fcgid_spawn_ctl.c
index 17039eb..d21c7d0 100644
--- a/fcgid_spawn_ctl.c
+++ b/fcgid_spawn_ctl.c
@@ -9,6 +9,7 @@ struct fcgid_stat_node {
uid_t uid;
gid_t gid;
apr_size_t share_grp_id;
+ char *virtualhost;
int score;
int process_counter;
apr_time_t last_stat_time;
@@ -42,6 +43,7 @@ register_life_death(server_rec * main_server,
if (current_node->inode == procnode->inode
&& current_node->deviceid == procnode->deviceid
&& current_node->share_grp_id == procnode->share_grp_id
+ && current_node->virtualhost == procnode->virtualhost
&& current_node->uid == procnode->uid
&& current_node->gid == procnode->gid)
break;
@@ -81,6 +83,7 @@ register_life_death(server_rec * main_server,
current_node->deviceid = procnode->deviceid;
current_node->inode = procnode->inode;
current_node->share_grp_id = procnode->share_grp_id;
+ current_node->virtualhost = procnode->virtualhost;
current_node->uid = procnode->uid;
current_node->gid = procnode->gid;
current_node->last_stat_time = apr_time_now();
@@ -152,6 +155,7 @@ int is_spawn_allowed(server_rec * main_server, fcgid_command * command)
if (current_node->inode == command->inode
&& current_node->deviceid == command->deviceid
&& current_node->share_grp_id == command->share_grp_id
+ && current_node->virtualhost == command->virtualhost
&& current_node->uid == command->uid
&& current_node->gid == command->gid)
break;
@@ -218,6 +222,7 @@ int is_kill_allowed(fcgid_procnode * procnode)
if (current_node->inode == procnode->inode
&& current_node->deviceid == procnode->deviceid
&& current_node->share_grp_id == procnode->share_grp_id
+ && current_node->virtualhost == procnode->virtualhost
&& current_node->uid == procnode->uid
&& current_node->gid == procnode->gid)
break;
|