|
|
41a6c3 |
Index: server/scoreboard.c
|
|
|
41a6c3 |
===================================================================
|
|
|
41a6c3 |
--- a/server/scoreboard.c (revision 1610498)
|
|
|
41a6c3 |
+++ b/server/scoreboard.c (revision 1610499)
|
|
|
41a6c3 |
@@ -579,6 +579,21 @@
|
|
|
41a6c3 |
sbh->thread_num);
|
|
|
41a6c3 |
}
|
|
|
41a6c3 |
|
|
|
41a6c3 |
+AP_DECLARE(void) ap_copy_scoreboard_worker(worker_score *dest,
|
|
|
41a6c3 |
+ int child_num,
|
|
|
41a6c3 |
+ int thread_num)
|
|
|
41a6c3 |
+{
|
|
|
41a6c3 |
+ worker_score *ws = ap_get_scoreboard_worker_from_indexes(child_num, thread_num);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+ memcpy(dest, ws, sizeof *ws);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+ /* For extra safety, NUL-terminate the strings returned, though it
|
|
|
41a6c3 |
+ * should be true those last bytes are always zero anyway. */
|
|
|
41a6c3 |
+ dest->client[sizeof(dest->client) - 1] = '\0';
|
|
|
41a6c3 |
+ dest->request[sizeof(dest->request) - 1] = '\0';
|
|
|
41a6c3 |
+ dest->vhost[sizeof(dest->vhost) - 1] = '\0';
|
|
|
41a6c3 |
+}
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
AP_DECLARE(process_score *) ap_get_scoreboard_process(int x)
|
|
|
41a6c3 |
{
|
|
|
41a6c3 |
if ((x < 0) || (x >= server_limit)) {
|
|
|
41a6c3 |
Index: modules/generators/mod_status.c
|
|
|
41a6c3 |
===================================================================
|
|
|
41a6c3 |
--- a/modules/generators/mod_status.c (revision 1610498)
|
|
|
41a6c3 |
+++ b/modules/generators/mod_status.c (revision 1610499)
|
|
|
41a6c3 |
@@ -194,7 +194,7 @@
|
|
|
41a6c3 |
long req_time;
|
|
|
41a6c3 |
int short_report;
|
|
|
41a6c3 |
int no_table_report;
|
|
|
41a6c3 |
- worker_score *ws_record;
|
|
|
41a6c3 |
+ worker_score *ws_record = apr_palloc(r->pool, sizeof *ws_record);
|
|
|
41a6c3 |
process_score *ps_record;
|
|
|
41a6c3 |
char *stat_buffer;
|
|
|
41a6c3 |
pid_t *pid_buffer, worker_pid;
|
|
|
41a6c3 |
@@ -306,7 +306,7 @@
|
|
|
41a6c3 |
for (j = 0; j < thread_limit; ++j) {
|
|
|
41a6c3 |
int indx = (i * thread_limit) + j;
|
|
|
41a6c3 |
|
|
|
41a6c3 |
- ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
|
|
|
41a6c3 |
+ ap_copy_scoreboard_worker(ws_record, i, j);
|
|
|
41a6c3 |
res = ws_record->status;
|
|
|
41a6c3 |
|
|
|
41a6c3 |
if ((i >= max_servers || j >= threads_per_child)
|
|
|
41a6c3 |
@@ -637,7 +637,7 @@
|
|
|
41a6c3 |
|
|
|
41a6c3 |
for (i = 0; i < server_limit; ++i) {
|
|
|
41a6c3 |
for (j = 0; j < thread_limit; ++j) {
|
|
|
41a6c3 |
- ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
|
|
|
41a6c3 |
+ ap_copy_scoreboard_worker(ws_record, i, j);
|
|
|
41a6c3 |
|
|
|
41a6c3 |
if (ws_record->access_count == 0 &&
|
|
|
41a6c3 |
(ws_record->status == SERVER_READY ||
|
|
|
41a6c3 |
Index: modules/lua/lua_request.c
|
|
|
41a6c3 |
===================================================================
|
|
|
41a6c3 |
--- a/modules/lua/lua_request.c (revision 1610498)
|
|
|
41a6c3 |
+++ b/modules/lua/lua_request.c (revision 1610499)
|
|
|
41a6c3 |
@@ -1245,16 +1245,22 @@
|
|
|
41a6c3 |
*/
|
|
|
41a6c3 |
static int lua_ap_scoreboard_worker(lua_State *L)
|
|
|
41a6c3 |
{
|
|
|
41a6c3 |
- int i,
|
|
|
41a6c3 |
- j;
|
|
|
41a6c3 |
- worker_score *ws_record;
|
|
|
41a6c3 |
+ int i, j;
|
|
|
41a6c3 |
+ worker_score *ws_record = NULL;
|
|
|
41a6c3 |
+ request_rec *r = NULL;
|
|
|
41a6c3 |
|
|
|
41a6c3 |
luaL_checktype(L, 1, LUA_TUSERDATA);
|
|
|
41a6c3 |
luaL_checktype(L, 2, LUA_TNUMBER);
|
|
|
41a6c3 |
luaL_checktype(L, 3, LUA_TNUMBER);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+ r = ap_lua_check_request_rec(L, 1);
|
|
|
41a6c3 |
+ if (!r) return 0;
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
i = lua_tointeger(L, 2);
|
|
|
41a6c3 |
j = lua_tointeger(L, 3);
|
|
|
41a6c3 |
- ws_record = ap_get_scoreboard_worker_from_indexes(i, j);
|
|
|
41a6c3 |
+ ws_record = apr_palloc(r->pool, sizeof *ws_record);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+ ap_copy_scoreboard_worker(ws_record, i, j);
|
|
|
41a6c3 |
if (ws_record) {
|
|
|
41a6c3 |
lua_newtable(L);
|
|
|
41a6c3 |
|
|
|
41a6c3 |
Index: include/scoreboard.h
|
|
|
41a6c3 |
===================================================================
|
|
|
41a6c3 |
--- a/include/scoreboard.h (revision 1610498)
|
|
|
41a6c3 |
+++ b/include/scoreboard.h (revision 1610499)
|
|
|
41a6c3 |
@@ -183,8 +183,25 @@
|
|
|
41a6c3 |
AP_DECLARE(void) ap_time_process_request(ap_sb_handle_t *sbh, int status);
|
|
|
41a6c3 |
|
|
|
41a6c3 |
AP_DECLARE(worker_score *) ap_get_scoreboard_worker(ap_sb_handle_t *sbh);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+/** Return a pointer to the worker_score for a given child, thread pair.
|
|
|
41a6c3 |
+ * @param child_num The child number.
|
|
|
41a6c3 |
+ * @param thread_num The thread number.
|
|
|
41a6c3 |
+ * @return A pointer to the worker_score structure.
|
|
|
41a6c3 |
+ * @deprecated This function is deprecated, use ap_copy_scoreboard_worker instead. */
|
|
|
41a6c3 |
AP_DECLARE(worker_score *) ap_get_scoreboard_worker_from_indexes(int child_num,
|
|
|
41a6c3 |
int thread_num);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
+/** Copy the contents of a worker scoreboard entry. The contents of
|
|
|
41a6c3 |
+ * the worker_score structure are copied verbatim into the dest
|
|
|
41a6c3 |
+ * structure.
|
|
|
41a6c3 |
+ * @param dest Output parameter.
|
|
|
41a6c3 |
+ * @param child_num The child number.
|
|
|
41a6c3 |
+ * @param thread_num The thread number.
|
|
|
41a6c3 |
+ */
|
|
|
41a6c3 |
+AP_DECLARE(void) ap_copy_scoreboard_worker(worker_score *dest,
|
|
|
41a6c3 |
+ int child_num, int thread_num);
|
|
|
41a6c3 |
+
|
|
|
41a6c3 |
AP_DECLARE(process_score *) ap_get_scoreboard_process(int x);
|
|
|
41a6c3 |
AP_DECLARE(global_score *) ap_get_scoreboard_global(void);
|
|
|
41a6c3 |
|
|
|
41a6c3 |
|