Changes with Apache 2.0.35
+ *) The old, legacy (and unused) code in which the scoreboard was totally
+ and completely contained in a file (SCOREBOARD_FILE) has been
+ removed. This does not affect scoreboards which are *mapped* to
+ files using named-shared-memory. [Jim Jagielski]
+
*) Change bucket brigades API to allow a "bucket allocator" to be
passed in at certain points. This allows us to implement freelists
so that we can stop using malloc/free so frequently.
AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p,
int child_num, int thread_num);
-void update_scoreboard_global(void);
AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid);
AP_DECLARE(int) ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r);
AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num, int thread_num,
ap_log_error(APLOG_MARK, APLOG_CRIT, errno, s,
"unable to replace stdout with sock device driver");
input_parms.generation = ap_my_generation;
-#ifdef SCOREBOARD_FILE
- input_parms.scoreboard_fd = scoreboard_fd;
-#else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */
input_parms.scoreboard_heap = ap_scoreboard_image;
-#endif
lr = ap_listeners;
count = 0;
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
- update_scoreboard_global();
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
"Graceful restart requested, doing restart");
int n, pid;
for (n = 0; n < ap_max_daemons_limit; ++n) {
- ap_sync_scoreboard_image();
if (ap_scoreboard_image->servers[n][0].status != SERVER_DEAD &&
kill((pid = ap_scoreboard_image->parent[n].pid), 0) == -1) {
ap_update_child_status_from_indexes(n, 0, SERVER_DEAD, NULL);
(void) ap_update_child_status(sbh, SERVER_READY, (request_rec *) NULL);
- ap_sync_scoreboard_image();
-
/* Set up the pollfd array */
listensocks = apr_pcalloc(pchild,
sizeof(*listensocks) * (num_listensocks));
* defer the exit
*/
for (;;) {
- ap_sync_scoreboard_image();
status = listensocks[offset].accept_func(&csd,
&listensocks[offset], ptrans);
*/
die_now = 1;
}
- ap_sync_scoreboard_image();
}
clean_child_exit(0);
}
}
ap_scoreboard_image->parent[slot].pid = pid;
-#ifdef SCOREBOARD_FILE
- lseek(scoreboard_fd, APR_XtOffsetOf(scoreboard, parent[slot]), 0);
- force_write(scoreboard_fd, &ap_scoreboard_image->parent[slot],
- sizeof(process_score));
-#endif
return 0;
}
last_non_dead = -1;
total_non_dead = 0;
- ap_sync_scoreboard_image();
for (i = 0; i < ap_daemons_limit; ++i) {
int status;
* cleared scoreboard
*/
ap_scoreboard_image->global->running_generation = ap_my_generation;
- update_scoreboard_global();
- }
-#ifdef SCOREBOARD_FILE
- else {
- ap_scoreboard_fname = ap_server_root_relative(pconf, ap_scoreboard_fname);
- ap_note_cleanups_for_fd(pconf, scoreboard_fd);
}
-#endif
set_signals();
}
/* non-fatal death... note that it's gone in the scoreboard. */
- ap_sync_scoreboard_image();
child_slot = find_child_by_pid(&pid);
if (child_slot >= 0) {
(void) ap_update_child_status_from_indexes(child_slot, 0, SERVER_DEAD,
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
- update_scoreboard_global();
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
/* kill off the idle ones */
ap_mpm_pod_killpg(pod, ap_daemons_limit);
-#ifndef SCOREBOARD_FILE
/* This is mostly for debugging... so that we know what is still
- * gracefully dealing with existing request. But we can't really
- * do it if we're in a SCOREBOARD_FILE because it'll cause
- * corruption too easily.
+ * gracefully dealing with existing request. This will break
+ * in a very nasty way if we ever have the scoreboard totally
+ * file-based (no shared memory)
*/
- ap_sync_scoreboard_image();
for (index = 0; index < ap_daemons_limit; ++index) {
if (ap_scoreboard_image->servers[index][0].status != SERVER_DEAD) {
ap_scoreboard_image->servers[index][0].status = SERVER_GRACEFUL;
}
}
-#endif
}
else {
/* Kill 'em off */
last_non_dead = -1;
total_non_dead = 0;
- ap_sync_scoreboard_image();
for (i = 0; i < ap_daemons_limit; ++i) {
/* Initialization to satisfy the compiler. It doesn't know
* that ap_threads_per_child is always > 0 */
* cleared scoreboard
*/
ap_scoreboard_image->global->running_generation = ap_my_generation;
- update_scoreboard_global();
}
set_signals();
*/
++ap_my_generation;
ap_scoreboard_image->global->running_generation = ap_my_generation;
- update_scoreboard_global();
if (is_graceful) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_NOTICE, 0, ap_server_conf,
* anyway.
*/
-void ap_sync_scoreboard_image(void)
-{
-}
-
AP_DECLARE(int) ap_exists_scoreboard_image(void)
{
return (ap_scoreboard_image ? 1 : 0);
}
-static APR_INLINE void put_scoreboard_info(int child_num, int thread_num,
- worker_score *new_score_rec)
-{
- /* XXX - needs to be fixed to account for threads */
-#ifdef SCOREBOARD_FILE
- lseek(scoreboard_fd, sizeof(global_score)
- + (long)child_num * sizeof(worker_score), 0);
- force_write(scoreboard_fd, new_score_rec, sizeof(worker_score));
-#endif
-}
-
-void update_scoreboard_global(void)
-{
-#ifdef SCOREBOARD_FILE
- lseek(scoreboard_fd, 0, 0);
- force_write(scoreboard_fd, &ap_scoreboard_image->global,
- sizeof ap_scoreboard_image->global);
-#endif
-}
-
AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r)
{
worker_score *ws;
ws->bytes_served += r->bytes_sent;
ws->my_bytes_served += r->bytes_sent;
ws->conn_bytes += r->bytes_sent;
-
- put_scoreboard_info(sb->child_num, sb->thread_num, ws);
}
AP_DECLARE(int) find_child_by_pid(apr_proc_t *pid)
}
}
- put_scoreboard_info(child_num, thread_num, ws);
return old_status;
}
else if (status == STOP_PREQUEST) {
ws->stop_time = apr_time_now();
}
- put_scoreboard_info(child_num, thread_num, ws);
}
AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y)