cvs commit: apache-2.0/src/modules/experimental mod_mmap_static.c
manoj 99/08/31 14:37:10 Modified:src/modules/experimental mod_mmap_static.c Log: ap_{block,unblock}_alarms aren't needed anymore, so take them out. Revision ChangesPath 1.4 +0 -9 apache-2.0/src/modules/experimental/mod_mmap_static.c Index: mod_mmap_static.c === RCS file: /home/cvs/apache-2.0/src/modules/experimental/mod_mmap_static.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- mod_mmap_static.c 1999/08/31 05:33:15 1.3 +++ mod_mmap_static.c 1999/08/31 21:37:08 1.4 @@ -122,12 +122,6 @@ #include "http_request.h" #include "http_core.h" -/* XXX - ap_{block,unblock}_alarms aren't used right now, but they could - * be, so just #define them away for now */ - -#define ap_block_alarms() -#define ap_unblock_alarms() - module MODULE_VAR_EXPORT mmap_static_module; typedef struct { @@ -184,7 +178,6 @@ "mmap_static: %s isn't a regular file, skipping", filename); return NULL; } -ap_block_alarms(); fd = open(filename, O_RDONLY, 0); if (fd == -1) { ap_log_error(APLOG_MARK, APLOG_WARNING, cmd->server, @@ -195,7 +188,6 @@ if (mm == (caddr_t)-1) { int save_errno = errno; close(fd); - ap_unblock_alarms(); errno = save_errno; ap_log_error(APLOG_MARK, APLOG_WARNING, cmd->server, "mmap_static: unable to mmap %s, skipping", filename); @@ -211,7 +203,6 @@ /* first one, register the cleanup */ ap_register_cleanup(cmd->pool, sconf, cleanup_mmap, ap_null_cleanup); } -ap_unblock_alarms(); return NULL; }
cvs commit: apache-2.0 STATUS
manoj 99/08/31 14:46:37 Modified:.STATUS Log: "Our computers are down. We'll call you back tomorrow morning." Grumble. Revision ChangesPath 1.5 +4 -3 apache-2.0/STATUS Index: STATUS === RCS file: /home/cvs/apache-2.0/STATUS,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- STATUS1999/08/28 03:25:04 1.4 +++ STATUS1999/08/31 21:46:35 1.5 @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 1999/08/28 03:25:04 $] +Last modified at [$Date: 1999/08/31 21:46:35 $] Release: @@ -55,8 +55,9 @@ * Areas where APRFile is being used need to be cleaned-up -* mod_mmap_static hides ap_block_alarms() and ap_unblock_alarms() - This should really be done in some header file elsewhere. +* SIGSEGV on Linux seems to only kill a thread not a whole process; + we need to work around this, probably by bouncing the signal to + the sigwait thread. But this will hurt debugability. Other features that need writing:
cvs commit: apache-1.3/src/support htpasswd.c
manoj 99/08/31 21:12:27 Modified:src/support htpasswd.c Log: Require the batch (-b) option and default to MD5 on TPF. Submitted by: David McCreedy <[EMAIL PROTECTED]> and others at IBM Revision ChangesPath 1.36 +10 -0 apache-1.3/src/support/htpasswd.c Index: htpasswd.c === RCS file: /home/cvs/apache-1.3/src/support/htpasswd.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -u -r1.35 -r1.36 --- htpasswd.c1999/08/12 14:15:22 1.35 +++ htpasswd.c1999/09/01 04:12:22 1.36 @@ -170,6 +170,10 @@ pw = passwd; } else { +#ifdef TPF +fprintf(stderr, "Invalid entry. The -b option is required on TPF.\n"); +return usage(); +#else if (ap_getpass("New password: ", pwin, sizeof(pwin)) != 0) { ap_snprintf(record, (rlen - 1), "password too long (>%d)", sizeof(pwin) - 1); @@ -182,6 +186,7 @@ } pw = pwin; memset(pwv, '\0', sizeof(pwin)); +#endif /* TPF */ } switch (alg) { @@ -436,6 +441,11 @@ alg = ALG_APMD5; fprintf(stderr, "Automatically using MD5 format on Windows.\n"); } +#elif defined(TPF) +if (alg == ALG_CRYPT) { +alg = ALG_APMD5; +fprintf(stderr, "Automatically using MD5 format.\n"); + } #endif #if (!(defined(WIN32) || defined(TPF)))
cvs commit: apache-1.3/src/main rfc1413.c
manoj 99/08/31 21:21:17 Modified:src/main rfc1413.c Log: Add TPF processing support for the socket read. This allows RFC 1413 support to work properly on TPF. Submitted by: David McCreedy <[EMAIL PROTECTED]> and others at IBM Revision ChangesPath 1.30 +21 -6 apache-1.3/src/main/rfc1413.c Index: rfc1413.c === RCS file: /home/cvs/apache-1.3/src/main/rfc1413.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -u -r1.29 -r1.30 --- rfc1413.c 1999/07/30 14:06:56 1.29 +++ rfc1413.c 1999/09/01 04:21:17 1.30 @@ -100,6 +100,12 @@ static JMP_BUF timebuf; +/* ident_timeout - handle timeouts */ +static void ident_timeout(int sig) +{ +ap_longjmp(timebuf, sig); +} + /* bind_connect - bind both ends of a socket */ /* Ambarish fix this. Very broken */ static int get_rfc1413(int sock, const struct sockaddr_in *our_sin, @@ -178,6 +184,21 @@ */ while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) { int j; + +#ifdef TPF +/* + * socket read on TPF doesn't get interrupted by + * signals so additional processing is needed + */ +j = ap_set_callback_and_alarm(NULL, 0); +ap_set_callback_and_alarm(ident_timeout, j); +j = select(&sock, 1, 0, 0, j * 1000); +if (j < 1) { +ap_set_callback_and_alarm(NULL, 0); +ap_check_signals(); +return -1; +} +#endif /* TPF */ j = read(sock, buffer+i, (sizeof(buffer) - 1) - i); if (j < 0 && errno != EINTR) { ap_log_error(APLOG_MARK, APLOG_CRIT, srv, @@ -207,12 +228,6 @@ *cp = '\0'; return 0; -} - -/* ident_timeout - handle timeouts */ -static void ident_timeout(int sig) -{ -ap_longjmp(timebuf, sig); } /* rfc1413 - return remote user name, given socket structures */
cvs commit: apache-1.3/src/regex Makefile.tmpl main.c
manoj 99/08/31 21:29:10 Modified:htdocs/manual install-tpf.html readme-tpf.html src CHANGES src/ap ap_checkpass.c src/include ap_config.h http_log.h src/main http_log.c src/os/tpf os.c os.h src/os/tpf/samples linkdll.jcl loadset.jcl src/regex Makefile.tmpl main.c Log: More TPF-related changes. Among them: - Code reorganization to eliminate some TPF #ifdefs - Tweaks to the regex code for easier testing - Documentation and build updates - Notes in the CHANGES file Submitted by: David McCreedy <[EMAIL PROTECTED]> and others at IBM Revision ChangesPath 1.8 +156 -96 apache-1.3/htdocs/manual/install-tpf.html Index: install-tpf.html === RCS file: /home/cvs/apache-1.3/htdocs/manual/install-tpf.html,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- install-tpf.html 1999/08/02 05:03:35 1.7 +++ install-tpf.html 1999/09/01 04:28:51 1.8 @@ -9,7 +9,7 @@ Installing the Apache 1.3 HTTP Server on TPF -[ Setup +[ Download | Compilation | Installation | VisualAge ] @@ -25,54 +25,69 @@ htdocs/manual/readme-tpf.html for basic information on the port of Apache to TPF including required PUT level and supported functions & modules. - - -Setup - -Due to the use of EBCDIC on MVS OS/390 Open Edition -(later referred to simply as -"Open Edition"), we've found that the most reliable -method for loading Apache onto your system is to unzip and tar the distribution -file on your PC, and then copy the extracted files to Open Edition -via an NFS client -capable of transferring the data in EBCDIC format. - - -Before moving the distribution to an -Open Edition environment, verify that the NFS drive will transfer the -filenames with upper/lower case preserved. - - -Since Open Edition is not the ultimate destination of the files, -the only required files and subdirectories that need to be moved to -Open Edition -are in /src. - -WARNING: -If you are using a product such as WinZip on your PC, verify that -the "TAR File Smart CR/LF Conversion" option is NOT checked. -You can find this in WinZip under Options, Configuration. -This will save you lots of headaches later on. - - -WARNING: -Editing files on a PC before moving them to Open Edition may result -in the loss/addition of unprintable characters. Files of concern include shell -scripts and src/Configuration. The most common problems are with -tab characters -and CR/LF characters. Most editors will handle the CR/LF problem correctly -but none seem to handle tab characters. If you need to edit files, edit them -in a UNIX editor such as vi or emacs. - - +Download +Releases of the Apache server are compressed into a "tarball" file and stored on the Apache web site. +You will need to choose a version and download the corresponding tarball to your PC. +Additionally the source code from the tarball will need to be copied onto an MVS OS/390 Open Edition machine +(later referred to simply as "Open Edition") for compiling. +So here are all the details on how to get Apache and how to get it where it needs to be: + + http://www.apache.org/dist/";>Download + the gzipped Apache files (the "tarball") to your PC. + The file name on the web site will be something like apache_1.3.x.tar.gz. + TIP: Be sure to keep the .tar.gz extension + when choosing the name of the PC file. + + Decompress the tarball on your PC using WinZip or some other PC decompression tool. + TIP: If you are using WinZip verify that the +"TAR File Smart CR/LF Conversion" option (under Options, Configuration) is NOT checked. +This is what you can expect if you use WinZip: + + open the tarball with WinZip (this can usually be done simply by double-clicking + on the downloaded tarball) + you will be told that the archive contains one file (such as apache_1.3.x.tar) - + allow WinZip to decompress it to a temporary folder + extract the archived files onto your PC - + you'll be using files from the conf, htdocs, and icons directories later in the install phase + + + FTP the tarball to your Open Edition machine using binary mode: + + activate FTP in an MSDOS window: ftp your.open.edition.machine.com + sign in + set mode to binary: binary + send the file to Open Edition: + send c:\downloaded_filename.tar.gz open_edition_filename.t
cvs commit: apache-2.0/src/modules/mpm/dexter Makefile.tmpl
manoj 99/09/05 20:11:36 Modified:src/modules/mpm/dexter Makefile.tmpl Log: Update dependencies to account for APR changes to date. Revision ChangesPath 1.3 +28 -20apache-2.0/src/modules/mpm/dexter/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/Makefile.tmpl,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- Makefile.tmpl 1999/08/27 22:16:16 1.2 +++ Makefile.tmpl 1999/09/06 03:11:33 1.3 @@ -59,27 +59,35 @@ $(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 $(INCDIR)/alloc.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h \ - $(INCDIR)/ap.h $(INCDIR)/apr.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ - $(INCDIR)/ap_hooks.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 acceptlock.h dexter.h \ - $(OSDIR)/unixd.h + $(INCDIR)/hsregex.h ../../../lib/apr/include/apr_general.h \ + ../../../lib/apr/include/apr_config.h \ + ../../../lib/apr/include/apr_errno.h \ + ../../../lib/apr/include/apr_lib.h \ + ../../../lib/apr/include/apr_file_io.h \ + ../../../lib/apr/include/hsregex.h $(INCDIR)/buff.h \ + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ + $(INCDIR)/apr.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.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 \ + acceptlock.h dexter.h $(OSDIR)/unixd.h dexter.o: dexter.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 $(INCDIR)/alloc.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h \ - $(INCDIR)/ap.h $(INCDIR)/apr.h \ - $(INCDIR)/util_uri.h $(INCDIR)/http_main.h \ - $(INCDIR)/http_log.h $(INCDIR)/http_config.h \ - $(INCDIR)/ap_hooks.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_connection.h $(INCDIR)/ap_mpm.h \ - $(OSDIR)/unixd.h $(OSDIR)/iol_socket.h \ - $(INCDIR)/ap_listen.h mpm_default.h acceptlock.h \ - dexter.h mpm_default.h + $(INCDIR)/hsregex.h ../../../lib/apr/include/apr_general.h \ + ../../../lib/apr/include/apr_config.h \ + ../../../lib/apr/include/apr_errno.h \ + ../../../lib/apr/include/apr_lib.h \ + ../../../lib/apr/include/apr_file_io.h \ + ../../../lib/apr/include/hsregex.h $(INCDIR)/buff.h \ + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ + $(INCDIR)/apr.h $(INCDIR)/util_uri.h \ + $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ + $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ + $(INCDIR)/http_core.h $(INCDIR)/http_connection.h \ + $(INCDIR)/ap_mpm.h $(OSDIR)/unixd.h \ + $(OSDIR)/iol_socket.h $(INCDIR)/ap_listen.h \ + acceptlock.h mpm_default.h dexter.h
cvs commit: apache-2.0/src/lib/apr/inc apr_pools.h
manoj 99/09/05 20:23:44 Modified:src/include ap_config.h src/lib/apr/inc apr_pools.h Log: The closesocket define causes problems on BeOS. Get rid of it where appropriate. Submitted by: In part by David Reid <[EMAIL PROTECTED]> Revision ChangesPath 1.7 +0 -1 apache-2.0/src/include/ap_config.h Index: ap_config.h === RCS file: /home/cvs/apache-2.0/src/include/ap_config.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- ap_config.h 1999/08/31 05:32:16 1.6 +++ ap_config.h 1999/09/06 03:23:39 1.7 @@ -1068,7 +1068,6 @@ #include #include #include -#define closesocket(s) close(s) #ifndef O_BINARY #define O_BINARY (0) #endif 1.4 +4 -0 apache-2.0/src/lib/apr/inc/apr_pools.h Index: apr_pools.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/inc/apr_pools.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- apr_pools.h 1999/08/31 05:32:31 1.3 +++ apr_pools.h 1999/09/06 03:23:44 1.4 @@ -232,7 +232,11 @@ #define ap_fdopen(d,m) fdopen((d), (m)) #endif +/* XXX - the socket functions for pools should (and will) use APR sockets. + * This is temporary. */ +#ifndef BEOS /* this really screws up BeOS R4.5 !! */ #define closesocket(s) close(s) +#endif
cvs commit: apache-1.3/src/include ap_config.h
manoj 99/09/07 12:58:21 Modified:src CHANGES src/include ap_config.h Log: Allow BeOS to use its native closesocket() call Submitted by: David Reid <[EMAIL PROTECTED]> Revision ChangesPath 1.1428+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1427 retrieving revision 1.1428 diff -u -d -u -r1.1427 -r1.1428 --- CHANGES 1999/09/01 04:28:56 1.1427 +++ CHANGES 1999/09/07 19:58:14 1.1428 @@ -1,5 +1,8 @@ Changes with Apache 1.3.10 + *) Allow BeOS to use its native closesocket() call + [David Reid <[EMAIL PROTECTED]>] + *) More TPF changes. Code reorganization for cleanliness, regex changes for testing, as well as doc and build updates. [David McCreedy <[EMAIL PROTECTED]> and others at IBM] 1.269 +2 -0 apache-1.3/src/include/ap_config.h Index: ap_config.h === RCS file: /home/cvs/apache-1.3/src/include/ap_config.h,v retrieving revision 1.268 retrieving revision 1.269 diff -u -d -u -r1.268 -r1.269 --- ap_config.h 1999/09/01 04:29:01 1.268 +++ ap_config.h 1999/09/07 19:58:20 1.269 @@ -1059,7 +1059,9 @@ #include #include #include +#ifndef BEOS #define closesocket(s) close(s) +#endif #ifndef O_BINARY #define O_BINARY (0) #endif
cvs commit: apache-2.0/src Configuration.mpm
manoj 99/09/07 13:30:10 Modified:src Configuration.mpm Log: Note the presence of dexter. Revision ChangesPath 1.16 +1 -0 apache-2.0/src/Configuration.mpm Index: Configuration.mpm === RCS file: /home/cvs/apache-2.0/src/Configuration.mpm,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -u -r1.15 -r1.16 --- Configuration.mpm 1999/08/31 05:31:57 1.15 +++ Configuration.mpm 1999/09/07 20:30:07 1.16 @@ -25,6 +25,7 @@ Rule WANTHSREGEX=yes #Rule MPM_METHOD=prefork Rule MPM_METHOD=mpmt_pthread +#Rule MPM_METHOD=dexter # # AddModule modules/experimental/mod_mmap_static.o AddModule modules/standard/mod_env.o
cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c
manoj 99/09/08 11:58:50 Modified:src/modules/mpm/dexter acceptlock.c dexter.c Log: Update dexter to work with the latest APR changes Revision ChangesPath 1.6 +4 -2 apache-2.0/src/modules/mpm/dexter/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- acceptlock.c 1999/08/31 21:34:05 1.5 +++ acceptlock.c 1999/09/08 18:58:46 1.6 @@ -488,6 +488,7 @@ { int i; char * lock_fname; +ap_file_t *tempfile; lock_count = number_of_locks; lock_fd = (int *)ap_palloc(p, lock_count * sizeof(int *)); @@ -505,8 +506,9 @@ init_lock_fname(p); for (i = 0; i < lock_count; i++) { lock_fname = expand_lock_fname(p, i); - lock_fd[i] = ap_popenf(p, lock_fname, -O_CREAT | O_WRONLY | O_EXCL, 0644); +ap_open(p, lock_fname, APR_CREATE | APR_WRITE | APR_EXCL, +APR_UREAD | APR_UWRITE | APR_GREAD | APR_WREAD, &tempfile); +ap_get_os_file(tempfile, &lock_fd[i]); if (lock_fd[i] == -1) { perror("open"); fprintf(stderr, "Cannot open lock file: %s\n", lock_fname); 1.36 +20 -10apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.35 retrieving revision 1.36 diff -u -d -u -r1.35 -r1.36 --- dexter.c 1999/08/31 21:34:05 1.35 +++ dexter.c 1999/09/08 18:58:46 1.36 @@ -57,6 +57,7 @@ #define CORE_PRIVATE +#include "apr_portable.h" #include "httpd.h" #include "http_main.h" #include "http_log.h" @@ -845,16 +846,16 @@ static void *worker_thread(void *arg) { struct sockaddr sa_client; -int csd = -1; +ap_socket_t *csd = NULL; ap_context_t *tpool; /* Pool for this thread */ ap_context_t *ptrans;/* Pool for per-transaction stuff */ -int sd = -1; +ap_socket_t *sd = NULL; int srv; int curr_pollfd, last_pollfd = 0; -NET_SIZE_T len = sizeof(struct sockaddr); int thread_just_started = 1; int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; +int native_socket; pthread_mutex_lock(&thread_pool_create_mutex); ap_create_context(thread_pool_parent, NULL, &tpool); @@ -908,7 +909,7 @@ } if (num_listenfds == 1) { -sd = ap_listeners->fd; +sd = ap_listeners->sd; goto got_fd; } else { @@ -922,7 +923,7 @@ /* XXX: Should we check for POLLERR? */ if (listenfds[curr_pollfd].revents & POLLIN) { last_pollfd = curr_pollfd; -sd = listenfds[curr_pollfd].fd; +ap_put_os_sock(tpool, &sd, &listenfds[curr_pollfd].fd); goto got_fd; } } while (curr_pollfd != last_pollfd); @@ -930,7 +931,7 @@ } got_fd: if (!workers_may_exit) { -csd = ap_accept(sd, &sa_client, &len); +ap_accept(sd, &csd); SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); pthread_mutex_lock(&idle_thread_count_mutex); @@ -951,7 +952,8 @@ pthread_mutex_unlock(&idle_thread_count_mutex); break; } -process_socket(ptrans, &sa_client, csd, conn_id); +ap_get_os_sock(csd, &native_socket); +process_socket(ptrans, &sa_client, native_socket, conn_id); ap_clear_pool(ptrans); requests_this_child--; } @@ -1009,7 +1011,7 @@ listenfds[0].events = POLLIN; listenfds[0].revents = 0; for (lr = ap_listeners, i = 1; i <= num_listenfds; lr = lr->next, ++i) { -listenfds[i].fd = lr->fd; +ap_get_os_sock(lr->sd, &listenfds[i].fd); listenfds[i].events = POLLIN; /* should we add POLLPRI ?*/ listenfds[i].revents = 0; } @@ -1261,6 +1263,14 @@ } } +static ap_status_t cleanup_fd(void *fdptr) +{ +if (close(*((int *) fdptr)) < 0) { +return APR_EBADF; +} +return APR_SUCCESS; +} + int ap_mpm_run(ap_context_t *_pconf, ap_context_t *plog, server_rec *s) { int remaining_children_to_start; @@ -12
cvs commit: apache-apr/pthreads/src/main http_main.c
manoj 99/09/17 16:26:54 Modified:pthreads/src/main http_main.c Log: Instead of blocking all signals in child_main, we were unblocking them; this fixes that. Reported by Dave Colasurdo <[EMAIL PROTECTED]>. Revision ChangesPath 1.98 +1 -1 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.97 retrieving revision 1.98 diff -u -d -u -r1.97 -r1.98 --- http_main.c 1999/08/19 20:52:35 1.97 +++ http_main.c 1999/09/17 23:26:52 1.98 @@ -1864,7 +1864,7 @@ /*done with init critical section */ /* All threads should mask signals out, accoring to sigwait(2) man page */ -sigemptyset(&sig_mask); +sigfillset(&sig_mask); if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask");
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/09/17 16:32:14 Modified:src/modules/mpm/dexter dexter.c src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Instead of blocking all signals in child_main, we were unblocking them; this fixes that. Reported by Dave Colasurdo <[EMAIL PROTECTED]>. Revision ChangesPath 1.38 +1 -1 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.37 retrieving revision 1.38 diff -u -d -u -r1.37 -r1.38 --- dexter.c 1999/09/14 13:37:41 1.37 +++ dexter.c 1999/09/17 23:32:10 1.38 @@ -997,7 +997,7 @@ /*done with init critical section */ /* All threads should mask signals out, accoring to sigwait(2) man page */ -sigemptyset(&sig_mask); +sigfillset(&sig_mask); if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask"); 1.33 +1 -1 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.32 retrieving revision 1.33 diff -u -d -u -r1.32 -r1.33 --- mpmt_pthread.c1999/09/14 13:37:42 1.32 +++ mpmt_pthread.c1999/09/17 23:32:11 1.33 @@ -935,7 +935,7 @@ /*done with init critical section */ /* All threads should mask signals out, accoring to sigwait(2) man page */ -sigemptyset(&sig_mask); +sigfillset(&sig_mask); if (pthread_sigmask(SIG_SETMASK, &sig_mask, NULL) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf, "pthread_sigmask");
cvs commit: apache-1.3/src/main http_main.c
manoj 99/09/20 13:34:44 Modified:src CHANGES src/main http_main.c Log: Add some compile-time flags to the output when -V is used for TPF Submitted by: David McCreedy <[EMAIL PROTECTED]> Revision ChangesPath 1.1432+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1431 retrieving revision 1.1432 diff -u -d -u -r1.1431 -r1.1432 --- CHANGES 1999/09/19 21:28:35 1.1431 +++ CHANGES 1999/09/20 20:34:30 1.1432 @@ -1,5 +1,8 @@ Changes with Apache 1.3.10 + *) Add some compile-time flags to the output when -V is used for TPF + [David McCreedy <[EMAIL PROTECTED]>] + *) mod_auth_digest fixes: - Use unix-io instead of stdio to read /dev/random (fixes problems on FreeBSD) 1.476 +6 -0 apache-1.3/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.475 retrieving revision 1.476 diff -u -d -u -r1.475 -r1.476 --- http_main.c 1999/09/07 20:47:23 1.475 +++ http_main.c 1999/09/20 20:34:37 1.476 @@ -3496,6 +3496,12 @@ #ifdef USE_SHMGET_SCOREBOARD printf(" -D USE_SHMGET_SCOREBOARD\n"); #endif +#ifdef USE_TPF_SCOREBOARD +printf(" -D USE_TPF_SCOREBOARD\n"); +#endif +#ifdef USE_TPF_DAEMON +printf(" -D USE_TPF_DAEMON\n"); +#endif #ifdef USE_OS2_SCOREBOARD printf(" -D USE_OS2_SCOREBOARD\n"); #endif
cvs commit: apache-1.3/src/os/tpf/samples linkdll.jcl
manoj 99/09/20 13:47:19 Modified:src CHANGES src/main http_main.c src/os/tpf os.h src/os/tpf/samples linkdll.jcl Log: Update for the next release of the TPF OS (PUT11) Submitted by: David McCreedy <[EMAIL PROTECTED]> Revision ChangesPath 1.1433+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1432 retrieving revision 1.1433 diff -u -d -u -r1.1432 -r1.1433 --- CHANGES 1999/09/20 20:34:30 1.1432 +++ CHANGES 1999/09/20 20:46:47 1.1433 @@ -1,5 +1,8 @@ Changes with Apache 1.3.10 + *) Update for the next release of the TPF OS (PUT11) + [David McCreedy <[EMAIL PROTECTED]>] + *) Add some compile-time flags to the output when -V is used for TPF [David McCreedy <[EMAIL PROTECTED]>] 1.477 +12 -12apache-1.3/src/main/http_main.c Index: http_main.c === RCS file: /home/cvs/apache-1.3/src/main/http_main.c,v retrieving revision 1.476 retrieving revision 1.477 diff -u -d -u -r1.476 -r1.477 --- http_main.c 1999/09/20 20:34:37 1.476 +++ http_main.c 1999/09/20 20:46:59 1.477 @@ -4711,9 +4711,9 @@ #endif #ifdef TPF -APACHE_TPF_INPUT input_parms; +EBW_AREA input_parms; ecbptr()->ebrout = PRIMECRAS; -input_parms = * (APACHE_TPF_INPUT *)(&(ecbptr()->ebw000)); +input_parms = * (EBW_AREA *)(&(ecbptr()->ebw000)); #endif MONCONTROL(0); @@ -4778,7 +4778,7 @@ break; #ifdef TPF case 'x': - os_tpf_child(&input_parms); + os_tpf_child(&input_parms.child); set_signals(); break; #endif @@ -4838,7 +4838,8 @@ #else if (ap_standalone) { if(!tpf_child) { -memcpy(tpf_server_name, input_parms.inetd_server.servname, INETD_SERVNAME_LENGTH); +memcpy(tpf_server_name, input_parms.parent.servname, + INETD_SERVNAME_LENGTH); tpf_server_name[INETD_SERVNAME_LENGTH+1] = '\0'; ap_open_logs(server_conf, pconf); } @@ -4847,15 +4848,16 @@ version_locked++; if(tpf_child) { copy_listeners(pconf); -reset_tpf_listeners(&input_parms); +reset_tpf_listeners(&input_parms.child); server_conf->error_log = NULL; #ifdef SCOREBOARD_FILE -scoreboard_fd = input_parms.scoreboard_fd; +scoreboard_fd = input_parms.child.scoreboard_fd; ap_scoreboard_image = &_scoreboard_image; #else /* must be USE_TPF_SCOREBOARD or USE_SHMGET_SCOREBOARD */ -ap_scoreboard_image = (scoreboard *)input_parms.scoreboard_heap; +ap_scoreboard_image = +(scoreboard *)input_parms.child.scoreboard_heap; #endif -child_main(input_parms.slot); +child_main(input_parms.child.slot); } else STANDALONE_MAIN(argc, argv); @@ -4902,10 +4904,8 @@ } #ifdef TPF -/* TPF only passes the incoming socket number from the internet daemon - in ebw000 */ -sock_in = * (int*)(&(ecbptr()->ebw000)); -sock_out = * (int*)(&(ecbptr()->ebw000)); +/* TPF's Internet Daemon passes the incoming socket nbr (inetd mode only) */ +sock_in = sock_out = input_parms.parent.socket; /* TPF also needs a signal set for alarm in inetd mode */ signal(SIGALRM, alrm_handler); #elif defined(MPE) 1.10 +6 -4 apache-1.3/src/os/tpf/os.h Index: os.h === RCS file: /home/cvs/apache-1.3/src/os/tpf/os.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- os.h 1999/09/01 04:29:05 1.9 +++ os.h 1999/09/20 20:47:08 1.10 @@ -92,8 +92,7 @@ }TPF_FD_LIST; #include -struct apache_input { -INETD_SERVER_INPUT inetd_server; +typedef struct apache_input { void*scoreboard_heap; /* scoreboard system heap address */ int scoreboard_fd; /* scoreboard file descriptor */ int slot; /* child number */ @@ -102,9 +101,12 @@ time_t restart_time; TPF_FD_LIST *tpf_fds; /* fd inheritance table ptr */ void*shm_static_ptr;/* shm ptr for static pages */ -}; +}APACHE_TPF_INPUT; -typedef struct apache_input APACHE_TPF_INPUT; +typedef union ebw_area { +INETD_SERVER_INPUT parent; +APACHE_TPF_INPUT child; +}
cvs commit: apache-2.0/src/lib/apr/lib apr_pools.c
manoj 99/09/20 14:51:09 Modified:src/lib/apr/lib apr_pools.c Log: Put back the regex_cleanup that was taken out by accident Revision ChangesPath 1.10 +1 -2 apache-2.0/src/lib/apr/lib/apr_pools.c Index: apr_pools.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- apr_pools.c 1999/09/12 10:52:17 1.9 +++ apr_pools.c 1999/09/20 21:51:06 1.10 @@ -1199,8 +1199,7 @@ return NULL; } -/*ap_register_cleanup(p, (void *) preg, regex_cleanup, regex_cleanup);*/ -ap_register_cleanup(p, (void *) preg, ap_null_cleanup, ap_null_cleanup); +ap_register_cleanup(p, (void *) preg, regex_cleanup, regex_cleanup); return preg; }
cvs commit: apache-2.0/src/main util.c
manoj 99/09/20 15:18:53 Modified:src/include httpd.h src/lib/apr/include apr_lib.h src/lib/apr/lib apr_pools.c src/main util.c Log: Move ap_pregcomp and ap_pregfree from APR to Apache proper, since these functions depend on Apache's regex libraries. This also should fix compilation on platforms not using hsregex. Revision ChangesPath 1.9 +3 -0 apache-2.0/src/include/httpd.h Index: httpd.h === RCS file: /home/cvs/apache-2.0/src/include/httpd.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- httpd.h 1999/09/08 14:15:40 1.8 +++ httpd.h 1999/09/20 22:18:43 1.9 @@ -962,6 +962,9 @@ char *ap_double_quotes(ap_context_t *p, char *str); #endif +API_EXPORT(regex_t *) ap_pregcomp(ap_context_t *p, const char *pattern, +int cflags); +API_EXPORT(void) ap_pregfree(ap_context_t *p, regex_t *reg); API_EXPORT(int)ap_regexec(const regex_t *preg, const char *string, size_t nmatch, regmatch_t pmatch[], int eflags); API_EXPORT(size_t) ap_regerror(int errcode, const regex_t *preg, 1.9 +0 -4 apache-2.0/src/lib/apr/include/apr_lib.h Index: apr_lib.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_lib.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- apr_lib.h 1999/09/12 10:52:16 1.8 +++ apr_lib.h 1999/09/20 22:18:46 1.9 @@ -76,7 +76,6 @@ #include "../file_io/win32/readdir.h" /* definition of DIR for WIN32 */ #include "apr_win.h" #endif -#include "hsregex.h" #ifdef HAVE_STDARG_H #include #endif @@ -372,9 +371,6 @@ API_EXPORT(ap_status_t) ap_getpass(const char *prompt, char *pwbuf, size_t *bufsize); API_EXPORT_NONSTD(ap_status_t) ap_null_cleanup(void *data); -API_EXPORT(regex_t *) ap_pregcomp(ap_context_t *p, const char *pattern, -int cflags); -API_EXPORT(void) ap_pregfree(ap_context_t *p, regex_t *reg); /*API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, pid_t pid, enum kill_conditions how); */ 1.11 +0 -37 apache-2.0/src/lib/apr/lib/apr_pools.c Index: apr_pools.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- apr_pools.c 1999/09/20 21:51:06 1.10 +++ apr_pools.c 1999/09/20 22:18:49 1.11 @@ -1176,43 +1176,6 @@ return APR_SUCCESS; } -/* - * Here's a pool-based interface to POSIX regex's regcomp(). - * Note that we return regex_t instead of being passed one. - * The reason is that if you use an already-used regex_t structure, - * the memory that you've already allocated gets forgotten, and - * regfree() doesn't clear it. So we don't allow it. - */ - -static ap_status_t regex_cleanup(void *preg) -{ -regfree((regex_t *) preg); -return APR_SUCCESS; -} - -API_EXPORT(regex_t *) ap_pregcomp(ap_context_t *p, const char *pattern, -int cflags) -{ -regex_t *preg = ap_palloc(p, sizeof(regex_t)); - -if (regcomp(preg, pattern, cflags)) { - return NULL; -} - -ap_register_cleanup(p, (void *) preg, regex_cleanup, regex_cleanup); - -return preg; -} - - -API_EXPORT(void) ap_pregfree(ap_context_t *p, regex_t * reg) -{ -ap_block_alarms(); -regfree(reg); -ap_kill_cleanup(p, (void *) reg, regex_cleanup); -ap_unblock_alarms(); -} - /* * * More grotty system stuff... subprocesses. Frump. These don't use 1.8 +36 -0 apache-2.0/src/main/util.c Index: util.c === RCS file: /home/cvs/apache-2.0/src/main/util.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- util.c1999/09/08 14:15:44 1.7 +++ util.c1999/09/20 22:18:51 1.8 @@ -348,6 +348,42 @@ return 0; } +/* + * Here's a pool-based interface to POSIX regex's regcomp(). + * Note that we return regex_t instead of being passed one. + * The reason is that if you use an already-used regex_t structure, + * the memory that you've already allocated gets forgotten, and + * regfree() doesn't clear it. So we don't allow it. + */ + +static ap_status_t regex_cleanup(void *preg) +{ +regfree((regex_t *) preg); +
cvs commit: apache-2.0/src/lib/apr/locks/unix locks.h
manoj 99/09/20 16:14:20 Modified:src/lib/apr/locks/unix locks.h Log: USE_FCNTL_SERIALIZE requires fcntl.h on Solaris, but it doesn't need sys/file.h. Untested on Solaris, but APR compiles on Linux with both USE_FCNTL_SERIALIZE and USE_FLOCK_SERIALIZE. Revision ChangesPath 1.3 +4 -1 apache-2.0/src/lib/apr/locks/unix/locks.h Index: locks.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- locks.h 1999/09/12 11:06:25 1.2 +++ locks.h 1999/09/20 23:14:18 1.3 @@ -65,9 +65,12 @@ #include #include #include -#elif defined (USE_FLOCK_SERIALIZE) || (USE_FCNTL_SERIALIZE) +#elif defined (USE_FLOCK_SERIALIZE) #include #include +#elif defined (USE_FCNTL_SERIALIZE) +#include +#include #endif #include
cvs commit: apache-2.0/src/lib/apr/time/unix Makefile.in
manoj 99/09/23 11:19:09 Modified:src/lib/apr/file_io/unix Makefile.in src/lib/apr/lib Makefile.in src/lib/apr/locks/unix Makefile.in src/lib/apr/misc/unix Makefile.in src/lib/apr/network_io/unix Makefile.in src/lib/apr/threadproc/unix Makefile.in src/lib/apr/time/unix Makefile.in Removed: src/lib/apr/include hsregex.h Log: Remove the vestigial hsregex.h from APR, and update dependencies. Revision ChangesPath 1.5 +8 -14 apache-2.0/src/lib/apr/file_io/unix/Makefile.in Index: Makefile.in === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/Makefile.in,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- Makefile.in 1999/08/27 16:25:35 1.4 +++ Makefile.in 1999/09/23 18:19:02 1.5 @@ -60,18 +60,15 @@ dir.o: dir.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ ../../include/apr_file_io.h ../../include/apr_lib.h \ - ../../include/hsregex.h ../../include/apr_portable.h \ - ../../include/apr_thread_proc.h ../../include/apr_win.h \ - ../../include/apr_network_io.h ../../include/apr_lock.h \ - ../../include/apr_time.h + ../../include/apr_portable.h ../../include/apr_thread_proc.h \ + ../../include/apr_win.h ../../include/apr_network_io.h \ + ../../include/apr_lock.h ../../include/apr_time.h fileacc.o: fileacc.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ - ../../include/apr_file_io.h ../../include/apr_lib.h \ - ../../include/hsregex.h + ../../include/apr_file_io.h ../../include/apr_lib.h filedup.o: filedup.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ - ../../include/apr_file_io.h ../../include/apr_lib.h \ - ../../include/hsregex.h + ../../include/apr_file_io.h ../../include/apr_lib.h filestat.o: filestat.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ ../../include/apr_file_io.h @@ -80,16 +77,13 @@ ../../include/apr_file_io.h ../../include/apr_portable.h \ ../../include/apr_thread_proc.h ../../include/apr_win.h \ ../../include/apr_network_io.h ../../include/apr_lock.h \ - ../../include/apr_time.h ../../include/apr_lib.h \ - ../../include/hsregex.h + ../../include/apr_time.h ../../include/apr_lib.h pipe.o: pipe.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ - ../../include/apr_file_io.h ../../include/apr_lib.h \ - ../../include/hsregex.h + ../../include/apr_file_io.h ../../include/apr_lib.h readwrite.o: readwrite.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ - ../../include/apr_file_io.h ../../include/apr_lib.h \ - ../../include/hsregex.h + ../../include/apr_file_io.h ../../include/apr_lib.h seek.o: seek.c fileio.h ../../include/apr_general.h \ ../../include/apr_config.h ../../include/apr_errno.h \ ../../include/apr_file_io.h 1.4 +8 -10 apache-2.0/src/lib/apr/lib/Makefile.in Index: Makefile.in === RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/Makefile.in,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- Makefile.in 1999/08/18 20:18:50 1.3 +++ Makefile.in 1999/09/23 18:19:03 1.4 @@ -65,25 +65,23 @@ apr_execve.o: apr_execve.c ../include/apr_config.h apr_fnmatch.o: apr_fnmatch.c ../include/apr_config.h \ $(INCDIR)/apr_fnmatch.h ../include/apr_lib.h ../include/apr_general.h \ - ../include/apr_errno.h ../include/apr_file_io.h ../include/hsregex.h + ../include/apr_errno.h ../include/apr_file_io.h apr_getpass.o: apr_getpass.c ../include/apr_config.h \ - ../include/apr_errno.h ../include/apr_lib.h ../include/apr_general.h \ - ../include/apr_file_io.h ../include/hsregex.h + ../include/apr_lib.h ../include/apr_general.h ../include/apr_errno.h \ + ../include/apr_file_io.h apr_md5.o: apr_md5.c ../include/apr_config.h ../include/apr_md5.h \ ../include/apr_lib.h ../include/apr_general.h ../include/apr_errno.h \ - ../include/apr_file_io.h ../include/hsregex.h + ../include/apr_file_io.h apr_pools.o: apr_pools.c ../include/apr_config.h \ ../include/apr_general.h ../include/apr_errno.h $(INCDIR)/apr_pools.h \ - ../include/apr_lib.h ../include/apr_file_io.h ../include/hsregex.h \ - ../misc/unix/misc.h + ../include/apr_lib.h ../include/apr_file_io.h ../misc/unix/misc.h apr_signal.o: apr_signal.c ../include/apr_config.h \ ../include/apr_lib.h ../include/apr_general.h ../include/apr_errno.h \ - ../include/apr_file_io.h ../include/hsregex.h + ../include
cvs commit: apache-2.0/src/os/unix Makefile.tmpl
manoj 99/09/23 12:08:23 Modified:src Makefile.tmpl src/ap Makefile.tmpl src/main Makefile.tmpl src/modules/mpm/dexter Makefile.tmpl src/modules/mpm/mpmt_pthread Makefile.tmpl src/modules/mpm/prefork Makefile.tmpl src/modules/standard Makefile.tmpl src/os/os2 Makefile.tmpl src/os/unix Makefile.tmpl Log: Catch more dependencies on APR's old hsregex.h. Revision ChangesPath 1.8 +2 -2 apache-2.0/src/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- Makefile.tmpl 1999/09/11 20:42:19 1.7 +++ Makefile.tmpl 1999/09/23 19:07:53 1.8 @@ -129,13 +129,13 @@ include/ap_ctype.h include/httpd.h lib/apr/include/apr_general.h \ lib/apr/include/apr_config.h lib/apr/include/apr_errno.h \ lib/apr/include/apr_lib.h lib/apr/include/apr_file_io.h \ - lib/apr/include/hsregex.h include/buff.h include/ap_iol.h \ + include/buff.h include/ap_iol.h \ include/ap.h include/apr.h include/util_uri.h modules.o: modules.c include/httpd.h include/ap_config.h \ include/ap_mmn.h include/ap_config_auto.h os/unix/os.h \ os/unix/os-inline.c include/ap_ctype.h lib/apr/include/apr_general.h \ lib/apr/include/apr_config.h lib/apr/include/apr_errno.h \ lib/apr/include/apr_lib.h lib/apr/include/apr_file_io.h \ - lib/apr/include/hsregex.h include/buff.h include/ap_iol.h \ + include/buff.h include/ap_iol.h \ include/ap.h include/apr.h include/util_uri.h include/http_config.h \ include/ap_hooks.h 1.6 +6 -6 apache-2.0/src/ap/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/ap/Makefile.tmpl,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- Makefile.tmpl 1999/09/10 14:34:41 1.5 +++ Makefile.tmpl 1999/09/23 19:07:56 1.6 @@ -51,7 +51,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h ap_execve.o: ap_execve.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ @@ -59,7 +59,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h ap_fnmatch.o: ap_fnmatch.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ @@ -73,7 +73,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h $(INCDIR)/ap_hooks.h ap_md5c.o: ap_md5c.c $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ @@ -89,7 +89,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h ap_slack.o: ap_slack.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ @@ -97,7 +97,7 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ $(INCDIR)/apr.h $(INCDIR)/util_uri.h $(INCDIR)/http_log.h ap_snprintf.o: ap_snprintf.c $(INCDIR)/httpd.h $(INCDIR)/ap_config.h \ @@ -105,6 +105,6 @@ $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h ../lib/apr/include/hsregex.h \ + ../lib/apr/include/apr_file_io.h \ $(INCDIR)/buff.h $(I
cvs commit: apache-2.0/src/lib/apr/include apr_network_io.h
manoj 99/09/24 14:50:52 Modified:src/lib/apr/include apr_network_io.h Log: APR_ANYADDR was defined to be "APR_ANYADDR", but when it was stored and retrieved from a socket, it would show up as "0.0.0.0". This changes the definition of APR_ANYADDR to "0.0.0.0" to be consistent (and help fix Apache restarts). Revision ChangesPath 1.7 +1 -1 apache-2.0/src/lib/apr/include/apr_network_io.h Index: apr_network_io.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/include/apr_network_io.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- apr_network_io.h 1999/09/18 11:48:14 1.6 +++ apr_network_io.h 1999/09/24 21:50:51 1.7 @@ -77,7 +77,7 @@ #endif #ifndef APR_ANYADDR -#define APR_ANYADDR "ANY_IPADDR" +#define APR_ANYADDR "0.0.0.0" #endif /* Socket option definitions */
cvs commit: apache-2.0/src/main listen.c
manoj 99/09/24 15:01:23 Modified:src/include ap_listen.h src/main listen.c Log: Restarts were hosed after the APR changes because we were opening sockets even when we had them open already. So, for now, add an "active" flag that indicates whether the socket stored in the listen_rec is an actual open socket yet. Revision ChangesPath 1.6 +1 -0 apache-2.0/src/include/ap_listen.h Index: ap_listen.h === RCS file: /home/cvs/apache-2.0/src/include/ap_listen.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- ap_listen.h 1999/09/08 14:15:40 1.5 +++ ap_listen.h 1999/09/24 22:01:17 1.6 @@ -64,6 +64,7 @@ struct ap_listen_rec { ap_listen_rec *next; ap_socket_t *sd; +int active; /* more stuff here, like which protocol is bound to the port */ }; 1.9 +13 -3 apache-2.0/src/main/listen.c Index: listen.c === RCS file: /home/cvs/apache-2.0/src/main/listen.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- listen.c 1999/09/18 11:48:17 1.8 +++ listen.c 1999/09/24 22:01:21 1.9 @@ -134,6 +134,7 @@ } server->sd = s; +server->active = 1; return APR_SUCCESS; } @@ -144,6 +145,7 @@ for (lr = ap_listeners; lr; lr = lr->next) { ap_close_socket(lr->sd); + lr->active = 0; } return APR_SUCCESS; } @@ -171,7 +173,9 @@ } /* this has to survive restarts */ +/* XXX - We need to deal with freeing this structure properly. */ new = malloc(sizeof(ap_listen_rec)); +new->active = 0; if (ap_create_tcp_socket(NULL, &new->sd) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, NULL, "make_sock: failed to get a socket for %s", addr); @@ -189,7 +193,7 @@ ap_listen_rec *lr; ap_listen_rec *next; int num_open; -ap_status_t stat; + /* allocate a default listener if necessary */ if (ap_listeners == NULL) { alloc_listener(APR_ANYADDR, port ? port : DEFAULT_HTTP_PORT); @@ -197,15 +201,21 @@ num_open = 0; for (lr = ap_listeners; lr; lr = lr->next) { - stat = make_sock(pconf, lr); - if (stat == APR_SUCCESS) { + if (lr->active) { ++num_open; } + else { + if (make_sock(pconf, lr) == APR_SUCCESS) { + ++num_open; + lr->active = 1; + } + } } /* close the old listeners */ for (lr = old_listeners; lr; lr = next) { ap_close_socket(lr->sd); + lr->active = 0; next = lr->next; /* free(lr);*/ }
cvs commit: apache-2.0/src/modules/mpm/prefork prefork.c
manoj 99/10/07 15:23:57 Modified:src/modules/mpm/prefork prefork.c Log: Make prefork's setup_listeners looks like the others'. Revision ChangesPath 1.40 +2 -2 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -u -r1.39 -r1.40 --- prefork.c 1999/10/07 20:48:18 1.39 +++ prefork.c 1999/10/07 22:23:54 1.40 @@ -2530,7 +2530,7 @@ } -static int setup_listeners(ap_context_t *p, server_rec *s) +static int setup_listeners(server_rec *s) { ap_listen_rec *lr; int sockdes; @@ -2568,7 +2568,7 @@ ap_log_pid(pconf, ap_pid_fname); -if (setup_listeners(pconf, s)) { +if (setup_listeners(s)) { /* XXX: hey, what's the right way for the mpm to indicate a fatal error? */ return 1; }
cvs commit: apache-2.0/src/lib/apr/network_io/unix networkio.h sockets.c sockopt.c
manoj 99/10/08 12:44:36 Modified:src/lib/apr/network_io/unix networkio.h sockets.c sockopt.c Log: Every accept() was resulting in a reverse name lookup. This eliminates it. Revision ChangesPath 1.5 +0 -1 apache-2.0/src/lib/apr/network_io/unix/networkio.h Index: networkio.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/networkio.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- networkio.h 1999/10/01 16:18:34 1.4 +++ networkio.h 1999/10/08 19:44:30 1.5 @@ -65,7 +65,6 @@ struct socket_t { ap_context_t *cntxt; int socketdes; -char *remote_hostname; struct sockaddr_in *addr; size_t addr_len; int timeout; 1.12 +0 -10 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- sockets.c 1999/10/04 16:37:13 1.11 +++ sockets.c 1999/10/08 19:44:31 1.12 @@ -100,7 +100,6 @@ } (*new)->socketdes = socket(AF_INET ,SOCK_STREAM, IPPROTO_TCP); -(*new)->remote_hostname = NULL; (*new)->addr->sin_family = AF_INET; @@ -252,8 +251,6 @@ */ ap_status_t ap_accept(struct socket_t **new, const struct socket_t *sock) { -struct hostent *hptr; - (*new) = (struct socket_t *)ap_palloc(sock->cntxt, sizeof(struct socket_t)); @@ -269,12 +266,6 @@ return errno; } -hptr = gethostbyaddr((char *)&(*new)->addr->sin_addr, - sizeof(struct in_addr), AF_INET); -if (hptr != NULL) { -(*new)->remote_hostname = strdup(hptr->h_name); -} - ap_register_cleanup((*new)->cntxt, (void *)(*new), socket_cleanup, NULL); return APR_SUCCESS; @@ -316,7 +307,6 @@ return errno; } else { -sock->remote_hostname = strdup(hostname); return APR_SUCCESS; } } 1.6 +14 -4 apache-2.0/src/lib/apr/network_io/unix/sockopt.c Index: sockopt.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockopt.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- sockopt.c 1999/10/04 16:37:13 1.5 +++ sockopt.c 1999/10/08 19:44:32 1.6 @@ -64,6 +64,8 @@ #include #include #include +#include +#include static ap_status_t soblock(int sd) { @@ -201,11 +203,19 @@ */ ap_status_t ap_get_remote_hostname(char **name, struct socket_t *sock) { -(*name) = ap_pstrdup(sock->cntxt, sock->remote_hostname); -if (*name) { -return APR_SUCCESS; +struct hostent *hptr; + +hptr = gethostbyaddr((char *)&(sock->addr->sin_addr), + sizeof(struct in_addr), AF_INET); +if (hptr != NULL) { +*name = ap_pstrdup(sock->cntxt, hptr->h_name); +if (*name) { +return APR_SUCCESS; +} +return APR_ENOMEM; } -return APR_ENOMEM; + +return errno; }
cvs commit: apache-2.0/src/lib/apr/network_io/win32 networkio.h sockets.c sockopt.c
manoj 99/10/08 14:28:48 Modified:src/lib/apr/network_io/beos networkio.h sockets.c sockopt.c src/lib/apr/network_io/os2 networkio.h sockets.c sockopt.c src/lib/apr/network_io/unix sockopt.c src/lib/apr/network_io/win32 networkio.h sockets.c sockopt.c Log: Get rid of the per-connection name lookup on non-Unix platforms. This also adds an attempt at correct error handling for gethostbyaddr() for all platforms. Non-Unix maintainers should check to make sure this is done right. Revision ChangesPath 1.3 +0 -1 apache-2.0/src/lib/apr/network_io/beos/networkio.h Index: networkio.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/networkio.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- networkio.h 1999/10/02 23:11:36 1.2 +++ networkio.h 1999/10/08 21:27:37 1.3 @@ -71,7 +71,6 @@ struct socket_t { ap_context_t *cntxt; int socketdes; -char *remote_hostname; struct sockaddr_in * addr; int addr_len; int timeout; 1.6 +0 -10 apache-2.0/src/lib/apr/network_io/beos/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/sockets.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- sockets.c 1999/10/08 20:04:15 1.5 +++ sockets.c 1999/10/08 21:27:39 1.6 @@ -90,7 +90,6 @@ } (*new)->socketdes = socket(AF_INET ,SOCK_STREAM, 0); - (*new)->remote_hostname=NULL; (*new)->addr->sin_family = AF_INET; (*new)->addr_len = sizeof(*(*new)->addr); memset(&(*new)->addr->sin_zero, 0, sizeof((*new)->addr->sin_zero)); @@ -172,8 +171,6 @@ ap_status_t ap_accept(struct socket_t **new, const struct socket_t *sock) { - struct hostent *hptr; - (*new) = (struct socket_t *)ap_palloc(sock->cntxt, sizeof(ap_socket_t)); @@ -189,12 +186,6 @@ return errno; } - hptr = gethostbyaddr((char*)&(*new)->addr->sin_addr, - sizeof(struct in_addr), AF_INET); - if (hptr != NULL){ - (*new)->remote_hostname = strdup(hptr->h_name); - } - ap_register_cleanup((*new)->cntxt, (void *)new, socket_cleanup, NULL); return APR_SUCCESS; @@ -222,7 +213,6 @@ return errno; } -sock->remote_hostname = strdup(hostname); return APR_SUCCESS; } 1.4 +14 -4 apache-2.0/src/lib/apr/network_io/beos/sockopt.c Index: sockopt.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/sockopt.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- sockopt.c 1999/10/04 16:37:06 1.3 +++ sockopt.c 1999/10/08 21:27:41 1.4 @@ -58,6 +58,7 @@ #include #include #include +#include #include "networkio.h" #include "apr_network_io.h" #include "apr_general.h" @@ -102,9 +103,18 @@ ap_status_t ap_get_remote_hostname(char **name, struct socket_t *sock) { -(*name) = (char*)ap_pstrdup(sock->cntxt, sock->remote_hostname); -if (*name) { -return APR_SUCCESS; +struct hostent *hptr; + +hptr = gethostbyaddr((char *)&(sock->addr->sin_addr), + sizeof(struct in_addr), AF_INET); +if (hptr != NULL) { +*name = ap_pstrdup(sock->cntxt, hptr->h_name); +if (*name) { +return APR_SUCCESS; + } +return APR_ENOMEM; } -return APR_ENOMEM; + +/* XXX - Is this threadsafe? - manoj */ +return h_errno; } 1.2 +0 -1 apache-2.0/src/lib/apr/network_io/os2/networkio.h Index: networkio.h === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/os2/networkio.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- networkio.h 1999/08/17 15:59:43 1.1 +++ networkio.h 1999/10/08 21:27:52 1.2 @@ -62,7 +62,6 @@ struct socket_t { ap_context_t *cntxt; int socketdes; -char *remote_hostname; struct sockaddr_in *addr; int addr_len; }; 1.3 +0 -10 apache-2.0/src/lib/apr/network_io/os2/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/
cvs commit: apache-site/contributors index.html
manoj 99/10/08 19:50:06 Modified:contributors index.html Log: Add myself and other new HTTP Server Project members to the page. New members without previous content should add stuff. Revision ChangesPath 1.75 +31 -8 apache-site/contributors/index.html Index: index.html === RCS file: /home/cvs/apache-site/contributors/index.html,v retrieving revision 1.74 retrieving revision 1.75 diff -u -d -u -r1.74 -r1.75 --- index.html1999/09/08 17:03:32 1.74 +++ index.html1999/10/09 02:50:05 1.75 @@ -18,10 +18,10 @@ This page exists to recognize the efforts and contributions of the -core individuals in the Apache project. +core individuals in the Apache HTTP Server Project. -Current Apache Group in alphabetical order as of 14 February 1999: +Current Apache HTTP Server Group in alphabetical order as of 8 October 1999: @@ -31,6 +31,9 @@ Brian Behlendorf Various, focusing on infrastructure for development. + Ryan Bloom + APR and initial work to hybridize Apache.. + Ken Coar HTML pedant, FAQ editor, UI perfectionist, bugdb script hacker @@ -47,17 +50,23 @@ Roy T. Fielding Standards Cop. + Tony Finch + Dean Gaudet Performance freak. Rob Hartill general trouble maker, comments to offend all. + Brian Havard + Ben Hyde Jim Jagielski Porter and general hacks. + Manoj Kasichainula + Alexei Kosut Martin Kraemer @@ -66,6 +75,9 @@ Ben Laurie SCO and QNX porting, Apache-SSL author, pedant. + Rasmus Lerdorf + mod_info, mod_php, mod_php3 + Doug MacEachern @@ -74,12 +86,18 @@ Sameer Parekh + Daniel Lopez Ridruejo + + Wilfredo Sanchez + Cliff Skolnick Solaris porting. Marc Slemko Security, networking issues + Greg Stein + Bill Stoddard @@ -109,9 +127,6 @@ Other major contributors: - Ryan Bloom - APR and initial work to hybridize Apache.. - Howard Fear SSI extensions. @@ -124,9 +139,6 @@ Kevin Hughes Creator of all those nifty icons - Rasmus Lerdorf - mod_info, mod_php, mod_php3 - Brandon Long and Beth Frank NCSA Server Development Team, post-1.3 @@ -334,6 +346,17 @@ General porter, coder and trouble maker. Plays "devil's advocate" a bit too often :-) + +Name: Manoj Kasichainula +Email: mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED] +URL: http://www.io.com/~manojk/";>http://www.io.com/~manojk/ +Organization: IBM Corporation +Occupation: Software Engineer +Location: Raleigh, NC, USA +OS Expertise: Linux, various Unixes +Contributions: Initial pthread hybrid server work, +Dexter MPM, 2.0 status API, other 2.0 stuff, arguing with Ryan +Comments: I am the one responsible for killing children with a pipe.
cvs commit: apache-2.0/src Configure
manoj 99/10/09 13:28:41 Modified:src Configure Log: Make Configure run autoheader in the APR directory. Revision ChangesPath 1.9 +1 -1 apache-2.0/src/Configure Index: Configure === RCS file: /home/cvs/apache-2.0/src/Configure,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- Configure 1999/10/01 16:22:48 1.8 +++ Configure 1999/10/09 20:28:40 1.9 @@ -1727,7 +1727,7 @@ if [ -d ./lib/apr ]; then if [ ! -f ./lib/apr/configure ]; then echo " + bootstrapping Apache Portable Runtime (APR)" -(cd lib/apr && autoconf) +(cd lib/apr && autoconf && autoheader) fi echo " + configuring Apache Portable Runtime (APR)" cd lib/apr
cvs commit: apache-2.0/src/modules/standard mod_cgi.c
manoj 99/10/11 21:06:59 Modified:src/modules/standard mod_cgi.c Log: Fix function arguments to respect APR's New World Order. Revision ChangesPath 1.7 +3 -3 apache-2.0/src/modules/standard/mod_cgi.c Index: mod_cgi.c === RCS file: /home/cvs/apache-2.0/src/modules/standard/mod_cgi.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- mod_cgi.c 1999/10/11 20:44:28 1.6 +++ mod_cgi.c 1999/10/12 04:06:58 1.7 @@ -380,8 +380,8 @@ exit(0); } -rc = ap_create_process(&procnew, child_context, r->filename, args, - env, procattr); +rc = ap_create_process(&procnew, r->filename, args, + env, procattr, child_context); if (rc != APR_SUCCESS) { /* Bad things happened. Everyone should have cleaned up. */ @@ -394,7 +394,7 @@ * stages. ap_note_subprocess and free_proc need to be redone * to make use of ap_proc_t instead of pid. */ -ap_get_os_proc(procnew, &fred); +ap_get_os_proc(&fred, procnew); ap_note_subprocess(child_context, fred, kill_after_timeout); #endif if (script_in) {
cvs commit: apache-2.0/src/lib/apr/locks/unix intraproc.c
manoj 99/10/11 22:54:02 Modified:src/lib/apr/locks/unix intraproc.c Log: Fix compilation warnings, and probably some bugs in the process. Revision ChangesPath 1.2 +9 -7 apache-2.0/src/lib/apr/locks/unix/intraproc.c Index: intraproc.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/intraproc.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- intraproc.c 1999/08/17 15:59:42 1.1 +++ intraproc.c 1999/10/12 05:54:00 1.2 @@ -55,15 +55,17 @@ #include "apr_lock.h" #include "apr_general.h" +#include "apr_lib.h" #include "locks.h" #if defined (USE_PTHREAD_SERIALIZE) -ap_status_t lock_intra_cleanup(struct lock_t *lock) +ap_status_t lock_intra_cleanup(void *data) { ap_status_t stat; +struct lock_t *lock = (struct lock_t *) data; if (lock->curr_locked == 1) { -if (stat = pthread_mutex_unlock(lock->intraproc)) { +if ((stat = pthread_mutex_unlock(lock->intraproc)) == 0) { return stat; } } @@ -95,7 +97,7 @@ return stat; } -new->curr_locked == 0; +new->curr_locked = 0; ap_register_cleanup(new->cntxt, (void *)new, lock_intra_cleanup, NULL); return APR_SUCCESS; } @@ -104,8 +106,8 @@ { ap_status_t stat; -lock->curr_locked == 1; -if (stat = pthread_mutex_lock(lock->intraproc)) { +lock->curr_locked = 1; +if ((stat = pthread_mutex_lock(lock->intraproc)) == 0) { return stat; } return APR_SUCCESS; @@ -115,10 +117,10 @@ { ap_status_t stat; -if (stat = pthread_mutex_unlock(lock->intraproc)) { +if ((stat = pthread_mutex_unlock(lock->intraproc)) == 0) { return stat; } -lock->curr_locked == 0; +lock->curr_locked = 0; return APR_SUCCESS; }
cvs commit: apache-2.0/src/modules/mpm/winnt winnt.c
manoj 99/10/11 23:14:47 Modified:src/lib/apr/file_io/os2 filedup.c open.c pipe.c src/lib/apr/file_io/unix dir.c filedup.c open.c src/lib/apr/file_io/win32 dir.c filedup.c src/lib/apr/locks/beos crossproc.c intraproc.c src/lib/apr/locks/unix crossproc.c intraproc.c src/lib/apr/misc/win32 start.c src/modules/mpm/winnt winnt.c Log: Make sure to use ap_null_cleanup instead of NULL when setting an empty child_cleanup. Revision ChangesPath 1.3 +2 -1 apache-2.0/src/lib/apr/file_io/os2/filedup.c Index: filedup.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/filedup.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -u -r1.2 -r1.3 --- filedup.c 1999/10/04 16:36:47 1.2 +++ filedup.c 1999/10/12 06:14:40 1.3 @@ -83,6 +83,7 @@ dup_file->status = old_file->status; dup_file->isopen = old_file->isopen; *new_file = dup_file; -ap_register_cleanup(dup_file->cntxt, dup_file, file_cleanup, NULL); +ap_register_cleanup(dup_file->cntxt, dup_file, file_cleanup, +ap_null_cleanup); return APR_SUCCESS; } 1.5 +1 -1 apache-2.0/src/lib/apr/file_io/os2/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/open.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- open.c1999/10/11 14:51:22 1.4 +++ open.c1999/10/12 06:14:40 1.5 @@ -128,7 +128,7 @@ dafile->isopen = TRUE; dafile->fname = ap_pstrdup(cntxt, fname); -ap_register_cleanup(dafile->cntxt, dafile, file_cleanup, NULL); +ap_register_cleanup(dafile->cntxt, dafile, file_cleanup, ap_null_cleanup); return APR_SUCCESS; } 1.4 +2 -2 apache-2.0/src/lib/apr/file_io/os2/pipe.c Index: pipe.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/pipe.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- pipe.c1999/10/06 23:03:44 1.3 +++ pipe.c1999/10/12 06:14:41 1.4 @@ -75,14 +75,14 @@ (*in)->filedes = filedes[0]; (*in)->fname = ap_pstrdup(cont, "PIPE"); (*in)->isopen = TRUE; -ap_register_cleanup(cont, *in, file_cleanup, NULL); +ap_register_cleanup(cont, *in, file_cleanup, ap_null_cleanup); (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); (*out)->cntxt = cont; (*out)->filedes = filedes[1]; (*out)->fname = ap_pstrdup(cont, "PIPE"); (*out)->isopen = TRUE; -ap_register_cleanup(cont, *out, file_cleanup, NULL); +ap_register_cleanup(cont, *out, file_cleanup, ap_null_cleanup); return APR_SUCCESS; } 1.8 +2 -1 apache-2.0/src/lib/apr/file_io/unix/dir.c Index: dir.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- dir.c 1999/10/06 23:03:46 1.7 +++ dir.c 1999/10/12 06:14:42 1.8 @@ -94,7 +94,8 @@ return errno; } else { -ap_register_cleanup((*new)->cntxt, (void *)(*new), dir_cleanup, NULL); +ap_register_cleanup((*new)->cntxt, (void *)(*new), dir_cleanup, + ap_null_cleanup); return APR_SUCCESS; } } 1.4 +2 -1 apache-2.0/src/lib/apr/file_io/unix/filedup.c Index: filedup.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/filedup.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- filedup.c 1999/10/04 16:36:50 1.3 +++ filedup.c 1999/10/12 06:14:42 1.4 @@ -104,7 +104,8 @@ (*new_file)->atime = old_file->atime; (*new_file)->mtime = old_file->mtime; (*new_file)->ctime = old_file->ctime; -ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup, NULL); +ap_register_cleanup((*new_file)->cntxt, (void *)(*new_file), file_cleanup, +ap_null_cleanup); return APR_SUCCESS; } 1.15 +2 -1 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u
cvs commit: apache-2.0/src/main http_protocol.c
manoj 99/10/12 13:37:05 Modified:src/main http_protocol.c Log: Attempt to make ap_send_fb work again. This is untested, but it works better than the old version because it compiles. Revision ChangesPath 1.20 +28 -71apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -u -r1.19 -r1.20 --- http_protocol.c 1999/10/11 22:07:25 1.19 +++ http_protocol.c 1999/10/12 20:36:56 1.20 @@ -2056,9 +2056,6 @@ return total_bytes_sent; } - -/* TODO: reimplement ap_send_fb */ -#if 0 /* * Send the body of a response to the client. */ @@ -2071,82 +2068,46 @@ { char buf[IOBUFSIZE]; long total_bytes_sent = 0; -register int n, w, o, len, fd; -struct pollfd fds; +long zero_timeout = 0; +int n, w, rc, o; -if (length == 0) +if (length == 0) { return 0; - -/* Make fb unbuffered and non-blocking */ -ap_bsetflag(fb, B_RD, 0); -fd = ap_bfileno(fb, B_RD); -ap_bnonblock(fd); -#ifdef CHECK_FD_SETSIZE -if (fd >= FD_SETSIZE) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_WARNING, NULL, - "send body: filedescriptor (%u) larger than FD_SETSIZE (%u) " - "found, you probably need to rebuild Apache with a " - "larger FD_SETSIZE", fd, FD_SETSIZE); - return 0; } -#endif -fds.fd = fd; -fds.events = POLLIN; +/* This function tries to as much as possible through non-blocking + * reads so that it can do writes while waiting for the CGI to + * produce more data. This way, the CGI's output gets to the client + * as soon as possible */ +ap_bsetopt(fb, BO_TIMEOUT, &zero_timeout); while (!ap_is_aborted(r->connection)) { -#ifdef NDELAY_PIPE_RETURNS_ZERO - /* Contributed by [EMAIL PROTECTED] for UTS 2.1.2, where the fcntl */ - /* O_NDELAY flag causes read to return 0 when there's nothing */ - /* available when reading from a pipe. That makes it tricky */ - /* to detect end-of-file :-(. This stupid bug is even documented */ - /* in the read(2) man page where it says that everything but */ - /* pipes return -1 and EAGAIN. That makes it a feature, right? */ - int afterselect = 0; -#endif -if ((length > 0) && (total_bytes_sent + IOBUFSIZE) > length) -len = length - total_bytes_sent; -else -len = IOBUFSIZE; - -do { -n = ap_bread(fb, buf, len); -#ifdef NDELAY_PIPE_RETURNS_ZERO - if ((n > 0) || (n == 0 && afterselect)) - break; -#else -if (n >= 0) -break; -#endif -if (ap_is_aborted(r->connection)) +n = ap_bread(fb, buf, sizeof(buf)); +if (n <= 0) { +if (n == 0) { +(void) ap_rflush(r); break; -if (n < 0 && errno != EAGAIN /* ZZZ rethink for threaded impl */) +} +if (n == -1 && errno != EAGAIN) { +r->connection->aborted = 1; break; +} +/* next read will block, so flush the client now */ +rc = ap_bflush(r->connection->client); -/* we need to block, so flush the output first */ -if (ap_bflush(r->connection->client) < 0) { -ap_log_rerror(APLOG_MARK, APLOG_INFO, r, -"client stopped connection before send body completed"); -ap_bsetflag(r->connection->client, B_EOUT, 1); +ap_bsetopt(fb, BO_TIMEOUT, &r->server->timeout); +n = ap_bread(fb, buf, sizeof(buf)); +if (n <= 0) { +if (n == 0) { +(void) ap_rflush(r); +} r->connection->aborted = 1; break; } -/* - * we don't care what poll says, we might as well loop back - * around and try another read - */ - /* use AP funcs */ -poll(&fds, 1, -1); -#ifdef NDELAY_PIPE_RETURNS_ZERO - afterselect = 1; -#endif -} while (!ap_is_aborted(r->connection)); - -if (n < 1 || ap_is_aborted(r->connection)) { -break; +ap_bsetopt(fb, BO_TIMEOUT, &zero_timeout); } + o = 0; - while (n && !ap_is_aborted(r->connection)) {
cvs commit: apache-2.0/src/main http_protocol.c
manoj 99/10/12 13:39:03 Modified:src/main http_protocol.c Log: Eliminate a warning. Revision ChangesPath 1.21 +1 -1 apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -u -r1.20 -r1.21 --- http_protocol.c 1999/10/12 20:36:56 1.20 +++ http_protocol.c 1999/10/12 20:38:58 1.21 @@ -2008,7 +2008,7 @@ { char buf[IOBUFSIZE]; long total_bytes_sent = 0; -register w, o; +register int w, o; int n; ap_status_t status;
cvs commit: apache-1.3/src/os/unix os.c
manoj 99/10/12 19:38:21 Modified:src CHANGES src/os/unix os.c Log: Support DSOs properly on 32-bit HP-UX 11.0 Submitted by: Dilip Khandekar <[EMAIL PROTECTED]> Revision ChangesPath 1.1437+3 -0 apache-1.3/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-1.3/src/CHANGES,v retrieving revision 1.1436 retrieving revision 1.1437 diff -u -d -u -r1.1436 -r1.1437 --- CHANGES 1999/10/11 21:33:30 1.1436 +++ CHANGES 1999/10/13 02:38:18 1.1437 @@ -1,5 +1,8 @@ Changes with Apache 1.3.10 + *) Support DSOs properly on 32-bit HP-UX 11.0 + [Dilip Khandekar <[EMAIL PROTECTED]>] + *) Fix problem with proxy configuration where globally set configuration options were overridden inside virtual hosts. [Graham Leggett <[EMAIL PROTECTED]>] 1.18 +4 -4 apache-1.3/src/os/unix/os.c Index: os.c === RCS file: /home/cvs/apache-1.3/src/os/unix/os.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -u -r1.17 -r1.18 --- os.c 1999/08/09 07:38:48 1.17 +++ os.c 1999/10/13 02:38:20 1.18 @@ -97,7 +97,7 @@ void *ap_os_dso_load(const char *path) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_t handle; handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L); return (void *)handle; @@ -120,7 +120,7 @@ void ap_os_dso_unload(void *handle) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_unload((shl_t)handle); #elif defined(HAVE_DYLD) @@ -135,7 +135,7 @@ void *ap_os_dso_sym(void *handle, const char *symname) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) void *symaddr = NULL; int status; @@ -171,7 +171,7 @@ const char *ap_os_dso_error(void) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) return strerror(errno); #elif defined(HAVE_DYLD) return NULL;
cvs commit: apache-2.0/src/os/unix os.c
manoj 99/10/12 19:41:09 Modified:src CHANGES src/os/unix os.c Log: Support DSOs properly on 32-bit HP-UX 11.0 Submitted by: Dilip Khandekar <[EMAIL PROTECTED]> Revision ChangesPath 1.11 +3 -0 apache-2.0/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- CHANGES 1999/09/27 07:56:27 1.10 +++ CHANGES 1999/10/13 02:41:06 1.11 @@ -1,5 +1,8 @@ Changes with Apache 2.0-dev + *) Support DSOs properly on 32-bit HP-UX 11.0 + [Dilip Khandekar <[EMAIL PROTECTED]>] + *) Updated MM in APR source tree from version 1.0.8 to 1.0.11 [Ralf S. Engelschall] 1.4 +4 -4 apache-2.0/src/os/unix/os.c Index: os.c === RCS file: /home/cvs/apache-2.0/src/os/unix/os.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- os.c 1999/08/31 12:33:08 1.3 +++ os.c 1999/10/13 02:41:08 1.4 @@ -97,7 +97,7 @@ void *ap_os_dso_load(const char *path) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_t handle; handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L); return (void *)handle; @@ -120,7 +120,7 @@ void ap_os_dso_unload(void *handle) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_unload((shl_t)handle); #elif defined(HAVE_DYLD) @@ -135,7 +135,7 @@ void *ap_os_dso_sym(void *handle, const char *symname) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) void *symaddr = NULL; int status; @@ -171,7 +171,7 @@ const char *ap_os_dso_error(void) { -#if defined(HPUX) || defined(HPUX10) +#if defined(HPUX) || defined(HPUX10) || defined(HPUX11) return strerror(errno); #elif defined(HAVE_DYLD) return NULL;
cvs commit: apache-2.0/src/modules/standard mod_status.c
manoj 99/10/12 22:24:17 Modified:.STATUS src/main http_connection.c http_protocol.c src/modules/mpm/dexter Makefile.tmpl dexter.c src/modules/standard mod_status.c Added: src/include mpm_status.h src/modules/mpm/dexter scoreboard.c scoreboard.h Log: Add a connection status table to replace the old function of the scoreboard. It allows MPMs to implement their own mechanism for the status table and allows any module to add its own per-connection status entries. Revision ChangesPath 1.6 +5 -7 apache-2.0/STATUS Index: STATUS === RCS file: /home/cvs/apache-2.0/STATUS,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- STATUS1999/08/31 21:46:35 1.5 +++ STATUS1999/10/13 05:24:11 1.6 @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 1999/08/31 21:46:35 $] +Last modified at [$Date: 1999/10/13 05:24:11 $] Release: @@ -15,12 +15,6 @@ * CGI doesn't work Status: Ben Laurie is working on this. -* mod_status doesn't work - Status: Manoj Kasichainula <[EMAIL PROTECTED]> is working on this. A -patch has been posted that starts to fix this: -(<[EMAIL PROTECTED]> and -<[EMAIL PROTECTED]>) - * suEXEC doesn't work Ben Laurie's work to fix CGIs will also fix this. @@ -43,6 +37,10 @@ * Use APR to get rid of more platform dependancies. Status: Ryan Bloom <[EMAIL PROTECTED]> is working on this. + +* The connection status table is not very efficient. Also, very few stats + are exported to the connection status table (easy to fix), and mod_status + is ugly. Other bugs that need fixing: 1.1 apache-2.0/src/include/mpm_status.h Index: mpm_status.h === /* * Copyright (c) 1995-1999 The Apache Group. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * * 1. Redistributions of source code must retain the above copyright *notice, this list of conditions and the following disclaimer. * * 2. Redistributions in binary form must reproduce the above copyright *notice, this list of conditions and the following disclaimer in *the documentation and/or other materials provided with the *distribution. * * 3. All advertising materials mentioning features or use of this *software must display the following acknowledgment: *"This product includes software developed by the Apache Group *for use in the Apache HTTP server project (http://www.apache.org/)." * * 4. The names "Apache Server" and "Apache Group" must not be used to *endorse or promote products derived from this software without *prior written permission. For written permission, please contact *[EMAIL PROTECTED] * * 5. Products derived from this software may not be called "Apache" *nor may "Apache" appear in their names without prior written *permission of the Apache Group. * * 6. Redistributions of any form whatsoever must retain the following *acknowledgment: *"This product includes software developed by the Apache Group *for use in the Apache HTTP server project (http://www.apache.org/)." * * THIS SOFTWARE IS PROVIDED BY THE APACHE GROUP ``AS IS'' AND ANY * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE APACHE GROUP OR * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED * OF THE POSSIBILITY OF SUCH DAMAGE. * * * This software consists of voluntary contributions made by many * individuals on behalf of the Apache Group and was originally based * on public domain software written at the National Center for * Supercomputing Applications, University of Illinois, U
cvs commit: apache-2.0/src/modules/mpm/winnt winnt.c
manoj 99/10/13 11:16:52 Modified:src/modules/mpm/mpmt_beos scoreboard.c src/modules/mpm/mpmt_pthread scoreboard.c src/modules/mpm/prefork prefork.c src/modules/mpm/spmt_os2 spmt_os2.c src/modules/mpm/winnt winnt.c Log: My connection status patch broke all the MPMs that didn't have connection status support yet. For now, throw in stub functions so that the server compiles. Revision ChangesPath 1.2 +14 -0 apache-2.0/src/modules/mpm/mpmt_beos/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_beos/scoreboard.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- scoreboard.c 1999/10/08 19:02:36 1.1 +++ scoreboard.c 1999/10/13 18:16:40 1.2 @@ -180,3 +180,17 @@ } put_scoreboard_info(child_num, thread_num, ss); } + +/* Stub functions until this MPM supports the connection status API */ + +API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \ + const char *value) +{ +/* NOP */ +} + +API_EXPORT(void) ap_reset_connection_status(long conn_id) +{ +/* NOP */ +} + 1.7 +14 -0 apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/scoreboard.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- scoreboard.c 1999/10/06 23:04:13 1.6 +++ scoreboard.c 1999/10/13 18:16:42 1.7 @@ -661,3 +661,17 @@ } put_scoreboard_info(child_num, thread_num, ss); } + +/* Stub functions until this MPM supports the connection status API */ + +API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \ + const char *value) +{ +/* NOP */ +} + +API_EXPORT(void) ap_reset_connection_status(long conn_id) +{ +/* NOP */ +} + 1.43 +12 -0 apache-2.0/src/modules/mpm/prefork/prefork.c Index: prefork.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/prefork/prefork.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -u -r1.42 -r1.43 --- prefork.c 1999/10/11 22:39:44 1.42 +++ prefork.c 1999/10/13 18:16:45 1.43 @@ -2968,6 +2968,18 @@ free(mtx); } +/* Stub functions until this MPM supports the connection status API */ + +API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \ + const char *value) +{ +/* NOP */ +} + +API_EXPORT(void) ap_reset_connection_status(long conn_id) +{ +/* NOP */ +} static const command_rec prefork_cmds[] = { UNIX_DAEMON_COMMANDS 1.14 +12 -0 apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c Index: spmt_os2.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/spmt_os2/spmt_os2.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- spmt_os2.c1999/10/11 22:39:45 1.13 +++ spmt_os2.c1999/10/13 18:16:48 1.14 @@ -1771,6 +1771,18 @@ free(mtx); } +/* Stub functions until this MPM supports the connection status API */ + +API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \ + const char *value) +{ +/* NOP */ +} + +API_EXPORT(void) ap_reset_connection_status(long conn_id) +{ +/* NOP */ +} static const command_rec spmt_os2_cmds[] = { LISTEN_COMMANDS 1.22 +13 -0 apache-2.0/src/modules/mpm/winnt/winnt.c Index: winnt.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/winnt/winnt.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -u -r1.21 -r1.22 --- winnt.c 1999/10/12 06:14:46 1.21 +++ winnt.c 1999/10/13 18:16:50 1.22 @@ -1731,6 +1731,19 @@ return NULL; } +/* Stub functions until this MPM supports the connection status API */ + +API_EXPORT(void) ap_update_connection_status(long conn_id, const char *key, \ + const char *value) +{ +/* NOP */ +} + +API_EXPORT(void) ap_reset_connection_status(long conn_id) +{ +/* NOP */ +} + static const command_rec winnt_cmds[] = { LISTEN_COMMANDS { "PidFile", set_pidfile, NULL, RSRC_CONF, TAKE1,
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c scoreboard.c scoreboard.h
manoj 99/10/13 13:14:58 Modified:src/modules/mpm/dexter dexter.c scoreboard.c scoreboard.h Log: Add a config directive to Dexter to not maintain any connection status, similarly to what ExtendedStatus did in 1.3. It's not perfect, since the server might still go through effort to derive status info only to have it not recorded, but it does go most of the way. Revision ChangesPath 1.44 +16 -1 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.43 retrieving revision 1.44 diff -u -d -u -r1.43 -r1.44 --- dexter.c 1999/10/13 05:24:14 1.43 +++ dexter.c 1999/10/13 20:14:51 1.44 @@ -1214,7 +1214,7 @@ child_slot = i; for (j = 0; j < HARD_THREAD_LIMIT; j++) { -ap_reset_connection_status(i * HARD_THREAD_LIMIT + j); +ap_dexter_force_reset_connection_status(i * HARD_THREAD_LIMIT + j); } break; } @@ -1448,6 +1448,7 @@ ap_pid_fname = DEFAULT_PIDLOG; ap_lock_fname = DEFAULT_LOCKFILE; max_requests_per_child = DEFAULT_MAX_REQUESTS_PER_CHILD; +ap_dexter_set_maintain_connection_status(1); ap_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir)); } @@ -1591,6 +1592,18 @@ return NULL; } +static const char *set_maintain_connection_status(cmd_parms *cmd, + core_dir_config *d, int arg) +{ +const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY); +if (err != NULL) { +return err; +} + +ap_dexter_set_maintain_connection_status(arg != 0); +return NULL; +} + static const char *set_coredumpdir (cmd_parms *cmd, void *dummy, char *arg) { struct stat finfo; @@ -1662,6 +1675,8 @@ "Maximum number of threads per child" }, { "MaxRequestsPerChild", set_max_requests, NULL, RSRC_CONF, TAKE1, "Maximum number of requests a particular child serves before dying." }, +{ "ConnectionStatus", set_maintain_connection_status, NULL, RSRC_CONF, FLAG, + "Whether or not to maintain status information on current connections"}, { "CoreDumpDirectory", set_coredumpdir, NULL, RSRC_CONF, TAKE1, "The location of the directory Apache changes to before dumping core" }, { NULL } 1.4 +24 -1 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- scoreboard.c 1999/10/13 05:24:15 1.3 +++ scoreboard.c 1999/10/13 20:14:52 1.4 @@ -439,7 +439,16 @@ * Above code is shmem code. Below code is interacting with the shmem / -void ap_reset_connection_status(long conn_id) +static int maintain_connection_status = 1; + +void ap_dexter_set_maintain_connection_status(int flag) { +maintain_connection_status = flag; +return; +} + +/* Useful to erase the status of children that might be from previous + * generations */ +void ap_dexter_force_reset_connection_status(long conn_id) { int i; @@ -448,12 +457,20 @@ } } +void ap_reset_connection_status(long conn_id) +{ +if (maintain_connection_status) { +ap_dexter_force_reset_connection_status(conn_id); +} +} + /* Don't mess with the string you get back from this function */ const char *ap_get_connection_status(long conn_id, const char *key) { int i = 0; status_table_entry *ss; +if (!maintain_connection_status) return ""; while (i < STATUSES_PER_CONNECTION) { ss = &(ap_scoreboard_image->table[conn_id][i]); if (ss->key[0] == '\0') { @@ -477,6 +494,7 @@ int i = 0; status_table_entry *ss; +if (!maintain_connection_status) return; while (i < STATUSES_PER_CONNECTION) { ss = &(ap_scoreboard_image->table[conn_id][i]); if (ss->key[0] == '\0') { @@ -506,6 +524,11 @@ status_table_entry *ss; server_status = ap_make_array(p, 0, sizeof(ap_status_table_row_t)); + +/* Go ahead and return what's in the connection status table even if we + * aren't maintaining it. We can at least look at what children from + * previous generations are up to. */ + for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) { if (ap_scoreboard_image-&g
cvs commit: apache-2.0/src/modules/mpm/dexter scoreboard.c
manoj 99/10/13 15:35:41 Modified:src/modules/mpm/dexter scoreboard.c Log: Whack a warning. Revision ChangesPath 1.5 +0 -1 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- scoreboard.c 1999/10/13 20:14:52 1.4 +++ scoreboard.c 1999/10/13 22:35:40 1.5 @@ -82,7 +82,6 @@ #endif static scoreboard *ap_scoreboard_image = NULL; -static char *ap_server_argv0=NULL; /* *
cvs commit: apache-2.0/src/modules/mpm/dexter scoreboard.c
manoj 99/10/13 15:40:10 Modified:src/include mpm_status.h src/modules/mpm/dexter scoreboard.c Log: Add calls ap_get_connections and ap_get_connection_keys to the connection status API, and add implementations of these calls to Dexter. Revision ChangesPath 1.2 +15 -0 apache-2.0/src/include/mpm_status.h Index: mpm_status.h === RCS file: /home/cvs/apache-2.0/src/include/mpm_status.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- mpm_status.h 1999/10/13 05:24:12 1.1 +++ mpm_status.h 1999/10/13 22:40:09 1.2 @@ -81,6 +81,21 @@ API_EXPORT(const char *) ap_get_connection_status(long conn_id, const char *key); /** + * Get an array of current connection IDs. + * + */ +API_EXPORT(ap_array_header_t *) ap_get_connections(ap_context_t *p); + +/** + * Get an array of keys from a given connection. + * + * conn_id = Connection ID + * + */ +API_EXPORT(ap_array_header_t *) ap_get_connection_keys(ap_context_t *p, + long conn_id); + +/** * * Set a cell in the status table. No guarantees are made that long strings * won't be truncated. 1.6 +39 -0 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- scoreboard.c 1999/10/13 22:35:40 1.5 +++ scoreboard.c 1999/10/13 22:40:09 1.6 @@ -483,6 +483,45 @@ return NULL; } +ap_array_header_t *ap_get_connections(ap_context_t *p) +{ +int i; +ap_array_header_t *connection_list; +long *array_slot; + +connection_list = ap_make_array(p, 0, sizeof(long)); +/* We assume that there is a connection iff it has an entry in the status + * table. Connections without any status sound problematic to me, so this + * is probably for the best. - manoj */ +for (i = 0; i < max_daemons_limit*HARD_THREAD_LIMIT; i++) { + if (ap_scoreboard_image->table[i][0].key[0] != '\0') { +array_slot = ap_push_array(connection_list); +*array_slot = i; +} +} +return connection_list; +} + +ap_array_header_t *ap_get_connection_keys(ap_context_t *p, long conn_id) +{ +int i = 0; +status_table_entry *ss; +ap_array_header_t *key_list; +char **array_slot; + +key_list = ap_make_array(p, 0, KEY_LENGTH * sizeof(char)); +while (i < STATUSES_PER_CONNECTION) { +ss = &(ap_scoreboard_image->table[conn_id][i]); +if (ss->key[0] == '\0') { +break; +} +array_slot = ap_push_array(key_list); +*array_slot = ap_pstrdup(p, ss->key); +i++; +} +return key_list; +} + /* Note: no effort is made here to prevent multiple threads from messing with * a single connection at the same time. ap_update_connection_status should * only be called by the thread that owns the connection */
cvs commit: apache-2.0/src/modules/mpm/dexter scoreboard.c
manoj 99/10/18 15:41:06 Modified:src/modules/mpm/dexter scoreboard.c Log: Delete some old unused code that was breaking compiles. Revision ChangesPath 1.7 +0 -3 apache-2.0/src/modules/mpm/dexter/scoreboard.c Index: scoreboard.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/scoreboard.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- scoreboard.c 1999/10/13 22:40:09 1.6 +++ scoreboard.c 1999/10/18 22:41:04 1.7 @@ -157,7 +157,6 @@ ap_server_argv0); } ap_scoreboard_image = (scoreboard *) m; -ap_scoreboard_image->global.running_generation = 0; } API_EXPORT(void) reopen_scoreboard(ap_context_t *p) @@ -244,7 +243,6 @@ close(fd); ap_register_cleanup(p, NULL, cleanup_shared_mem, ap_null_cleanup); ap_scoreboard_image = (scoreboard *) m; -ap_scoreboard_image->global.running_generation = 0; } API_EXPORT(void) reopen_scoreboard(ap_context_t *p) @@ -324,7 +322,6 @@ close(fd); #endif ap_scoreboard_image = (scoreboard *) m; -ap_scoreboard_image->global.running_generation = 0; } API_EXPORT(void) reopen_scoreboard(ap_context_t *p)
cvs commit: apache-2.0/src/modules/mpm/dexter acceptlock.c dexter.c scoreboard.c
manoj 99/10/20 12:07:51 Modified:src/modules/mpm/dexter acceptlock.c dexter.c scoreboard.c Log: Fix dexter after adding a status code to ap_log_error broke it. Revision ChangesPath 1.14 +19 -14apache-2.0/src/modules/mpm/dexter/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- acceptlock.c 1999/10/14 14:36:39 1.13 +++ acceptlock.c 1999/10/20 19:07:48 1.14 @@ -123,7 +123,7 @@ void intra_mutex_on(int locknum) { if ((errno = pthread_mutex_lock(&intra_mutex[locknum])) != 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "Error getting intraprocess lock. Exiting!"); } @@ -132,7 +132,7 @@ void intra_mutex_off(int locknum) { if (pthread_mutex_unlock(&intra_mutex[locknum]) != 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "Error releasing intraprocess lock. Exiting!"); } @@ -531,7 +531,8 @@ } if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, +(const server_rec*) ap_get_server_conf(), "fcntl: F_SETLKW: Error getting accept lock, exiting! " "Perhaps you need to use the LockFile directive to place " "your lock file on a local disk!"); @@ -548,10 +549,11 @@ /* nop */ } if (ret < 0) { - ap_log_error(APLOG_MARK, APLOG_EMERG, (const server_rec*) ap_get_server_conf(), - "fcntl: F_SETLKW: Error freeing accept lock, exiting! " - "Perhaps you need to use the LockFile directive to place " - "your lock file on a local disk!"); + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, + (const server_rec*) ap_get_server_conf(), + "fcntl: F_SETLKW: Error freeing accept lock, exiting! " + "Perhaps you need to use the LockFile directive to place " + "your lock file on a local disk!"); ap_clean_child_exit(APEXIT_CHILDFATAL); } } @@ -587,7 +589,7 @@ ap_open(&tempfile, lock_fname, APR_WRITE, APR_UREAD | APR_UWRITE, p); ap_get_os_file(&lock_fd[i], tempfile); if (lock_fd[i] == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *)ap_get_server_conf(), "Child cannot open lock file: %s", lock_fname); ap_clean_child_exit(APEXIT_CHILDINIT); @@ -614,7 +616,7 @@ ap_open(&tempfile, lock_fname, APR_CREATE | APR_WRITE | APR_EXCL, APR_UREAD | APR_UWRITE, p); ap_get_os_file(&lock_fd[i], tempfile); if (lock_fd[i] == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "Parent cannot open lock file: %s", lock_fname); exit(APEXIT_INIT); @@ -631,7 +633,7 @@ continue; if (ret < 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "flock: LOCK_EX: Error getting accept lock. Exiting!"); ap_clean_child_exit(APEXIT_CHILDFATAL); @@ -641,7 +643,7 @@ void accept_mutex_off(int locknum) { if (flock(lock_fd[locknum], LOCK_UN) < 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "flock: LOCK_UN: Error freeing accept lock. Exiting!"); ap_clean_child_exit(APEXIT_CHILDFATAL); @@ -675,7 +677,8 @@ int rc = DosOpenMutexSem(NULL, &lock_sem[locknum]); if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_get_server_conf(), + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno, + ap_get_server_conf(), "Child cannot open lock semaphore, rc=%d", rc); ap_c
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread acceptlock.c
manoj 99/10/20 12:11:54 Modified:src/modules/mpm/mpmt_pthread acceptlock.c Log: Add errno to ap_log_error calls that were missed before. Revision ChangesPath 1.16 +10 -7 apache-2.0/src/modules/mpm/mpmt_pthread/acceptlock.c Index: acceptlock.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/acceptlock.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -u -r1.15 -r1.16 --- acceptlock.c 1999/10/20 12:50:01 1.15 +++ acceptlock.c 1999/10/20 19:11:53 1.16 @@ -584,7 +584,7 @@ ap_open(&tempfile, lock_fname, APR_WRITE, APR_UREAD | APR_UWRITE, p); ap_get_os_file(&lock_fd[i], tempfile); if (lock_fd[i] == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *)ap_get_server_conf(), "Child cannot open lock file: %s", lock_fname); clean_child_exit(APEXIT_CHILDINIT); @@ -612,7 +612,7 @@ APR_UREAD | APR_UWRITE, p); ap_get_os_file(&lock_fd[i], tempfile); if (lock_fd[i] == -1) { - ap_log_error(APLOG_MARK, APLOG_EMERG, + ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "Parent cannot open lock file: %s", lock_fname); exit(APEXIT_INIT); @@ -629,7 +629,7 @@ continue; if (ret < 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "flock: LOCK_EX: Error getting accept lock. Exiting!"); clean_child_exit(APEXIT_CHILDFATAL); @@ -639,7 +639,7 @@ void accept_mutex_off(int locknum) { if (flock(lock_fd[locknum], LOCK_UN) < 0) { -ap_log_error(APLOG_MARK, APLOG_EMERG, +ap_log_error(APLOG_MARK, APLOG_EMERG, errno, (const server_rec *) ap_get_server_conf(), "flock: LOCK_UN: Error freeing accept lock. Exiting!"); clean_child_exit(APEXIT_CHILDFATAL); @@ -672,7 +672,8 @@ int rc = DosOpenMutexSem(NULL, &lock_sem[locknum]); if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_get_server_conf(), + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno, + ap_get_server_conf(), "Child cannot open lock semaphore, rc=%d", rc); clean_child_exit(APEXIT_CHILDINIT); } @@ -708,7 +709,8 @@ int rc = DosRequestMutexSem(lock_sem[locknum], SEM_INDEFINITE_WAIT); if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_get_server_conf(), + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno, + ap_get_server_conf(), "OS2SEM: Error %d getting accept lock. Exiting!", rc); clean_child_exit(APEXIT_CHILDFATAL); } @@ -719,7 +721,8 @@ int rc = DosReleaseMutexSem(lock_sem[locknum]); if (rc != 0) { - ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, ap_get_server_conf(), + ap_log_error(APLOG_MARK, APLOG_NOERRNO|APLOG_EMERG, errno, + ap_get_server_conf(), "OS2SEM: Error %d freeing accept lock. Exiting!", rc); clean_child_exit(APEXIT_CHILDFATAL); }
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/20 12:35:33 Modified:src/include ap_iol.h src/main buff.c iol_file.c src/os/unix iol_socket.c Log: Change the IOL API to no longer use errno. Functions now return error codes like APR does. iol_socket on non-Unix platforms hasn't been fixed yet. Revision ChangesPath 1.6 +20 -18apache-2.0/src/include/ap_iol.h Index: ap_iol.h === RCS file: /home/cvs/apache-2.0/src/include/ap_iol.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- ap_iol.h 1999/09/24 18:58:10 1.5 +++ ap_iol.h 1999/10/20 19:35:17 1.6 @@ -60,6 +60,8 @@ #ifndef AP_IOL_H #define AP_IOL_H +#include "apr_errno.h" /* For ap_status_t and the APR_errnos */ + typedef struct ap_iol ap_iol; typedef struct ap_iol_methods ap_iol_methods; @@ -68,22 +70,19 @@ } ap_iol_option; /* -write, writev, read guarantee they won't return EINTR. +write, writev, read guarantee they won't return APR_EINTR. -If no error occurs, they return the number of bytes read/written. +If no error occurs, they return APR_SUCCESS. If timeout is negative, they may block forever, and they still don't guarantee they'll write/read the full length. -If timeout is 0, they will never block, and will return -1 and -EWOULDBLOCK in the event that they can't read/write any bytes. +If timeout is 0, they will never block, and will return APR_EAGAIN +in the event that they can't read/write any bytes. If the timeout is positive, they will block up to the specified number of seconds. If the read/write can't be completed in that time, -a -1 will be returned and errno will be set to ETIMEDOUT. - -TODO: we've all agreed errno is somewhat evil, and it must be replaced -by a status result code. I'll leave that to someone else. +APR_ETIMEDOUT will be returned. Just to drive the point home again -- none of these functions guarantee they will read/write the entire length specified. @@ -92,7 +91,7 @@ of care if you're implementing filters. It may mean you have to keep state from one call to the next. The chunking filter will have an example of this. If you're not sure how to handle the state sitatuation -you will want to return EINVAL when the timeout is set to 0. This may +you will want to return APR_EINVAL when the timeout is set to 0. This may break various things... hopefully we'll be able to recover gracefully. Note: implementation tip: if your system doesn't have writev(), you @@ -103,12 +102,15 @@ */ struct ap_iol_methods { -int (*close)(ap_iol *fd); -int (*write)(ap_iol *fd, const char *buf, int len); -int (*writev)(ap_iol *fd, const struct iovec *vec, int nvec); -int (*read)(ap_iol *fd, char *buf, int len); -int (*setopt)(ap_iol *fd, ap_iol_option opt, const void *value); -int (*getopt)(ap_iol *fd, ap_iol_option opt, void *value); +ap_status_t (*close)(ap_iol *fd); +ap_status_t (*write)(ap_iol *fd, const char *buf, int len, + ap_ssize_t *nbytes); +ap_status_t (*writev)(ap_iol *fd, const struct iovec *vec, int nvec, + ap_ssize_t *nbytes); +ap_status_t (*read)(ap_iol *fd, char *buf, int len, +ap_ssize_t *nbytes); +ap_status_t (*setopt)(ap_iol *fd, ap_iol_option opt, const void *value); +ap_status_t (*getopt)(ap_iol *fd, ap_iol_option opt, void *value); /* TODO: accept, connect, ... */ }; @@ -120,9 +122,9 @@ }; #define iol_close(iol) ((iol)->methods->close((iol))) -#define iol_write(iol, a, b) ((iol)->methods->write((iol), (a), (b))) -#define iol_writev(iol, a, b) ((iol)->methods->writev((iol), (a), (b))) -#define iol_read(iol, a, b) ((iol)->methods->read((iol), (a), (b))) +#define iol_write(iol, a, b, c) ((iol)->methods->write((iol), (a), (b), (c))) +#define iol_writev(iol, a, b, c) ((iol)->methods->writev((iol), (a), (b), (c))) +#define iol_read(iol, a, b, c) ((iol)->methods->read((iol), (a), (b), (c))) #define iol_setopt(iol, a, b) ((iol)->methods->setopt((iol), (a), (b))) #define iol_getopt(iol, a, b) ((iol)->methods->getopt((iol), (a), (b))) 1.8 +51 -25apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- buff.c1999/10/14 14:36:37 1.7 +++ buff.c1999/10/20 19:35:24 1.8 @@ -55
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/20 12:38:28 Modified:src/include ap_iol.h src/main iol_file.c src/os/unix iol_socket.c Log: Change some ints to ap_size_t to be more "correct" for APR and Unix I/O. Revision ChangesPath 1.7 +3 -2 apache-2.0/src/include/ap_iol.h Index: ap_iol.h === RCS file: /home/cvs/apache-2.0/src/include/ap_iol.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- ap_iol.h 1999/10/20 19:35:17 1.6 +++ ap_iol.h 1999/10/20 19:38:20 1.7 @@ -60,6 +60,7 @@ #ifndef AP_IOL_H #define AP_IOL_H +#include "apr_general.h" /* For ap_s?size_t */ #include "apr_errno.h" /* For ap_status_t and the APR_errnos */ typedef struct ap_iol ap_iol; @@ -103,11 +104,11 @@ struct ap_iol_methods { ap_status_t (*close)(ap_iol *fd); -ap_status_t (*write)(ap_iol *fd, const char *buf, int len, +ap_status_t (*write)(ap_iol *fd, const char *buf, ap_size_t len, ap_ssize_t *nbytes); ap_status_t (*writev)(ap_iol *fd, const struct iovec *vec, int nvec, ap_ssize_t *nbytes); -ap_status_t (*read)(ap_iol *fd, char *buf, int len, +ap_status_t (*read)(ap_iol *fd, char *buf, ap_size_t len, ap_ssize_t *nbytes); ap_status_t (*setopt)(ap_iol *fd, ap_iol_option opt, const void *value); ap_status_t (*getopt)(ap_iol *fd, ap_iol_option opt, void *value); 1.5 +4 -4 apache-2.0/src/main/iol_file.c Index: iol_file.c === RCS file: /home/cvs/apache-2.0/src/main/iol_file.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- iol_file.c1999/10/20 19:35:26 1.4 +++ iol_file.c1999/10/20 19:38:23 1.5 @@ -85,10 +85,10 @@ return errno; \ } -method(write, (ap_iol *viol, const char *arg1, int arg2, +method(write, (ap_iol *viol, const char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) method(writev, (ap_iol *viol, const struct iovec *arg1, int arg2, ap_ssize_t *nbytes)) -method(read, (ap_iol *viol, char *arg1, int arg2, ap_ssize_t *nbytes)) +method(read, (ap_iol *viol, char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) static ap_status_t file_close(ap_iol *viol) @@ -164,9 +164,9 @@ return rv; \ } -method(ap_write, (ap_iol *viol, const char *arg1, int arg2, ap_ssize_t *nbytes)) +method(ap_write, (ap_iol *viol, const char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) method(ap_writev, (ap_iol *viol, const struct iovec *arg1, int arg2, ap_ssize_t *nbytes)) -method(ap_read, (ap_iol *viol, char *arg1, int arg2, ap_ssize_t *nbytes)) +method(ap_read, (ap_iol *viol, char *arg1, ap_size_t arg2, ap_ssize_t *nbytes)) /* This function will clean-up the iol struct and close the file... */ 1.6 +2 -2 apache-2.0/src/os/unix/iol_socket.c Index: iol_socket.c === RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- iol_socket.c 1999/10/20 19:35:29 1.5 +++ iol_socket.c 1999/10/20 19:38:27 1.6 @@ -199,9 +199,9 @@ return errno; \ } -method(write, (ap_iol *viol, const char *arg1, int arg2, ap_ssize_t *nbytes), write, NULL, &fdset) +method(write, (ap_iol *viol, const char *arg1, ap_size_t arg2, ap_ssize_t *nbytes), write, NULL, &fdset) method(writev, (ap_iol *viol, const struct iovec *arg1, int arg2, ap_ssize_t *nbytes), writev, NULL, &fdset) -method(read, (ap_iol *viol, char *arg1, int arg2, ap_ssize_t *nbytes), read, &fdset, NULL) +method(read, (ap_iol *viol, char *arg1, ap_size_t arg2, ap_ssize_t *nbytes), read, &fdset, NULL) static ap_status_t unix_close(ap_iol *viol) {
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/21 12:00:20 Modified:src/main buff.c Log: Fix an swap in the ?: operator's arguments in writev_it_all. Revision ChangesPath 1.9 +1 -1 apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- buff.c1999/10/20 19:35:24 1.8 +++ buff.c1999/10/21 19:00:18 1.9 @@ -583,7 +583,7 @@ while (i < nvec) { rv = writev_with_errors(fb, vec + i, nvec - i); if (rv < 0) { - return total ? -1 : total; + return total ? total : -1; } total += rv; if (fb->flags & B_NONBLOCK) {
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/22 15:08:18 Modified:src/include buff.h src/main buff.c Log: Change ap_bgetopt and ap_bsetopt to use APR-style return codes instead of errno. There's no effect on other Apache code since nothing actually checks return values on these functions. Revision ChangesPath 1.4 +2 -2 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- buff.h1999/08/31 05:32:17 1.3 +++ buff.h1999/10/22 22:08:11 1.4 @@ -169,8 +169,8 @@ /* XXX - unused right now - mvsk */ API_EXPORT(BUFF *) ap_bopenf(ap_context_t *a, const char *name, int flg, int mode); -API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval); -API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval); +API_EXPORT(ap_status_t) ap_bsetopt(BUFF *fb, int optname, const void *optval); +API_EXPORT(ap_status_t) ap_bgetopt(BUFF *fb, int optname, void *optval); API_EXPORT(int) ap_bsetflag(BUFF *fb, int flag, int value); API_EXPORT(int) ap_bclose(BUFF *fb); 1.10 +6 -21 apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- buff.c1999/10/21 19:00:18 1.9 +++ buff.c1999/10/22 22:08:15 1.10 @@ -201,8 +201,6 @@ API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) { -int rv; - switch (optname) { case BO_BYTECT: fb->bytes_sent = *(const long int *) optval - (long int) fb->outcnt; @@ -214,21 +212,14 @@ fb->flags |= B_NONBLOCK; /* XXX: should remove B_WR now... */ } - rv = iol_setopt(fb->iol, AP_IOL_TIMEOUT, optval); -if (rv == APR_SUCCESS) { -return 0; -} -errno = rv; -return -1; + return iol_setopt(fb->iol, AP_IOL_TIMEOUT, optval); } -errno = EINVAL; -return -1; +return APR_EINVAL; } -API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval) +API_EXPORT(ap_status_t) ap_bgetopt(BUFF *fb, int optname, void *optval) { long int bs; -int rv; switch (optname) { case BO_BYTECT: @@ -236,18 +227,12 @@ if (bs < 0L) bs = 0L; *(long int *) optval = bs; - return 0; + return APR_SUCCESS; case BO_TIMEOUT: - rv = iol_getopt(fb->iol, AP_IOL_TIMEOUT, optval); -if (rv == APR_SUCCESS) { -return 0; -} -errno = rv; -return -1; + return iol_getopt(fb->iol, AP_IOL_TIMEOUT, optval); } -errno = EINVAL; -return -1; +return APR_EINVAL; } static void start_chunk(BUFF *fb)
cvs commit: apache-2.0/src/lib/apr/mmap/unix .cvsignore
manoj 99/10/22 20:07:49 Added: src/lib/apr/mmap/unix .cvsignore Log: Add a .cvsignore file to the Unix mmap section of APR Revision ChangesPath 1.1 apache-2.0/src/lib/apr/mmap/unix/.cvsignore Index: .cvsignore === Makefile
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/25 14:00:33 Modified:src/os/unix iol_socket.c Log: We didn't zero out nbytes in one case of error; fix that. Revision ChangesPath 1.7 +1 -0 apache-2.0/src/os/unix/iol_socket.c Index: iol_socket.c === RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- iol_socket.c 1999/10/20 19:38:27 1.6 +++ iol_socket.c 1999/10/25 21:00:27 1.7 @@ -157,6 +157,7 @@ *nbytes = rv; \ return APR_SUCCESS; \ } \ +*nbytes = 0; \ return errno; \ \ } \
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/25 14:01:09 Modified:src/os/unix iol_socket.c Log: Fix a misspelling in a comment Revision ChangesPath 1.8 +1 -1 apache-2.0/src/os/unix/iol_socket.c Index: iol_socket.c === RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- iol_socket.c 1999/10/25 21:00:27 1.7 +++ iol_socket.c 1999/10/25 21:01:08 1.8 @@ -167,7 +167,7 @@ iol_socket *iol = (iol_socket *)viol; \ int rv; \ \ -/* Present to zero until some bytes are actually written */ \ +/* Preset to zero until some bytes are actually written */ \ *nbytes = 0; \ if (!(iol->flags & FD_NONBLOCKING_SET)) { \ if (iol->timeout < 0) { \
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/25 14:12:42 Modified:src/main buff.c Log: The first layer of buff changes to abandon errno. Now .*_with_errors and doerror are errno independant, but export the old errno-using interface. Revision ChangesPath 1.12 +54 -49apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- buff.c1999/10/24 19:23:57 1.11 +++ buff.c1999/10/25 21:12:34 1.12 @@ -136,13 +136,11 @@ static void doerror(BUFF *fb, int direction) { -int errsave = errno; /* Save errno to prevent overwriting it below */ - +/* TODO: doerror should look at fb->saved_errno instead of errno */ +errno = fb->saved_errno; fb->flags |= (direction == B_RD ? B_RDERR : B_WRERR); if (fb->error != NULL) (*fb->error) (fb, direction, fb->error_data); - -errno = errsave; } /* Buffering routines */ @@ -316,24 +314,22 @@ /* a wrapper around iol_read which checks for errors and EOFs */ -static int read_with_errors(BUFF *fb, void *buf, int nbyte) +static ap_status_t read_with_errors(BUFF *fb, void *buf, ap_size_t nbyte, +ap_ssize_t *bytes_read) { -int rv; -ap_ssize_t bytes_read; +ap_status_t rv; -rv = iol_read(fb->iol, buf, nbyte, &bytes_read); -if (rv == APR_SUCCESS && bytes_read == 0) { +rv = iol_read(fb->iol, buf, nbyte, bytes_read); +if (rv == APR_SUCCESS && *bytes_read == 0) { fb->flags |= B_EOF; } else if (rv != APR_SUCCESS) { -errno = rv; fb->saved_errno = rv; if (rv != APR_EAGAIN) { doerror(fb, B_RD); } -return -1; } -return bytes_read; +return rv; } @@ -345,6 +341,7 @@ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) { int i, nrd; +ap_status_t rv; if (fb->flags & B_RDERR) { errno = fb->saved_errno; @@ -363,7 +360,12 @@ fb->inptr += i; return i; } - return read_with_errors(fb, buf, nbyte); + rv = read_with_errors(fb, buf, nbyte, &i); +if (rv == APR_SUCCESS) { +return i; +} +errno = rv; +return -1; } nrd = fb->incnt; @@ -387,16 +389,18 @@ /* do a single read */ if (nbyte >= fb->bufsiz) { /* read directly into caller's buffer */ - i = read_with_errors(fb, buf, nbyte); - if (i == -1) { + rv = read_with_errors(fb, buf, nbyte, &i); + if (rv != APR_SUCCESS) { +errno = rv; return nrd ? nrd : -1; } } else { /* read into hold buffer, then memcpy */ fb->inptr = fb->inbase; - i = read_with_errors(fb, fb->inptr, fb->bufsiz); - if (i == -1) { + rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); + if (rv != APR_SUCCESS) { +errno = rv; return nrd ? nrd : -1; } fb->incnt = i; @@ -431,6 +435,7 @@ API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb) { int i, ch, ct; +ap_status_t rv; /* Can't do bgets on an unbuffered stream */ if (!(fb->flags & B_RD)) { @@ -451,8 +456,9 @@ fb->incnt = 0; if (fb->flags & B_EOF) break; - i = read_with_errors(fb, fb->inptr, fb->bufsiz); - if (i == -1) { + rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); + if (rv != APR_SUCCESS) { +errno = rv; buff[ct] = '\0'; return ct ? ct : -1; } @@ -540,51 +546,51 @@ /* A wrapper for writev which deals with error conditions and * bytes_sent. */ -static int writev_with_errors(BUFF *fb, const struct iovec *vec, int nvec) +static ap_status_t writev_with_errors(BUFF *fb, const struct iovec *vec, + int nvec, ap_ssize_t *bytes_written) { -int rv; -ap_ssize_t bytes_written; +ap_status_t rv; -rv = iol_writev(fb->iol, vec, nvec, &bytes_written); +rv = iol_writev(fb->iol, vec, nvec, bytes_written); if (rv != APR_SUCCESS) { -errno = rv; fb->saved_errno = rv; if (rv != APR_EAGAIN) { doerror(fb, B_WR); } - return -1; } -fb->bytes_sent += bytes_written; -return bytes_written; +fb->bytes_sent += *bytes_written; +return rv; } static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec)
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/25 15:04:08 Modified:src/main buff.c Log: large_write now doesn't use errno internally, but exports an errnoish interface. Revision ChangesPath 1.13 +34 -24apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -u -r1.12 -r1.13 --- buff.c1999/10/25 21:12:34 1.12 +++ buff.c1999/10/25 22:04:05 1.13 @@ -563,39 +563,44 @@ } -static int writev_it_all(BUFF *fb, struct iovec *vec, int nvec) +static ap_status_t writev_it_all(BUFF *fb, struct iovec *vec, int nvec, + ap_ssize_t *bytes_written) { int i; ap_status_t rv; -ap_ssize_t bytes_written; -int total; +ap_ssize_t n; i = 0; -total = 0; +*bytes_written = 0; while (i < nvec) { - rv = writev_with_errors(fb, vec + i, nvec - i, &bytes_written); + rv = writev_with_errors(fb, vec + i, nvec - i, &n); if (rv != APR_SUCCESS) { -errno = rv; - return total ? total : -1; +/* XXX - When we decide which way to go here, the ifdef will do away. the macro + * is undefined by default */ +#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH +return rv; +#else +return *bytes_written ? APR_SUCCESS : rv; +#endif } - total += bytes_written; + *bytes_written += n; if (fb->flags & B_NONBLOCK) { - return total; + return APR_SUCCESS; } /* recalculate to deal with partial writes */ - while (bytes_written > 0) { -if (bytes_written < vec[i].iov_len) { -vec[i].iov_base = (char *) vec[i].iov_base + bytes_written; -vec[i].iov_len -= bytes_written; + while (n > 0) { +if (n < vec[i].iov_len) { +vec[i].iov_base = (char *) vec[i].iov_base + n; +vec[i].iov_len -= n; break; } else { -bytes_written -= vec[i].iov_len; +n -= vec[i].iov_len; ++i; } } } -return total; +return APR_SUCCESS; } @@ -609,7 +614,8 @@ { struct iovec vec[2]; int nvec; -int rv; +ap_status_t rv; +ap_ssize_t bytes_written; ap_assert(nbyte > 0); if (fb->outcnt) { @@ -624,19 +630,23 @@ vec[0].iov_len = nbyte; nvec = 1; } -rv = writev_it_all(fb, vec, nvec); -if (rv <= 0) { - return rv; +rv = writev_it_all(fb, vec, nvec, &bytes_written); +if (bytes_written == 0) { /* error or eof */ +if (rv == APR_SUCCESS) { + return 0; +} +errno = rv; +return -1; } -if (rv < fb->outcnt) { +if (bytes_written < fb->outcnt) { /* shift bytes forward in buffer */ - memmove(fb->outbase, fb->outbase + rv, fb->outcnt - rv); - fb->outcnt -= rv; + fb->outcnt -= bytes_written; + memmove(fb->outbase, fb->outbase + bytes_written, fb->outcnt); return 0; } -rv -= fb->outcnt; +bytes_written -= fb->outcnt; fb->outcnt = 0; -return rv; +return bytes_written; }
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/10/25 16:16:32 Modified:src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Fix warnings, and fix a segfault in the process. Revision ChangesPath 1.40 +8 -7 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -u -r1.39 -r1.40 --- mpmt_pthread.c1999/10/24 13:08:28 1.39 +++ mpmt_pthread.c1999/10/25 23:16:29 1.40 @@ -725,7 +725,7 @@ * Child process main loop. */ -static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num) +static void process_socket(ap_context_t *p, struct sockaddr *sa_client, ap_socket_t *sock, int my_child_num, int my_thread_num) { struct sockaddr sa_server; /* */ size_t len = sizeof(struct sockaddr); @@ -733,6 +733,9 @@ conn_rec *current_conn; ap_iol *iol; long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num; +int csd; + +(void) ap_get_os_sock(&csd, sock); if (getsockname(csd, &sa_server, &len) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname"); @@ -754,7 +757,7 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL, "error attaching to socket"); } -close(csd); +ap_close_socket(sock); return; } @@ -763,7 +766,8 @@ conn_io = ap_bcreate(p, B_RDWR); ap_bpush_iol(conn_io, iol); -current_conn = ap_new_apr_connection(p, server_conf, conn_io, csd, conn_id); +current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock, + conn_id); ap_process_connection(current_conn); } @@ -802,7 +806,6 @@ ap_socket_t *sd = NULL; int n; int curr_pollfd, last_pollfd = 0; -int thesock; ap_pollfd_t *pollset; free(ti); @@ -891,8 +894,7 @@ SAFE_ACCEPT(intra_mutex_off(0)); break; } -ap_get_os_sock(&thesock, csd); -process_socket(ptrans, &sa_client, thesock, process_slot, thread_slot); +process_socket(ptrans, &sa_client, csd, process_slot, thread_slot); ap_clear_pool(ptrans); requests_this_child--; } @@ -917,7 +919,6 @@ { sigset_t sig_mask; int signal_received; -pthread_t thread; pthread_attr_t thread_attr; int i; int my_child_num = child_num_arg;
cvs commit: apache-2.0/src Configuration.mpm
manoj 99/10/25 18:58:57 Modified:src Configuration.mpm Log: Fix EXTRA_LIBS to match the one-library APR Revision ChangesPath 1.17 +1 -1 apache-2.0/src/Configuration.mpm Index: Configuration.mpm === RCS file: /home/cvs/apache-2.0/src/Configuration.mpm,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -u -r1.16 -r1.17 --- Configuration.mpm 1999/09/07 20:30:07 1.16 +++ Configuration.mpm 1999/10/26 01:58:56 1.17 @@ -2,7 +2,7 @@ # mpmt_pthread MPM (-pthread in EXTRA_CFLAGS on Linux) EXTRA_CFLAGS= -Wall -pthread EXTRA_LDFLAGS= -EXTRA_LIBS= -lpthread -L$(SRCDIR)/lib/apr/libs -lfile -lnetwork -lapr -llock -lmisc -lsig -lthreadproc -ltime +EXTRA_LIBS= -lpthread -L$(SRCDIR)/lib/apr -lapr EXTRA_INCLUDES= EXTRA_DEPS= #CC=
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/25 22:24:52 Modified:src/main buff.c Log: Fix a Manojly stupid bclose bug. Revision ChangesPath 1.14 +1 -1 apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- buff.c1999/10/25 22:04:05 1.13 +++ buff.c1999/10/26 05:24:50 1.14 @@ -834,7 +834,7 @@ rc1 = 0; ap_kill_cleanup(fb->pool, fb, bcleanup); rc2 = iol_close(fb->iol); -if (rc2 != APR_SUCCESS) { +if (rc2 == APR_SUCCESS) { rc2 = 0; } else {
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/25 22:29:40 Modified:src/os/unix iol_socket.c Log: Fix bugs in the big fat macro. Revision ChangesPath 1.9 +4 -3 apache-2.0/src/os/unix/iol_socket.c Index: iol_socket.c === RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- iol_socket.c 1999/10/25 21:01:08 1.8 +++ iol_socket.c 1999/10/26 05:29:40 1.9 @@ -148,6 +148,7 @@ rv = select(iol->fd + 1, selread, selwrite, NULL, iol->timeout < 0 ? NULL : &tv); \ } while (rv == -1 && errno == EINTR); \ if (!FD_ISSET(iol->fd, &fdset)) { \ +*nbytes = 0; \ return APR_ETIMEDOUT; \ } \ do { \ @@ -190,12 +191,12 @@ do { \ rv = syscall(iol->fd, arg1, arg2); \ } while (rv == -1 && errno == EINTR); \ - if ((errno == EWOULDBLOCK || errno == EAGAIN) && iol->timeout != 0) { \ - return unix_##name##_timeout(viol, arg1, arg2, nbytes); \ - } \ if (rv >= 0) { \ *nbytes = rv; \ return APR_SUCCESS; \ + } \ + if ((errno == EWOULDBLOCK || errno == EAGAIN) && iol->timeout != 0) { \ + return unix_##name##_timeout(viol, arg1, arg2, nbytes); \ } \ return errno; \ }
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/10/25 23:05:39 Modified:src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Fix warnings from the local/remote_addr stuff properly. Revision ChangesPath 1.41 +3 -11 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.40 retrieving revision 1.41 diff -u -d -u -r1.40 -r1.41 --- mpmt_pthread.c1999/10/25 23:16:29 1.40 +++ mpmt_pthread.c1999/10/26 06:05:38 1.41 @@ -725,10 +725,8 @@ * Child process main loop. */ -static void process_socket(ap_context_t *p, struct sockaddr *sa_client, ap_socket_t *sock, int my_child_num, int my_thread_num) +static void process_socket(ap_context_t *p, ap_socket_t *sock, int my_child_num, int my_thread_num) { -struct sockaddr sa_server; /* */ -size_t len = sizeof(struct sockaddr); BUFF *conn_io; conn_rec *current_conn; ap_iol *iol; @@ -737,12 +735,6 @@ (void) ap_get_os_sock(&csd, sock); -if (getsockname(csd, &sa_server, &len) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname"); - close(csd); - return; -} - sock_disable_nagle(csd); iol = unix_attach_socket(csd); @@ -800,7 +792,6 @@ int process_slot = ti->pid; int thread_slot = ti->tid; ap_context_t *tpool = ti->tpool; -struct sockaddr sa_client; ap_socket_t *csd = NULL; ap_context_t *ptrans;/* Pool for per-transaction stuff */ ap_socket_t *sd = NULL; @@ -894,7 +885,7 @@ SAFE_ACCEPT(intra_mutex_off(0)); break; } -process_socket(ptrans, &sa_client, csd, process_slot, thread_slot); +process_socket(ptrans, csd, process_slot, thread_slot); ap_clear_pool(ptrans); requests_this_child--; } @@ -919,6 +910,7 @@ { sigset_t sig_mask; int signal_received; +pthread_t thread; pthread_attr_t thread_attr; int i; int my_child_num = child_num_arg;
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/25 23:07:38 Modified:src/modules/mpm/dexter dexter.c Log: Take advantage of ap_new_apr_connection in dexter Revision ChangesPath 1.47 +7 -19 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.46 retrieving revision 1.47 diff -u -d -u -r1.46 -r1.47 --- dexter.c 1999/10/24 13:08:27 1.46 +++ dexter.c 1999/10/26 06:07:36 1.47 @@ -737,21 +737,14 @@ * Child process main loop. */ -static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, - int conn_id) +static void process_socket(ap_context_t *p, ap_socket_t *sock, long conn_id) { -struct sockaddr sa_server; /* */ -NET_SIZE_T len = sizeof(struct sockaddr); BUFF *conn_io; conn_rec *current_conn; ap_iol *iol; - -if (getsockname(csd, &sa_server, &len) < 0) { - ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname"); - close(csd); - return; -} +int csd; +ap_get_os_sock(&csd, sock); sock_disable_nagle(csd); iol = unix_attach_socket(csd); @@ -766,17 +759,15 @@ ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL, "error attaching to socket"); } -close(csd); +ap_close_socket(sock); return; } conn_io = ap_bcreate(p, B_RDWR); ap_bpush_iol(conn_io, iol); -current_conn = ap_new_connection(p, server_conf, conn_io, - (const struct sockaddr_in *) sa_client, - (const struct sockaddr_in *) &sa_server, - conn_id); +current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock, + conn_id); ap_process_connection(current_conn); } @@ -848,7 +839,6 @@ static void *worker_thread(void *arg) { -struct sockaddr sa_client; ap_socket_t *csd = NULL; ap_context_t *tpool; /* Pool for this thread */ ap_context_t *ptrans;/* Pool for per-transaction stuff */ @@ -858,7 +848,6 @@ int thread_just_started = 1; int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; -int native_socket; pthread_mutex_lock(&thread_pool_create_mutex); ap_create_context(&tpool, thread_pool_parent); @@ -955,8 +944,7 @@ pthread_mutex_unlock(&idle_thread_count_mutex); break; } -ap_get_os_sock(&native_socket, csd); -process_socket(ptrans, &sa_client, native_socket, conn_id); +process_socket(ptrans, csd, conn_id); ap_clear_pool(ptrans); requests_this_child--; }
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/25 23:15:59 Modified:src/main buff.c Log: More elimination of errno in buff. Now, everything under ap_bwrite is errno-free. ap_bwrite doesn't use errno, excpet for exporting its old interface. Revision ChangesPath 1.15 +49 -41apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- buff.c1999/10/26 05:24:50 1.14 +++ buff.c1999/10/26 06:15:59 1.15 @@ -606,16 +606,13 @@ /* write the contents of fb->outbase, and buf, stop at first partial write for a non-blocking buff - - return number of bytes of buf which were written - -1 for errors */ -static int large_write(BUFF *fb, const char *buf, int nbyte) +static ap_status_t large_write(BUFF *fb, const char *buf, ap_size_t nbyte, + ap_ssize_t *bytes_written) { struct iovec vec[2]; int nvec; ap_status_t rv; -ap_ssize_t bytes_written; ap_assert(nbyte > 0); if (fb->outcnt) { @@ -630,64 +627,64 @@ vec[0].iov_len = nbyte; nvec = 1; } -rv = writev_it_all(fb, vec, nvec, &bytes_written); -if (bytes_written == 0) { /* error or eof */ -if (rv == APR_SUCCESS) { - return 0; -} -errno = rv; -return -1; +rv = writev_it_all(fb, vec, nvec, bytes_written); +if (*bytes_written == 0) { /* error or eof */ +return rv; } -if (bytes_written < fb->outcnt) { +if (*bytes_written < fb->outcnt) { /* shift bytes forward in buffer */ - fb->outcnt -= bytes_written; - memmove(fb->outbase, fb->outbase + bytes_written, fb->outcnt); - return 0; + fb->outcnt -= *bytes_written; + memmove(fb->outbase, fb->outbase + *bytes_written, fb->outcnt); +*bytes_written = 0; + return APR_SUCCESS; } -bytes_written -= fb->outcnt; +*bytes_written -= fb->outcnt; fb->outcnt = 0; -return bytes_written; +return APR_SUCCESS; } -static int large_write_chunk(BUFF *fb, const char *buf, int nbyte) +static ap_status_t large_write_chunk(BUFF *fb, const char *buf, ap_size_t nbyte, + ap_ssize_t *bytes_written) { -int rv; -int amt; -int total; +ap_status_t rv; +ap_ssize_t total, n, amt; ap_assert(nbyte > 0); if (fb->chunk_overcommit) { amt = nbyte > fb->chunk_overcommit ? fb->chunk_overcommit : nbyte; - rv = large_write(fb, buf, amt); - if (rv <= 0) { - return rv; + rv = large_write(fb, buf, amt, &total); + if (total == 0) { /* error or eof */ +*bytes_written = total; +return rv; } - fb->chunk_overcommit -= rv; + fb->chunk_overcommit -= total; if (fb->chunk_overcommit == 0) { fb->outbase[0] = '\015'; fb->outbase[1] = '\012'; fb->outcnt = 2; start_chunk(fb); } - if (rv < amt || amt == nbyte) { - return rv; + if (total < amt || amt == nbyte) { +*bytes_written = total; + return APR_SUCCESS; } - nbyte -= rv; - buf += rv; + nbyte -= total; + buf += total; } ap_assert(fb->chunk_overcommit == 0 && fb->outchunk != -1); total = 0; do { amt = end_chunk(fb, nbyte); - rv = large_write(fb, buf, amt); - if (rv < amt) { - if (rv < 0) { - fb->chunk_overcommit = amt; - return total ? total : -1; - } - fb->chunk_overcommit = amt - rv; - return total + rv; + rv = large_write(fb, buf, amt, &n); + if (n < amt) { + fb->chunk_overcommit = amt - n; +*bytes_written = total + n; +#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH +return rv; +#else +return *bytes_written ? APR_SUCCESS : rv; +#endif } fb->outbase[0] = '\015'; fb->outbase[1] = '\012'; @@ -697,7 +694,8 @@ buf += amt; total += amt; } while (nbyte); -return total; +*bytes_written = total; +return APR_SUCCESS; } /* A wrapper for write which deals with error conditions and @@ -777,10 +775,20 @@ */ if (!(fb->flags & B_WR) || (nbyte > LARGE_WRITE_THRESHOLD && nbyte + fb->outcnt >= fb->bufsiz)) { +ap_status_t rv; +ap_ssize_t n; + if (f
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/26 13:43:52 Modified:src/main buff.c Log: Fix some (probably) inconsequential mistakes in ap_bsetopt. Revision ChangesPath 1.16 +2 -2 apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -u -r1.15 -r1.16 --- buff.c1999/10/26 06:15:59 1.15 +++ buff.c1999/10/26 20:43:46 1.16 @@ -197,12 +197,12 @@ ap_register_cleanup(fb->pool, fb, bcleanup, bcleanup); } -API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) +API_EXPORT(ap_status_t) ap_bsetopt(BUFF *fb, int optname, const void *optval) { switch (optname) { case BO_BYTECT: fb->bytes_sent = *(const long int *) optval - (long int) fb->outcnt; - return 0; + return APR_SUCCESS; case BO_TIMEOUT: fb->flags &= ~B_NONBLOCK;
cvs commit: apache-2.0/src Configuration.mpm
manoj 99/10/26 15:05:41 Modified:src Configuration.mpm Log: The -lapr is redundant. Revision ChangesPath 1.18 +1 -1 apache-2.0/src/Configuration.mpm Index: Configuration.mpm === RCS file: /home/cvs/apache-2.0/src/Configuration.mpm,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -u -r1.17 -r1.18 --- Configuration.mpm 1999/10/26 01:58:56 1.17 +++ Configuration.mpm 1999/10/26 22:05:38 1.18 @@ -2,7 +2,7 @@ # mpmt_pthread MPM (-pthread in EXTRA_CFLAGS on Linux) EXTRA_CFLAGS= -Wall -pthread EXTRA_LDFLAGS= -EXTRA_LIBS= -lpthread -L$(SRCDIR)/lib/apr -lapr +EXTRA_LIBS= -lpthread EXTRA_INCLUDES= EXTRA_DEPS= #CC=
cvs commit: apache-2.0/src/main http_protocol.c
manoj 99/10/26 15:15:20 Modified:src/main http_protocol.c Log: One ap_bflush to the client wasn't checked. Now fixed. Revision ChangesPath 1.25 +4 -2 apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -u -r1.24 -r1.25 --- http_protocol.c 1999/10/24 19:23:58 1.24 +++ http_protocol.c 1999/10/26 22:15:16 1.25 @@ -2072,7 +2072,7 @@ char buf[IOBUFSIZE]; long total_bytes_sent = 0; long zero_timeout = 0; -int n, w, rc, o; +int n, w, o; if (length == 0) { return 0; @@ -2096,7 +2096,9 @@ break; } /* next read will block, so flush the client now */ -rc = ap_bflush(r->connection->client); +if (ap_rflush(r) == EOF) { +break; +} ap_bsetopt(fb, BO_TIMEOUT, &r->server->timeout); n = ap_bread(fb, buf, sizeof(buf));
cvs commit: apache-2.0/src/main buff.c http_connection.c http_protocol.c
manoj 99/10/26 15:25:03 Modified:src CHANGES src/main buff.c http_connection.c http_protocol.c Log: ap_bflush and ap_bclose now return ap_status_t error codes instead of returning -1 and setting errno. Revision ChangesPath 1.13 +3 -0 apache-2.0/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -u -r1.12 -r1.13 --- CHANGES 1999/10/23 21:20:15 1.12 +++ CHANGES 1999/10/26 22:25:00 1.13 @@ -1,5 +1,8 @@ Changes with Apache 2.0-dev + *) ap_bflush and ap_bclose now return ap_status_t error codes instead + of returning -1 and setting errno. [Manoj Kasichainula] + *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and interface adaption to APR functions did it. [Martin Kraemer] 1.17 +36 -37apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -u -r1.16 -r1.17 --- buff.c1999/10/26 20:43:46 1.16 +++ buff.c1999/10/26 22:25:01 1.17 @@ -718,32 +718,36 @@ } -static int bflush_core(BUFF *fb) +static ap_status_t bflush_core(BUFF *fb, ap_ssize_t *bytes_written) { -int total; -ap_ssize_t bytes_written; +ap_status_t rv; +ap_ssize_t n; if (fb->flags & B_CHUNK) { end_chunk(fb, 0); } -total = 0; +*bytes_written = 0; while (fb->outcnt > 0) { - (void) write_with_errors(fb, fb->outbase + total, fb->outcnt, - &bytes_written); - if (bytes_written <= 0) { /* error or eof */ - if (total) { - memmove(fb->outbase, fb->outbase + total, fb->outcnt); - return total; + rv = write_with_errors(fb, fb->outbase + *bytes_written, fb->outcnt, + &n); + if (n <= 0) { /* error or eof */ + if (*bytes_written) { + memmove(fb->outbase, fb->outbase + *bytes_written, fb->outcnt); +#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH +return rv; +#else + return APR_SUCCESS; +#endif } - return -1; + return rv; } - fb->outcnt -= bytes_written; - total += bytes_written; + fb->outcnt -= n; + *bytes_written += n; } if (fb->flags & B_CHUNK) { start_chunk(fb); } -return total; +return APR_SUCCESS; } @@ -758,6 +762,8 @@ { int amt; int total; +ap_ssize_t n; +ap_status_t rv; if (fb->flags & (B_WRERR | B_EOUT)) { errno = fb->saved_errno; @@ -775,7 +781,6 @@ */ if (!(fb->flags & B_WR) || (nbyte > LARGE_WRITE_THRESHOLD && nbyte + fb->outcnt >= fb->bufsiz)) { -ap_status_t rv; ap_ssize_t n; if (fb->flags & B_CHUNK) { @@ -799,7 +804,8 @@ fb->outcnt += amt; buf = (const char *) buf + amt; nbyte -= amt; - if (bflush_core(fb) < amt) { +(void) bflush_core(fb, &n); + if (n < amt) { return amt; } total = amt; @@ -812,18 +818,18 @@ /* * Flushes the buffered stream. - * Returns 0 on success or -1 on error */ -API_EXPORT(int) ap_bflush(BUFF *fb) +API_EXPORT(ap_status_t) ap_bflush(BUFF *fb) { -int ret; - -if ((fb->flags & (B_WRERR | B_EOUT | B_WR)) != B_WR) - return -1; - -ret = bflush_core(fb); +ap_ssize_t n; /* Placeholder; not ever used */ -return ret; +if ((fb->flags & (B_EOUT | B_WR)) != B_WR) { +return APR_EINVAL; +} +if ((fb->flags & B_WRERR) != 0) { +return fb->saved_errno; +} +return bflush_core(fb, &n); } /* @@ -832,23 +838,16 @@ * Sets the EOF flag to indicate no futher data can be read, * and the EOUT flag to indicate no further data can be written. */ -API_EXPORT(int) ap_bclose(BUFF *fb) +API_EXPORT(ap_status_t) ap_bclose(BUFF *fb) { -int rc1, rc2; +ap_status_t rc1, rc2; if (fb->flags & B_WR) rc1 = ap_bflush(fb); else - rc1 = 0; + rc1 = APR_SUCCESS; ap_kill_cleanup(fb->pool, fb, bcleanup); rc2 = iol_close(fb->iol); -if (rc2 == APR_SUCCESS) { -rc2 = 0; -} -else { -errno = rc2; -rc2 = -1; -} fb->inptr = fb->inbase; fb->incnt =
cvs commit: apache-2.0/src/main buff.c
manoj 99/10/26 15:42:51 Modified:src CHANGES src/include buff.h src/main buff.c Log: Error functions recorded with ap_bonerror now take a status code as an argument, so errno isn't needed. Revision ChangesPath 1.14 +3 -1 apache-2.0/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- CHANGES 1999/10/26 22:25:00 1.13 +++ CHANGES 1999/10/26 22:42:33 1.14 @@ -1,7 +1,9 @@ Changes with Apache 2.0-dev *) ap_bflush and ap_bclose now return ap_status_t error codes instead - of returning -1 and setting errno. [Manoj Kasichainula] + of returning -1 and setting errno. And error functions recorded + with ap_bonerror now take a status code as an argument. [Manoj + Kasichainula] *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and interface adaption to APR functions did it. [Martin Kraemer] 1.5 +5 -4 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- buff.h1999/10/22 22:08:11 1.4 +++ buff.h1999/10/26 22:42:41 1.5 @@ -128,7 +128,7 @@ struct buff_struct { int flags; /* flags */ -int saved_errno; /* saved errno */ +ap_status_t saved_errno; /* saved errno */ unsigned char *inptr;/* pointer to next location to read */ int incnt; /* number of bytes left to read from input buffer; * always 0 if had a read error */ @@ -141,7 +141,7 @@ * keep track of the #remaining bytes in the chunk * here */ -void (*error) (BUFF *fb, int op, void *data); +void (*error) (BUFF *fb, int op, void *data, ap_status_t errnum); void *error_data; long int bytes_sent; /* number of bytes actually written */ @@ -177,8 +177,9 @@ #define ap_bgetflag(fb, flag)((fb)->flags & (flag)) /* Error handling */ -API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *), - void *data); +API_EXPORT(void) ap_bonerror(BUFF *fb, + void (*error) (BUFF *, int, void *, ap_status_t), + void *data); /* I/O */ API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte); 1.18 +4 -5 apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -u -r1.17 -r1.18 --- buff.c1999/10/26 22:25:01 1.17 +++ buff.c1999/10/26 22:42:46 1.18 @@ -136,11 +136,9 @@ static void doerror(BUFF *fb, int direction) { -/* TODO: doerror should look at fb->saved_errno instead of errno */ -errno = fb->saved_errno; fb->flags |= (direction == B_RD ? B_RDERR : B_WRERR); if (fb->error != NULL) - (*fb->error) (fb, direction, fb->error_data); + (*fb->error) (fb, direction, fb->error_data, fb->saved_errno); } /* Buffering routines */ @@ -901,8 +899,9 @@ return k; } -API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *), - void *data) +API_EXPORT(void) ap_bonerror(BUFF *fb, + void (*error) (BUFF *, int, void *, ap_status_t), + void *data) { fb->error = error; fb->error_data = data;
cvs commit: apache-2.0/src/include buff.h
manoj 99/10/26 15:53:57 Modified:src/include buff.h Log: Prototypes changed slightly for ap_bclose and ap_bflush. Revision ChangesPath 1.6 +2 -2 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- buff.h1999/10/26 22:42:41 1.5 +++ buff.h1999/10/26 22:53:55 1.6 @@ -172,7 +172,7 @@ API_EXPORT(ap_status_t) ap_bsetopt(BUFF *fb, int optname, const void *optval); API_EXPORT(ap_status_t) ap_bgetopt(BUFF *fb, int optname, void *optval); API_EXPORT(int) ap_bsetflag(BUFF *fb, int flag, int value); -API_EXPORT(int) ap_bclose(BUFF *fb); +API_EXPORT(ap_status_t) ap_bclose(BUFF *fb); #define ap_bgetflag(fb, flag)((fb)->flags & (flag)) @@ -186,7 +186,7 @@ API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); API_EXPORT(int) ap_blookc(BUFF *fb); API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); -API_EXPORT(int) ap_bflush(BUFF *fb); +API_EXPORT(ap_status_t) ap_bflush(BUFF *fb); API_EXPORT(int) ap_bputs(const char *x, BUFF *fb); API_EXPORT(int) ap_bvputs(BUFF *fb,...); API_EXPORT_NONSTD(int) ap_bprintf(BUFF *fb, const char *fmt,...)
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/10/26 23:11:22 Modified:src/modules/mpm/dexter dexter.c src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Only process a connection if we've actually accepted one. Revision ChangesPath 1.48 +2 -2 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.47 retrieving revision 1.48 diff -u -d -u -r1.47 -r1.48 --- dexter.c 1999/10/26 06:07:36 1.47 +++ dexter.c 1999/10/27 06:11:19 1.48 @@ -936,6 +936,8 @@ } } pthread_mutex_unlock(&idle_thread_count_mutex); +process_socket(ptrans, csd, conn_id); +requests_this_child--; } else { SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); @@ -944,9 +946,7 @@ pthread_mutex_unlock(&idle_thread_count_mutex); break; } -process_socket(ptrans, csd, conn_id); ap_clear_pool(ptrans); -requests_this_child--; } ap_destroy_pool(tpool); 1.42 +2 -2 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.41 retrieving revision 1.42 diff -u -d -u -r1.41 -r1.42 --- mpmt_pthread.c1999/10/26 06:05:38 1.41 +++ mpmt_pthread.c1999/10/27 06:11:21 1.42 @@ -879,15 +879,15 @@ ap_accept(&csd, sd, ptrans); SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); +process_socket(ptrans, csd, process_slot, thread_slot); +requests_this_child--; } else { SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); break; } -process_socket(ptrans, csd, process_slot, thread_slot); ap_clear_pool(ptrans); -requests_this_child--; } ap_destroy_pool(tpool);
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/26 23:16:49 Modified:src/modules/mpm/dexter dexter.c Log: A little bit of error logging to help with debugging. Revision ChangesPath 1.49 +9 -2 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.48 retrieving revision 1.49 diff -u -d -u -r1.48 -r1.49 --- dexter.c 1999/10/27 06:11:19 1.48 +++ dexter.c 1999/10/27 06:16:48 1.49 @@ -743,8 +743,11 @@ conn_rec *current_conn; ap_iol *iol; int csd; +ap_status_t rv; -ap_get_os_sock(&csd, sock); +if ((rv = ap_get_os_sock(&csd, sock)) != APR_SUCCESS) { +ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_get_os_sock"); +} sock_disable_nagle(csd); iol = unix_attach_socket(csd); @@ -923,7 +926,11 @@ } got_fd: if (!workers_may_exit) { -ap_accept(&csd, sd, ptrans); +ap_status_t rv; + +if ((rv = ap_accept(&csd, sd, ptrans)) != APR_SUCCESS) { +ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_accept"); +} SAFE_ACCEPT(accept_mutex_off(0)); SAFE_ACCEPT(intra_mutex_off(0)); pthread_mutex_lock(&idle_thread_count_mutex);
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/29 13:43:06 Modified:src/modules/mpm/dexter dexter.c Log: Fix a couple of pool-related bugs that may or may not be causing actual problems. This makes sure that all interactions with the thread_pool_parent are mutexed, and makes ap_put_os_sock use the correct pool in worker_thread(). Revision ChangesPath 1.50 +8 -6 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.49 retrieving revision 1.50 diff -u -d -u -r1.49 -r1.50 --- dexter.c 1999/10/27 06:16:48 1.49 +++ dexter.c 1999/10/29 20:42:49 1.50 @@ -162,7 +162,7 @@ static ap_context_t *pconf; /* Pool for config stuff */ static ap_context_t *pchild; /* Pool for httpd child stuff */ static ap_context_t *thread_pool_parent; /* Parent of per-thread pools */ -static pthread_mutex_t thread_pool_create_mutex; +static pthread_mutex_t thread_pool_parent_mutex; static int child_num; static int my_pid; /* Linux getpid() doesn't work except in main thread. Use @@ -852,9 +852,9 @@ int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; -pthread_mutex_lock(&thread_pool_create_mutex); +pthread_mutex_lock(&thread_pool_parent_mutex); ap_create_context(&tpool, thread_pool_parent); -pthread_mutex_unlock(&thread_pool_create_mutex); +pthread_mutex_unlock(&thread_pool_parent_mutex); ap_create_context(&ptrans, tpool); while (!workers_may_exit) { @@ -918,7 +918,7 @@ /* XXX: Should we check for POLLERR? */ if (listenfds[curr_pollfd].revents & POLLIN) { last_pollfd = curr_pollfd; -ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, tpool); +ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, ptrans); goto got_fd; } } while (curr_pollfd != last_pollfd); @@ -956,7 +956,9 @@ ap_clear_pool(ptrans); } -ap_destroy_pool(tpool); +pthread_mutex_lock(&thread_pool_parent_mutex); +ap_destroy_context(tpool); +pthread_mutex_unlock(&thread_pool_parent_mutex); pthread_mutex_lock(&worker_thread_count_mutex); worker_thread_count--; worker_thread_free_ids[worker_thread_count] = thread_num; @@ -1026,7 +1028,7 @@ worker_thread_free_ids[i] = i; } ap_create_context(&thread_pool_parent, pchild); -pthread_mutex_init(&thread_pool_create_mutex, NULL); +pthread_mutex_init(&thread_pool_parent_mutex, NULL); pthread_mutex_init(&idle_thread_count_mutex, NULL); pthread_mutex_init(&worker_thread_count_mutex, NULL); pthread_mutex_init(&pipe_of_death_mutex, NULL);
cvs commit: apache-2.0/src/lib/apr/lib apr_pools.c
manoj 99/10/29 14:52:33 Modified:src/lib/apr/lib apr_pools.c Log: Make -DALLOC_USE_MALLOC work for APR's pools. Revision ChangesPath 1.20 +5 -1 apache-2.0/src/lib/apr/lib/apr_pools.c Index: apr_pools.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/lib/apr_pools.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -u -r1.19 -r1.20 --- apr_pools.c 1999/10/13 17:45:16 1.19 +++ apr_pools.c 1999/10/29 21:52:32 1.20 @@ -765,11 +765,15 @@ API_EXPORT(void *) ap_palloc(struct context_t *c, int reqsize) { #ifdef ALLOC_USE_MALLOC -ap_pool_t *a = c->pool; +ap_pool_t *a; int size = reqsize + CLICK_SZ; void *ptr; ap_block_alarms(); +if (c == NULL) { +return malloc(reqsize); +} +a = c->pool; ptr = malloc(size); if (ptr == NULL) { fputs("Ouch! Out of memory!\n", stderr);
cvs commit: apache-2.0/src/os/unix iol_socket.c
manoj 99/10/29 17:25:31 Modified:src/os/unix iol_socket.c Log: Fix a horrible bug causing all sorts of insanely weird file descriptor bugs. Both APR (during pool cleanup) and IOL (triggered by bclose) were trying to close the same socket. As a temporary hack, this patch makes the socket's iol_close a no-op, so that buff doesn't actually close the socket. Revision ChangesPath 1.10 +8 -0 apache-2.0/src/os/unix/iol_socket.c Index: iol_socket.c === RCS file: /home/cvs/apache-2.0/src/os/unix/iol_socket.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- iol_socket.c 1999/10/26 05:29:40 1.9 +++ iol_socket.c 1999/10/30 00:25:31 1.10 @@ -207,6 +207,13 @@ static ap_status_t unix_close(ap_iol *viol) { + +/* XXX: This is a *temporary* ultra-hack solution to the double-close problem. + * APR and buff were both trying to close this socket */ + +return APR_SUCCESS; + +#if 0 iol_socket *iol = (iol_socket *)viol; int rv; int saved_errno; @@ -218,6 +225,7 @@ return APR_SUCCESS; } return saved_errno; +#endif } static const ap_iol_methods socket_methods = {
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/10/29 18:49:54 Modified:src/modules/mpm/dexter dexter.c Log: Force ap_put_os_sock() to create a new ap_socket_t by presetting what's passed in to NULL. Revision ChangesPath 1.51 +1 -0 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -u -r1.50 -r1.51 --- dexter.c 1999/10/29 20:42:49 1.50 +++ dexter.c 1999/10/30 01:49:53 1.51 @@ -918,6 +918,7 @@ /* XXX: Should we check for POLLERR? */ if (listenfds[curr_pollfd].revents & POLLIN) { last_pollfd = curr_pollfd; +sd = NULL; ap_put_os_sock(&sd, &listenfds[curr_pollfd].fd, ptrans); goto got_fd; }
cvs commit: apache-2.0/src/main listen.c
manoj 99/10/29 18:56:36 Modified:src/main listen.c Log: Get rid of an implicit malloc, by making ap_create_tcp_socket use the process context. Revision ChangesPath 1.17 +1 -2 apache-2.0/src/main/listen.c Index: listen.c === RCS file: /home/cvs/apache-2.0/src/main/listen.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -u -r1.16 -r1.17 --- listen.c 1999/10/24 05:59:18 1.16 +++ listen.c 1999/10/30 01:56:35 1.17 @@ -176,10 +176,9 @@ } /* this has to survive restarts */ -/* XXX - We need to deal with freeing this structure properly. */ new = ap_palloc(process->pool, sizeof(ap_listen_rec)); new->active = 0; -if ((status = ap_create_tcp_socket(&new->sd, NULL)) != APR_SUCCESS) { +if ((status = ap_create_tcp_socket(&new->sd, process->pool)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, status, NULL, "make_sock: failed to get a socket for %s", addr); return;
cvs commit: apache-2.0/src/modules/standard mod_echo.c mod_mime_magic.c
manoj 99/10/29 19:06:35 Modified:src CHANGES src/include buff.h src/main buff.c http_protocol.c src/modules/standard mod_echo.c mod_mime_magic.c Log: Change ap_bread's interface to no longer require errno. Revision ChangesPath 1.15 +2 -4 apache-2.0/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- CHANGES 1999/10/26 22:42:33 1.14 +++ CHANGES 1999/10/30 02:06:31 1.15 @@ -1,9 +1,7 @@ Changes with Apache 2.0-dev - *) ap_bflush and ap_bclose now return ap_status_t error codes instead - of returning -1 and setting errno. And error functions recorded - with ap_bonerror now take a status code as an argument. [Manoj - Kasichainula] + *) Large sections of buff, including the APIs, have been converted to + no longer use errno. [Manoj Kasichainula] *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and interface adaption to APR functions did it. [Martin Kraemer] 1.7 +2 -1 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- buff.h1999/10/26 22:53:55 1.6 +++ buff.h1999/10/30 02:06:32 1.7 @@ -182,7 +182,8 @@ void *data); /* I/O */ -API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte); +API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte, + ap_ssize_t *bytes_read); API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); API_EXPORT(int) ap_blookc(BUFF *fb); API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); 1.19 +35 -24apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -u -r1.18 -r1.19 --- buff.c1999/10/26 22:42:46 1.18 +++ buff.c1999/10/30 02:06:32 1.19 @@ -334,19 +334,21 @@ /* * Read up to nbyte bytes into buf. * If fewer than byte bytes are currently available, then return those. - * Returns 0 for EOF, -1 for error. */ -API_EXPORT(int) ap_bread(BUFF *fb, void *buf, int nbyte) +API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte, + ap_ssize_t *bytes_read) { int i, nrd; ap_status_t rv; if (fb->flags & B_RDERR) { - errno = fb->saved_errno; - return -1; +*bytes_read = 0; + return fb->saved_errno; } -if (nbyte == 0) - return 0; +if (nbyte == 0) { +*bytes_read = 0; + return APR_SUCCESS; +} if (!(fb->flags & B_RD)) { /* Unbuffered reading. First check if there was something in the @@ -356,14 +358,10 @@ memcpy(buf, fb->inptr, i); fb->incnt -= i; fb->inptr += i; - return i; +*bytes_read = i; + return APR_SUCCESS; } - rv = read_with_errors(fb, buf, nbyte, &i); -if (rv == APR_SUCCESS) { -return i; -} -errno = rv; -return -1; + return read_with_errors(fb, buf, nbyte, bytes_read); } nrd = fb->incnt; @@ -372,7 +370,8 @@ memcpy(buf, fb->inptr, nbyte); fb->incnt = nrd - nbyte; fb->inptr += nbyte; - return nbyte; +*bytes_read = nbyte; + return APR_SUCCESS; } if (nrd > 0) { @@ -381,16 +380,22 @@ buf = nrd + (char *) buf; fb->incnt = 0; } -if (fb->flags & B_EOF) - return nrd; +if (fb->flags & B_EOF) { +*bytes_read = nrd; + return APR_SUCCESS; +} /* do a single read */ if (nbyte >= fb->bufsiz) { /* read directly into caller's buffer */ rv = read_with_errors(fb, buf, nbyte, &i); if (rv != APR_SUCCESS) { -errno = rv; - return nrd ? nrd : -1; +*bytes_read = nrd; +#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH +return rv; +#else + return *bytes_read ? APR_SUCCESS : rv; +#endif } } else { @@ -398,8 +403,12 @@ fb->inptr = fb->inbase; rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); if (rv != APR_SUCCESS) { -errno = rv; - return nrd ? nrd : -1; +
cvs commit: apache-2.0/src/modules/standard mod_cgi.c mod_echo.c
manoj 99/10/29 22:25:33 Modified:src/include buff.h src/main buff.c http_protocol.c src/modules/standard mod_cgi.c mod_echo.c Log: ap_bwrite now exports an errnoless interface. Revision ChangesPath 1.8 +3 -2 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- buff.h1999/10/30 02:06:32 1.7 +++ buff.h1999/10/30 05:25:28 1.8 @@ -78,7 +78,7 @@ non-blocking, unbuffered non-blocking, unbuffered, HTTP-chunked -In all the blocking modes, a bwrite(fb, buf, len) will return less +In all the blocking modes, a bwrite(fb, buf, len) will write less than len only in an error state. The error may be deferred until the next use of fb. @@ -186,7 +186,8 @@ ap_ssize_t *bytes_read); API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); API_EXPORT(int) ap_blookc(BUFF *fb); -API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte); +API_EXPORT(ap_status_t) ap_bwrite(BUFF *fb, const void *buf, ap_size_t nbyte, + ap_ssize_t *bytes_written); API_EXPORT(ap_status_t) ap_bflush(BUFF *fb); API_EXPORT(int) ap_bputs(const char *x, BUFF *fb); API_EXPORT(int) ap_bvputs(BUFF *fb,...); 1.20 +24 -20apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -u -r1.19 -r1.20 --- buff.c1999/10/30 02:06:32 1.19 +++ buff.c1999/10/30 05:25:29 1.20 @@ -529,9 +529,16 @@ API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb) { char ss[1]; +ap_ssize_t bytes_written; +ap_status_t rv; ss[0] = c; -return ap_bwrite(fb, ss, 1); +rv = ap_bwrite(fb, ss, 1, &bytes_written); +if (rv == APR_SUCCESS) { +return bytes_written; +} +errno = rv; +return -1; } /* @@ -767,19 +774,21 @@ * It is worth noting that if an error occurs, the buffer is in an unknown * state. */ -API_EXPORT(int) ap_bwrite(BUFF *fb, const void *buf, int nbyte) +API_EXPORT(ap_status_t) ap_bwrite(BUFF *fb, const void *buf, ap_size_t nbyte, + ap_ssize_t *bytes_written) { int amt; int total; ap_ssize_t n; -ap_status_t rv; if (fb->flags & (B_WRERR | B_EOUT)) { - errno = fb->saved_errno; - return -1; +*bytes_written = 0; + return fb->saved_errno; } -if (nbyte == 0) - return 0; +if (nbyte == 0) { +*bytes_written = 0; + return APR_SUCCESS; +} /* * Detect case where we're asked to write a large buffer, and combine our @@ -790,19 +799,12 @@ */ if (!(fb->flags & B_WR) || (nbyte > LARGE_WRITE_THRESHOLD && nbyte + fb->outcnt >= fb->bufsiz)) { -ap_ssize_t n; - if (fb->flags & B_CHUNK) { - rv = large_write_chunk(fb, buf, nbyte, &n); + return large_write_chunk(fb, buf, nbyte, bytes_written); } else { - rv = large_write(fb, buf, nbyte, &n); -} -if (rv == APR_SUCCESS) { -return n; + return large_write(fb, buf, nbyte, bytes_written); } -errno = rv; -return -1; } /* at this point we know that nbyte < fb->bufsize */ @@ -815,14 +817,16 @@ nbyte -= amt; (void) bflush_core(fb, &n); if (n < amt) { - return amt; +*bytes_written = amt; +return APR_SUCCESS; } total = amt; } /* now we know that nbyte < fb->bufsiz */ memcpy(fb->outbase + fb->outcnt, buf, nbyte); fb->outcnt += nbyte; -return total + nbyte; +*bytes_written = total + nbyte; +return APR_SUCCESS; } /* @@ -875,7 +879,7 @@ API_EXPORT(int) ap_bputs(const char *x, BUFF *fb) { int i, j = strlen(x); -i = ap_bwrite(fb, x, j); +(void) ap_bwrite(fb, x, j, &i); if (i != j) return -1; else @@ -897,7 +901,7 @@ if (x == NULL) break; j = strlen(x); - i = ap_bwrite(fb, x, j); + (void) ap_bwrite(fb, x, j, &i); if (i != j) { va_end(v); return -1; 1.28 +27 -21apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-
cvs commit: apache-2.0/src/os/unix Makefile.tmpl
manoj 99/10/29 22:59:32 Modified:src Makefile.tmpl src/ap Makefile.tmpl src/lib/apr/lib Makefile.in src/lib/apr/locks/unix Makefile.in src/lib/apr/mmap/unix Makefile.in src/lib/apr/network_io/unix Makefile.in src/lib/apr/threadproc/unix Makefile.in src/main Makefile.tmpl src/modules/mpm/dexter Makefile.tmpl src/modules/mpm/mpmt_pthread Makefile.tmpl src/modules/mpm/prefork Makefile.tmpl src/modules/standard Makefile.tmpl src/os/unix Makefile.tmpl Log: Remake the unix dependencies. Revision ChangesPath 1.10 +8 -8 apache-2.0/src/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/Makefile.tmpl,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- Makefile.tmpl 1999/09/27 07:25:06 1.9 +++ Makefile.tmpl 1999/10/30 05:59:19 1.10 @@ -123,16 +123,16 @@ # DO NOT REMOVE buildmark.o: buildmark.c include/ap_config.h include/ap_mmn.h \ include/ap_config_auto.h os/unix/os.h os/unix/os-inline.c \ - include/ap_ctype.h include/httpd.h lib/apr/include/apr_general.h \ - lib/apr/include/apr_config.h lib/apr/include/apr_errno.h \ - lib/apr/include/apr_lib.h lib/apr/include/apr_file_io.h \ - include/buff.h include/ap_iol.h \ + include/ap_ctype.h include/hsregex.h include/httpd.h \ + lib/apr/include/apr_general.h lib/apr/include/apr_config.h \ + lib/apr/include/apr_errno.h lib/apr/include/apr_lib.h \ + lib/apr/include/apr_file_io.h include/buff.h include/ap_iol.h \ include/ap.h include/apr.h include/util_uri.h modules.o: modules.c include/httpd.h include/ap_config.h \ include/ap_mmn.h include/ap_config_auto.h os/unix/os.h \ - os/unix/os-inline.c include/ap_ctype.h lib/apr/include/apr_general.h \ - lib/apr/include/apr_config.h lib/apr/include/apr_errno.h \ - lib/apr/include/apr_lib.h lib/apr/include/apr_file_io.h \ - include/buff.h include/ap_iol.h \ + os/unix/os-inline.c include/ap_ctype.h include/hsregex.h \ + lib/apr/include/apr_general.h lib/apr/include/apr_config.h \ + lib/apr/include/apr_errno.h lib/apr/include/apr_lib.h \ + lib/apr/include/apr_file_io.h include/buff.h include/ap_iol.h \ include/ap.h include/apr.h include/util_uri.h include/http_config.h \ include/ap_hooks.h 1.8 +42 -35apache-2.0/src/ap/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/ap/Makefile.tmpl,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- Makefile.tmpl 1999/09/27 07:19:47 1.7 +++ Makefile.tmpl 1999/10/30 05:59:20 1.8 @@ -40,71 +40,78 @@ # DO NOT REMOVE ap_base64.o: ap_base64.c $(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)/ap.h $(INCDIR)/apr.h + $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h $(INCDIR)/ap.h \ + $(INCDIR)/apr.h ap_buf.o: ap_buf.c ap_checkpass.o: ap_checkpass.c $(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)/ap_md5.h \ - $(INCDIR)/ap_sha1.h $(INCDIR)/ap.h $(INCDIR)/apr.h + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ + $(INCDIR)/ap_md5.h $(INCDIR)/ap_sha1.h $(INCDIR)/ap.h \ + $(INCDIR)/apr.h ap_cpystrn.o: ap_cpystrn.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 \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h + ../lib/apr/include/apr_file_io.h $(INCDIR)/buff.h \ + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h $(INCDIR)/apr.h \ + $(INCDIR)/util_uri.h ap_execve.o: ap_execve.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 \ + $(OSDIR)/os-inline.c $(INCDIR)/ap_ctype.h $(INCDIR)/hsregex.h \ ../lib/apr/include/apr_general.h ../lib/apr/include/apr_config.h \ ../lib/apr/include/apr_errno.h ../lib/apr/include/apr_lib.h \ - ../lib/apr/include/apr_file_io.h \ - $(INCDIR)/buff.h $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h + ../lib/apr/include/apr_file_io.h $(INCDIR)/buff.h \ + $(INCDIR)/ap_iol.h $(INCDIR)/ap.h $(INCDIR)/apr.h \ + $(INCDIR)/util_uri.h
cvs commit: apache-2.0/src/modules/standard mod_cgi.c
manoj 99/10/30 01:05:10 Modified:src/include buff.h src/main buff.c http_protocol.c util_script.c src/modules/standard mod_cgi.c Log: An errnoless interface for ap_bgets Revision ChangesPath 1.9 +2 -1 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- buff.h1999/10/30 05:25:28 1.8 +++ buff.h1999/10/30 08:05:07 1.9 @@ -184,7 +184,8 @@ /* I/O */ API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte, ap_ssize_t *bytes_read); -API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); +API_EXPORT(ap_status_t) ap_bgets(char *s, int n, BUFF *fb, + ap_ssize_t *bytes_read); API_EXPORT(int) ap_blookc(BUFF *fb); API_EXPORT(ap_status_t) ap_bwrite(BUFF *fb, const void *buf, ap_size_t nbyte, ap_ssize_t *bytes_written); 1.21 +21 -10apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -u -r1.20 -r1.21 --- buff.c1999/10/30 05:25:29 1.20 +++ buff.c1999/10/30 08:05:08 1.21 @@ -429,8 +429,11 @@ * read, it is replaced by a newline character. The string is then * terminated with a null character. * - * Returns the number of bytes stored in buff, or zero on end of - * transmission, or -1 on an error. + * Works a little differently than the other BUFF functions, returning + * APR_EOF on end-of-file instead of just setting bytes_read = 0, + * because it makes code simpler. + * + * XXX - I'm undecided on keeping this function inconsistent - manoj * * Notes: * If null characters are expected in the data stream, then @@ -440,19 +443,20 @@ * CR characters in the byte stream not immediately followed by a LF * will be preserved. */ -API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb) +API_EXPORT(ap_status_t) ap_bgets(char *buff, int n, BUFF *fb, + ap_ssize_t *bytes_read) { int i, ch, ct; ap_status_t rv; /* Can't do bgets on an unbuffered stream */ if (!(fb->flags & B_RD)) { - errno = EINVAL; - return -1; +*bytes_read = 0; + return APR_EINVAL; } if (fb->flags & B_RDERR) { - errno = fb->saved_errno; - return -1; +*bytes_read = 0; + return fb->saved_errno; } ct = 0; @@ -466,9 +470,13 @@ break; rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); if (rv != APR_SUCCESS) { -errno = rv; buff[ct] = '\0'; - return ct ? ct : -1; +*bytes_read = ct; +#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH +return rv; +#else + return *bytes_read ? APR_SUCCESS : rv; +#endif } fb->incnt = i; if (i == 0) @@ -501,7 +509,10 @@ fb->inptr += i; buff[ct] = '\0'; -return ct; +*bytes_read = ct; +if (i == 0) +return APR_EOF; +return APR_SUCCESS; } /* 1.29 +11 -10apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.28 retrieving revision 1.29 diff -u -d -u -r1.28 -r1.29 --- http_protocol.c 1999/10/30 05:25:30 1.28 +++ http_protocol.c 1999/10/30 08:05:08 1.29 @@ -674,23 +674,24 @@ static int getline(char *s, int n, BUFF *in, int fold) { char *pos, next; -int retval; +ap_status_t retval; +ap_ssize_t nbytes; int total = 0; pos = s; do { -retval = ap_bgets(pos, n, in); - /* retval == -1 if error, 0 if EOF */ +retval = ap_bgets(pos, n, in, &nbytes); + /* retval == APR_EOF if EOF, normal error codes otherwise */ -if (retval <= 0) -return ((retval < 0) && (total == 0)) ? -1 : total; +if (retval != APR_SUCCESS)/* error or eof */ +return ((retval != APR_EOF) && (total == 0)) ? -1 : total; -/* retval is the number of characters read, not including NUL */ +/* nbytes is the number of characters read, not including NUL */ -n -= retval;/* Keep
cvs commit: apache-2.0/src/modules/standard mod_cgi.c
manoj 99/10/31 01:02:57 Modified:src/include buff.h src/main buff.c http_protocol.c util_script.c src/modules/standard mod_cgi.c Log: Undo the ap_bgets errno patch. It will return status with ap_berror(). Revision ChangesPath 1.10 +1 -2 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- buff.h1999/10/30 08:05:07 1.9 +++ buff.h1999/10/31 09:02:52 1.10 @@ -184,8 +184,7 @@ /* I/O */ API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte, ap_ssize_t *bytes_read); -API_EXPORT(ap_status_t) ap_bgets(char *s, int n, BUFF *fb, - ap_ssize_t *bytes_read); +API_EXPORT(int) ap_bgets(char *s, int n, BUFF *fb); API_EXPORT(int) ap_blookc(BUFF *fb); API_EXPORT(ap_status_t) ap_bwrite(BUFF *fb, const void *buf, ap_size_t nbyte, ap_ssize_t *bytes_written); 1.22 +10 -21apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -u -r1.21 -r1.22 --- buff.c1999/10/30 08:05:08 1.21 +++ buff.c1999/10/31 09:02:53 1.22 @@ -429,11 +429,8 @@ * read, it is replaced by a newline character. The string is then * terminated with a null character. * - * Works a little differently than the other BUFF functions, returning - * APR_EOF on end-of-file instead of just setting bytes_read = 0, - * because it makes code simpler. - * - * XXX - I'm undecided on keeping this function inconsistent - manoj + * Returns the number of bytes stored in buff, or zero on end of + * transmission, or -1 on an error. * * Notes: * If null characters are expected in the data stream, then @@ -443,20 +440,19 @@ * CR characters in the byte stream not immediately followed by a LF * will be preserved. */ -API_EXPORT(ap_status_t) ap_bgets(char *buff, int n, BUFF *fb, - ap_ssize_t *bytes_read) +API_EXPORT(int) ap_bgets(char *buff, int n, BUFF *fb) { int i, ch, ct; ap_status_t rv; /* Can't do bgets on an unbuffered stream */ if (!(fb->flags & B_RD)) { -*bytes_read = 0; - return APR_EINVAL; + errno = EINVAL; + return -1; } if (fb->flags & B_RDERR) { -*bytes_read = 0; - return fb->saved_errno; + errno = fb->saved_errno; + return -1; } ct = 0; @@ -470,13 +466,9 @@ break; rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); if (rv != APR_SUCCESS) { +errno = rv; buff[ct] = '\0'; -*bytes_read = ct; -#ifdef MIDWAY_ERROR_RETURNS_ERROR_BLAH_BLAH_BLAH -return rv; -#else - return *bytes_read ? APR_SUCCESS : rv; -#endif + return ct ? ct : -1; } fb->incnt = i; if (i == 0) @@ -509,10 +501,7 @@ fb->inptr += i; buff[ct] = '\0'; -*bytes_read = ct; -if (i == 0) -return APR_EOF; -return APR_SUCCESS; +return ct; } /* 1.30 +10 -11apache-2.0/src/main/http_protocol.c Index: http_protocol.c === RCS file: /home/cvs/apache-2.0/src/main/http_protocol.c,v retrieving revision 1.29 retrieving revision 1.30 diff -u -d -u -r1.29 -r1.30 --- http_protocol.c 1999/10/30 08:05:08 1.29 +++ http_protocol.c 1999/10/31 09:02:53 1.30 @@ -674,24 +674,23 @@ static int getline(char *s, int n, BUFF *in, int fold) { char *pos, next; -ap_status_t retval; -ap_ssize_t nbytes; +int retval; int total = 0; pos = s; do { -retval = ap_bgets(pos, n, in, &nbytes); - /* retval == APR_EOF if EOF, normal error codes otherwise */ +retval = ap_bgets(pos, n, in); + /* retval == -1 if error, 0 if EOF */ -if (retval != APR_SUCCESS)/* error or eof */ -return ((retval != APR_EOF) && (total == 0)) ? -1 : total; +if (retval <= 0) +return ((retval < 0) && (total == 0)) ? -1 : total; -/* nbytes is the number of characters read, not including NUL */ +/* retval is the number of characters read, not including NUL */ -n -= nbytes;/* Keep
cvs commit: apache-2.0/src/main buff.c http_protocol.c
manoj 99/10/31 01:13:23 Modified:src CHANGES src/include buff.h src/main buff.c http_protocol.c Log: Finish removing references to errno from buff, by introducing ap_berror() to return the status from calls that don't return an ap_status_t. Revision ChangesPath 1.16 +2 -2 apache-2.0/src/CHANGES Index: CHANGES === RCS file: /home/cvs/apache-2.0/src/CHANGES,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -u -r1.15 -r1.16 --- CHANGES 1999/10/30 02:06:31 1.15 +++ CHANGES 1999/10/31 09:13:20 1.16 @@ -1,7 +1,7 @@ Changes with Apache 2.0-dev - *) Large sections of buff, including the APIs, have been converted to - no longer use errno. [Manoj Kasichainula] + *) buff.c has been converted to no longer use errno. + [Manoj Kasichainula] *) mod_speling runs in 2.0-dev now: a bug in readdir_r handling and interface adaption to APR functions did it. [Martin Kraemer] 1.11 +6 -0 apache-2.0/src/include/buff.h Index: buff.h === RCS file: /home/cvs/apache-2.0/src/include/buff.h,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- buff.h1999/10/31 09:02:52 1.10 +++ buff.h1999/10/31 09:13:21 1.11 @@ -129,6 +129,11 @@ struct buff_struct { int flags; /* flags */ ap_status_t saved_errno; /* saved errno */ +ap_status_t berrno; /* errno for the functions that don't return + an ap_status_t. This is separate from + saved_errno. A broken call, e.g. ap_bgets + on an unbuffered stream, shouldn't change + the saved error from I/O */ unsigned char *inptr;/* pointer to next location to read */ int incnt; /* number of bytes left to read from input buffer; * always 0 if had a read error */ @@ -180,6 +185,7 @@ API_EXPORT(void) ap_bonerror(BUFF *fb, void (*error) (BUFF *, int, void *, ap_status_t), void *data); +API_EXPORT(ap_status_t) ap_berror(BUFF *fb); /* I/O */ API_EXPORT(ap_status_t) ap_bread(BUFF *fb, void *buf, ap_size_t nbyte, 1.23 +22 -13apache-2.0/src/main/buff.c Index: buff.c === RCS file: /home/cvs/apache-2.0/src/main/buff.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -u -r1.22 -r1.23 --- buff.c1999/10/31 09:02:53 1.22 +++ buff.c1999/10/31 09:13:22 1.23 @@ -55,14 +55,10 @@ * */ -/* TODO: Everything involving errno in here is a hack to manage the - * transition from errnohood to nonerrnohood - manoj */ - #include "httpd.h" #include "http_main.h" #include "http_log.h" -#include #include #include #include @@ -210,6 +206,7 @@ } return iol_setopt(fb->iol, AP_IOL_TIMEOUT, optval); } +fb->berrno = APR_EINVAL; return APR_EINVAL; } @@ -228,6 +225,7 @@ case BO_TIMEOUT: return iol_getopt(fb->iol, AP_IOL_TIMEOUT, optval); } +fb->berrno = APR_EINVAL; return APR_EINVAL; } @@ -322,6 +320,7 @@ fb->flags |= B_EOF; } else if (rv != APR_SUCCESS) { + fb->berrno = rv; fb->saved_errno = rv; if (rv != APR_EAGAIN) { doerror(fb, B_RD); @@ -447,11 +446,10 @@ /* Can't do bgets on an unbuffered stream */ if (!(fb->flags & B_RD)) { - errno = EINVAL; + fb->berrno = APR_EINVAL; return -1; } if (fb->flags & B_RDERR) { - errno = fb->saved_errno; return -1; } @@ -466,7 +464,6 @@ break; rv = read_with_errors(fb, fb->inptr, fb->bufsiz, &i); if (rv != APR_SUCCESS) { -errno = rv; buff[ct] = '\0'; return ct ? ct : -1; } @@ -537,7 +534,6 @@ if (rv == APR_SUCCESS) { return bytes_written; } -errno = rv; return -1; } @@ -552,7 +548,7 @@ rv = ap_bread(fb, buf, 1, &i); if (rv == APR_SUCCESS && i == 0) - errno = 0; /* no error; EOF */ +fb->berrno = APR_SUCCESS; /* no error; EOF */ if (i != 1) return EOF; else @@ -837,6 +833,7 @@ ap_ssize_t n; /* Placeholder; not ever used */ if
cvs commit: apache-2.0/src/lib/apr/network_io/win32 sockets.c
manoj 99/10/31 16:49:45 Modified:src/lib/apr/network_io/beos sockets.c src/lib/apr/network_io/os2 sockets.c src/lib/apr/network_io/unix sockets.c src/lib/apr/network_io/win32 sockets.c Log: We were passing NULL to ap_register_cleanup, breaking mod_cgi. Replace them all with ap_null_cleanup. Revision ChangesPath 1.11 +2 -2 apache-2.0/src/lib/apr/network_io/beos/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/sockets.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- sockets.c 1999/10/24 13:08:24 1.10 +++ sockets.c 1999/11/01 00:49:35 1.11 @@ -103,7 +103,7 @@ (*new)->timeout = -1; ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } @@ -162,7 +162,7 @@ } ap_register_cleanup((*new)->cntxt, (void *)new, -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } 1.8 +2 -2 apache-2.0/src/lib/apr/network_io/os2/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/os2/sockets.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- sockets.c 1999/10/29 14:21:01 1.7 +++ sockets.c 1999/11/01 00:49:39 1.8 @@ -108,7 +108,7 @@ } (*new)->timeout = -1; ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } @@ -167,7 +167,7 @@ } ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } 1.21 +2 -2 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -u -r1.20 -r1.21 --- sockets.c 1999/10/24 13:08:25 1.20 +++ sockets.c 1999/11/01 00:49:41 1.21 @@ -118,7 +118,7 @@ } (*new)->timeout = -1; ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } @@ -218,7 +218,7 @@ } ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } 1.13 +2 -2 apache-2.0/src/lib/apr/network_io/win32/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockets.c,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -u -r1.12 -r1.13 --- sockets.c 1999/10/25 23:55:28 1.12 +++ sockets.c 1999/11/01 00:49:44 1.13 @@ -104,7 +104,7 @@ return APR_EEXIST; } ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; } @@ -176,7 +176,7 @@ } ap_register_cleanup((*new)->cntxt, (void *)(*new), -socket_cleanup, NULL); +socket_cleanup, ap_null_cleanup); return APR_SUCCESS; }
cvs commit: apache-2.0/src/lib/apr/file_io/unix pipe.c
manoj 99/10/31 19:07:08 Modified:src/lib/apr/file_io/unix pipe.c Log: Force ap_create_pipe to properly note that it uses a Unix fd instead of a FILE pointer. This also makes mod_cgi work properly on Unix. Revision ChangesPath 1.4 +2 -0 apache-2.0/src/lib/apr/file_io/unix/pipe.c Index: pipe.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/pipe.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -u -r1.3 -r1.4 --- pipe.c1999/10/06 23:03:47 1.3 +++ pipe.c1999/11/01 03:07:07 1.4 @@ -81,11 +81,13 @@ (*in) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); (*in)->cntxt = cont; (*in)->filedes = filedes[0]; +(*in)->buffered = 0; (*in)->fname = ap_pstrdup(cont, "PIPE"); (*out) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); (*out)->cntxt = cont; (*out)->filedes = filedes[1]; +(*out)->buffered = 0; (*out)->fname = ap_pstrdup(cont, "PIPE"); return APR_SUCCESS;
cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c
manoj 99/10/31 19:20:53 Modified:src/lib/apr/file_io/unix open.c Log: Some cleanup Revision ChangesPath 1.17 +10 -6 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -u -r1.16 -r1.17 --- open.c1999/10/14 14:36:30 1.16 +++ open.c1999/11/01 03:20:52 1.17 @@ -75,6 +75,7 @@ if (rv == 0) { file->filedes = -1; +file->filehand = NULL; return APR_SUCCESS; } else { @@ -116,26 +117,29 @@ (*new)->filedes = -1; if ((flag & APR_READ) && (flag & APR_WRITE)) { -buf_oflags = strdup("r+"); +buf_oflags = ap_pstrdup(cont, "r+"); oflags = O_RDWR; } else if (flag & APR_READ) { -buf_oflags = strdup("r"); +buf_oflags = ap_pstrdup(cont, "r"); oflags = O_RDONLY; } else if (flag & APR_WRITE) { -buf_oflags = strdup("w"); +buf_oflags = ap_pstrdup(cont, "r"); oflags = O_WRONLY; } else { - (*new)->filedes = -1; +(*new)->filedes = -1; return APR_EACCES; } if (flag & APR_BUFFERED) { - (*new)->buffered = TRUE; +(*new)->buffered = TRUE; } - (*new)->fname = strdup(fname); +else { +(*new)->buffered = FALSE; +} +(*new)->fname = ap_pstrdup(cont, fname); if (flag & APR_CREATE) { oflags |= O_CREAT;
cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c
manoj 99/10/31 19:58:15 Modified:src/lib/apr/file_io/unix open.c Log: Fix a thinko I made in the last commit. Revision ChangesPath 1.18 +1 -1 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -u -r1.17 -r1.18 --- open.c1999/11/01 03:20:52 1.17 +++ open.c1999/11/01 03:58:13 1.18 @@ -125,7 +125,7 @@ oflags = O_RDONLY; } else if (flag & APR_WRITE) { -buf_oflags = ap_pstrdup(cont, "r"); +buf_oflags = ap_pstrdup(cont, "w"); oflags = O_WRONLY; } else {
cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c
manoj 99/10/31 20:24:09 Modified:src/lib/apr/file_io/unix open.c Log: A little more cleanup. Buffered mode complicates things. Revision ChangesPath 1.19 +1 -2 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -u -r1.18 -r1.19 --- open.c1999/11/01 03:58:13 1.18 +++ open.c1999/11/01 04:24:08 1.19 @@ -115,6 +115,7 @@ (*new)->cntxt = cont; (*new)->oflags = oflags; (*new)->filedes = -1; +(*new)->filehand = NULL; if ((flag & APR_READ) && (flag & APR_WRITE)) { buf_oflags = ap_pstrdup(cont, "r+"); @@ -129,7 +130,6 @@ oflags = O_WRONLY; } else { -(*new)->filedes = -1; return APR_EACCES; } @@ -148,7 +148,6 @@ } } if ((flag & APR_EXCL) && !(flag & APR_CREATE)) { - (*new)->filedes = -1; return APR_EACCES; }
cvs commit: apache-2.0 STATUS
manoj 99/10/31 20:30:54 Modified:.STATUS Log: Still no progress on the PalmPilot MPM, though. Revision ChangesPath 1.7 +1 -8 apache-2.0/STATUS Index: STATUS === RCS file: /home/cvs/apache-2.0/STATUS,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- STATUS1999/10/13 05:24:11 1.6 +++ STATUS1999/11/01 04:30:52 1.7 @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 1999/10/13 05:24:11 $] +Last modified at [$Date: 1999/11/01 04:30:52 $] Release: @@ -12,11 +12,7 @@ RELEASE SHOWSTOPPERS: -* CGI doesn't work -Status: Ben Laurie is working on this. - * suEXEC doesn't work -Ben Laurie's work to fix CGIs will also fix this. * Windows NT port isn't done Status: Bill is working on this through his MPM work, and Ryan @@ -67,9 +63,6 @@ * Odd comments in source (egrep for "ZZZ") need to be cleaned-up * Work on other MPMs. Possible MPMs discussed or in progress include: - - - David Reid's <[EMAIL PROTECTED]> Beos MPM - Status: in progress - Dean Gaudet's async MPM Status: ?
cvs commit: apache-2.0/src/lib/apr/network_io/win32 sockets.c
manoj 99/11/02 13:21:55 Modified:src/lib/apr/network_io/beos sockets.c src/lib/apr/network_io/os2 sockets.c src/lib/apr/network_io/unix sockets.c src/lib/apr/network_io/win32 sockets.c Log: Fix an APR socket bug. ap_bind would always bind to INADDR_ANY, no matter what. Revision ChangesPath 1.14 +0 -1 apache-2.0/src/lib/apr/network_io/beos/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/sockets.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- sockets.c 1999/11/02 14:16:10 1.13 +++ sockets.c 1999/11/02 21:21:51 1.14 @@ -126,7 +126,6 @@ ap_status_t ap_bind(struct socket_t *sock) { -sock->local_addr->sin_addr.s_addr = INADDR_ANY; if (bind(sock->socketdes, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) return errno; else 1.9 +0 -1 apache-2.0/src/lib/apr/network_io/os2/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/os2/sockets.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- sockets.c 1999/11/01 00:49:39 1.8 +++ sockets.c 1999/11/02 21:21:52 1.9 @@ -133,7 +133,6 @@ ap_status_t ap_bind(struct socket_t *sock) { -sock->local_addr->sin_addr.s_addr = INADDR_ANY; if (bind(sock->socketdes, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) return os2errno(sock_errno()); else 1.22 +0 -1 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -u -r1.21 -r1.22 --- sockets.c 1999/11/01 00:49:41 1.21 +++ sockets.c 1999/11/02 21:21:53 1.22 @@ -163,7 +163,6 @@ */ ap_status_t ap_bind(struct socket_t *sock) { -sock->local_addr->sin_addr.s_addr = INADDR_ANY; if (bind(sock->socketdes, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) return errno; else 1.14 +0 -1 apache-2.0/src/lib/apr/network_io/win32/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockets.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -u -r1.13 -r1.14 --- sockets.c 1999/11/01 00:49:44 1.13 +++ sockets.c 1999/11/02 21:21:54 1.14 @@ -142,7 +142,6 @@ ap_status_t ap_bind(struct socket_t *sock) { -sock->local_addr->sin_addr.s_addr = INADDR_ANY; if (bind(sock->sock, (struct sockaddr *)sock->local_addr, sock->addr_len) == -1) { return errno; }
cvs commit: apache-2.0/src/lib/apr/network_io/win32 sockets.c
manoj 99/11/02 13:49:28 Modified:src/lib/apr/network_io/beos sockets.c src/lib/apr/network_io/unix sockets.c src/lib/apr/network_io/win32 sockets.c Log: Another APR socket bug. We weren't properly setting local_addr. This also makes vhosts work again. My previous APR socket commit made restarts work again, BTW. Revision ChangesPath 1.15 +2 -0 apache-2.0/src/lib/apr/network_io/beos/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/beos/sockets.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- sockets.c 1999/11/02 21:21:51 1.14 +++ sockets.c 1999/11/02 21:49:25 1.15 @@ -148,6 +148,8 @@ (*new)->cntxt = connection_context; (*new)->local_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt, sizeof(struct sockaddr_in)); +memcpy((*new)->local_addr, sock->local_addr, sizeof(struct sockaddr_in)); + (*new)->remote_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt, sizeof(struct sockaddr_in)); (*new)->addr_len = sizeof(struct sockaddr_in); 1.23 +2 -0 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.22 retrieving revision 1.23 diff -u -d -u -r1.22 -r1.23 --- sockets.c 1999/11/02 21:21:53 1.22 +++ sockets.c 1999/11/02 21:49:26 1.23 @@ -202,6 +202,8 @@ (*new)->cntxt = connection_context; (*new)->local_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt, sizeof(struct sockaddr_in)); +memcpy((*new)->local_addr, sock->local_addr, sizeof(struct sockaddr_in)); + (*new)->remote_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt, sizeof(struct sockaddr_in)); (*new)->addr_len = sizeof(struct sockaddr_in); 1.15 +2 -0 apache-2.0/src/lib/apr/network_io/win32/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/win32/sockets.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- sockets.c 1999/11/02 21:21:54 1.14 +++ sockets.c 1999/11/02 21:49:27 1.15 @@ -165,6 +165,8 @@ (*new)->cntxt = connection_context; (*new)->local_addr = (struct sockaddr_in *)ap_palloc((*new)->cntxt, sizeof(struct sockaddr_in)); +memcpy((*new)->local_addr, sock->local_addr, sizeof(struct sockaddr_in)); + (*new)->addr_len = sizeof(struct sockaddr_in); (*new)->sock = accept(sock->sock, (struct sockaddr *)(*new)->local_addr,
cvs commit: apache-2.0 STATUS
manoj 99/11/02 15:18:30 Modified:.STATUS Log: No, PalmOS doesn't have threads or any process support other than a task swapper, but it has a TCP stack with non-blocking I/O and an event subsystem that will report on socket status changes. A PalmOS MPM shouldn't be too much trouble at all. Revision ChangesPath 1.8 +11 -2 apache-2.0/STATUS Index: STATUS === RCS file: /home/cvs/apache-2.0/STATUS,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- STATUS1999/11/01 04:30:52 1.7 +++ STATUS1999/11/02 23:18:28 1.8 @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 1999/11/01 04:30:52 $] +Last modified at [$Date: 1999/11/02 23:18:28 $] Release: @@ -12,7 +12,14 @@ RELEASE SHOWSTOPPERS: +* CGI programs will stop working after a little while + Status: Manoj is working on this + * suEXEC doesn't work + Status: Manoj has finished an implementation, but it needs +polishing. Specifically, it puts a bunch of Unix stuff into +portable code. Current patch will be sent to new-httpd upon +request. * Windows NT port isn't done Status: Bill is working on this through his MPM work, and Ryan @@ -41,6 +48,8 @@ Other bugs that need fixing: * MaxRequestsPerChild measures connections, not requests. +Until someone has a better way, we'll probably just rename it +"MaxConnectionsPerChild". * Regex containers don't work in an intutive way Status: No one has come up with an efficient way to fix this @@ -49,7 +58,7 @@ * Areas where APRFile is being used need to be cleaned-up -* SIGSEGV on Linux seems to only kill a thread not a whole process; +* SIGSEGV on Linux seems to only kill a thread, not a whole process; we need to work around this, probably by bouncing the signal to the sigwait thread. But this will hurt debugability.
cvs commit: apache-2.0/src/lib/apr/threadproc/unix proc.c
manoj 99/11/02 23:29:07 Modified:.STATUS src/lib/apr/threadproc/beos proc.c src/lib/apr/threadproc/unix proc.c Log: Fix yet another APR bug. This one caused sporadic CGI failures. Revision ChangesPath 1.9 +3 -8 apache-2.0/STATUS Index: STATUS === RCS file: /home/cvs/apache-2.0/STATUS,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- STATUS1999/11/02 23:18:28 1.8 +++ STATUS1999/11/03 07:29:02 1.9 @@ -1,5 +1,5 @@ Apache 2.0 STATUS: -Last modified at [$Date: 1999/11/02 23:18:28 $] +Last modified at [$Date: 1999/11/03 07:29:02 $] Release: @@ -12,14 +12,9 @@ RELEASE SHOWSTOPPERS: -* CGI programs will stop working after a little while -Status: Manoj is working on this - * suEXEC doesn't work -Status: Manoj has finished an implementation, but it needs -polishing. Specifically, it puts a bunch of Unix stuff into -portable code. Current patch will be sent to new-httpd upon -request. +Status: Manoj has posted an patch to fix this. +<[EMAIL PROTECTED]> * Windows NT port isn't done Status: Bill is working on this through his MPM work, and Ryan 1.9 +1 -0 apache-2.0/src/lib/apr/threadproc/beos/proc.c Index: proc.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/beos/proc.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- proc.c1999/10/22 22:06:16 1.8 +++ proc.c1999/11/03 07:29:05 1.9 @@ -87,6 +87,7 @@ (*new)->child_err = NULL; (*new)->currdir = NULL; (*new)->cmdtype = APR_PROGRAM; +(*new)->detached = 0; return APR_SUCCESS; } 1.9 +1 -0 apache-2.0/src/lib/apr/threadproc/unix/proc.c Index: proc.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -u -r1.8 -r1.9 --- proc.c1999/10/20 18:27:48 1.8 +++ proc.c1999/11/03 07:29:06 1.9 @@ -89,6 +89,7 @@ (*new)->child_err = NULL; (*new)->currdir = NULL; (*new)->cmdtype = APR_PROGRAM; +(*new)->detached = 0; return APR_SUCCESS; }
cvs commit: apache-2.0/src/lib/apr/file_io/unix readwrite.c
manoj 99/11/03 23:24:24 Modified:src/lib/apr/file_io/unix readwrite.c Log: a rewrite of ap_fprintf that fixes a potential buffer overflow, a memory leak, and more. Revision ChangesPath 1.15 +5 -15 apache-2.0/src/lib/apr/file_io/unix/readwrite.c Index: readwrite.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/readwrite.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- readwrite.c 1999/10/24 19:23:55 1.14 +++ readwrite.c 1999/11/04 07:24:23 1.15 @@ -356,28 +356,18 @@ { int cc; va_list ap; -ap_vformatter_buff_t vbuff; char *buf; -ap_ssize_t len; +int len; buf = malloc(HUGE_STRING_LEN); if (buf == NULL) { return 0; } -/* save one byte for nul terminator */ -vbuff.curpos = buf; -vbuff.endpos = buf + len - 1; va_start(ap, format); -#if 0 -cc = ap_vformatter(printf_flush, &vbuff, format, ap); -va_end(ap); -*vbuff.curpos = '\0'; -#endif -vsprintf(buf, format, ap); -len = strlen(buf); -cc = ap_write(fptr, buf, &len); +len = ap_vsnprintf(buf, HUGE_STRING_LEN, format, ap); +cc = ap_puts(buf, fptr); va_end(ap); -return (cc == -1) ? len : cc; +free(buf); +return (cc == APR_SUCCESS) ? len : -1; } -
cvs commit: apache-2.0/src/lib/apr/threadproc/unix proc.c
manoj 99/11/03 23:26:22 Modified:src/lib/apr/file_io/unix dir.c src/lib/apr/locks/unix locks.c src/lib/apr/misc/unix start.c src/lib/apr/threadproc/unix proc.c Log: Fix memory leaks in the Unix portions of APR. Revision ChangesPath 1.15 +1 -1 apache-2.0/src/lib/apr/file_io/unix/dir.c Index: dir.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/dir.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- dir.c 1999/10/31 16:18:36 1.14 +++ dir.c 1999/11/04 07:26:20 1.15 @@ -86,7 +86,7 @@ (*new) = (struct dir_t *)ap_palloc(cont, sizeof(struct dir_t)); (*new)->cntxt = cont; -(*new)->dirname = strdup(dirname); +(*new)->dirname = ap_pstrdup(cont, dirname); (*new)->dirstruct = opendir(dirname); (*new)->entry = ap_pcalloc(cont, sizeof(struct dirent)); 1.12 +2 -2 apache-2.0/src/lib/apr/locks/unix/locks.c Index: locks.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/unix/locks.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- locks.c 1999/10/21 14:31:20 1.11 +++ locks.c 1999/11/04 07:26:20 1.12 @@ -88,10 +88,10 @@ new->cntxt = cont; new->type = type; if (fname != NULL) { -new->fname = strdup(fname); +new->fname = ap_pstrdup(cont, fname); } else { -new->fname = strdup(tempnam(NULL, NULL)); +new->fname = ap_pstrdup(cont, tempnam(NULL, NULL)); unlink(new->fname); } 1.12 +2 -7 apache-2.0/src/lib/apr/misc/unix/start.c Index: start.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/unix/start.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- start.c 1999/10/13 09:31:36 1.11 +++ start.c 1999/11/04 07:26:21 1.12 @@ -92,12 +92,7 @@ return APR_ENOPOOL; } -if (cont) { -new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t)); -} -else { -new = (struct context_t *)malloc(sizeof(struct context_t)); -} +new = (struct context_t *)ap_palloc(cont, sizeof(struct context_t)); new->pool = pool; new->prog_data = NULL; @@ -150,7 +145,7 @@ if (dptr == NULL) { dptr = ap_palloc(cont, sizeof(datastruct)); dptr->next = dptr->prev = NULL; -dptr->key = strdup(key); +dptr->key = ap_pstrdup(cont, key); if (dptr2) { dptr2->next = dptr; dptr->prev = dptr2; 1.10 +8 -6 apache-2.0/src/lib/apr/threadproc/unix/proc.c Index: proc.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/threadproc/unix/proc.c,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -u -r1.9 -r1.10 --- proc.c1999/11/03 07:29:06 1.9 +++ proc.c1999/11/04 07:26:22 1.10 @@ -305,7 +305,8 @@ struct procattr_t *attr, ap_context_t *cont) { int i; -char **newargs; +typedef const char *my_stupid_string; +my_stupid_string *newargs; struct proc_t *pgrp; (*new) = (struct proc_t *)ap_palloc(cont, sizeof(struct proc_t)); @@ -352,19 +353,20 @@ while (args[i]) { i++; } -newargs = (char **)ap_palloc(cont, sizeof (char *) * (i + 3)); -newargs[0] = strdup(SHELL_PATH); -newargs[1] = strdup("-c"); +newargs = + (my_stupid_string *) ap_palloc(cont, sizeof (char *) * (i + 3)); +newargs[0] = SHELL_PATH; +newargs[1] = "-c"; i = 0; while (args[i]) { -newargs[i + 2] = strdup(args[i]); +newargs[i + 2] = args[i]; i++; } newargs[i + 3] = NULL; if (attr->detached) { ap_detach(&pgrp, attr->cntxt); } -execve(SHELL_PATH, newargs, env); +execve(SHELL_PATH, (char **) newargs, env); } else { if (attr->detached) {
cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c
manoj 99/11/04 13:59:23 Modified:src/lib/apr/file_io/unix open.c Log: Save a little bit of work when opening a file with default permissions. Revision ChangesPath 1.20 +1 -2 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -u -r1.19 -r1.20 --- open.c1999/11/01 04:24:08 1.19 +++ open.c1999/11/04 21:59:17 1.20 @@ -107,7 +107,6 @@ ap_status_t ap_open(struct file_t **new, const char *fname, ap_int32_t flag, ap_fileperms_t perm, ap_context_t *cont) { int oflags = 0; -mode_t mode = get_fileperms(perm); char *buf_oflags; (*new) = (struct file_t *)ap_palloc(cont, sizeof(struct file_t)); @@ -167,7 +166,7 @@ (*new)->filedes = open(fname, oflags); } else { -(*new)->filedes = open(fname, oflags, mode); +(*new)->filedes = open(fname, oflags, get_fileperms(perm)); } }
cvs commit: apache-2.0/src/lib/apr/file_io/unix open.c
manoj 99/11/04 14:04:19 Modified:src/lib/apr/file_io/unix open.c Log: Change ap_open's behavior when using APR_OS_DEFAULT permissions. My Linux man pages say that you must provide permissions to use when creating a file. We weren't doing so, and non APR_BUFFERED files were created with garbage permissions (01254 in my case!). This patch tells open() to use 0777 permissions as the default. Revision ChangesPath 1.21 +1 -1 apache-2.0/src/lib/apr/file_io/unix/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/unix/open.c,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -u -r1.20 -r1.21 --- open.c1999/11/04 21:59:17 1.20 +++ open.c1999/11/04 22:04:16 1.21 @@ -163,7 +163,7 @@ } else { if (perm == APR_OS_DEFAULT) { -(*new)->filedes = open(fname, oflags); +(*new)->filedes = open(fname, oflags, 0777); } else { (*new)->filedes = open(fname, oflags, get_fileperms(perm));
cvs commit: apache-2.0/src/main http_log.c
manoj 99/11/05 13:01:46 Modified:src/main http_log.c Log: Stop using APR_BUFFERED for the error log and httpd.pid file. The error logging code has been tweaked a bit so that we still have one write per log entry. Revision ChangesPath 1.15 +17 -15apache-2.0/src/main/http_log.c Index: http_log.c === RCS file: /home/cvs/apache-2.0/src/main/http_log.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -u -r1.14 -r1.15 --- http_log.c1999/10/23 21:27:38 1.14 +++ http_log.c1999/11/05 21:01:44 1.15 @@ -260,7 +260,7 @@ else { fname = ap_server_root_relative(p, s->error_fname); /* Change to AP funcs. */ -if (ap_open(&s->error_log, fname, APR_BUFFERED | APR_APPEND | +if (ap_open(&s->error_log, fname, APR_APPEND | APR_READ | APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) { perror("fopen"); fprintf(stderr, "%s: could not open error log file %s.\n", @@ -328,7 +328,7 @@ ap_status_t status, const server_rec *s, const request_rec *r, const char *fmt, va_list args) { -char errstr[MAX_STRING_LEN]; +char errstr[MAX_STRING_LEN + 1];/* + 1 to have room for '\n' */ size_t len; ap_file_t *logf = NULL; int errfileno = STDERR_FILENO; @@ -377,12 +377,12 @@ } if (logf) { - len = ap_snprintf(errstr, sizeof(errstr), "[%s] ", ap_get_time()); + len = ap_snprintf(errstr, MAX_STRING_LEN, "[%s] ", ap_get_time()); } else { len = 0; } -len += ap_snprintf(errstr + len, sizeof(errstr) - len, +len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "[%s] ", priorities[level & APLOG_LEVELMASK].t_name); #ifndef TPF @@ -405,7 +405,7 @@ file = tmp; } #endif /*_OSD_POSIX*/ - len += ap_snprintf(errstr + len, sizeof(errstr) - len, + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "%s(%d): ", file, line); } #endif /* TPF */ @@ -415,7 +415,7 @@ * quad is the most secure, which is why I'm implementing it * first. -djg */ - len += ap_snprintf(errstr + len, sizeof(errstr) - len, + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "[client %s] ", r->connection->remote_ip); } if (!(level & APLOG_NOERRNO) @@ -424,7 +424,7 @@ && !(level & APLOG_WIN32ERROR) #endif ) { - len += ap_snprintf(errstr + len, sizeof(errstr) - len, + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "(%d)%s: ", status, strerror(status)); } #ifdef WIN32 @@ -433,7 +433,7 @@ int nErrorCode; nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "(%d)", nErrorCode); nChars = FormatMessage( @@ -442,7 +442,7 @@ nErrorCode, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* // Default language */ (LPTSTR) errstr + len, - sizeof(errstr) - len, + MAX_STRING_LEN - len, NULL ); len += nChars; @@ -452,7 +452,7 @@ * log the numeric value. */ nErrorCode = GetLastError(); - len += ap_snprintf(errstr + len, sizeof(errstr) - len, + len += ap_snprintf(errstr + len, MAX_STRING_LEN - len, "(FormatMessage failed with code %d): ", nErrorCode); } @@ -472,14 +472,16 @@ } #endif -len += ap_vsnprintf(errstr + len, sizeof(errstr) - len, fmt, args); +len += ap_vsnprintf(errstr + len, MAX_STRING_LEN - len, fmt, args); /* NULL if we are logging to syslog */ if (logf) { - /* ZZZ let's just use AP funcs to Write to the error log. If failure, - can we output a message to the console??? */ +/* We know that we have one more character of space available because + * the array is sized that way */ +/* ap_assert(len < MAX_STRING_LEN) */ +errstr[len++] = '\n'; +errstr[len] = '\0'; ap_puts(errstr, logf); - ap_putc('\n', logf); ap_flush(logf); } #ifdef HAVE_SYSLOG @@ -553,7 +555,7 @@ ); } -if(ap_open(&pid_file, fname, APR_WRITE | APR_BUFFERED | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) { +if(ap_open(&pid_file, fname, APR_WRITE | APR_CREATE, APR_OS_DEFAULT, p) != APR_SUCCESS) { perror("fopen"); fprintf(stderr, "%s: could not log pid to file %s\n", ap_server_argv0, fname);
cvs commit: apache-2.0/src/lib/apr/file_io/win32 readwrite.c
manoj 99/11/05 13:16:19 Modified:src/lib/apr/file_io/os2 readwrite.c src/lib/apr/file_io/win32 readwrite.c Log: Rewrite ap_fprintf to be uniform on all platforms. This fixes a memory leak and potential buffer overflow. Revision ChangesPath 1.7 +4 -8 apache-2.0/src/lib/apr/file_io/os2/readwrite.c Index: readwrite.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/os2/readwrite.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- readwrite.c 1999/11/03 12:47:22 1.6 +++ readwrite.c 1999/11/05 21:16:16 1.7 @@ -328,7 +328,6 @@ { int cc; va_list ap; -ap_vformatter_buff_t vbuff; char *buf; int len; @@ -336,15 +335,12 @@ if (buf == NULL) { return 0; } -/* save one byte for nul terminator */ -vbuff.curpos = buf; -vbuff.endpos = buf + len - 1; va_start(ap, format); -vsprintf(buf, format, ap); -len = strlen(buf); -cc = ap_write(fptr, buf, &len); +len = ap_vsnprintf(buf, HUGE_STRING_LEN, format, ap); +cc = ap_puts(buf, fptr); va_end(ap); -return (cc == -1) ? len : cc; +free(buf); +return (cc == APR_SUCCESS) ? len : -1; } 1.8 +4 -13 apache-2.0/src/lib/apr/file_io/win32/readwrite.c Index: readwrite.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readwrite.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- readwrite.c 1999/11/01 22:16:51 1.7 +++ readwrite.c 1999/11/05 21:16:18 1.8 @@ -256,7 +256,6 @@ { int cc; va_list ap; -ap_vformatter_buff_t vbuff; char *buf; int len; @@ -264,20 +263,12 @@ if (buf == NULL) { return 0; } -/* save one byte for nul terminator */ -vbuff.curpos = buf; -vbuff.endpos = buf + len - 1; va_start(ap, format); -#if 0 -cc = ap_vformatter(printf_flush, &vbuff, format, ap); -va_end(ap); -*vbuff.curpos = '\0'; -#endif -vsprintf(buf, format, ap); -len = strlen(buf); -cc = ap_write(fptr, buf, &len); +len = ap_vsnprintf(buf, HUGE_STRING_LEN, format, ap); +cc = ap_puts(buf, fptr); va_end(ap); -return (cc == -1) ? len : cc; +free(buf); +return (cc == APR_SUCCESS) ? len : -1; }
cvs commit: apache-2.0/src/lib/apr/threadproc/beos proc.c
manoj 99/11/05 13:26:32 Modified:src/lib/apr/file_io/win32 dir.c open.c readdir.c src/lib/apr/locks/beos locks.c src/lib/apr/locks/win32 locks.c src/lib/apr/misc/beos start.c src/lib/apr/misc/win32 start.c src/lib/apr/threadproc/beos proc.c Log: Plug some memory leaks, and eliminate a little redundant code. Revision ChangesPath 1.7 +1 -1 apache-2.0/src/lib/apr/file_io/win32/dir.c Index: dir.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/dir.c,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- dir.c 1999/10/23 20:15:17 1.6 +++ dir.c 1999/11/05 21:26:07 1.7 @@ -132,7 +132,7 @@ { ap_status_t stat; ap_context_t *cont = thedir->cntxt; -char *temp = strdup(thedir->dirname); +char *temp = ap_pstrdup(cont, thedir->dirname); temp[strlen(temp) - 2] = '\0'; /*remove the \* at the end */ if (thedir->dirhand == INVALID_HANDLE_VALUE) { return APR_SUCCESS; 1.11 +1 -1 apache-2.0/src/lib/apr/file_io/win32/open.c Index: open.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/open.c,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- open.c1999/11/03 22:01:46 1.10 +++ open.c1999/11/05 21:26:09 1.11 @@ -102,7 +102,7 @@ } else { (*dafile)->buffered = FALSE; } -(*dafile)->fname = strdup(fname); +(*dafile)->fname = ap_pstrdup(cont, fname); (*dafile)->demonfname = canonical_filename((*dafile)->cntxt, fname); (*dafile)->lowerdemonfname = strlwr((*dafile)->demonfname); 1.2 +1 -0 apache-2.0/src/lib/apr/file_io/win32/readdir.c Index: readdir.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/file_io/win32/readdir.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -u -r1.1 -r1.2 --- readdir.c 1999/08/17 15:59:37 1.1 +++ readdir.c 1999/11/05 21:26:10 1.2 @@ -40,6 +40,7 @@ if (errno == ENOENT) dp->finished = 1; else +free(filespec) return NULL; } 1.6 +1 -1 apache-2.0/src/lib/apr/locks/beos/locks.c Index: locks.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/beos/locks.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- locks.c 1999/10/14 20:53:28 1.5 +++ locks.c 1999/11/05 21:26:13 1.6 @@ -73,7 +73,7 @@ new->cntxt = cont; new->type = type; -new->fname = strdup(fname); +new->fname = ap_pstrdup(cont, fname); if (type != APR_CROSS_PROCESS) { if ((stat = create_intra_lock(new)) != APR_SUCCESS) { 1.12 +2 -9 apache-2.0/src/lib/apr/locks/win32/locks.c Index: locks.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/locks/win32/locks.c,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -u -r1.11 -r1.12 --- locks.c 1999/10/15 14:20:05 1.11 +++ locks.c 1999/11/05 21:26:15 1.12 @@ -71,10 +71,7 @@ /* ToDo: How to handle the case when no context is available? * How to cleanup the storage properly? */ -if (cont) -newlock->fname = ap_pstrdup(cont, fname); -else -newlock->fname = strdup(fname); +newlock->fname = ap_pstrdup(cont, fname); newlock->type = type; newlock->scope = scope; sec.nLength = sizeof(SECURITY_ATTRIBUTES); @@ -106,11 +103,7 @@ if ((*lock) == NULL) { return APR_ENOMEM; } -if (cont) -(*lock)->fname = ap_pstrdup(cont, fname); -else -(*lock)->fname = strdup(fname); - +(*lock)->fname = ap_pstrdup(cont, fname); (*lock)->mutex = OpenMutex(MUTEX_ALL_ACCESS, TRUE, fname); if ((*lock)->mutex == NULL) { 1.8 +2 -7 apache-2.0/src/lib/apr/misc/beos/start.c Index: start.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/misc/beos/start.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -u -r1.7 -r1.8 --- start.c 1999/10/08 20:03:57 1.7 +++ start.c 1999/11/05 21:26:19 1.8 @@ -79,12 +79,7 @@ return APR_ENOPOOL; } -if (cont) { -new = (struct context_t *)ap
cvs commit: apache-2.0/src/lib/apr/network_io/unix sockets.c
manoj 99/11/06 23:35:43 Modified:src/lib/apr/network_io/unix sockets.c Log: ap_put_os_sock needs to do a lot of preparation of an ap_socket_t for it to be usable. This patch adds it. Revision ChangesPath 1.24 +14 -0 apache-2.0/src/lib/apr/network_io/unix/sockets.c Index: sockets.c === RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v retrieving revision 1.23 retrieving revision 1.24 diff -u -d -u -r1.23 -r1.24 --- sockets.c 1999/11/02 21:49:26 1.23 +++ sockets.c 1999/11/07 07:35:42 1.24 @@ -335,6 +335,20 @@ if ((*sock) == NULL) { (*sock) = (struct socket_t *)ap_palloc(cont, sizeof(struct socket_t)); (*sock)->cntxt = cont; +(*sock)->local_addr = (struct sockaddr_in *)ap_palloc((*sock)->cntxt, + sizeof(struct sockaddr_in)); +(*sock)->remote_addr = (struct sockaddr_in *)ap_palloc((*sock)->cntxt, + sizeof(struct sockaddr_in)); + +if ((*sock)->local_addr == NULL || (*sock)->remote_addr == NULL) { +return APR_ENOMEM; +} + +(*sock)->addr_len = sizeof(*(*sock)->local_addr); +(*sock)->timeout = -1; +if (getsockname(*thesock, (*sock)->local_addr, &((*sock)->addr_len)) < 0) { +return errno; +} } (*sock)->socketdes = *thesock; return APR_SUCCESS;
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
manoj 99/11/11 14:57:27 Modified:src/modules/mpm/mpmt_pthread mpmt_pthread.c Log: Fix a race condition found by David Colasurdo <[EMAIL PROTECTED]>. We should make sure that the parent notes the creation of a child process in the scoreboard so that perform_idle_server_maintanence doesn't get the chance to claim that slot. Revision ChangesPath 1.43 +10 -0 apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -u -r1.42 -r1.43 --- mpmt_pthread.c1999/10/27 06:11:21 1.42 +++ mpmt_pthread.c1999/11/11 22:57:19 1.43 @@ -1028,8 +1028,18 @@ child_main(slot); } +/* Tag this slot as occupied so that perform_idle_server_maintenance + * doesn't try to steal it */ +(void) ap_update_child_status(slot, 0, SERVER_STARTING, (request_rec *) NULL); + if ((pid = fork()) == -1) { ap_log_error(APLOG_MARK, APLOG_ERR, errno, s, "fork: Unable to fork new process"); + +/* fork didn't succeed. Fix the scoreboard or else + * it will say SERVER_STARTING forever and ever + */ +(void) ap_update_child_status(slot, 0, SERVER_DEAD, (request_rec *) NULL); + /* In case system resources are maxxed out, we don't want Apache running away with the CPU trying to fork over and over and over again. */
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread acceptlock.h
manoj 99/11/15 11:46:48 Modified:src/modules/mpm/dexter acceptlock.h src/modules/mpm/mpmt_pthread acceptlock.h Log: Fix a couple of function prototypes Revision ChangesPath 1.5 +2 -2 apache-2.0/src/modules/mpm/dexter/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/acceptlock.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- acceptlock.h 1999/10/13 21:14:02 1.4 +++ acceptlock.h 1999/11/15 19:46:41 1.5 @@ -80,9 +80,9 @@ void accept_mutex_off(int); #elif defined (USE_PTHREAD_SERIALIZED_ACCEPT) -void accept_mutex_child_cleanup(void *); +ap_status_t accept_mutex_child_cleanup(void *); void accept_mutex_child_init(ap_context_t *); -void accept_mutex_cleanup(void *); +ap_status_t accept_mutex_cleanup(void *); void accept_mutex_init(ap_context_t *, int); void accept_mutex_on(int); void accept_mutex_off(int); 1.6 +1 -1 apache-2.0/src/modules/mpm/mpmt_pthread/acceptlock.h Index: acceptlock.h === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/acceptlock.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -u -r1.5 -r1.6 --- acceptlock.h 1999/10/10 17:08:07 1.5 +++ acceptlock.h 1999/11/15 19:46:45 1.6 @@ -80,7 +80,7 @@ void accept_mutex_off(int); #elif defined (USE_PTHREAD_SERIALIZED_ACCEPT) -void accept_mutex_child_cleanup(void *); +ap_status_t accept_mutex_child_cleanup(void *); void accept_mutex_child_init(ap_context_t *); ap_status_t accept_mutex_cleanup(void *); void accept_mutex_init(ap_context_t *, int);
cvs commit: apache-2.0/src/modules/mpm/dexter Makefile.tmpl dexter.c acceptlock.c acceptlock.h
manoj 99/11/15 13:22:50 Modified:src/modules/mpm/dexter Makefile.tmpl dexter.c Removed: src/modules/mpm/dexter acceptlock.c acceptlock.h Log: Eliminate acceptlock.{c,h} in dexter. They mostly duplicated code in APR. Revision ChangesPath 1.7 +4 -27 apache-2.0/src/modules/mpm/dexter/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/Makefile.tmpl,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -u -r1.6 -r1.7 --- Makefile.tmpl 1999/10/30 05:59:27 1.6 +++ Makefile.tmpl 1999/11/15 21:22:42 1.7 @@ -2,9 +2,9 @@ LIB=libdexter.$(LIBEXT) OBJS=\ - dexter.o acceptlock.o scoreboard.o + dexter.o scoreboard.o OBJS_PIC=\ - dexter.lo acceptlock.lo scoreboard.lo + dexter.lo scoreboard.lo all: lib @@ -55,29 +55,6 @@ $(OBJS) $(OBJS_PIC): Makefile # DO NOT REMOVE -acceptlock.o: acceptlock.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 ../../../lib/apr/include/apr_general.h \ - ../../../lib/apr/include/apr_config.h \ - ../../../lib/apr/include/apr_errno.h \ - ../../../lib/apr/include/apr_lib.h \ - ../../../lib/apr/include/apr_file_io.h $(INCDIR)/buff.h \ - $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ - $(INCDIR)/http_protocol.h \ - ../../../lib/apr/include/apr_portable.h \ - ../../../lib/apr/include/apr_thread_proc.h \ - ../../../lib/apr/include/apr_win.h \ - ../../../lib/apr/include/apr_network_io.h \ - ../../../lib/apr/include/apr_lock.h \ - ../../../lib/apr/include/apr_time.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_vhost.h $(INCDIR)/util_script.h \ - acceptlock.h dexter.h $(OSDIR)/unixd.h dexter.o: dexter.c ../../../lib/apr/include/apr_portable.h \ ../../../lib/apr/include/apr_config.h \ ../../../lib/apr/include/apr_general.h \ @@ -99,8 +76,8 @@ $(INCDIR)/ap_hooks.h $(INCDIR)/http_core.h \ $(INCDIR)/http_connection.h $(INCDIR)/ap_mpm.h \ $(OSDIR)/unixd.h $(OSDIR)/iol_socket.h \ - $(INCDIR)/ap_listen.h acceptlock.h mpm_default.h dexter.h \ - scoreboard.h $(INCDIR)/mpm_status.h + $(INCDIR)/ap_listen.h mpm_default.h dexter.h scoreboard.h \ + $(INCDIR)/mpm_status.h scoreboard.o: scoreboard.c $(INCDIR)/httpd.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ 1.53 +52 -20apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.52 retrieving revision 1.53 diff -u -d -u -r1.52 -r1.53 --- dexter.c 1999/11/15 19:50:05 1.52 +++ dexter.c 1999/11/15 21:22:47 1.53 @@ -68,7 +68,6 @@ #include "unixd.h" #include "iol_socket.h" #include "ap_listen.h" -#include "acceptlock.h" #include "mpm_default.h" #include "dexter.h" #include "scoreboard.h" @@ -103,11 +102,7 @@ unsigned char status; } child_table[HARD_SERVER_LIMIT]; -#if 0 -#define SAFE_ACCEPT(stmt) do {if (ap_listeners->next != NULL) {stmt;}} while (0) -#else #define SAFE_ACCEPT(stmt) do {stmt;} while (0) -#endif /* * The max child slot ever assigned, preserved across restarts. Necessary @@ -119,7 +114,6 @@ */ int max_daemons_limit = -1; - static char ap_coredump_dir[MAX_STRING_LEN]; static int pipe_of_death[2]; @@ -177,6 +171,11 @@ static int idle_thread_count; static pthread_mutex_t idle_thread_count_mutex; +/* Locks for accept serialization */ +static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; +static ap_lock_t *process_accept_mutex; +static char *lock_fname; + /* Global, alas, so http_core can talk to us */ enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -851,6 +850,7 @@ int thread_just_started = 1; int thread_num = *((int *) arg); long conn_id = child_num * HARD_THREAD_LIMIT + thread_num; +ap_status_t rv; pthread_mutex_lock(&thread_pool_parent_mutex); ap_create_context(&tpool, thread_pool_parent); @@ -874,12 +874,18 @@ else { thread_just_started = 0; } -SAFE_ACCEPT(intra_mutex_on(0)); +pthread_mutex_lock(&thread_accept_mutex); if (workers_may_exit) { -SAFE_ACCEPT(intra_mutex_off(0)); +pthread_mutex_un
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c
manoj 99/11/15 14:26:42 Modified:src/modules/mpm/dexter dexter.c Log: Allow NO_SERIALIZED_ACCEPT to work. Revision ChangesPath 1.54 +16 -9 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.53 retrieving revision 1.54 diff -u -d -u -r1.53 -r1.54 --- dexter.c 1999/11/15 21:22:47 1.53 +++ dexter.c 1999/11/15 22:26:35 1.54 @@ -102,8 +102,6 @@ unsigned char status; } child_table[HARD_SERVER_LIMIT]; -#define SAFE_ACCEPT(stmt) do {stmt;} while (0) - /* * The max child slot ever assigned, preserved across restarts. Necessary * to deal with NumServers changes across SIGWINCH restarts. We use this @@ -172,9 +170,14 @@ static pthread_mutex_t idle_thread_count_mutex; /* Locks for accept serialization */ -static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; +#ifdef NO_SERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) APR_SUCCESS +#else +#define SAFE_ACCEPT(stmt) (stmt) static ap_lock_t *process_accept_mutex; +#endif /* NO_SERIALIZED_ACCEPT */ static char *lock_fname; +static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; /* Global, alas, so http_core can talk to us */ enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -879,7 +882,8 @@ pthread_mutex_unlock(&thread_accept_mutex); break; } -if ((rv = ap_lock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_lock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_lock failed. Attempting to shutdown " "process gracefully."); @@ -936,7 +940,8 @@ if ((rv = ap_accept(&csd, sd, ptrans)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_ERR, rv, NULL, "ap_accept"); } -if ((rv = ap_unlock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_unlock failed. Attempting to shutdown " "process gracefully."); @@ -956,7 +961,8 @@ process_socket(ptrans, csd, conn_id); requests_this_child--; } else { -if ((rv = ap_unlock(process_accept_mutex)) != APR_SUCCESS) { +if ((rv = SAFE_ACCEPT(ap_unlock(process_accept_mutex))) +!= APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "ap_unlock failed. Attempting to shutdown " "process gracefully."); @@ -1001,7 +1007,8 @@ /*stuff to do before we switch id's, so we have permissions.*/ -rv = ap_child_init_lock(&process_accept_mutex, lock_fname, pchild); +rv = SAFE_ACCEPT(ap_child_init_lock(&process_accept_mutex, lock_fname, +pchild)); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "Couldn't initialize cross-process lock in child"); @@ -1335,8 +1342,8 @@ lock_fname = ap_psprintf(_pconf, "%s.%lu", ap_server_root_relative(_pconf, lock_fname), my_pid); -rv = ap_create_lock(&process_accept_mutex, APR_MUTEX, APR_CROSS_PROCESS, - lock_fname, _pconf); +rv = SAFE_ACCEPT(ap_create_lock(&process_accept_mutex, APR_MUTEX, +APR_CROSS_PROCESS, lock_fname, _pconf)); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't create cross-process lock");
cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread Makefile.tmpl mpmt_pthread.c acceptlock.c acceptlock.h
manoj 99/11/15 15:30:03 Modified:src/modules/mpm/mpmt_pthread Makefile.tmpl mpmt_pthread.c Removed: src/modules/mpm/mpmt_pthread acceptlock.c acceptlock.h Log: Eliminate acceptlock.c from mpmt_pthread. Use an APR type for the cross-process lock instead. Revision ChangesPath 1.11 +3 -26 apache-2.0/src/modules/mpm/mpmt_pthread/Makefile.tmpl Index: Makefile.tmpl === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/Makefile.tmpl,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -u -r1.10 -r1.11 --- Makefile.tmpl 1999/10/30 05:59:28 1.10 +++ Makefile.tmpl 1999/11/15 23:28:47 1.11 @@ -2,9 +2,9 @@ LIB=libmpmt_pthread.$(LIBEXT) OBJS=\ - mpmt_pthread.o acceptlock.o scoreboard.o + mpmt_pthread.o scoreboard.o OBJS_PIC=\ - mpmt_pthread.lo acceptlock.lo scoreboard.lo + mpmt_pthread.lo scoreboard.lo all: lib @@ -55,29 +55,6 @@ $(OBJS) $(OBJS_PIC): Makefile # DO NOT REMOVE -acceptlock.o: acceptlock.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 ../../../lib/apr/include/apr_general.h \ - ../../../lib/apr/include/apr_config.h \ - ../../../lib/apr/include/apr_errno.h \ - ../../../lib/apr/include/apr_lib.h \ - ../../../lib/apr/include/apr_file_io.h $(INCDIR)/buff.h \ - $(INCDIR)/ap_iol.h $(INCDIR)/ap.h \ - $(INCDIR)/apr.h $(INCDIR)/util_uri.h \ - $(INCDIR)/http_main.h $(INCDIR)/http_log.h \ - $(INCDIR)/http_config.h $(INCDIR)/ap_hooks.h \ - $(INCDIR)/http_protocol.h \ - ../../../lib/apr/include/apr_portable.h \ - ../../../lib/apr/include/apr_thread_proc.h \ - ../../../lib/apr/include/apr_win.h \ - ../../../lib/apr/include/apr_network_io.h \ - ../../../lib/apr/include/apr_lock.h \ - ../../../lib/apr/include/apr_time.h $(INCDIR)/http_request.h \ - $(INCDIR)/http_conf_globals.h $(INCDIR)/http_core.h \ - $(INCDIR)/http_vhost.h $(INCDIR)/util_script.h \ - acceptlock.h mpmt_pthread.h $(OSDIR)/unixd.h mpmt_pthread.o: mpmt_pthread.c ../../../lib/apr/include/apr_portable.h \ ../../../lib/apr/include/apr_config.h \ ../../../lib/apr/include/apr_general.h \ @@ -99,7 +76,7 @@ $(INCDIR)/ap_hooks.h $(INCDIR)/http_core.h \ $(INCDIR)/http_connection.h $(INCDIR)/ap_mpm.h \ $(OSDIR)/unixd.h $(OSDIR)/iol_socket.h \ - $(INCDIR)/ap_listen.h scoreboard.h mpm_default.h acceptlock.h + $(INCDIR)/ap_listen.h scoreboard.h mpm_default.h scoreboard.o: scoreboard.c $(INCDIR)/httpd.h \ $(INCDIR)/ap_config.h $(INCDIR)/ap_mmn.h \ $(INCDIR)/ap_config_auto.h $(OSDIR)/os.h \ 1.45 +65 -19apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c Index: mpmt_pthread.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v retrieving revision 1.44 retrieving revision 1.45 diff -u -d -u -r1.44 -r1.45 --- mpmt_pthread.c1999/11/15 19:50:11 1.44 +++ mpmt_pthread.c1999/11/15 23:29:47 1.45 @@ -69,7 +69,6 @@ #include "iol_socket.h" #include "ap_listen.h" #include "scoreboard.h" -#include "acceptlock.h" #include #include @@ -101,12 +100,6 @@ ap_context_t *tpool; /* "pthread" would be confusing */ } proc_info; -#if 0 -#define SAFE_ACCEPT(stmt) do {if (ap_listeners->next != NULL) {stmt;}} while (0) -#else -#define SAFE_ACCEPT(stmt) do {stmt;} while (0) -#endif - /* * The max child slot ever assigned, preserved across restarts. Necessary * to deal with MaxClients changes across SIGWINCH restarts. We use this @@ -162,6 +155,18 @@ static int worker_thread_count; static pthread_mutex_t worker_thread_count_mutex; +/* Locks for accept serialization */ +static pthread_mutex_t thread_accept_mutex = PTHREAD_MUTEX_INITIALIZER; +static ap_lock_t *process_accept_mutex; +static char *lock_fname; + +#ifdef NO_SERIALIZED_ACCEPT +#define SAFE_ACCEPT(stmt) APR_SUCCESS +#else +#define SAFE_ACCEPT(stmt) (stmt) +#endif + + /* Global, alas, so http_core can talk to us */ enum server_token_type ap_server_tokens = SrvTk_FULL; @@ -798,6 +803,7 @@ int n; int curr_pollfd, last_pollfd = 0; ap_pollfd_t *pollset; +ap_status_t rv; free(ti); @@ -819,12 +825,19 @@ (void) ap_update_child_status(process_slot, thread_slot, SERVER_READY, (request_rec *) NULL); -SAFE_ACCEPT(intra_mutex_on(0)); +pthread_mutex_lock(&thread_accept_mutex); if (workers_may_exit) { -SAFE_ACCEPT(intra_mutex_off(0)); +pthread
cvs commit: apache-2.0/src/modules/mpm/dexter dexter.c dexter.h
manoj 99/11/15 19:00:46 Modified:src/modules/mpm/dexter dexter.c dexter.h Log: ap_clean_child_exit is static in dexter now, and the ap_ prefix is gone. Revision ChangesPath 1.55 +5 -6 apache-2.0/src/modules/mpm/dexter/dexter.c Index: dexter.c === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.c,v retrieving revision 1.54 retrieving revision 1.55 diff -u -d -u -r1.54 -r1.55 --- dexter.c 1999/11/15 22:26:35 1.54 +++ dexter.c 1999/11/16 03:00:38 1.55 @@ -187,9 +187,8 @@ return (server_conf); } -/* a clean exit from a child with proper cleanup - static void ap_clean_child_exit(int code) __attribute__ ((noreturn)); */ -void ap_clean_child_exit(int code) +/* a clean exit from a child with proper cleanup */ +static void clean_child_exit(int code) { if (pchild) { ap_destroy_pool(pchild); @@ -463,7 +462,7 @@ static void just_die(int sig) { -ap_clean_child_exit(0); +clean_child_exit(0); } /* @@ -1012,11 +1011,11 @@ if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, server_conf, "Couldn't initialize cross-process lock in child"); -ap_clean_child_exit(APEXIT_CHILDFATAL); +clean_child_exit(APEXIT_CHILDFATAL); } if (unixd_setup_child()) { - ap_clean_child_exit(APEXIT_CHILDFATAL); + clean_child_exit(APEXIT_CHILDFATAL); } ap_child_init_hook(pchild, server_conf); 1.5 +0 -1 apache-2.0/src/modules/mpm/dexter/dexter.h Index: dexter.h === RCS file: /home/cvs/apache-2.0/src/modules/mpm/dexter/dexter.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -u -r1.4 -r1.5 --- dexter.h 1999/08/28 13:00:35 1.4 +++ dexter.h 1999/11/16 03:00:42 1.5 @@ -59,6 +59,5 @@ #define APACHE_MPM_DEXTER_H extern int max_daemons_limit; -extern void ap_clean_child_exit(int); #endif /* APACHE_MPM_DEXTER_H */