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