manoj 99/04/08 21:10:41
Modified: pthreads/src/include alloc.h buff.h http_main.h scoreboard.h
pthreads/src/main buff.c fdqueue.c http_accept.c http_main.c
http_protocol.c scoreboard.c
pthreads/src/modules/standard mod_auth.c mod_auth_anon.c
mod_auth_db.c mod_auth_dbm.c mod_digest.c
Log:
Lots of minor changes that mostly eliminate warnings during a compile
with whininess settings turned on.
Revision Changes Path
1.5 +2 -1 apache-apr/pthreads/src/include/alloc.h
Index: alloc.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/alloc.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- alloc.h 1999/03/17 17:01:06 1.4
+++ alloc.h 1999/04/09 04:10:34 1.5
@@ -93,7 +93,8 @@
pool * ap_init_alloc(void); /* Set up everything */
void ap_child_init_alloc(void); /* Set up everything */
-API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of
permanent_pool */
+API_EXPORT(pool *) ap_make_sub_pool(pool *);
+API_EXPORT(pool *) ap_make_root_pool(void);
API_EXPORT(void) ap_destroy_pool(pool *);
/* used to guarantee to the pool debugging code that the sub pool will not be
1.4 +4 -0 apache-apr/pthreads/src/include/buff.h
Index: buff.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/buff.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- buff.h 1999/03/15 14:26:48 1.3
+++ buff.h 1999/04/09 04:10:35 1.4
@@ -145,6 +145,10 @@
/* Stream creation and modification */
API_EXPORT(BUFF *) ap_bcreate(pool *p, int flags);
API_EXPORT(void) ap_bpushfd(BUFF *fb, int fd_in, int fd_out);
+
+/* XXX - unused right now - mvsk */
+API_EXPORT(BUFF *) ap_bopenf(pool *a, const char *name, int flg, int mode);
+
#ifdef WIN32
API_EXPORT(void) ap_bpushh(BUFF *fb, HANDLE hFH);
#endif
1.5 +2 -0 apache-apr/pthreads/src/include/http_main.h
Index: http_main.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -u -r1.4 -r1.5
--- http_main.h 1999/02/24 20:30:14 1.4
+++ http_main.h 1999/04/09 04:10:35 1.5
@@ -62,6 +62,8 @@
extern "C" {
#endif
+void clean_child_exit(int code);
+
/*
* Routines in http_main.c which other code --- in particular modules ---
* may want to call. Right now, that's limited to timeout handling.
1.7 +1 -8 apache-apr/pthreads/src/include/scoreboard.h
Index: scoreboard.h
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/include/scoreboard.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- scoreboard.h 1999/02/15 20:38:57 1.6
+++ scoreboard.h 1999/04/09 04:10:35 1.7
@@ -200,21 +200,14 @@
#elif defined(USE_POSIX_SCOREBOARD)
static void cleanup_shared_mem(void *d);
#else
-static int force_write(int fd, void *buffer, int bufsz);
-static int force_read(int fd, void *buffer, int bufsz);
-static void cleanup_scoreboard_file(void *foo);
void reinit_scoreboard(pool *p);
#endif
API_EXPORT(void) reopen_scoreboard(pool *p);
-static void setup_shared_mem(pool *p);
-
ap_inline void ap_sync_scoreboard_image(void);
-static ap_inline void put_scoreboard_info(int child_num,
- thread_score *new_score_rec);
-static void update_scoreboard_global(void);
void increment_counts(int child_num, int thread_num, request_rec *r);
+void update_scoreboard_global(void);
API_EXPORT(int) find_child_by_pid(int pid);
int ap_update_child_status(int child_num, int thread_num, int status,
request_rec *r);
void ap_time_process_request(int child_num, int thread_num, int status);
1.7 +4 -4 apache-apr/pthreads/src/main/buff.c
Index: buff.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- buff.c 1999/03/17 17:01:16 1.6
+++ buff.c 1999/04/09 04:10:36 1.7
@@ -125,7 +125,7 @@
select() sometimes returns 1 even though the write will block. We must
work around this.
*/
-int sendwithtimeout(int sock, const char *buf, int len, int flags, int sec)
+static int sendwithtimeout(int sock, const char *buf, int len, int flags,
int sec)
{
int iostate = 1;
fd_set fdset;
@@ -184,7 +184,7 @@
}
-int recvwithtimeout(int sock, char *buf, int len, int flags, int sec)
+static int recvwithtimeout(int sock, char *buf, int len, int flags, int sec)
{
int iostate = 1;
fd_set fdset;
@@ -229,7 +229,7 @@
#else
-int sendwithtimeout(int sock, const char *buf, int len, int flags, time_t
sec)
+static int sendwithtimeout(int sock, const char *buf, int len, int flags,
time_t sec)
{
fd_set fdset;
struct timeval tv;
@@ -264,7 +264,7 @@
return (rv);
}
-int recvwithtimeout(int sock, char *buf, int len, int flags, time_t sec)
+static int recvwithtimeout(int sock, char *buf, int len, int flags, time_t
sec)
{
fd_set fdset;
struct timeval tv;
1.14 +7 -3 apache-apr/pthreads/src/main/fdqueue.c
Index: fdqueue.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/fdqueue.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -u -r1.13 -r1.14
--- fdqueue.c 1999/04/07 22:52:18 1.13
+++ fdqueue.c 1999/04/09 04:10:36 1.14
@@ -3,9 +3,9 @@
/* Assumption: queue itself is allocated by the user */
/* Assumption: increment and decrement are atomic on int */
-int queue_init(FDQueue *queue, int queue_size, pool *a) {
+int queue_init(FDQueue *queue, int queue_capacity, pool *a) {
int i;
- int bounds = queue_size + 1;
+ int bounds = queue_capacity + 1;
pthread_mutex_init(&queue->one_big_mutex, NULL);
pthread_cond_init(&queue->not_empty, NULL);
pthread_cond_init(&queue->not_full, NULL);
@@ -24,6 +24,7 @@
pthread_cond_destroy(&queue->not_empty);
pthread_cond_destroy(&queue->not_full);
pthread_mutex_destroy(&queue->one_big_mutex);
+ return FD_QUEUE_SUCCESS;
}
int queue_push(FDQueue *queue, int fd, struct sockaddr *addr) {
@@ -41,6 +42,7 @@
if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) {
return FD_QUEUE_FAILURE;
}
+ return FD_QUEUE_SUCCESS;
}
int queue_pop(FDQueue *queue, struct sockaddr *addr, int block_if_empty) {
@@ -56,7 +58,7 @@
pthread_cond_wait(&queue->not_empty, &queue->one_big_mutex);
else {
pthread_mutex_unlock(&queue->one_big_mutex);
- return -1;
+ return FD_QUEUE_FAILURE;
}
}
@@ -88,6 +90,7 @@
if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) {
return FD_QUEUE_FAILURE;
}
+ return FD_QUEUE_SUCCESS;
}
int increase_blanks(FDQueue *queue) {
@@ -98,4 +101,5 @@
if (pthread_mutex_unlock(&queue->one_big_mutex) != 0) {
return FD_QUEUE_FAILURE;
}
+ return FD_QUEUE_SUCCESS;
}
1.2 +2 -2 apache-apr/pthreads/src/main/http_accept.c
Index: http_accept.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_accept.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -u -r1.1 -r1.2
--- http_accept.c 1999/04/07 22:52:18 1.1
+++ http_accept.c 1999/04/09 04:10:37 1.2
@@ -195,10 +195,10 @@
int worker_threads_per_child,
int acceptor_threads_per_child)
{
- int queue_size = worker_threads_per_child + acceptor_threads_per_child;
+ int queue_capacity = worker_threads_per_child +
acceptor_threads_per_child;
SAFE_ACCEPT(accept_mutex_child_init(pchild));
requests_this_child = ap_max_requests_per_child;
- queue_init(&csd_queue, queue_size, pchild);
+ queue_init(&csd_queue, queue_capacity, pchild);
}
1.68 +21 -30 apache-apr/pthreads/src/main/http_main.c
Index: http_main.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
retrieving revision 1.67
retrieving revision 1.68
diff -u -u -r1.67 -r1.68
--- http_main.c 1999/04/07 22:52:18 1.67
+++ http_main.c 1999/04/09 04:10:37 1.68
@@ -92,6 +92,9 @@
#include "util_script.h" /* to force util_script.c linking */
#include "util_uri.h"
#include "scoreboard.h"
+/* XXX - the accept_mutex_init call should be moved to http_accept.c. Until
+ * that... - mvsk */
+#include "acceptlock.h"
#include "http_accept.h"
#include <poll.h>
@@ -216,6 +219,9 @@
pool *pchild; /* Pool for httpd child stuff */
+/* thread local storage code that isn't used right now */
+
+#if 0
/* stuff that needs thread local store in main */
typedef struct {
jmp_buf thread_exit;
@@ -226,7 +232,6 @@
static tls_main_t *gettls(pthread_key_t tls_main_key)
{
- int rc;
tls_main_t *tls_p;
tls_p = pthread_getspecific(tls_main_key);
if (!tls_p) {
@@ -237,13 +242,13 @@
return tls_p;
}
#define tls() ((tls_main_t *) gettls(tls_main_key)) /* ZZZZZ */
+#endif
static listen_rec *head_listener;
/* *Non*-shared http_main globals... */
static server_rec *server_conf;
-static struct pollfd *listenfds; /* ZZZZZ abstract fd_set */
static pid_t pgrp;
/* one_process --- debugging mode variable; can be set from the command line
@@ -385,8 +390,6 @@
{
int child_num = find_child_by_pid(getpid());
int i;
- listen_rec *lr;
- parent_score *ss = &ap_scoreboard_image->parent[child_num];
for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++)
ap_update_child_status(child_num, i, SERVER_DEAD, (request_rec *)
NULL);
@@ -399,9 +402,7 @@
exit(code);
}
-
-
-void graceful_killer(void)
+static void graceful_killer(void)
{
stop_accepting_requests(pconf);
}
@@ -999,9 +1000,6 @@
}
}
-static int volatile usr1_just_die = 1;
-static int volatile deferred_die;
-
static void graceful_sig_handler(int sig)
{
ap_max_requests_per_child = 1;
@@ -1476,7 +1474,6 @@
{
listen_rec *lr;
int fd;
- int i;
lr = ap_listeners;
ap_acceptors_per_child = 0;
@@ -1742,11 +1739,11 @@
}
-void * worker_thread(void * dummy)
+static void * worker_thread(void * dummy)
{
proc_info * ti = dummy;
- int my_pid = ti->pid;
- int my_tid = ti->tid;
+ int process_slot = ti->pid;
+ int thread_slot = ti->tid;
struct sockaddr sa_client;
int csd;
pool *ptrans; /* Pool for per-transaction stuff */
@@ -1756,18 +1753,19 @@
ptrans = ap_make_sub_pool(pchild);
while (1) {
- (void) ap_update_child_status(my_pid, my_tid, SERVER_READY,
+ (void) ap_update_child_status(process_slot, thread_slot,
SERVER_READY,
(request_rec *) NULL);
csd = get_request(&sa_client);
if (csd < 0) {
break;
}
- process_socket(ptrans, &sa_client, csd, my_pid, my_tid);
+ process_socket(ptrans, &sa_client, csd, process_slot, thread_slot);
ap_clear_pool(ptrans);
}
ap_destroy_pool(ptrans);
- ap_update_child_status(my_pid, my_tid, SERVER_DEAD, (request_rec *)
NULL);
+ ap_update_child_status(process_slot, thread_slot, SERVER_DEAD,
+ (request_rec *) NULL);
return NULL;
}
@@ -1895,14 +1893,11 @@
}
static void *thread_starter_thread(void *thread_arg) {
- listen_rec *lr;
- int i, curr;
+ int i;
pthread_t thread;
int my_child_num = *((int *) thread_arg);
proc_info *my_info = NULL;
- sigset_t sig_mask;
-
/* Setup worker threads */
for (i=0; i < ap_threads_per_child; i++) {
@@ -1939,7 +1934,7 @@
*
*/
start_accepting_requests(my_child_num);
-
+ return NULL;
}
static void child_main(int child_num_arg)
@@ -1947,7 +1942,6 @@
sigset_t sig_mask;
int signal_received;
pthread_t thread;
- int temp = 0;
my_pid = getpid();
@@ -2014,9 +2008,7 @@
static int make_child(server_rec *s, int slot, time_t now) /* ZZZ */
{
- pthread_t tid; /* ZZZZ */
int pid;
- listen_rec *lr;
if (ap_acceptors_per_child + ap_threads_per_child > HARD_THREAD_LIMIT) {
ap_log_error(APLOG_MARK, APLOG_ERR, s,
@@ -2080,6 +2072,7 @@
}
/* else */
ap_scoreboard_image->parent[slot].pid = pid;
+ return 0;
}
/* start up a bunch of children */
@@ -2133,7 +2126,9 @@
ap_sync_scoreboard_image();
for (i = 0; i < ap_daemons_limit; ++i) {
- int status;
+ /* Initialization to satisfy the compiler. It doesn't know
+ * that ap_threads_per_child is always > 0 */
+ int status = SERVER_DEAD;
idle_thread_count = 0;
if (i >= max_daemons_limit && free_length == idle_spawn_rate)
@@ -2202,7 +2197,6 @@
}
else {
/* ZZZZ */
- time_t now = 0; /*ZZZZZ */
if (idle_spawn_rate >= 8) {
ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_INFO, server_conf,
@@ -2404,9 +2398,7 @@
*/
++ap_my_generation;
ap_scoreboard_image->global.running_generation = ap_my_generation;
-#ifdef HAVENTWRITENYET
update_scoreboard_global();
-#endif
if (is_graceful) {
int i, j;
@@ -2474,7 +2466,6 @@
int main(int argc, char **argv)
{
int c;
- int rc; /* ZZZZ */
int configtestonly = 0;
char *s;
1.16 +0 -1 apache-apr/pthreads/src/main/http_protocol.c
Index: http_protocol.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/http_protocol.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -u -r1.15 -r1.16
--- http_protocol.c 1999/03/24 18:39:47 1.15
+++ http_protocol.c 1999/04/09 04:10:37 1.16
@@ -922,7 +922,6 @@
pool *p;
const char *expect;
int access_status;
- int rv;
p = ap_make_sub_pool(conn->pool);
r = ap_pcalloc(p, sizeof(request_rec));
1.7 +7 -2 apache-apr/pthreads/src/main/scoreboard.c
Index: scoreboard.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/main/scoreboard.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -u -r1.6 -r1.7
--- scoreboard.c 1999/03/17 17:01:22 1.6
+++ scoreboard.c 1999/04/09 04:10:37 1.7
@@ -512,16 +512,17 @@
return (ap_scoreboard_image ? 1 : 0);
}
-static ap_inline void put_scoreboard_info(int child_num,
+static ap_inline void put_scoreboard_info(int child_num, int thread_num,
thread_score *new_score_rec)
{
+ /* XXX - needs to be fixed to account for threads */
#ifdef SCOREBOARD_FILE
lseek(scoreboard_fd, (long) child_num * sizeof(thread_score), 0);
force_write(scoreboard_fd, new_score_rec, sizeof(thread_score));
#endif
}
-static void update_scoreboard_global(void)
+void update_scoreboard_global(void)
{
#ifdef SCOREBOARD_FILE
lseek(scoreboard_fd,
@@ -551,6 +552,8 @@
ss->my_bytes_served += (unsigned long) bs;
ss->conn_bytes += (unsigned long) bs;
+ put_scoreboard_info(child_num, thread_num, ss);
+
}
API_EXPORT(int) find_child_by_pid(int pid)
@@ -618,6 +621,7 @@
}
}
+ put_scoreboard_info(child_num, thread_num, ss);
return old_status;
}
@@ -646,4 +650,5 @@
ss->start_time.tv_sec = ss->start_time.tv_usec = 0L;
}
}
+ put_scoreboard_info(child_num, thread_num, ss);
}
1.4 +0 -1 apache-apr/pthreads/src/modules/standard/mod_auth.c
Index: mod_auth.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- mod_auth.c 1999/03/24 18:39:51 1.3
+++ mod_auth.c 1999/04/09 04:10:39 1.4
@@ -198,7 +198,6 @@
{
auth_config_rec *sec =
(auth_config_rec *) ap_get_module_config(r->per_dir_config,
&auth_module);
- conn_rec *c = r->connection;
const char *sent_pw;
char *real_pw;
char *invalid_pw;
1.4 +0 -1 apache-apr/pthreads/src/modules/standard/mod_auth_anon.c
Index: mod_auth_anon.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_anon.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- mod_auth_anon.c 1999/03/24 18:39:51 1.3
+++ mod_auth_anon.c 1999/04/09 04:10:39 1.4
@@ -216,7 +216,6 @@
anon_auth_config_rec *sec =
(anon_auth_config_rec *) ap_get_module_config(r->per_dir_config,
&anon_auth_module);
- conn_rec *c = r->connection;
const char *sent_pw;
int res = DECLINED;
1.4 +0 -1 apache-apr/pthreads/src/modules/standard/mod_auth_db.c
Index: mod_auth_db.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_db.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- mod_auth_db.c 1999/03/24 18:39:52 1.3
+++ mod_auth_db.c 1999/04/09 04:10:40 1.4
@@ -224,7 +224,6 @@
db_auth_config_rec *sec =
(db_auth_config_rec *) ap_get_module_config(r->per_dir_config,
&db_auth_module);
- conn_rec *c = r->connection;
const char *sent_pw;
char *real_pw, *colon_pw;
char *invalid_pw;
1.4 +0 -1 apache-apr/pthreads/src/modules/standard/mod_auth_dbm.c
Index: mod_auth_dbm.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_auth_dbm.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- mod_auth_dbm.c 1999/03/24 18:39:52 1.3
+++ mod_auth_dbm.c 1999/04/09 04:10:40 1.4
@@ -206,7 +206,6 @@
dbm_auth_config_rec *sec =
(dbm_auth_config_rec *) ap_get_module_config(r->per_dir_config,
&dbm_auth_module);
- conn_rec *c = r->connection;
const char *sent_pw;
char *real_pw, *colon_pw;
char *invalid_pw;
1.4 +0 -1 apache-apr/pthreads/src/modules/standard/mod_digest.c
Index: mod_digest.c
===================================================================
RCS file: /home/cvs/apache-apr/pthreads/src/modules/standard/mod_digest.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -u -r1.3 -r1.4
--- mod_digest.c 1999/03/24 18:39:53 1.3
+++ mod_digest.c 1999/04/09 04:10:40 1.4
@@ -288,7 +288,6 @@
(digest_config_rec *) ap_get_module_config(r->per_dir_config,
&digest_module);
digest_header_rec *response = ap_pcalloc(r->pool,
sizeof(digest_header_rec));
- conn_rec *c = r->connection;
char *a1;
int res;