📄 eapi.patch
字号:
## _____ _ ____ ___ ## | ____| / \ | _ \_ _|## | _| / _ \ | |_) | | ## | |__ / ___ \| __/| | ## |____/_/ \_\_| |___| Extended API for Apache## ____________________________________________________________________________## ## Annotated patch file: eapi.patch## Copyright (c) 1998-2007 Ralf S. Engelschall, All Rights Reserved. ## Created on: 08-Feb-2008#### This file assembles changes to existing Apache source files## between the original Apache and the patched variant. It can be## automatically applied to a vanilla Apache source tree with the## 'patch' tool to upgrade those files. Each patch snippet is## annotated with a short description.#### This file contains all patches to the Apache source## tree which add the Extended API (EAPI) support.##+---------------------------------------------------------------------------| Add the EAPI and EAPI_MM configuration entries which triggers the EAPI| patches and configured the shared memory support via the MM library.+---------------------------------------------------------------------------Index: src/Configuration.tmpl--- src/Configuration.tmpl 11 May 2004 18:28:09 -0000 1.1.1.8+++ src/Configuration.tmpl 11 May 2004 18:32:15 -0000 1.24@@ -68,6 +105,24 @@ #TARGET= ################################################################+# Extended API (EAPI) support:+#+# EAPI:+# The EAPI rule enables more module hooks, a generic low-level hook+# mechanism, a generic context mechanism and shared memory based pools. +#+# EAPI_MM:+# Set the EAPI_MM variable to either the directory of a MM Shared Memory+# Library source tree or the installation tree of MM. Alternatively you can+# also use the value 'SYSTEM' which then indicates that MM is installed+# under various system locations. When the MM library files cannot be found+# the EAPI still can be built, but without shared memory pool support, of+# course.++Rule EAPI=no+#EAPI_MM=SYSTEM++################################################################ # Dynamic Shared Object (DSO) support # # There is experimental support for compiling the Apache core and+---------------------------------------------------------------------------| Patch in implementation of the EAPI rule.+---------------------------------------------------------------------------Index: src/Configure--- src/Configure 8 Feb 2008 11:15:36 -0000 1.1.1.31+++ src/Configure 8 Feb 2008 11:17:39 -0000 1.34@@ -1868,6 +1868,72 @@ fi ####################################################################+## Extended API (EAPI) support:+##+if [ "x$RULE_EAPI" = "x" ]; then+ RULE_EAPI=`./helpers/CutRule EAPI $file`+fi+if [ "x$RULE_EAPI" = "xyes" ]; then+ echo " + enabling Extended API (EAPI)"+ CFLAGS="$CFLAGS -DEAPI"+ # some vendor compilers are too restrictive+ # for our ap_hook and ap_ctx sources.+ case "$OS:$CC" in+ *IRIX-32*:*/cc|*IRIX-32*:cc )+ CFLAGS="$CFLAGS -woff 1048,1110,1164"+ ;;+ esac+ # MM Shared Memory Library support for EAPI+ if [ "x$EAPI_MM" = "x" ]; then+ EAPI_MM=`egrep '^EAPI_MM=' $file | sed -n -e '$p' | awk -F= '{print $2}'`+ fi+ if [ "x$EAPI_MM" != "x" ]; then+ case $EAPI_MM in+ SYSTEM|/* ) ;;+ * ) for p in . .. ../..; do+ if [ -d "$p/$EAPI_MM" ]; then+ EAPI_MM="`echo $p/$EAPI_MM | sed -e 's;/\./;/;g'`" + break+ fi+ done+ ;;+ esac+ if [ "x$EAPI_MM" = "xSYSTEM" ]; then+ echo " using MM library for EAPI: (system-wide)"+ CFLAGS="$CFLAGS -DEAPI_MM"+ __INCLUDES="`mm-config --cflags`"+ if [ "x$__INCLUDES" != "x-I/usr/include" ]; then+ INCLUDES="$INCLUDES $__INCLUDES"+ fi+ LDFLAGS="$LDFLAGS `mm-config --ldflags`"+ LIBS="$LIBS `mm-config --libs`"+ else+ if [ -f "$EAPI_MM/.libs/libmm.a" -a -f "$EAPI_MM/mm.h" ]; then+ echo " using MM library: $EAPI_MM (source-tree only)"+ case $EAPI_MM in+ /* ) ;;+ * ) EAPI_MM="\$(SRCDIR)/$EAPI_MM" ;;+ esac+ CFLAGS="$CFLAGS -DEAPI_MM"+ INCLUDES="$INCLUDES -I$EAPI_MM"+ LDFLAGS="$LDFLAGS -L$EAPI_MM/.libs"+ LIBS="$LIBS -lmm"+ elif [ -f "$EAPI_MM/bin/mm-config" ]; then+ echo " using MM library: $EAPI_MM (installed)"+ CFLAGS="$CFLAGS -DEAPI_MM"+ INCLUDES="$INCLUDES `$EAPI_MM/bin/mm-config --cflags`"+ LDFLAGS="$LDFLAGS `$EAPI_MM/bin/mm-config --ldflags`"+ LIBS="$LIBS `$EAPI_MM/bin/mm-config --libs`"+ else+ echo "Configure:Error: Cannot find MM library under $EAPI_MM" 1>&2+ exit 1+ fi+ fi+ fi+fi+++#################################################################### ## Add in the Expat library if needed/wanted. ## +---------------------------------------------------------------------------| Add the build support for the ap_hook.c and ap_ctx.c sources (Unix)+---------------------------------------------------------------------------Index: src/ap/Makefile.tmpl--- src/ap/Makefile.tmpl 19 Jun 2002 07:20:22 -0000 1.1.1.8+++ src/ap/Makefile.tmpl 19 Jun 2002 07:29:08 -0000 1.8@@ -7,7 +7,7 @@ OBJS=ap_cpystrn.o ap_execve.o ap_fnmatch.o ap_getpass.o ap_md5c.o ap_signal.o \ ap_slack.o ap_snprintf.o ap_sha1.o ap_checkpass.o ap_base64.o ap_ebcdic.o \- ap_strtol.o+ ap_strtol.o ap_hook.o ap_ctx.o ap_mm.o .c.o: $(CC) -c $(INCLUDES) $(CFLAGS) $<+---------------------------------------------------------------------------| Add the build support for the ap_hook.c and ap_ctx.c sources (Win32)+---------------------------------------------------------------------------Index: src/ap/ap.mak--- src/ap/ap.mak 18 Oct 2005 06:26:22 -0000 1.1.1.11+++ src/ap/ap.mak 18 Oct 2005 06:27:34 -0000 1.11@@ -44,6 +44,9 @@ -@erase "$(INTDIR)\ap_cpystrn.obj" -@erase "$(INTDIR)\ap_fnmatch.obj" -@erase "$(INTDIR)\ap_md5c.obj"+ -@erase "$(INTDIR)\ap_hook.obj"+ -@erase "$(INTDIR)\ap_ctx.obj"+ -@erase "$(INTDIR)\ap_mm.obj" -@erase "$(INTDIR)\ap_sha1.obj" -@erase "$(INTDIR)\ap_signal.obj" -@erase "$(INTDIR)\ap_slack.obj"@@ -99,6 +102,9 @@ "$(INTDIR)\ap_cpystrn.obj" \ "$(INTDIR)\ap_fnmatch.obj" \ "$(INTDIR)\ap_md5c.obj" \+ "$(INTDIR)\ap_hook.obj" \+ "$(INTDIR)\ap_ctx.obj" \+ "$(INTDIR)\ap_mm.obj" \ "$(INTDIR)\ap_sha1.obj" \ "$(INTDIR)\ap_signal.obj" \ "$(INTDIR)\ap_slack.obj" \@@ -128,6 +134,9 @@ -@erase "$(INTDIR)\ap_cpystrn.obj" -@erase "$(INTDIR)\ap_fnmatch.obj" -@erase "$(INTDIR)\ap_md5c.obj"+ -@erase "$(INTDIR)\ap_hook.obj"+ -@erase "$(INTDIR)\ap_ctx.obj"+ -@erase "$(INTDIR)\ap_mm.obj" -@erase "$(INTDIR)\ap_sha1.obj" -@erase "$(INTDIR)\ap_signal.obj" -@erase "$(INTDIR)\ap_slack.obj"@@ -183,6 +192,9 @@ "$(INTDIR)\ap_cpystrn.obj" \ "$(INTDIR)\ap_fnmatch.obj" \ "$(INTDIR)\ap_md5c.obj" \+ "$(INTDIR)\ap_hook.obj" \+ "$(INTDIR)\ap_ctx.obj" \+ "$(INTDIR)\ap_mm.obj" \ "$(INTDIR)\ap_sha1.obj" \ "$(INTDIR)\ap_signal.obj" \ "$(INTDIR)\ap_slack.obj" \+---------------------------------------------------------------------------| Replace the MODULE_MAGIC_COOKIE to allow us to distinguish between| EAPI-aware modules and standard modules.+---------------------------------------------------------------------------Index: src/include/ap_mmn.h--- src/include/ap_mmn.h 28 Jul 2006 13:55:31 -0000 1.1.1.15+++ src/include/ap_mmn.h 28 Jul 2006 13:56:29 -0000 1.15@@ -207,7 +207,23 @@ * 19990320.18 - trace_enable member added to core server_config */ +/* + * Under Extended API situations we replace the magic cookie "AP13" with+ * "EAPI" to let us distinguish between the EAPI module structure (which+ * contain additional pointers at the end) and standard module structures+ * (which lack at least NULL's for the pointers at the end). This is+ * important because standard ("AP13") modules would dump core when we+ * dispatch over the additional hooks because NULL's are missing at the end of+ * the module structure. See also the code in mod_so for details on loading+ * (we accept both "AP13" and "EAPI").+ */+#ifdef EAPI+#define MODULE_MAGIC_COOKIE_AP13 0x41503133UL /* "AP13" */+#define MODULE_MAGIC_COOKIE_EAPI 0x45415049UL /* "EAPI" */+#define MODULE_MAGIC_COOKIE MODULE_MAGIC_COOKIE_EAPI +#else #define MODULE_MAGIC_COOKIE 0x41503133UL /* "AP13" */+#endif #ifndef MODULE_MAGIC_NUMBER_MAJOR #define MODULE_MAGIC_NUMBER_MAJOR 19990320+---------------------------------------------------------------------------| Add the additional prototypes and defines for the | shared memory pools.+---------------------------------------------------------------------------Index: src/include/ap_alloc.h--- src/include/ap_alloc.h 28 Jul 2006 13:55:32 -0000 1.1.1.9+++ src/include/ap_alloc.h 28 Jul 2006 13:56:29 -0000 1.10@@ -53,6 +53,15 @@ API_EXPORT(pool *) ap_init_alloc(void); /* Set up everything */ void ap_cleanup_alloc(void); API_EXPORT(pool *) ap_make_sub_pool(pool *); /* All pools are subpools of permanent_pool */+#if defined(EAPI)+typedef enum { AP_POOL_RD, AP_POOL_RW } ap_pool_lock_mode;+int ap_shared_pool_possible(void);+void ap_init_alloc_shared(int);+void ap_kill_alloc_shared(void);+API_EXPORT(pool *) ap_make_shared_sub_pool(pool *);+API_EXPORT(int) ap_acquire_pool(pool *, ap_pool_lock_mode);+API_EXPORT(int) ap_release_pool(pool *);+#endif API_EXPORT(void) ap_destroy_pool(pool *); /* pools have nested lifetimes -- sub_pools are destroyed when the+---------------------------------------------------------------------------| Add the additional context variable `ctx' for BUFF structures.+---------------------------------------------------------------------------Index: src/include/buff.h--- src/include/buff.h 28 Jul 2006 13:55:31 -0000 1.1.1.9+++ src/include/buff.h 28 Jul 2006 13:56:29 -0000 1.13@@ -83,6 +83,10 @@ /* transport handle, for RPC binding handle or some such */ void *t_handle; +#ifdef EAPI+ ap_ctx *ctx;+#endif /* EAPI */+ #ifdef B_SFIO Sfio_t *sf_in; Sfio_t *sf_out;@@ -139,6 +143,10 @@ API_EXPORT(int) ap_bflsbuf(int c, BUFF *fb); API_EXPORT(int) ap_bfilbuf(BUFF *fb); +#ifdef EAPI+#define ap_bpeekc(fb) ( ((fb)->incnt == 0) ? EOF : *((fb)->inptr) )+#endif+ #ifndef CHARSET_EBCDIC #define ap_bgetc(fb) ( ((fb)->incnt == 0) ? ap_bfilbuf(fb) : \+---------------------------------------------------------------------------| Add the four additional Apache API module hooks.+---------------------------------------------------------------------------Index: src/include/http_config.h--- src/include/http_config.h 28 Jul 2006 13:55:31 -0000 1.1.1.15+++ src/include/http_config.h 28 Jul 2006 13:56:29 -0000 1.17@@ -234,6 +234,65 @@ void (*child_exit) (server_rec *, pool *); #endif int (*post_read_request) (request_rec *);++#ifdef EAPI+ /*+ * ANSI C guarantees us that we can at least _extend_ the module structure+ * with additional hooks without the need to change all existing modules.+ * Because: ``If there are fewer initializers in the list than members of+ * the structure, the trailing members are initialized with 0.'' (The C+ * Programming Language, 2nd Ed., A8.7 Initialization). So we just+ * have to put our additional hooks here:+ *+ * add_module: + * Called from within ap_add_module() right after the module structure+ * was linked into the Apache internal module list. It is mainly+ * intended to be used to define configuration defines (<IfDefine>)+ * which have to be available directly after a LoadModule/AddModule.+ * Actually this is the earliest possible hook a module can use.+ *+ * remove_module: + * Called from within ap_remove_module() right before the module+ * structure is kicked out from the Apache internal module list.+ * Actually this is last possible hook a module can use and exists for+ * consistency with the add_module hook.+ *+ * rewrite_command:+ * Called right after a configuration directive line was read and+ * before it is processed. It is mainly intended to be used for+ * rewriting directives in order to provide backward compatibility to+ * old directive variants.+ *+ * new_connection:+ * Called from within the internal new_connection() function, right+ * after the conn_rec structure for the new established connection was+ * created and before Apache starts processing the request with+ * ap_read_request(). It is mainly intended to be used to setup/run+ * connection dependent things like sending start headers for+ * on-the-fly compression, etc.+ *+ * close_connection:+ * Called from within the Apache dispatching loop just before any+ * ap_bclose() is performed on the socket connection, but a long time+ * before any pool cleanups are done for the connection (which can be+ * too late for some applications). It is mainly intended to be used+ * to close/finalize connection dependent things like sending end+ * headers for on-the-fly compression, etc.+ */+#ifdef ULTRIX_BRAIN_DEATH+ void (*add_module) ();+ void (*remove_module) ();+ char *(*rewrite_command) ();+ void (*new_connection) ();+ void (*close_connection) ();+#else+ void (*add_module) (struct module_struct *);+ void (*remove_module) (struct module_struct *);+ char *(*rewrite_command) (cmd_parms *, void *config, const char *);+ void (*new_connection) (conn_rec *);+ void (*close_connection) (conn_rec *);+#endif+#endif /* EAPI */ } module; /* Initializer for the first few module slots, which are only+---------------------------------------------------------------------------| Add the additional variable `ap_global_ctx' for holding| global module context.+---------------------------------------------------------------------------Index: src/include/http_conf_globals.h--- src/include/http_conf_globals.h 28 Jul 2006 13:55:30 -0000 1.1.1.15+++ src/include/http_conf_globals.h 28 Jul 2006 13:56:29 -0000 1.16@@ -53,6 +53,9 @@ #endif extern int ap_dump_settings; extern API_VAR_EXPORT int ap_extended_status;+#ifdef EAPI+extern API_VAR_EXPORT ap_ctx *ap_global_ctx;+#endif /* EAPI */ extern API_VAR_EXPORT char *ap_pid_fname; extern API_VAR_EXPORT char *ap_scoreboard_fname;+---------------------------------------------------------------------------| First add support for the HTTPS protocol scheme via hooks,| second add the additional context variable `ctx' for the| conn_rec, server_rec and request_rec structures. And third| add a prototype for the additional ap_add_config_define()| function.+---------------------------------------------------------------------------Index: src/include/httpd.h--- src/include/httpd.h 8 Feb 2008 11:15:38 -0000 1.1.1.31+++ src/include/httpd.h 8 Feb 2008 11:17:39 -0000 1.41@@ -28,7 +28,19 @@ /* Headers in which EVERYONE has an interest... */ #include "ap_config.h"+#ifdef EAPI+#include "ap_mm.h"+#endif #include "ap_alloc.h"+/*+ * Include the Extended API headers.+ * Don't move the position. It has to be after ap_alloc.h because it uses the+ * pool stuff but before buff.h because the buffer stuff uses the EAPI, too. + */+#ifdef EAPI+#include "ap_hook.h"+#include "ap_ctx.h"+#endif /* EAPI */ #include "buff.h"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -