cvs commit: apache-apr/pthreads/src/main http_accept.c
manoj 99/04/16 18:58:58 Modified:pthreads/src/main http_accept.c Log: Next time I'll read the whole man page. filedes[0] is for reading, filedes[1] is for writing. Revision ChangesPath 1.8 +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.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- http_accept.c 1999/04/15 20:01:40 1.7 +++ http_accept.c 1999/04/17 01:58:58 1.8 @@ -345,8 +345,8 @@ "pipe: (pipe_of_death)"); clean_child_exit(1); } -pipe_of_death = pipe_pair_of_death[0]; -listenfds[0].fd = pipe_pair_of_death[1]; +pipe_of_death = pipe_pair_of_death[1]; +listenfds[0].fd = pipe_pair_of_death[0]; listenfds[0].events = POLLIN; listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) {
cvs commit: apache-apr/pthreads/src/main util.c
manoj 99/04/16 20:06:39 Modified:pthreads/src/main util.c Log: Optimize ap_gm_timestr_822, ap_make_dirstr_prefix, and ap_unescape_url. Revision ChangesPath 1.4 +60 -15apache-apr/pthreads/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/util.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- util.c1999/03/17 17:01:23 1.3 +++ util.c1999/04/17 03:06:38 1.4 @@ -173,14 +173,56 @@ API_EXPORT(char *) ap_gm_timestr_822(pool *p, time_t sec) { struct tm *tms; +char *date_str = ap_palloc(p, 48 * sizeof(char)); +char *date_str_ptr = date_str; +int real_year; tms = gmtime(&sec);/* ZZZ replace with AP time routine */ +/* Assumption: this is always 3 */ +/* i = strlen(ap_day_snames[tms->tm_wday]); */ +memcpy(date_str_ptr, ap_day_snames[tms->tm_wday], 3); +date_str_ptr += 3; +*date_str_ptr++ = ','; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms->tm_mday / 10 + '0'; +*date_str_ptr++ = tms->tm_mday % 10 + '0'; +*date_str_ptr++ = ' '; +/* Assumption: this is also always 3 */ +/* i = strlen(ap_month_snames[tms->tm_mon]); */ +memcpy(date_str_ptr, ap_month_snames[tms->tm_mon], 3); +date_str_ptr += 3; +*date_str_ptr++ = ' '; +real_year = 1900 + tms->tm_year; +/* This routine isn't y10k ready. */ +*date_str_ptr++ = real_year / 1000 + '0'; +*date_str_ptr++ = real_year % 1000 / 100 + '0'; +*date_str_ptr++ = real_year % 100 / 10 + '0'; +*date_str_ptr++ = real_year % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = tms->tm_hour / 10 + '0'; +*date_str_ptr++ = tms->tm_hour % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms->tm_min / 10 + '0'; +*date_str_ptr++ = tms->tm_min % 10 + '0'; +*date_str_ptr++ = ':'; +*date_str_ptr++ = tms->tm_sec / 10 + '0'; +*date_str_ptr++ = tms->tm_sec % 10 + '0'; +*date_str_ptr++ = ' '; +*date_str_ptr++ = 'G'; +*date_str_ptr++ = 'M'; +*date_str_ptr++ = 'T'; +*date_str_ptr = '\0'; + +return date_str; /* RFC date format; as strftime '%a, %d %b %Y %T GMT' */ + +/* The equivalent using sprintf. Use this for more legible but slower code return ap_psprintf(p, "%s, %.2d %s %d %.2d:%.2d:%.2d GMT", ap_day_snames[tms->tm_wday], tms->tm_mday, ap_month_snames[tms->tm_mon], tms->tm_year + 1900, tms->tm_hour, tms->tm_min, tms->tm_sec); +*/ } /* What a pain in the ass. */ @@ -472,15 +514,11 @@ API_EXPORT(char *) ap_make_dirstr_prefix(char *d, const char *s, int n) { for (;;) { - *d = *s; - if (*d == '\0') { + if (*s == '\0' || (*s == '/' && (--n) == 0)) { *d = '/'; break; } - if (*d == '/' && (--n) == 0) - break; - ++d; - ++s; + *d++ = *s++; } *++d = 0; return (d); @@ -1395,27 +1433,34 @@ */ API_EXPORT(int) ap_unescape_url(char *url) { -register int x, y, badesc, badpath; +register int badesc, badpath; +char *x, *y; badesc = 0; badpath = 0; -for (x = 0, y = 0; url[y]; ++x, ++y) { - if (url[y] != '%') - url[x] = url[y]; +/* Initial scan for first '%'. Don't bother writing values before + * seeing a '%' */ +y = strchr(url, '%'); +if (y == NULL) { +return OK; +} +for (x = y; *y; ++x, ++y) { + if (*y != '%') + *x = *y; else { - if (!ap_isxdigit(url[y + 1]) || !ap_isxdigit(url[y + 2])) { + if (!ap_isxdigit(*(y + 1)) || !ap_isxdigit(*(y + 2))) { badesc = 1; - url[x] = '%'; + *x = '%'; } else { - url[x] = x2c(&url[y + 1]); + *x = x2c(y + 1); y += 2; - if (url[x] == '/' || url[x] == '\0') + if (*x == '/' || *x == '\0') badpath = 1; } } } -url[x] = '\0'; +*x = '\0'; if (badesc) return BAD_REQUEST; else if (badpath)
cvs commit: apache-apr/pthreads/src/main Makefile.tmpl acceptlock.c
manoj 99/04/16 20:35:55 Modified:pthreads/src/include acceptlock.h http_accept.h pthreads/src/main Makefile.tmpl acceptlock.c Log: Add intraprocess support to the accept mutexes. This is needed by the USE_MULTI_ACCEPT model since threads within a process can compete with each other for the lock. Revision ChangesPath 1.4 +2 -1 apache-apr/pthreads/src/include/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/acceptlock.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -u -r1.3 -r1.4 --- acceptlock.h 1999/04/14 22:44:55 1.3 +++ acceptlock.h 1999/04/17 03:35:53 1.4 @@ -79,12 +79,13 @@ #elif defined (USE_SYSVSEM_SERIALIZED_ACCEPT) void accept_mutex_cleanup(void *); +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); #elif defined(USE_FCNTL_SERIALIZED_ACCEPT) -#define accept_mutex_child_init(x) +void accept_mutex_child_init(pool *); void accept_mutex_init(pool *, int); void accept_mutex_on(int); void accept_mutex_off(int); 1.5 +4 -0 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -u -r1.4 -r1.5 --- http_accept.h 1999/04/14 22:44:55 1.4 +++ http_accept.h 1999/04/17 03:35:53 1.5 @@ -85,6 +85,10 @@ int get_connection(struct sockaddr *); void stop_accepting_connections(pool*); +#ifdef USE_MULTI_ACCEPT +#define NEED_INTRAPROCESS_SERIALIZED_ACCEPT +#endif + #ifdef __cplusplus } #endif 1.8 +2 -1 apache-apr/pthreads/src/main/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-apr/pthreads/src/main/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -u -r1.7 -r1.8 --- Makefile.tmpl 1999/04/07 22:52:17 1.7 +++ Makefile.tmpl 1999/04/17 03:35:54 1.8 @@ -66,7 +66,8 @@ $(INCDIR)/http_config.h $(INCDIR)/http_protocol.h \ $(INCDIR)/http_request.h $(INCDIR)/http_conf_globals.h \ $(INCDIR)/http_core.h $(INCDIR)/http_vhost.h \ - $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h + $(INCDIR)/util_script.h $(INCDIR)/fdqueue.h $(INCDIR)/acceptlock.h \ + $(INCDIR)/http_accept.h alloc.o: alloc.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ $(INCDIR)/ap_mmn.h $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ 1.7 +69 -2 apache-apr/pthreads/src/main/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-apr/pthreads/src/main/acceptlock.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -u -r1.6 -r1.7 --- acceptlock.c 1999/04/16 04:43:01 1.6 +++ acceptlock.c 1999/04/17 03:35:54 1.7 @@ -68,6 +68,7 @@ #include "util_uri.h" #include "fdqueue.h" #include "acceptlock.h" +#include "http_accept.h" #include #include @@ -82,6 +83,56 @@ /* Number of cross-process locks we're managing */ static int lock_count; +/* Intraprocess locking used by other serialization techniques */ +#ifdef NEED_INTRAPROCESS_SERIALIZED_ACCEPT +static pthread_mutex_t *intra_mutex = NULL; + +static void intra_mutex_cleanup(void *foo) +{ +int i; + +for (i = 0; i < lock_count; i++) { +(void) pthread_mutex_destroy(&intra_mutex[i]); +} +} + +static void intra_mutex_init(pool *p) +{ +int i; + +intra_mutex = (pthread_mutex_t *)ap_palloc(p, lock_count * sizeof(pthread_mutex_t )); +for (i = 0; i < lock_count; i++) { +if (pthread_mutex_init(&intra_mutex[i], NULL) != 0) { +perror("intra_mutex_init"); + clean_child_exit(APEXIT_CHILDFATAL); +} +} +ap_register_cleanup(p, NULL, intra_mutex_cleanup, ap_null_cleanup); +} + +static void intra_mutex_on(int locknum) +{ +if ((errno = pthread_mutex_lock(&intra_mutex[locknum])) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const server_rec *) ap_get_server_conf(), + "Error getting intraprocess lock. Exiting!"); +} +} + +static void intra_mutex_off(int locknum) +{ +if (pthread_mutex_unlock(&intra_mutex[locknum]) != 0) { +ap_log_error(APLOG_MARK, APLOG_EMERG, + (const server_rec *) ap_get_server_conf(), + "Error releasing intraprocess lock. Exitin
cvs commit: apache-apr/pthreads/src/main http_accept.c http_main.c
manoj 99/04/16 21:25:57 Modified:pthreads/src/include http_accept.h pthreads/src/main http_accept.c http_main.c Log: An attempt to put SINGLE_LISTEN_UNSERIALIZED_ACCEPT support back in. This also moves the SAFE_ACCEPT definition from http_accept.h to http_accept.c since it isn't (and shouldn't be) used in other files anymore. Revision ChangesPath 1.6 +0 -2 apache-apr/pthreads/src/include/http_accept.h Index: http_accept.h === RCS file: /home/cvs/apache-apr/pthreads/src/include/http_accept.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -u -r1.5 -r1.6 --- http_accept.h 1999/04/17 03:35:53 1.5 +++ http_accept.h 1999/04/17 04:25:55 1.6 @@ -65,8 +65,6 @@ #include "httpd.h" #include "ap_config.h" -#define SAFE_ACCEPT(stmt) do {stmt;} while(0) - /* The info each server thread needs to start correctly. */ typedef struct { 1.9 +16 -0 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.8 retrieving revision 1.9 diff -u -u -r1.8 -r1.9 --- http_accept.c 1999/04/17 01:58:58 1.8 +++ http_accept.c 1999/04/17 04:25:56 1.9 @@ -72,6 +72,15 @@ static int num_listenfds; #if defined (USE_ACCEPT_QUEUE) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +/* Each thread only listens to one socket in this model, so the starvation + * problem described in manual/misc/perf-tuning.html can't occur here */ +#define SAFE_ACCEPT(stmt) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* The queue of sockets we've accepted */ static FDQueue csd_queue; @@ -311,6 +320,13 @@ } #elif defined(USE_MULTI_ACCEPT) + +#ifdef SINGLE_LISTEN_UNSERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) do {if(ap_listeners->next != NULL) {stmt;}} while(0) +#else +#define SAFE_ACCEPT(stmt) do {stmt;} while(0) +#endif + /* * USE_MULTI_ACCEPT * Worker threads do the accept and process the request. 1.73 +0 -7 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.72 retrieving revision 1.73 diff -u -u -r1.72 -r1.73 --- http_main.c 1999/04/15 20:01:40 1.72 +++ http_main.c 1999/04/17 04:25:56 1.73 @@ -416,13 +416,6 @@ } } -/* On some architectures it's safe to do unserialized accept()s in the single - * Listen case. But it's never safe to do it in the case where there's - * multiple Listen statements. Define SINGLE_LISTEN_UNSERIALIZED_ACCEPT - * when it's safe in the single Listen case. We haven't defined this yet - * for the hybrid server. ZZZ - */ - static void usage(char *bin) { char pad[MAX_STRING_LEN];
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/04/16 22:10:19 Modified:pthreads/src/main http_main.c Log: Note in the scoreboard when a child process dies abnormally, so that a substitute can be started. Revision ChangesPath 1.74 +3 -3 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.73 retrieving revision 1.74 diff -u -u -r1.73 -r1.74 --- http_main.c 1999/04/17 04:25:56 1.73 +++ http_main.c 1999/04/17 05:10:18 1.74 @@ -2227,6 +2227,7 @@ int child_slot; ap_wait_t status; int pid; +int i; while (!restart_pending && !shutdown_pending) { pid = wait_or_timeout(&status); @@ -2234,9 +2235,8 @@ if (pid >= 0) { child_slot = find_child_by_pid(pid); if (child_slot >= 0) { -/*(void) ap_update_child_status(child_slot, SERVER_DEAD, - (request_rec *) NULL); - LOOK INTO THIS */ +for (i = 0; i < ap_threads_per_child + ap_acceptors_per_child; i++) +ap_update_child_status(child_slot, i, SERVER_DEAD, (request_rec *) NULL); if (remaining_children_to_start && child_slot < ap_daemons_limit) {
Re: cvs commit: apache-apr/pthreads/src/main util.c
[EMAIL PROTECTED] wrote: > > manoj 99/04/16 20:06:39 > > Modified:pthreads/src/main util.c > Log: > Optimize ap_gm_timestr_822, ap_make_dirstr_prefix, and ap_unescape_url. > > Revision ChangesPath > 1.4 +60 -15apache-apr/pthreads/src/main/util.c Why was this done on the -apr branch rather than the 1.3 branch? Doing stuff like this to -apr just makes the two diverge even more. I really don't see the need to do optimizations to the -apr branch (I view the branch as being a platform for threaded testing, rather than "mainline" apache development). Cheers, -g -- Greg Stein, http://www.lyra.org/
cvs commit: apache-1.3 STATUS
gstein 99/04/17 01:43:27 Modified:.STATUS Log: add note about Expat patch. Revision ChangesPath 1.682 +8 -1 apache-1.3/STATUS Index: STATUS === RCS file: /home/cvs/apache-1.3/STATUS,v retrieving revision 1.681 retrieving revision 1.682 diff -u -r1.681 -r1.682 --- STATUS1999/03/30 06:18:58 1.681 +++ STATUS1999/04/17 08:43:26 1.682 @@ -1,5 +1,5 @@ 1.3 STATUS: - Last modified at [$Date: 1999/03/30 06:18:58 $] + Last modified at [$Date: 1999/04/17 08:43:26 $] Release: @@ -162,6 +162,13 @@ This package contains modules for manipulating client request data via the Apache API with Perl and C. Status: http://www.pobox.com/~dougm/libapr-0.20_01.tar.gz + +* Greg's [PATCH] Expat as an option +Message-ID: <[EMAIL PROTECTED]> +Status: a few open issues remaining: 1) shift expat, regex, and +Ralf's MM stuff down to a new src/lib/ subdir. 2) exporting +Expat functions from httpd on Win32 and AIX for DSOs to use +(requires changes to the .def and .exp files). Needs patch:
cvs commit: apache-1.3/src/main util.c
coar99/04/17 09:09:26 Modified:src/main util.c Log: Fix an oversight in the string-termination procesing. Submitted by: Ken Parzygnat <[EMAIL PROTECTED]> Reviewed by: Bill Stoddard Revision ChangesPath 1.158 +4 -0 apache-1.3/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.157 retrieving revision 1.158 diff -u -r1.157 -r1.158 --- util.c1999/04/10 23:21:23 1.157 +++ util.c1999/04/17 16:09:25 1.158 @@ -1982,6 +1982,10 @@ *(bufout++) = (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2); } +if (nprbytes > 3) { +*(bufout++) = +(unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]); +} #else /*CHARSET_EBCDIC*/ bufin = (const unsigned char *) bufcoded; while (pr2six[os_toascii[(unsigned char)*(bufin++)]] <= 63);
cvs commit: apache-1.3/src/main util.c
martin 99/04/17 15:08:00 Modified:src/main util.c Log: Fix EBCDIC branch of ap_uudecode() which was broken by last commit. Revision ChangesPath 1.159 +4 -0 apache-1.3/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-1.3/src/main/util.c,v retrieving revision 1.158 retrieving revision 1.159 diff -u -r1.158 -r1.159 --- util.c1999/04/17 16:09:25 1.158 +++ util.c1999/04/17 22:07:59 1.159 @@ -2017,6 +2017,10 @@ *(bufout++) = os_toebcdic[ (unsigned char) (pr2six[os_toascii[bufin[1]]] << 4 | pr2six[os_toascii[bufin[2]]] >> 2)]; } +if (nprbytes > 3) { +*(bufout++) = os_toebcdic[ +(unsigned char) (pr2six[os_toascii[bufin[2]]] << 6 | pr2six[os_toascii[bufin[3]]])]; +} #endif /*CHARSET_EBCDIC*/ nbytesdecoded -= (4 - nprbytes) & 3;