diff options
author | Ryan Bloom <rbb@apache.org> | 2000-04-14 15:58:54 +0000 |
---|---|---|
committer | Ryan Bloom <rbb@apache.org> | 2000-04-14 15:58:54 +0000 |
commit | f6be29db115b28bf436f84e67e1ba49e92ab9538 (patch) | |
tree | c07dfce5f37b9ffae3b9b7b8b0b435fb98cdc74b | |
parent | 9baccbbbd719982aee0888ca35a3f7b98cc3792a (diff) | |
download | apr-f6be29db115b28bf436f84e67e1ba49e92ab9538.tar.gz |
Change ap_context_t to ap_pool_t. This compiles, runs, and serves pages
on Linux, but probably breaks somewhere.
git-svn-id: https://svn.apache.org/repos/asf/apr/apr/trunk@59856 13f79535-47bb-0310-9956-ffa450edef68
152 files changed, 896 insertions, 685 deletions
diff --git a/dso/aix/dso.c b/dso/aix/dso.c index 0b99a29ab..d43c8fdd9 100644 --- a/dso/aix/dso.c +++ b/dso/aix/dso.c @@ -135,7 +135,7 @@ ap_status_t ap_dso_init(void){ } ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, - ap_context_t *ctx) + ap_pool_t *ctx) { void *os_handle = dlopen((char *)path, RTLD_NOW | RTLD_GLOBAL); diff --git a/dso/aix/dso.h b/dso/aix/dso.h index 89c33f5c0..ec6d5bf7a 100644 --- a/dso/aix/dso.h +++ b/dso/aix/dso.h @@ -66,7 +66,7 @@ const char *dlerror(void); int dlclose(void *handle); struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/dso/beos/dso.c b/dso/beos/dso.c index ee65fabbb..c63102739 100644 --- a/dso/beos/dso.c +++ b/dso/beos/dso.c @@ -60,7 +60,7 @@ ap_status_t ap_dso_init(void){ } ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, - ap_context_t *ctx) + ap_pool_t *ctx) { image_id newid; diff --git a/dso/beos/dso.h b/dso/beos/dso.h index d863ae1cc..6e65454d9 100644 --- a/dso/beos/dso.h +++ b/dso/beos/dso.h @@ -64,7 +64,7 @@ struct ap_dso_handle_t { image_id handle; /* Handle to the DSO loaded */ - ap_context_t *cont; + ap_pool_t *cont; }; #endif diff --git a/dso/os2/dso.c b/dso/os2/dso.c index 0873b66eb..25043c130 100644 --- a/dso/os2/dso.c +++ b/dso/os2/dso.c @@ -71,7 +71,7 @@ static ap_status_t dso_cleanup(void *thedso) } -ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, ap_context_t *ctx) +ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, ap_pool_t *ctx) { char failed_module[1024]; HMODULE handle; diff --git a/dso/os2/dso.h b/dso/os2/dso.h index b71882036..1466a03b9 100644 --- a/dso/os2/dso.h +++ b/dso/os2/dso.h @@ -64,7 +64,7 @@ #include "apr_dso.h" struct ap_dso_handle_t { - ap_context_t *cont; /* Context for returning error strings */ + ap_pool_t *cont; /* Context for returning error strings */ HMODULE handle; /* Handle to the DSO loaded */ char *failed_module; }; diff --git a/dso/unix/dso.c b/dso/unix/dso.c index 3901be7af..c25986b85 100644 --- a/dso/unix/dso.c +++ b/dso/unix/dso.c @@ -59,7 +59,7 @@ ap_status_t ap_dso_init(void){ } ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, - ap_context_t *ctx) + ap_pool_t *ctx) { #if defined(HPUX) || defined(HPUX10) || defined(HPUX11) shl_t os_handle = shl_load(path, BIND_IMMEDIATE|BIND_VERBOSE|BIND_NOSTART, 0L); diff --git a/dso/unix/dso.h b/dso/unix/dso.h index 6eb2de665..01a1c9c59 100644 --- a/dso/unix/dso.h +++ b/dso/unix/dso.h @@ -83,7 +83,7 @@ #endif struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/dso/win32/dso.c b/dso/win32/dso.c index 5b66ea5ff..b8dde20e4 100644 --- a/dso/win32/dso.c +++ b/dso/win32/dso.c @@ -59,7 +59,7 @@ ap_status_t ap_dso_init(void){ } ap_status_t ap_dso_load(struct ap_dso_handle_t **res_handle, const char *path, - ap_context_t *ctx) + ap_pool_t *ctx) { HINSTANCE os_handle = LoadLibraryEx(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); if(os_handle == NULL) { diff --git a/dso/win32/dso.h b/dso/win32/dso.h index 701ed309b..45b74420b 100644 --- a/dso/win32/dso.h +++ b/dso/win32/dso.h @@ -61,7 +61,7 @@ #include "apr_dso.h" struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/file_io/os2/dir.c b/file_io/os2/dir.c index 09db99195..34f973ec6 100644 --- a/file_io/os2/dir.c +++ b/file_io/os2/dir.c @@ -68,7 +68,7 @@ static ap_status_t dir_cleanup(void *thedir) -ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_context_t *cntxt) +ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_pool_t *cntxt) { ap_dir_t *thedir = (ap_dir_t *)ap_palloc(cntxt, sizeof(ap_dir_t)); @@ -143,14 +143,14 @@ ap_status_t ap_rewinddir(ap_dir_t *thedir) -ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *cont) +ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_pool_t *cont) { return APR_OS2_STATUS(DosCreateDir(path, NULL)); } -ap_status_t ap_remove_dir(const char *path, ap_context_t *cont) +ap_status_t ap_remove_dir(const char *path, ap_pool_t *cont) { return APR_OS2_STATUS(DosDeleteDir(path)); } diff --git a/file_io/os2/fileio.h b/file_io/os2/fileio.h index ef09d53bc..80f5fe358 100644 --- a/file_io/os2/fileio.h +++ b/file_io/os2/fileio.h @@ -66,7 +66,7 @@ #define APR_FILE_BUFSIZE 4096 struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HFILE filedes; char * fname; int isopen; @@ -83,7 +83,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; ULONG handle; FILEFINDBUF3 entry; diff --git a/file_io/os2/filestat.c b/file_io/os2/filestat.c index db9fa0081..429686c28 100644 --- a/file_io/os2/filestat.c +++ b/file_io/os2/filestat.c @@ -138,7 +138,7 @@ ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile) -ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont) +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_pool_t *cont) { ULONG rc; FILESTATUS3 fstatus; diff --git a/file_io/os2/open.c b/file_io/os2/open.c index 6a6624e67..f59913e9b 100644 --- a/file_io/os2/open.c +++ b/file_io/os2/open.c @@ -69,7 +69,7 @@ ap_status_t apr_file_cleanup(void *thefile) -ap_status_t ap_open(ap_file_t **new, const char *fname, ap_int32_t flag, ap_fileperms_t perm, ap_context_t *cntxt) +ap_status_t ap_open(ap_file_t **new, const char *fname, ap_int32_t flag, ap_fileperms_t perm, ap_pool_t *cntxt) { int oflags = 0; int mflags = OPEN_FLAGS_FAIL_ON_ERROR|OPEN_SHARE_DENYNONE; @@ -171,7 +171,7 @@ ap_status_t ap_close(ap_file_t *file) -ap_status_t ap_remove_file(char *path, ap_context_t *cntxt) +ap_status_t ap_remove_file(char *path, ap_pool_t *cntxt) { ULONG rc = DosDelete(path); return APR_OS2_STATUS(rc); @@ -191,7 +191,7 @@ ap_status_t ap_get_os_file(ap_os_file_t *thefile, ap_file_t *file) -ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, ap_context_t *cont) +ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, ap_pool_t *cont) { ap_os_file_t *dafile = thefile; if ((*file) == NULL) { @@ -218,7 +218,7 @@ ap_status_t ap_eof(ap_file_t *fptr) -ap_status_t ap_open_stderr(ap_file_t **thefile, ap_context_t *cont) +ap_status_t ap_open_stderr(ap_file_t **thefile, ap_pool_t *cont) { (*thefile) = ap_palloc(cont, sizeof(ap_file_t)); if ((*thefile) == NULL) { diff --git a/file_io/os2/pipe.c b/file_io/os2/pipe.c index aaebaa064..b8b093812 100644 --- a/file_io/os2/pipe.c +++ b/file_io/os2/pipe.c @@ -58,7 +58,7 @@ #include "apr_lib.h" #include <string.h> -ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont) +ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_pool_t *cont) { ULONG filedes[2]; ULONG rc; @@ -92,7 +92,7 @@ ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont) -ap_status_t ap_create_namedpipe(char *filename, ap_fileperms_t perm, ap_context_t *cont) +ap_status_t ap_create_namedpipe(char *filename, ap_fileperms_t perm, ap_pool_t *cont) { /* Not yet implemented, interface not suitable */ return APR_ENOTIMPL; diff --git a/file_io/unix/dir.c b/file_io/unix/dir.c index abc50981c..ebf2ab7bd 100644 --- a/file_io/unix/dir.c +++ b/file_io/unix/dir.c @@ -66,7 +66,7 @@ static ap_status_t dir_cleanup(void *thedir) } } -ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_context_t *cont) +ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_pool_t *cont) { if (new == NULL) return APR_EBADARG; @@ -143,7 +143,7 @@ ap_status_t ap_rewinddir(ap_dir_t *thedir) return APR_SUCCESS; } -ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *cont) +ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_pool_t *cont) { mode_t mode = ap_unix_get_fileperms(perm); @@ -155,7 +155,7 @@ ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *con } } -ap_status_t ap_remove_dir(const char *path, ap_context_t *cont) +ap_status_t ap_remove_dir(const char *path, ap_pool_t *cont) { if (rmdir(path) == 0) { return APR_SUCCESS; @@ -275,7 +275,7 @@ ap_status_t ap_get_os_dir(ap_os_dir_t **thedir, ap_dir_t *dir) } ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, - ap_context_t *cont) + ap_pool_t *cont) { if ((*dir) == NULL) { (*dir) = (ap_dir_t *)ap_palloc(cont, sizeof(ap_dir_t)); diff --git a/file_io/unix/fileio.h b/file_io/unix/fileio.h index 3dcaa81d8..6eb7df9f4 100644 --- a/file_io/unix/fileio.h +++ b/file_io/unix/fileio.h @@ -101,7 +101,7 @@ /* End System headers */ struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int filedes; char * fname; int oflags; @@ -112,7 +112,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; DIR *dirstruct; struct dirent *entry; diff --git a/file_io/unix/filestat.c b/file_io/unix/filestat.c index ef9d1ed4e..7b805b2eb 100644 --- a/file_io/unix/filestat.c +++ b/file_io/unix/filestat.c @@ -104,7 +104,7 @@ ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile) } } -ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont) +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_pool_t *cont) { struct stat info; diff --git a/file_io/unix/open.c b/file_io/unix/open.c index 54f106477..fcf793f47 100644 --- a/file_io/unix/open.c +++ b/file_io/unix/open.c @@ -72,7 +72,7 @@ ap_status_t ap_unix_file_cleanup(void *thefile) } } -ap_status_t ap_open(ap_file_t **new, const char *fname, ap_int32_t flag, ap_fileperms_t perm, ap_context_t *cont) +ap_status_t ap_open(ap_file_t **new, const char *fname, ap_int32_t flag, ap_fileperms_t perm, ap_pool_t *cont) { int oflags = 0; @@ -158,7 +158,7 @@ ap_status_t ap_close(ap_file_t *file) return rv; } -ap_status_t ap_remove_file(char *path, ap_context_t *cont) +ap_status_t ap_remove_file(char *path, ap_pool_t *cont) { if (unlink(path) == 0) { return APR_SUCCESS; @@ -182,7 +182,7 @@ ap_status_t ap_get_os_file(ap_os_file_t *thefile, ap_file_t *file) } ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, - ap_context_t *cont) + ap_pool_t *cont) { int *dafile = thefile; @@ -221,7 +221,7 @@ ap_status_t ap_ferror(ap_file_t *fptr) return APR_SUCCESS; } -ap_status_t ap_open_stderr(ap_file_t **thefile, ap_context_t *cont) +ap_status_t ap_open_stderr(ap_file_t **thefile, ap_pool_t *cont) { if (thefile == NULL) return APR_EBADARG; diff --git a/file_io/unix/pipe.c b/file_io/unix/pipe.c index e8ddcecc0..6380cced1 100644 --- a/file_io/unix/pipe.c +++ b/file_io/unix/pipe.c @@ -89,7 +89,7 @@ ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_int32_t timeout) return APR_EINVAL; } -ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont) +ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_pool_t *cont) { int filedes[2]; @@ -121,7 +121,7 @@ ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont) } ap_status_t ap_create_namedpipe(char *filename, - ap_fileperms_t perm, ap_context_t *cont) + ap_fileperms_t perm, ap_pool_t *cont) { mode_t mode = ap_unix_get_fileperms(perm); diff --git a/file_io/win32/dir.c b/file_io/win32/dir.c index e8b4f60cc..a4e653d68 100644 --- a/file_io/win32/dir.c +++ b/file_io/win32/dir.c @@ -79,7 +79,7 @@ ap_status_t dir_cleanup(void *thedir) return APR_SUCCESS; } -ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_context_t *cont) +ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_pool_t *cont) { char * temp; (*new) = ap_palloc(cont, sizeof(ap_dir_t)); @@ -126,7 +126,7 @@ ap_status_t ap_readdir(ap_dir_t *thedir) ap_status_t ap_rewinddir(ap_dir_t *thedir) { ap_status_t stat; - ap_context_t *cont = thedir->cntxt; + ap_pool_t *cont = thedir->cntxt; char *temp = ap_pstrdup(cont, thedir->dirname); temp[strlen(temp) - 2] = '\0'; /*remove the \* at the end */ if (thedir->dirhand == INVALID_HANDLE_VALUE) { @@ -141,7 +141,7 @@ ap_status_t ap_rewinddir(ap_dir_t *thedir) return stat; } -ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *cont) +ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_pool_t *cont) { if (!CreateDirectory(path, NULL)) { return GetLastError(); @@ -149,7 +149,7 @@ ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, ap_context_t *con return APR_SUCCESS; } -ap_status_t ap_remove_dir(const char *path, ap_context_t *cont) +ap_status_t ap_remove_dir(const char *path, ap_pool_t *cont) { char *temp = canonical_filename(cont, path); if (!RemoveDirectory(temp)) { @@ -210,7 +210,7 @@ ap_status_t ap_get_os_dir(ap_os_dir_t **thedir, ap_dir_t *dir) return APR_SUCCESS; } -ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, ap_context_t *cont) +ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/file_io/win32/fileio.h b/file_io/win32/fileio.h index 550227464..108c343d4 100644 --- a/file_io/win32/fileio.h +++ b/file_io/win32/fileio.h @@ -96,7 +96,7 @@ */ struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HANDLE filehand; char *fname; DWORD dwFileAttributes; @@ -114,7 +114,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; HANDLE dirhand; WIN32_FIND_DATA *entry; @@ -123,9 +123,9 @@ struct ap_dir_t { ap_status_t file_cleanup(void *); /*mode_t get_fileperms(ap_fileperms_t); */ -API_EXPORT(char *) ap_os_systemcase_filename(struct ap_context_t *pCont, +API_EXPORT(char *) ap_os_systemcase_filename(struct ap_pool_t *pCont, const char *szFile); -char * canonical_filename(struct ap_context_t *pCont, const char *szFile); +char * canonical_filename(struct ap_pool_t *pCont, const char *szFile); #endif /* ! FILE_IO_H */ diff --git a/file_io/win32/filestat.c b/file_io/win32/filestat.c index f750285bc..31c0a2f38 100644 --- a/file_io/win32/filestat.c +++ b/file_io/win32/filestat.c @@ -78,7 +78,7 @@ static ap_filetype_e filetype_from_mode(int mode) return type; } -BOOLEAN is_exe(const char* fname, ap_context_t *cont) { +BOOLEAN is_exe(const char* fname, ap_pool_t *cont) { const char* exename; const char* ext; exename = strrchr(fname, '/'); @@ -126,7 +126,7 @@ ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile) return errno; } } -ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont) +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_pool_t *cont) { /* WIN32_FILE_ATTRIBUTE_DATA is an exact subset of the first * entries of WIN32_FIND_DATA diff --git a/file_io/win32/open.c b/file_io/win32/open.c index 640fc0f0a..94737360b 100644 --- a/file_io/win32/open.c +++ b/file_io/win32/open.c @@ -74,7 +74,7 @@ ap_status_t file_cleanup(void *thefile) } ap_status_t ap_open(ap_file_t **dafile, const char *fname, - ap_int32_t flag, ap_fileperms_t perm, ap_context_t *cont) + ap_int32_t flag, ap_fileperms_t perm, ap_pool_t *cont) { DWORD oflags = 0; DWORD createflags = 0; @@ -173,7 +173,7 @@ ap_status_t ap_close(ap_file_t *file) return stat; } -ap_status_t ap_remove_file(char *path, ap_context_t *cont) +ap_status_t ap_remove_file(char *path, ap_pool_t *cont) { char *temp = canonical_filename(cont, path); @@ -195,7 +195,7 @@ ap_status_t ap_get_os_file(ap_os_file_t *thefile, ap_file_t *file) } ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, - ap_context_t *cont) + ap_pool_t *cont) { if ((*file) == NULL) { if (cont == NULL) { @@ -216,7 +216,7 @@ ap_status_t ap_eof(ap_file_t *fptr) return APR_SUCCESS; } -ap_status_t ap_open_stderr(ap_file_t **thefile, ap_context_t *cont) +ap_status_t ap_open_stderr(ap_file_t **thefile, ap_pool_t *cont) { (*thefile) = ap_pcalloc(cont, sizeof(ap_file_t)); if ((*thefile) == NULL) { diff --git a/file_io/win32/pipe.c b/file_io/win32/pipe.c index e8b3a4522..f34de138b 100644 --- a/file_io/win32/pipe.c +++ b/file_io/win32/pipe.c @@ -87,7 +87,7 @@ ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_int32_t timeout) return APR_EINVAL; } -ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont) +ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_pool_t *cont) { SECURITY_ATTRIBUTES sa; diff --git a/include/apr_dso.h b/include/apr_dso.h index 512ddf012..ea7ae47dc 100644 --- a/include/apr_dso.h +++ b/include/apr_dso.h @@ -80,7 +80,7 @@ ap_status_t ap_dso_init(void); * arg 3) Context to use. */ ap_status_t ap_dso_load(ap_dso_handle_t **res_handle, const char *path, - ap_context_t *ctx); + ap_pool_t *ctx); /* ***APRDOC******************************************************** * ap_status_t ap_dso_unload(ap_dso_handle_t *handle) diff --git a/include/apr_file_io.h b/include/apr_file_io.h index c58d7fa54..267533fca 100644 --- a/include/apr_file_io.h +++ b/include/apr_file_io.h @@ -147,7 +147,7 @@ struct ap_finfo_t { * file_t, or NULL (in which case it will be allocated) */ ap_status_t ap_open(ap_file_t **new, const char *fname, ap_int32_t flag, - ap_fileperms_t perm, ap_context_t *cont); + ap_fileperms_t perm, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_close(ap_file_t *file) @@ -164,7 +164,7 @@ ap_status_t ap_close(ap_file_t *file); * NOTE: If the file is open, it won't be removed until all instances are * closed. */ -ap_status_t ap_remove_file(char *path, ap_context_t *cont); +ap_status_t ap_remove_file(char *path, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_eof(ap_file_t *fptr) @@ -188,7 +188,7 @@ ap_status_t ap_ferror(ap_file_t *fptr); * arg 1) The apr file to use as stderr. * arg 2) The context to allocate the file out of. */ -ap_status_t ap_open_stderr(ap_file_t **thefile, ap_context_t *cont); +ap_status_t ap_open_stderr(ap_file_t **thefile, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_read(ap_file_t *thefile, void *buf, ap_ssize_t *nbytes) @@ -317,6 +317,7 @@ ap_status_t ap_dupfile(ap_file_t **new_file, ap_file_t *old_file); * arg 2) The file to get information about. */ ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile); +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_stat(ap_file_t **finfo, char *fname, ap_context_t *cont) @@ -326,7 +327,7 @@ ap_status_t ap_getfileinfo(ap_finfo_t *finfo, ap_file_t *thefile); * arg 2) The name of the file to stat. * arg 3) the context to use to allocate the new file. */ -ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_context_t *cont); +ap_status_t ap_stat(ap_finfo_t *finfo, const char *fname, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_seek(ap_file_t *thefile, ap_seek_where_t where, @@ -350,7 +351,7 @@ ap_status_t ap_seek(ap_file_t *thefile, ap_seek_where_t where,ap_off_t *offset); * arg 2) The full path to the directory (use / on all systems) * arg 3) The context to use. */ -ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_context_t *cont); +ap_status_t ap_opendir(ap_dir_t **new, const char *dirname, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_closedir(ap_dir_t *thedir) @@ -383,7 +384,7 @@ ap_status_t ap_rewinddir(ap_dir_t *thedir); * arg 3) the context to use. */ ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_remove_dir(const char *path, ap_context_t *cont) @@ -391,7 +392,7 @@ ap_status_t ap_make_dir(const char *path, ap_fileperms_t perm, * arg 1) the path for the directory to be removed. (use / on all systems) * arg 2) the context to use. */ -ap_status_t ap_remove_dir(const char *path, ap_context_t *cont); +ap_status_t ap_remove_dir(const char *path, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, @@ -401,7 +402,7 @@ ap_status_t ap_remove_dir(const char *path, ap_context_t *cont); * arg 2) The file descriptor to use as output from the pipe. * arg 3) The context to operate on. */ -ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont); +ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_create_namedpipe(char *filename, ap_fileperms_t perm, @@ -412,7 +413,7 @@ ap_status_t ap_create_pipe(ap_file_t **in, ap_file_t **out, ap_context_t *cont); * arg 3) The context to operate on. */ ap_status_t ap_create_namedpipe(char *filename, ap_fileperms_t perm, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_set_pipe_timeout(ap_file_t *thepipe, ap_int32_t timeout) diff --git a/include/apr_fnmatch.h b/include/apr_fnmatch.h index eca33a9bb..c0300b638 100644 --- a/include/apr_fnmatch.h +++ b/include/apr_fnmatch.h @@ -49,7 +49,7 @@ extern "C" { #define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */ #define FNM_PERIOD 0x04 /* Period must be matched by period. */ /* This flag is an Apache addition */ -#define FNM_CASE_BLIND 0x08 /* Compare characters case ap_context_t nsensitively. */ +#define FNM_CASE_BLIND 0x08 /* Compare characters case ap_pool_t nsensitively. */ API_EXPORT(ap_status_t) ap_fnmatch(const char *pattern, const char *strings, int flags); diff --git a/include/apr_general.h b/include/apr_general.h index 1cbcd6af5..96c791dfd 100644 --- a/include/apr_general.h +++ b/include/apr_general.h @@ -77,7 +77,6 @@ extern "C" { #define MAXIMUM_WAIT_OBJECTS 64 -typedef struct ap_context_t ap_context_t; typedef int ap_signum_t; #ifdef SIGHUP @@ -212,8 +211,26 @@ typedef int ap_signum_t; #define XtOffsetOf(s_type,field) XtOffset(s_type*,field) #endif - - +typedef struct ap_pool_t { + union block_hdr *first; + union block_hdr *last; + struct cleanup *cleanups; + struct process_chain *subprocesses; + struct ap_pool_t *sub_pools; + struct ap_pool_t *sub_next; + struct ap_pool_t *sub_prev; + struct ap_pool_t *parent; + char *free_first_avail; +#ifdef ALLOC_USE_MALLOC + void *allocation_list; +#endif +#ifdef POOL_DEBUG + ap_pool_t *joined; +#endif + int (*apr_abort)(int retcode); + struct datastruct *prog_data; +}ap_pool_t; + /* Context functions */ /* ***APRDOC******************************************************** * ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) @@ -224,15 +241,16 @@ typedef int ap_signum_t; * of it's parent context's attributes, except the ap_context_t will be a * sub-pool. */ -ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont); +ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_destroy_context(ap_context_t *cont) * Free the context and all of it's child contexts'. * arg 1) The context to free. */ -ap_status_t ap_destroy_context(struct ap_context_t *cont); -ap_status_t ap_exit(ap_context_t *); +ap_status_t ap_destroy_context(ap_pool_t *cont); + +ap_status_t ap_exit(ap_pool_t *); /* ***APRDOC******************************************************** * ap_status_t ap_set_userdata(void *data, char *key, @@ -254,7 +272,7 @@ ap_status_t ap_exit(ap_context_t *); */ ap_status_t ap_set_userdata(void *data, char *key, ap_status_t (*cleanup) (void *), - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_get_userdata(void **data, char *key, ap_context_t *cont) @@ -263,7 +281,7 @@ ap_status_t ap_set_userdata(void *data, char *key, * arg 2) The user data associated with the context. * arg 3) The current context. */ -ap_status_t ap_get_userdata(void **, char *key, ap_context_t *cont); +ap_status_t ap_get_userdata(void **, char *key, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_initialize(void) @@ -279,7 +297,7 @@ ap_status_t ap_initialize(void); * function at termination once it has stopped using APR * services. */ -void ap_terminate(void); +void ap_terminate(void); /* ***APRDOC******************************************************** * ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_context_t *cont) @@ -291,7 +309,7 @@ void ap_terminate(void); * then APR will return an error and expect the calling program to * deal with the error accordingly. */ -ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_context_t *cont); +ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_pool_t *cont); #ifdef __cplusplus } diff --git a/include/apr_getopt.h b/include/apr_getopt.h index b0bf7eec9..044c45760 100644 --- a/include/apr_getopt.h +++ b/include/apr_getopt.h @@ -83,7 +83,7 @@ API_VAR_IMPORT char * * main(argc, argv) */ ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, - ap_int32_t *rv, ap_context_t *cont); + ap_int32_t *rv, ap_pool_t *cont); #endif /* ! APR_GETOPT_H */ diff --git a/include/apr_iconv.h b/include/apr_iconv.h index 5fc6ed95f..6d101a396 100644 --- a/include/apr_iconv.h +++ b/include/apr_iconv.h @@ -85,7 +85,7 @@ typedef void ap_iconv_t; typedef struct ap_iconv_t ap_iconv_t; void ap_codepage_open(ap_iconv_t **convset, const char *topage, - const char *frompage, ap_context_t *context); + const char *frompage, ap_pool_t *context); void ap_translate_codepage(ap_iconv_t *convset, const char *inbuf, ap_size_t inbytes_left, const char *outbuf, ap_size_t outbytes_left); diff --git a/include/apr_lib.h b/include/apr_lib.h index 0ac0d4f25..b58b6ff44 100644 --- a/include/apr_lib.h +++ b/include/apr_lib.h @@ -81,12 +81,11 @@ extern "C" { * and tables are opaque structures to applications, but arrays are * published. */ -typedef struct ap_pool_t ap_pool_t; typedef struct ap_table_t ap_table_t; typedef struct ap_child_info_t ap_child_info_t; typedef void ap_mutex_t; typedef struct ap_array_header_t { - ap_context_t *cont; + ap_pool_t *cont; int elt_size; int nelts; int nalloc; @@ -118,7 +117,7 @@ typedef struct ap_vformatter_buff_t { enum kill_conditions { kill_never, /* process is never sent any signals */ - kill_always, /* process is sent SIGKILL on ap_context_t cleanup */ + kill_always, /* process is sent SIGKILL on ap_pool_t cleanup */ kill_after_timeout, /* SIGTERM, wait 3 seconds, SIGKILL */ just_wait, /* wait forever for the process to complete */ kill_only_once /* send SIGTERM and then wait */ @@ -128,7 +127,7 @@ enum kill_conditions { * Define the prototypes for the various APR GP routines. */ API_EXPORT(char *) ap_cpystrn(char *d, const char *s, size_t l); -API_EXPORT(int) ap_tokenize_to_argv(ap_context_t *token_context, +API_EXPORT(int) ap_tokenize_to_argv(ap_pool_t *token_context, char *arg_str, char ***argv_out); API_EXPORT(const char *) ap_filename_of_pathname(const char *pathname); /*API_EXPORT(ap_mutex_t *) ap_create_mutex(void *m);*/ @@ -208,7 +207,7 @@ API_EXPORT_NONSTD(ap_status_t) ap_execve(const char *c, const char *argv[], * can return -1 to indicate that no further output should be attempted, * and ap_vformatter will return immediately with -1. Otherwise * the flush_func should flush the buffer in whatever manner is - * appropriate, re ap_context_t nitialize curpos and endpos, and return 0. + * appropriate, re ap_pool_t nitialize curpos and endpos, and return 0. * * Note that flush_func is only invoked as a result of attempting to * write another byte at curpos when curpos >= endpos. So for @@ -264,15 +263,15 @@ API_EXPORT(int) ap_vsnprintf(char *buf, size_t len, const char *format, * APR memory structure manipulators (pools, tables, and arrays). */ API_EXPORT(ap_pool_t *) ap_make_sub_pool(ap_pool_t *p, int (*apr_abort)(int retcode)); -API_EXPORT(void) ap_clear_pool(struct ap_context_t *p); -API_EXPORT(void) ap_destroy_pool(struct ap_context_t *p); +API_EXPORT(void) ap_clear_pool(struct ap_pool_t *p); +API_EXPORT(void) ap_destroy_pool(struct ap_pool_t *p); API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p); API_EXPORT(long) ap_bytes_in_free_blocks(void); API_EXPORT(ap_pool_t *) ap_find_pool(const void *ts); API_EXPORT(int) ap_pool_is_ancestor(ap_pool_t *a, ap_pool_t *b); API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub); -/* used to guarantee to the ap_context_t debugging code that the sub ap_context_t will not be +/* used to guarantee to the ap_pool_t debugging code that the sub ap_pool_t will not be * destroyed before the parent pool */ #ifndef POOL_DEBUG @@ -283,32 +282,32 @@ API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub); #endif /* POOL_DEBUG */ -API_EXPORT(void *) ap_palloc(struct ap_context_t *c, int reqsize); -API_EXPORT(void *) ap_pcalloc(struct ap_context_t *p, int size); -API_EXPORT(char *) ap_pstrdup(struct ap_context_t *p, const char *s); -API_EXPORT(char *) ap_pstrndup(struct ap_context_t *p, const char *s, int n); -API_EXPORT_NONSTD(char *) ap_pstrcat(struct ap_context_t *p, ...); -API_EXPORT(char *) ap_pvsprintf(struct ap_context_t *p, const char *fmt, va_list ap); -API_EXPORT_NONSTD(char *) ap_psprintf(struct ap_context_t *p, const char *fmt, ...); -API_EXPORT(ap_array_header_t *) ap_make_array(struct ap_context_t *p, int nelts, +API_EXPORT(void *) ap_palloc(struct ap_pool_t *c, int reqsize); +API_EXPORT(void *) ap_pcalloc(struct ap_pool_t *p, int size); +API_EXPORT(char *) ap_pstrdup(struct ap_pool_t *p, const char *s); +API_EXPORT(char *) ap_pstrndup(struct ap_pool_t *p, const char *s, int n); +API_EXPORT_NONSTD(char *) ap_pstrcat(struct ap_pool_t *p, ...); +API_EXPORT(char *) ap_pvsprintf(struct ap_pool_t *p, const char *fmt, va_list ap); +API_EXPORT_NONSTD(char *) ap_psprintf(struct ap_pool_t *p, const char *fmt, ...); +API_EXPORT(ap_array_header_t *) ap_make_array(struct ap_pool_t *p, int nelts, int elt_size); API_EXPORT(void *) ap_push_array(ap_array_header_t *arr); API_EXPORT(void) ap_array_cat(ap_array_header_t *dst, const ap_array_header_t *src); -API_EXPORT(ap_array_header_t *) ap_copy_array(struct ap_context_t *p, +API_EXPORT(ap_array_header_t *) ap_copy_array(struct ap_pool_t *p, const ap_array_header_t *arr); API_EXPORT(ap_array_header_t *) - ap_copy_array_hdr(struct ap_context_t *p, + ap_copy_array_hdr(struct ap_pool_t *p, const ap_array_header_t *arr); API_EXPORT(ap_array_header_t *) - ap_append_arrays(struct ap_context_t *p, + ap_append_arrays(struct ap_pool_t *p, const ap_array_header_t *first, const ap_array_header_t *second); -API_EXPORT(char *) ap_array_pstrcat(struct ap_context_t *p, +API_EXPORT(char *) ap_array_pstrcat(struct ap_pool_t *p, const ap_array_header_t *arr, const char sep); -API_EXPORT(ap_table_t *) ap_make_table(struct ap_context_t *p, int nelts); -API_EXPORT(ap_table_t *) ap_copy_table(struct ap_context_t *p, const ap_table_t *t); +API_EXPORT(ap_table_t *) ap_make_table(struct ap_pool_t *p, int nelts); +API_EXPORT(ap_table_t *) ap_copy_table(struct ap_pool_t *p, const ap_table_t *t); API_EXPORT(void) ap_clear_table(ap_table_t *t); API_EXPORT(const char *) ap_table_get(const ap_table_t *t, const char *key); API_EXPORT(void) ap_table_set(ap_table_t *t, const char *key, @@ -324,7 +323,7 @@ API_EXPORT(void) ap_table_add(ap_table_t *t, const char *key, const char *val); API_EXPORT(void) ap_table_addn(ap_table_t *t, const char *key, const char *val); -API_EXPORT(ap_table_t *) ap_overlay_tables(struct ap_context_t *p, +API_EXPORT(ap_table_t *) ap_overlay_tables(struct ap_pool_t *p, const ap_table_t *overlay, const ap_table_t *base); API_EXPORT(void) @@ -334,21 +333,21 @@ API_EXPORT(void) #define AP_OVERLAP_TABLES_MERGE (1) API_EXPORT(void) ap_overlap_tables(ap_table_t *a, const ap_table_t *b, unsigned flags); -API_EXPORT(void) ap_register_cleanup(struct ap_context_t *p, void *data, +API_EXPORT(void) ap_register_cleanup(struct ap_pool_t *p, void *data, ap_status_t (*plain_cleanup) (void *), ap_status_t (*child_cleanup) (void *)); -API_EXPORT(void) ap_kill_cleanup(struct ap_context_t *p, void *data, +API_EXPORT(void) ap_kill_cleanup(struct ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)); -API_EXPORT(void) ap_run_cleanup(struct ap_context_t *p, void *data, +API_EXPORT(void) ap_run_cleanup(struct ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)); API_EXPORT(void) ap_cleanup_for_exec(void); 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(void) ap_note_subprocess(struct ap_context_t *a, ap_proc_t *pid, +API_EXPORT(void) ap_note_subprocess(struct ap_pool_t *a, ap_proc_t *pid, enum kill_conditions how); API_EXPORT(int) - ap_spawn_child(ap_context_t *p, + ap_spawn_child(ap_pool_t *p, int (*func) (void *a, ap_child_info_t *c), void *data, enum kill_conditions kill_how, FILE **pipe_in, FILE **pipe_out, diff --git a/include/apr_lock.h b/include/apr_lock.h index 7abc06591..778321d65 100644 --- a/include/apr_lock.h +++ b/include/apr_lock.h @@ -91,8 +91,8 @@ typedef struct ap_lock_t ap_lock_t; * only guaranteed to lock processes. */ ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, - ap_lockscope_e scope, const char *fname, - ap_context_t *cont); + ap_lockscope_e scope, char *fname, + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_lock(ap_lock_t *lock) @@ -133,7 +133,7 @@ ap_status_t ap_destroy_lock(ap_lock_t *lock); * portable. */ ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_get_lockdata(ap_lock_t *lock, char *key, void *data) @@ -146,7 +146,7 @@ ap_status_t ap_get_lockdata(ap_lock_t *lock, char *key, void *data); /* ***APRDOC******************************************************** * ap_status_t ap_set_lockdata(ap_lock_t *lock, void *data, char *key, - ap_status_t (*cleanup) (void *)) + * ap_status_t (*cleanup) (void *)) * Return the context associated with the current lock. * arg 1) The currently open lock. * arg 2) The user data to associate with the lock. diff --git a/include/apr_mmap.h b/include/apr_mmap.h index 06cef140c..7cf2349f0 100644 --- a/include/apr_mmap.h +++ b/include/apr_mmap.h @@ -79,7 +79,7 @@ typedef struct ap_mmap_t ap_mmap_t; * arg 5) The context to use when creating the mmap. */ ap_status_t ap_mmap_create(ap_mmap_t ** newmmap, ap_file_t *file, ap_off_t offset, - ap_size_t size, ap_context_t *cntxt); + ap_size_t size, ap_pool_t *cntxt); /* ***APRDOC******************************************************** * ap_status_t ap_mmap_delete(ap_mmap_t *mmap) diff --git a/include/apr_network_io.h b/include/apr_network_io.h index 601480073..8ad12f643 100644 --- a/include/apr_network_io.h +++ b/include/apr_network_io.h @@ -143,7 +143,7 @@ struct ap_hdtr_t { * arg 1) The new socket that has been setup. * arg 2) The context to use */ -ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_context_t *cont); +ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_shutdown(ap_socket_t *thesocket, ap_shutdown_how_e how) @@ -195,7 +195,7 @@ ap_status_t ap_listen(ap_socket_t *sock, ap_int32_t backlog); * arg 3) The context for the new socket. */ ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, - ap_context_t *connection_context); + ap_pool_t *connection_context); /* ***APRDOC******************************************************** * ap_status_t ap_connect(ap_socket_t *sock, char *hostname) @@ -224,7 +224,7 @@ ap_status_t ap_get_remote_hostname(char **name, ap_socket_t *sock); * buffer provided. * arg 3) The context to use. */ -ap_status_t ap_gethostname(char *buf, int len, ap_context_t *cont); +ap_status_t ap_gethostname(char *buf, int len, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_get_socketdata(void **data, char *key, ap_socket_t *sock) @@ -440,7 +440,7 @@ ap_status_t ap_get_remote_name(struct sockaddr_in **name, const ap_socket_t *soc * arg 3) The context to operate on. */ ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_poll(ap_pollfd_t *aprset, ap_int32_t *nsds, diff --git a/include/apr_pools.h b/include/apr_pools.h index 6199cde3c..c485464e2 100644 --- a/include/apr_pools.h +++ b/include/apr_pools.h @@ -69,14 +69,14 @@ extern "C" { * Instead, we maintain pools, and allocate items (both memory and I/O * handlers) from the pools --- currently there are two, one for per * transaction info, and one for config info. When a transaction is over, - * we can delete everything in the per-transaction ap_context_t without fear, and + * we can delete everything in the per-transaction ap_pool_t without fear, and * without thinking too hard about it either. * * rst */ /* Arenas for configuration info and transaction info - * --- actual layout of the ap_context_t structure is private to + * --- actual layout of the ap_pool_t structure is private to * alloc.c. */ @@ -92,24 +92,6 @@ struct process_chain { struct process_chain *next; }; -struct ap_pool_t { - union block_hdr *first; - union block_hdr *last; - struct cleanup *cleanups; - struct process_chain *subprocesses; - ap_pool_t *sub_pools; - ap_pool_t *sub_next; - ap_pool_t *sub_prev; - ap_pool_t *parent; - char *free_first_avail; -#ifdef ALLOC_USE_MALLOC - void *allocation_list; -#endif -#ifdef POOL_DEBUG - ap_pool_t *joined; -#endif -}; - struct ap_table_t { /* This has to be first to promote backwards compatibility with * older modules which cast a ap_table_t * to an ap_array_header_t *... @@ -153,14 +135,14 @@ void ap_term_alloc(void); /* Tear down everything */ /* routines to allocate memory from an pool... */ -API_EXPORT_NONSTD(char *) ap_psprintf(struct ap_context_t *, const char *fmt, ...) +API_EXPORT_NONSTD(char *) ap_psprintf(struct ap_pool_t *, const char *fmt, ...) __attribute__((format(printf,2,3))); /* array and alist management... keeping lists of things. * Common enough to want common support code ... */ -/* ap_array_pstrcat generates a new string from the ap_context_t containing +/* ap_array_pstrcat generates a new string from the ap_pool_t containing * the concatenated sequence of substrings referenced as elements within * the array. The string will be empty if all substrings are empty or null, * or if there are no elements in the array. @@ -240,7 +222,7 @@ extern int raise_sigstop_flags; #define ap_table_elts(t) ((ap_array_header_t *)(t)) #define ap_is_empty_table(t) (((t) == NULL)||(((ap_array_header_t *)(t))->nelts == 0)) -/* magic numbers --- min free bytes to consider a free ap_context_t block useable, +/* magic numbers --- min free bytes to consider a free ap_pool_t block useable, * and the min amount to allocate if we have to go to malloc() */ #ifndef BLOCK_MINFREE diff --git a/include/apr_portable.h b/include/apr_portable.h index a2d7317f3..768632a7a 100644 --- a/include/apr_portable.h +++ b/include/apr_portable.h @@ -265,7 +265,7 @@ ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *thekey, ap_threadkey_t *key); * an apr file type. */ ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, @@ -276,7 +276,7 @@ ap_status_t ap_put_os_file(ap_file_t **file, ap_os_file_t *thefile, * arg 3) The context to use when creating to apr directory. */ ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_socket_t *thesock, @@ -287,7 +287,7 @@ ap_status_t ap_put_os_dir(ap_dir_t **dir, ap_os_dir_t *thedir, * arg 3) The socket we are converting to an apr type. */ ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *, @@ -298,7 +298,7 @@ ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, * arg 3) The context to use if it is needed. */ ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *thelock, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_proc(ap_proc_t *proc, ap_os_proc_t *theproc, @@ -309,7 +309,7 @@ ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *thelock, * arg 3) The context to use if it is needed. */ ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_imp_time(ap_time_t *aprtime, ap_os_imp_time_t **ostime, ap_context_t, *cont) @@ -318,7 +318,7 @@ ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, * arg 2) the time to convert * arg 3) the context to use if necessary */ -ap_status_t ap_put_os_imp_time(ap_time_t *, ap_os_imp_time_t **, ap_context_t *); +ap_status_t ap_put_os_imp_time(ap_time_t *, ap_os_imp_time_t **, ap_pool_t *); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_exp_time(ap_exploded_time_t *aprtime, ap_os_exp_time_t **ostime, ap_context_t, *cont) @@ -327,7 +327,8 @@ ap_status_t ap_put_os_imp_time(ap_time_t *, ap_os_imp_time_t **, ap_context_t *) * arg 2) the time to convert * arg 3) the context to use if necessary */ -ap_status_t ap_put_os_exp_time(ap_exploded_time_t *, ap_os_exp_time_t **, ap_context_t *); +ap_status_t ap_put_os_exp_time(ap_exploded_time_t *, ap_os_exp_time_t **, ap_pool_t *); + #if APR_HAS_THREADS /* ***APRDOC******************************************************** * ap_status_t ap_put_os_thread(ap_thread_t *thd, ap_os_thread_t *thethd, @@ -338,7 +339,7 @@ ap_status_t ap_put_os_exp_time(ap_exploded_time_t *, ap_os_exp_time_t **, ap_con * arg 3) The context to use if it is needed. */ ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_put_os_threadkey(ap_threadkey_t *key, ap_os_threadkey_t *thekey, @@ -349,7 +350,7 @@ ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, * arg 3) The context to use if it is needed. */ ap_status_t ap_put_os_threadkey(ap_threadkey_t **key, ap_os_threadkey_t *thekey, - ap_context_t *cont); + ap_pool_t *cont); #endif #ifdef __cplusplus diff --git a/include/apr_shmem.h b/include/apr_shmem.h index 387a11f08..1ddb0b673 100644 --- a/include/apr_shmem.h +++ b/include/apr_shmem.h @@ -82,7 +82,7 @@ typedef struct shmem_t ap_shmem_t; * require it. * arg 4) The context to use */ -ap_status_t ap_shm_init(ap_shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont); +ap_status_t ap_shm_init(ap_shmem_t **m, ap_size_t reqsize, const char *file, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_shm_destroy(ap_shmem_t *m) diff --git a/include/apr_thread_proc.h b/include/apr_thread_proc.h index e49afa9a9..907762baa 100644 --- a/include/apr_thread_proc.h +++ b/include/apr_thread_proc.h @@ -96,13 +96,14 @@ typedef struct ap_other_child_rec_t ap_other_child_rec_t; typedef void *(API_THREAD_FUNC *ap_thread_start_t)(void *); /* Thread Function definitions */ + /* ***APRDOC******************************************************** * ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont) * Create and initialize a new threadattr variable * arg 1) The newly created threadattr. * arg 2) The context to use */ -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont); +ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) @@ -132,7 +133,7 @@ ap_status_t ap_getthreadattr_detach(ap_threadattr_t *iattr); */ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, ap_thread_start_t func, void *data, - ap_context_t *cont); + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) @@ -189,8 +190,8 @@ ap_status_t ap_set_threaddata(void *data, char *key, * arg 2) The destructor to use when freeing the private memory. * arg 3) The context to use */ -ap_status_t ap_create_thread_private(ap_threadkey_t **key, void (*dest)(void *), - ap_context_t *cont); +ap_status_t ap_create_thread_private(ap_threadkey_t **key, void (*dest)(void *), + ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) @@ -246,7 +247,7 @@ ap_status_t ap_set_threadkeydata(void *data, char *key, * arg 1) The newly created procattr. * arg 2) The context to use */ -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_context_t *cont); +ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, @@ -393,7 +394,7 @@ ap_status_t ap_get_childerr(ap_file_t **new, ap_proc_t *proc); * arg 1) The resulting process handle. * arg 2) The context to use. */ -ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont); +ap_status_t ap_fork(ap_proc_t **proc, ap_pool_t *cont); #endif /* ***APRDOC******************************************************** @@ -413,7 +414,7 @@ ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont); */ ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_context_t *cont); + ap_procattr_t *attr, ap_pool_t *cont); /* ***APRDOC******************************************************** * ap_status_t ap_wait_proc(ap_proc_t *proc, ap_wait_how waithow) @@ -436,7 +437,7 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, ap_wait_how_e waithow); * arg 1) The new process handler * arg 2) The context to use if it is needed. */ -ap_status_t ap_detach(ap_proc_t **new, ap_context_t *cont); +ap_status_t ap_detach(ap_proc_t **new, ap_pool_t *cont); /* ***APRDOC******************************************************** * void ap_register_other_child(ap_proc_t *pid, @@ -457,7 +458,7 @@ ap_status_t ap_detach(ap_proc_t **new, ap_context_t *cont); */ void ap_register_other_child(ap_proc_t *pid, void (*maintenance) (int reason, void *), - void *data, int write_fd, ap_context_t *p); + void *data, int write_fd, ap_pool_t *p); /* ***APRDOC******************************************************** * void ap_unregister_other_child(void *data) @@ -499,10 +500,3 @@ ap_status_t ap_kill(ap_proc_t *proc, int sig); #endif /* ! APR_FILE_IO_H */ - - - - - - - diff --git a/include/arch/aix/dso.h b/include/arch/aix/dso.h index 89c33f5c0..ec6d5bf7a 100644 --- a/include/arch/aix/dso.h +++ b/include/arch/aix/dso.h @@ -66,7 +66,7 @@ const char *dlerror(void); int dlclose(void *handle); struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/include/arch/beos/dso.h b/include/arch/beos/dso.h index d863ae1cc..6e65454d9 100644 --- a/include/arch/beos/dso.h +++ b/include/arch/beos/dso.h @@ -64,7 +64,7 @@ struct ap_dso_handle_t { image_id handle; /* Handle to the DSO loaded */ - ap_context_t *cont; + ap_pool_t *cont; }; #endif diff --git a/include/arch/beos/locks.h b/include/arch/beos/locks.h index d88f2fcde..0160b5e71 100644 --- a/include/arch/beos/locks.h +++ b/include/arch/beos/locks.h @@ -62,7 +62,7 @@ #include "apr_lib.h" struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; int curr_locked; diff --git a/include/arch/beos/networkio.h b/include/arch/beos/networkio.h index c085fc332..e971e489f 100644 --- a/include/arch/beos/networkio.h +++ b/include/arch/beos/networkio.h @@ -86,7 +86,7 @@ #define POLLNVAL 32 struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -96,7 +96,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; struct ap_socket_t *sock; fd_set *read; fd_set *write; diff --git a/include/arch/beos/threadproc.h b/include/arch/beos/threadproc.h index f7ffe559b..4588105d1 100644 --- a/include/arch/beos/threadproc.h +++ b/include/arch/beos/threadproc.h @@ -78,19 +78,19 @@ #define BEOS_MAX_DATAKEYS 128 struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; thread_id td; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int32 attr; int detached; int joinable; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int32 key; }; @@ -109,7 +109,7 @@ struct beos_key { }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -122,7 +122,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; thread_id pid; struct ap_procattr_t *attr; }; diff --git a/include/arch/os2/dso.h b/include/arch/os2/dso.h index b71882036..1466a03b9 100644 --- a/include/arch/os2/dso.h +++ b/include/arch/os2/dso.h @@ -64,7 +64,7 @@ #include "apr_dso.h" struct ap_dso_handle_t { - ap_context_t *cont; /* Context for returning error strings */ + ap_pool_t *cont; /* Context for returning error strings */ HMODULE handle; /* Handle to the DSO loaded */ char *failed_module; }; diff --git a/include/arch/os2/fileio.h b/include/arch/os2/fileio.h index ef09d53bc..80f5fe358 100644 --- a/include/arch/os2/fileio.h +++ b/include/arch/os2/fileio.h @@ -66,7 +66,7 @@ #define APR_FILE_BUFSIZE 4096 struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HFILE filedes; char * fname; int isopen; @@ -83,7 +83,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; ULONG handle; FILEFINDBUF3 entry; diff --git a/include/arch/os2/locks.h b/include/arch/os2/locks.h index 9dcf0f293..d416b6b08 100644 --- a/include/arch/os2/locks.h +++ b/include/arch/os2/locks.h @@ -61,7 +61,7 @@ #include <os2.h> struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; char *fname; diff --git a/include/arch/os2/networkio.h b/include/arch/os2/networkio.h index a8fd397a5..c0be3720b 100644 --- a/include/arch/os2/networkio.h +++ b/include/arch/os2/networkio.h @@ -60,7 +60,7 @@ #include "os2calls.h" struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -70,7 +70,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int *socket_list; int *r_socket_list; int num_read; diff --git a/include/arch/os2/threadproc.h b/include/arch/os2/threadproc.h index a4f2e3ce4..cfcca8d62 100644 --- a/include/arch/os2/threadproc.h +++ b/include/arch/os2/threadproc.h @@ -64,12 +64,12 @@ #define APR_THREAD_STACKSIZE 65536 struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; unsigned long attr; }; struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; struct ap_threadattr_t *attr; unsigned long tid; ap_thread_start_t func; @@ -78,12 +78,12 @@ struct ap_thread_t { }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; unsigned long *key; }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -96,7 +96,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pid_t pid; struct ap_procattr_t *attr; int running; diff --git a/include/arch/unix/dso.h b/include/arch/unix/dso.h index 6eb2de665..01a1c9c59 100644 --- a/include/arch/unix/dso.h +++ b/include/arch/unix/dso.h @@ -83,7 +83,7 @@ #endif struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/include/arch/unix/fileio.h b/include/arch/unix/fileio.h index 3dcaa81d8..6eb7df9f4 100644 --- a/include/arch/unix/fileio.h +++ b/include/arch/unix/fileio.h @@ -101,7 +101,7 @@ /* End System headers */ struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int filedes; char * fname; int oflags; @@ -112,7 +112,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; DIR *dirstruct; struct dirent *entry; diff --git a/include/arch/unix/locks.h b/include/arch/unix/locks.h index 9938d6797..e10d89086 100644 --- a/include/arch/unix/locks.h +++ b/include/arch/unix/locks.h @@ -109,7 +109,7 @@ union semun { #endif struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; int curr_locked; @@ -150,7 +150,7 @@ ap_status_t ap_unix_lock_inter(struct ap_lock_t *lock); ap_status_t ap_unix_unlock_inter(struct ap_lock_t *lock); ap_status_t ap_unix_destroy_inter_lock(struct ap_lock_t *lock); -ap_status_t ap_unix_child_init_lock(struct ap_lock_t **lock, ap_context_t *cont, +ap_status_t ap_unix_child_init_lock(struct ap_lock_t **lock, ap_pool_t *cont, const char *fname); #endif /* LOCKS_H */ diff --git a/include/arch/unix/misc.h b/include/arch/unix/misc.h index dfe0413a9..4e6b51d62 100644 --- a/include/arch/unix/misc.h +++ b/include/arch/unix/misc.h @@ -85,12 +85,6 @@ typedef struct datastruct { struct datastruct *prev; } datastruct; -struct ap_context_t { - struct ap_pool_t *pool; - datastruct *prog_data; - int (*apr_abort)(int retcode); -}; - struct ap_other_child_rec_t { struct ap_other_child_rec_t *next; int pid; diff --git a/include/arch/unix/mmap.c b/include/arch/unix/mmap.c index c2c48869a..5e5b571f7 100644 --- a/include/arch/unix/mmap.c +++ b/include/arch/unix/mmap.c @@ -77,7 +77,7 @@ static ap_status_t mmap_cleanup(void *themmap) } ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset, - ap_size_t size, ap_context_t *cont) + ap_size_t size, ap_pool_t *cont) { caddr_t mm; diff --git a/include/arch/unix/networkio.h b/include/arch/unix/networkio.h index d3e3f732c..951c045a7 100644 --- a/include/arch/unix/networkio.h +++ b/include/arch/unix/networkio.h @@ -107,7 +107,7 @@ /* End System Headers */ struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -119,7 +119,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; #ifdef HAVE_POLL int *sock; int curpos; diff --git a/include/arch/unix/threadproc.h b/include/arch/unix/threadproc.h index 7aba340f7..45fe78707 100644 --- a/include/arch/unix/threadproc.h +++ b/include/arch/unix/threadproc.h @@ -83,23 +83,23 @@ #if APR_HAS_THREADS struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_t *td; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_attr_t *attr; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_key_t key; }; #endif struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -112,7 +112,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pid_t pid; struct ap_procattr_t *attr; }; @@ -120,7 +120,7 @@ struct ap_proc_t { /*This will move to ap_threadproc.h in time, but I need to figure it out * on windows first. :) */ -ap_status_t ap_detach(struct ap_proc_t **, ap_context_t *); +ap_status_t ap_detach(struct ap_proc_t **, ap_pool_t *); #endif /* ! THREAD_PROC_H */ diff --git a/include/arch/win32/atime.h b/include/arch/win32/atime.h index 1b42d31a5..d24fc4243 100644 --- a/include/arch/win32/atime.h +++ b/include/arch/win32/atime.h @@ -60,7 +60,7 @@ #include <time.h> struct atime_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_time_t currtime; SYSTEMTIME *explodedtime; }; diff --git a/include/arch/win32/dso.h b/include/arch/win32/dso.h index 701ed309b..45b74420b 100644 --- a/include/arch/win32/dso.h +++ b/include/arch/win32/dso.h @@ -61,7 +61,7 @@ #include "apr_dso.h" struct ap_dso_handle_t { - ap_context_t *cont; + ap_pool_t *cont; void *handle; }; diff --git a/include/arch/win32/fileio.h b/include/arch/win32/fileio.h index 550227464..108c343d4 100644 --- a/include/arch/win32/fileio.h +++ b/include/arch/win32/fileio.h @@ -96,7 +96,7 @@ */ struct ap_file_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HANDLE filehand; char *fname; DWORD dwFileAttributes; @@ -114,7 +114,7 @@ struct ap_file_t { }; struct ap_dir_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; char *dirname; HANDLE dirhand; WIN32_FIND_DATA *entry; @@ -123,9 +123,9 @@ struct ap_dir_t { ap_status_t file_cleanup(void *); /*mode_t get_fileperms(ap_fileperms_t); */ -API_EXPORT(char *) ap_os_systemcase_filename(struct ap_context_t *pCont, +API_EXPORT(char *) ap_os_systemcase_filename(struct ap_pool_t *pCont, const char *szFile); -char * canonical_filename(struct ap_context_t *pCont, const char *szFile); +char * canonical_filename(struct ap_pool_t *pCont, const char *szFile); #endif /* ! FILE_IO_H */ diff --git a/include/arch/win32/locks.h b/include/arch/win32/locks.h index 7c89002f0..602c2eb67 100644 --- a/include/arch/win32/locks.h +++ b/include/arch/win32/locks.h @@ -58,7 +58,7 @@ #include "apr_lock.h" struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; HANDLE mutex; diff --git a/include/arch/win32/misc.h b/include/arch/win32/misc.h index dfe0413a9..4e6b51d62 100644 --- a/include/arch/win32/misc.h +++ b/include/arch/win32/misc.h @@ -85,12 +85,6 @@ typedef struct datastruct { struct datastruct *prev; } datastruct; -struct ap_context_t { - struct ap_pool_t *pool; - datastruct *prog_data; - int (*apr_abort)(int retcode); -}; - struct ap_other_child_rec_t { struct ap_other_child_rec_t *next; int pid; diff --git a/include/arch/win32/networkio.h b/include/arch/win32/networkio.h index a008062ea..5421312e2 100644 --- a/include/arch/win32/networkio.h +++ b/include/arch/win32/networkio.h @@ -59,7 +59,7 @@ #include "apr_general.h" struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; SOCKET sock; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -68,7 +68,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; fd_set *read; int numread; fd_set *write; diff --git a/include/arch/win32/threadproc.h b/include/arch/win32/threadproc.h index 391c691f5..f486662bc 100644 --- a/include/arch/win32/threadproc.h +++ b/include/arch/win32/threadproc.h @@ -63,24 +63,24 @@ #define SHELL_PATH "cmd.exe" struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HANDLE td; ap_int32_t cancel; ap_int32_t cancel_how; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_int32_t detach; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; DWORD key; }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; STARTUPINFO si; ap_file_t *parent_in; ap_file_t *child_in; @@ -94,7 +94,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; PROCESS_INFORMATION pi; struct ap_procattr_t *attr; }; diff --git a/lib/apr_cpystrn.c b/lib/apr_cpystrn.c index fa0119e43..bfd62ca44 100644 --- a/lib/apr_cpystrn.c +++ b/lib/apr_cpystrn.c @@ -115,7 +115,7 @@ API_EXPORT(char *) ap_cpystrn(char *dst, const char *src, size_t dst_size) * pool and filled in with copies of the tokens * found during parsing of the arg_str. */ -API_EXPORT(int) ap_tokenize_to_argv(ap_context_t *token_context, +API_EXPORT(int) ap_tokenize_to_argv(ap_pool_t *token_context, char *arg_str, char ***argv_out) { char *cp, *tmpCnt; diff --git a/lib/apr_pools.c b/lib/apr_pools.c index c9ee7f840..9602bc126 100644 --- a/lib/apr_pools.c +++ b/lib/apr_pools.c @@ -594,7 +594,7 @@ static void ap_register_pool_cleanup(struct ap_pool_t *p, void *data, } #endif -API_EXPORT(void) ap_register_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_register_cleanup(ap_pool_t *p, void *data, ap_status_t (*plain_cleanup) (void *), ap_status_t (*child_cleanup) (void *)) { @@ -605,12 +605,12 @@ API_EXPORT(void) ap_register_cleanup(ap_context_t *p, void *data, c->data = data; c->plain_cleanup = plain_cleanup; c->child_cleanup = child_cleanup; - c->next = p->pool->cleanups; - p->pool->cleanups = c; + c->next = p->cleanups; + p->cleanups = c; } } -API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_kill_cleanup(ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)) { struct cleanup *c; @@ -618,8 +618,8 @@ API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, if (p == NULL) return; - c = p->pool->cleanups; - lastp = &p->pool->cleanups; + c = p->cleanups; + lastp = &p->cleanups; while (c) { if (c->data == data && c->plain_cleanup == cleanup) { *lastp = c->next; @@ -631,7 +631,7 @@ API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, } } -API_EXPORT(void) ap_run_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_run_cleanup(ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)) { ap_block_alarms(); /* Run cleanup only once! */ @@ -731,20 +731,18 @@ void ap_term_alloc(void) #endif } -void ap_destroy_real_pool(ap_pool_t *); - /* We only want to lock the mutex if we are being called from ap_clear_pool. * This is because if we also call this function from ap_destroy_real_pool, * which also locks the same mutex, and recursive locks aren't portable. * This way, we are garaunteed that we only lock this mutex once when calling * either one of these functions. */ -static void ap_clear_real_pool(ap_pool_t *a) +API_EXPORT(void) ap_clear_pool(ap_pool_t *a) { ap_block_alarms(); while (a->sub_pools) { - ap_destroy_real_pool(a->sub_pools); + ap_destroy_pool(a->sub_pools); } /* * Don't hold the mutex during cleanups. @@ -776,15 +774,10 @@ static void ap_clear_real_pool(ap_pool_t *a) ap_unblock_alarms(); } -API_EXPORT(void) ap_clear_pool(ap_context_t *a) -{ - ap_clear_real_pool(a->pool); -} - -API_EXPORT(void) ap_destroy_real_pool(ap_pool_t *a) +API_EXPORT(void) ap_destroy_pool(ap_pool_t *a) { ap_block_alarms(); - ap_clear_real_pool(a); + ap_clear_pool(a); #if APR_HAS_THREADS ap_lock(alloc_mutex); #endif @@ -807,11 +800,6 @@ API_EXPORT(void) ap_destroy_real_pool(ap_pool_t *a) ap_unblock_alarms(); } -API_EXPORT(void) ap_destroy_pool(ap_context_t *a) -{ - ap_destroy_real_pool(a->pool); -} - API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p) { return bytes_in_block_list(p->first); @@ -935,12 +923,15 @@ API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub, * Allocating stuff... */ -static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int retcode)) +void * ap_palloc(ap_pool_t *a, int reqsize) { #ifdef ALLOC_USE_MALLOC int size = reqsize + CLICK_SZ; void *ptr; + if (a == NULL) { + return malloc(reqsize); + } ap_block_alarms(); if (c == NULL) { return malloc(reqsize); @@ -972,6 +963,10 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret char *first_avail; char *new_first_avail; + if (a == NULL) { + return malloc(reqsize); + } + nclicks = 1 + ((reqsize - 1) / CLICK_SZ); size = nclicks * CLICK_SZ; @@ -1004,7 +999,7 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret ap_lock(alloc_mutex); #endif - blok = new_block(size, apr_abort); + blok = new_block(size, a->apr_abort); a->last->h.next = blok; a->last = blok; #ifdef POOL_DEBUG @@ -1024,22 +1019,14 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret #endif } -API_EXPORT(void *) ap_palloc(ap_context_t *c, int reqsize) -{ - if (c == NULL) { - return malloc(reqsize); - } - return ap_pool_palloc(c->pool, reqsize, c->apr_abort); -} - -API_EXPORT(void *) ap_pcalloc(ap_context_t *a, int size) +API_EXPORT(void *) ap_pcalloc(ap_pool_t *a, int size) { void *res = ap_palloc(a, size); memset(res, '\0', size); return res; } -API_EXPORT(char *) ap_pstrdup(ap_context_t *a, const char *s) +API_EXPORT(char *) ap_pstrdup(ap_pool_t *a, const char *s) { char *res; size_t len; @@ -1053,7 +1040,7 @@ API_EXPORT(char *) ap_pstrdup(ap_context_t *a, const char *s) return res; } -API_EXPORT(char *) ap_pstrndup(ap_context_t *a, const char *s, int n) +API_EXPORT(char *) ap_pstrndup(ap_pool_t *a, const char *s, int n) { char *res; @@ -1066,7 +1053,7 @@ API_EXPORT(char *) ap_pstrndup(ap_context_t *a, const char *s, int n) return res; } -API_EXPORT_NONSTD(char *) ap_pstrcat(ap_context_t *a, ...) +API_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *a, ...) { char *cp, *argp, *res; @@ -1113,7 +1100,7 @@ API_EXPORT_NONSTD(char *) ap_pstrcat(ap_context_t *a, ...) * until all the output is done. * * Note that this is completely safe because nothing else can - * allocate in this ap_context_t while ap_psprintf is running. alarms are + * allocate in this ap_pool_t while ap_psprintf is running. alarms are * blocked, and the only thing outside of alloc.c that's invoked * is ap_vformatter -- which was purposefully written to be * self-contained with no callouts. @@ -1191,10 +1178,9 @@ static int psprintf_flush(ap_vformatter_buff_t *vbuff) #endif } -API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) +API_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap) { #ifdef ALLOC_USE_MALLOC - ap_pool_t *p = c->pool; struct psprintf_data ps; void *ptr; @@ -1224,7 +1210,6 @@ API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) struct psprintf_data ps; char *strp; int size; - ap_pool_t *p = c->pool; ap_block_alarms(); ps.blok = p->last; @@ -1256,7 +1241,7 @@ API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) #endif } -API_EXPORT_NONSTD(char *) ap_psprintf(ap_context_t *p, const char *fmt, ...) +API_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...) { va_list ap; char *res; @@ -1279,7 +1264,7 @@ API_EXPORT_NONSTD(char *) ap_psprintf(ap_context_t *p, const char *fmt, ...) * generic interface, but for now, it's a special case */ -API_EXPORT(void) ap_note_subprocess(ap_context_t *a, ap_proc_t *pid, +API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, ap_proc_t *pid, enum kill_conditions how) { struct process_chain *new = @@ -1287,8 +1272,8 @@ API_EXPORT(void) ap_note_subprocess(ap_context_t *a, ap_proc_t *pid, new->pid = pid; new->kill_how = how; - new->next = a->pool->subprocesses; - a->pool->subprocesses = new; + new->next = a->subprocesses; + a->subprocesses = new; } #ifdef WIN32 diff --git a/lib/apr_tables.c b/lib/apr_tables.c index 90517a81b..f1d5ce650 100644 --- a/lib/apr_tables.c +++ b/lib/apr_tables.c @@ -84,7 +84,7 @@ * The 'array' functions... */ -static void make_array_core(ap_array_header_t *res, ap_context_t *c, +static void make_array_core(ap_array_header_t *res, ap_pool_t *c, int nelts, int elt_size) { /* @@ -103,7 +103,7 @@ static void make_array_core(ap_array_header_t *res, ap_context_t *c, res->nalloc = nelts; /* ...but this many allocated */ } -API_EXPORT(ap_array_header_t *) ap_make_array(ap_context_t *p, +API_EXPORT(ap_array_header_t *) ap_make_array(ap_pool_t *p, int nelts, int elt_size) { ap_array_header_t *res; @@ -155,7 +155,7 @@ API_EXPORT(void) ap_array_cat(ap_array_header_t *dst, dst->nelts += src->nelts; } -API_EXPORT(ap_array_header_t *) ap_copy_array(ap_context_t *p, +API_EXPORT(ap_array_header_t *) ap_copy_array(ap_pool_t *p, const ap_array_header_t *arr) { ap_array_header_t *res = ap_make_array(p, arr->nalloc, arr->elt_size); @@ -182,7 +182,7 @@ static APR_INLINE void copy_array_hdr_core(ap_array_header_t *res, } API_EXPORT(ap_array_header_t *) - ap_copy_array_hdr(ap_context_t *p, + ap_copy_array_hdr(ap_pool_t *p, const ap_array_header_t *arr) { ap_array_header_t *res; @@ -196,7 +196,7 @@ API_EXPORT(ap_array_header_t *) /* The above is used here to avoid consing multiple new array bodies... */ API_EXPORT(ap_array_header_t *) - ap_append_arrays(ap_context_t *p, + ap_append_arrays(ap_pool_t *p, const ap_array_header_t *first, const ap_array_header_t *second) { @@ -206,13 +206,13 @@ API_EXPORT(ap_array_header_t *) return res; } -/* ap_array_pstrcat generates a new string from the ap_context_t containing +/* ap_array_pstrcat generates a new string from the ap_pool_t containing * the concatenated sequence of substrings referenced as elements within * the array. The string will be empty if all substrings are empty or null, * or if there are no elements in the array. * If sep is non-NUL, it will be inserted between elements as a separator. */ -API_EXPORT(char *) ap_array_pstrcat(ap_context_t *p, +API_EXPORT(char *) ap_array_pstrcat(ap_pool_t *p, const ap_array_header_t *arr, const char sep) { @@ -289,7 +289,7 @@ static ap_table_entry_t *table_push(ap_table_t *t) #endif /* MAKE_TABLE_PROFILE */ -API_EXPORT(ap_table_t *) ap_make_table(ap_context_t *p, int nelts) +API_EXPORT(ap_table_t *) ap_make_table(ap_pool_t *p, int nelts) { ap_table_t *t = ap_palloc(p, sizeof(ap_table_t)); @@ -300,7 +300,7 @@ API_EXPORT(ap_table_t *) ap_make_table(ap_context_t *p, int nelts) return t; } -API_EXPORT(ap_table_t *) ap_copy_table(ap_context_t *p, const ap_table_t *t) +API_EXPORT(ap_table_t *) ap_copy_table(ap_pool_t *p, const ap_table_t *t) { ap_table_t *new = ap_palloc(p, sizeof(ap_table_t)); @@ -530,7 +530,7 @@ API_EXPORT(void) ap_table_addn(ap_table_t *t, const char *key, elts->val = (char *)val; } -API_EXPORT(ap_table_t *) ap_overlay_tables(ap_context_t *p, +API_EXPORT(ap_table_t *) ap_overlay_tables(ap_pool_t *p, const ap_table_t *overlay, const ap_table_t *base) { diff --git a/locks/beos/crossproc.c b/locks/beos/crossproc.c index d5f7a6db8..388dba8ed 100644 --- a/locks/beos/crossproc.c +++ b/locks/beos/crossproc.c @@ -123,8 +123,7 @@ ap_status_t destroy_inter_lock(ap_lock_t *lock) return stat; } -ap_status_t child_init_lock(ap_lock_t **lock, ap_context_t *cont, - const char *fname) +ap_status_t child_init_lock(ap_lock_t **lock, ap_pool_t *cont, char *fname) { return APR_SUCCESS; } diff --git a/locks/beos/locks.c b/locks/beos/locks.c index 50a0a2dee..48d8c07aa 100644 --- a/locks/beos/locks.c +++ b/locks/beos/locks.c @@ -55,8 +55,8 @@ #include "locks.h" ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, - ap_lockscope_e scope, const char *fname, - ap_context_t *cont) + ap_lockscope_e scope, char *fname, + ap_pool_t *cont) { ap_lock_t *new; ap_status_t stat; @@ -134,8 +134,7 @@ ap_status_t ap_destroy_lock(ap_lock_t *lock) return APR_SUCCESS; } -ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, - ap_context_t *cont) +ap_status_t ap_child_init_lock(ap_lock_t **lock, char *fname, ap_pool_t *cont) { ap_status_t stat; if ((*lock)->scope != APR_CROSS_PROCESS) { diff --git a/locks/beos/locks.h b/locks/beos/locks.h index d88f2fcde..0160b5e71 100644 --- a/locks/beos/locks.h +++ b/locks/beos/locks.h @@ -62,7 +62,7 @@ #include "apr_lib.h" struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; int curr_locked; diff --git a/locks/os2/locks.c b/locks/os2/locks.c index c2114c83c..4272a164b 100644 --- a/locks/os2/locks.c +++ b/locks/os2/locks.c @@ -77,8 +77,7 @@ static ap_status_t lock_cleanup(void *thelock) -ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, ap_lockscope_e scope, - const char *fname, ap_context_t *cont) +ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, ap_lockscope_e scope, char *fname, ap_pool_t *cont) { ap_lock_t *new; ULONG rc; @@ -110,7 +109,7 @@ ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, ap_lockscope_e -ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, ap_context_t *cont) +ap_status_t ap_child_init_lock(ap_lock_t **lock, char *fname, ap_pool_t *cont) { int rc; PIB *ppib; diff --git a/locks/os2/locks.h b/locks/os2/locks.h index 9dcf0f293..d416b6b08 100644 --- a/locks/os2/locks.h +++ b/locks/os2/locks.h @@ -61,7 +61,7 @@ #include <os2.h> struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; char *fname; diff --git a/locks/unix/crossproc.c b/locks/unix/crossproc.c index 6ec5c4e31..cddd80f4a 100644 --- a/locks/unix/crossproc.c +++ b/locks/unix/crossproc.c @@ -130,8 +130,7 @@ ap_status_t ap_unix_destroy_inter_lock(ap_lock_t *lock) return stat; } -ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_context_t *cont, - const char *fname) +ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_pool_t *cont, char *fname) { return APR_SUCCESS; } @@ -231,8 +230,7 @@ ap_status_t ap_unix_destroy_inter_lock(ap_lock_t *lock) return stat; } -ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_context_t *cont, - const char *fname) +ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_pool_t *cont, char *fname) { return APR_SUCCESS; } @@ -312,8 +310,8 @@ ap_status_t ap_unix_destroy_inter_lock(ap_lock_t *lock) return stat; } -ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_context_t *cont, - const char *fname) +ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_pool_t *cont, + const char *fname) { return APR_SUCCESS; } @@ -379,7 +377,7 @@ ap_status_t ap_unix_destroy_inter_lock(ap_lock_t *lock) return stat; } -ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_context_t *cont, +ap_status_t ap_unix_child_init_lock(ap_lock_t **lock, ap_pool_t *cont, const char *fname) { ap_lock_t *new; diff --git a/locks/unix/locks.c b/locks/unix/locks.c index 365eb3582..c550dfea9 100644 --- a/locks/unix/locks.c +++ b/locks/unix/locks.c @@ -56,8 +56,8 @@ #include "apr_portable.h" ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, - ap_lockscope_e scope, const char *fname, - ap_context_t *cont) + ap_lockscope_e scope, char *fname, + ap_pool_t *cont) { ap_lock_t *new; ap_status_t stat; @@ -159,8 +159,8 @@ ap_status_t ap_destroy_lock(ap_lock_t *lock) return APR_SUCCESS; } -ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, - ap_context_t *cont) +ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, + ap_pool_t *cont) { ap_status_t stat; if ((*lock)->scope != APR_CROSS_PROCESS) { @@ -210,7 +210,7 @@ ap_status_t ap_get_os_lock(ap_os_lock_t *oslock, ap_lock_t *lock) } ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *thelock, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/locks/unix/locks.h b/locks/unix/locks.h index 9938d6797..e10d89086 100644 --- a/locks/unix/locks.h +++ b/locks/unix/locks.h @@ -109,7 +109,7 @@ union semun { #endif struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; int curr_locked; @@ -150,7 +150,7 @@ ap_status_t ap_unix_lock_inter(struct ap_lock_t *lock); ap_status_t ap_unix_unlock_inter(struct ap_lock_t *lock); ap_status_t ap_unix_destroy_inter_lock(struct ap_lock_t *lock); -ap_status_t ap_unix_child_init_lock(struct ap_lock_t **lock, ap_context_t *cont, +ap_status_t ap_unix_child_init_lock(struct ap_lock_t **lock, ap_pool_t *cont, const char *fname); #endif /* LOCKS_H */ diff --git a/locks/win32/locks.c b/locks/win32/locks.c index 300877c67..d841ea419 100644 --- a/locks/win32/locks.c +++ b/locks/win32/locks.c @@ -1,56 +1,56 @@ /* ==================================================================== - * The Apache Software License, Version 1.1 - * - * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, - * if any, must include the following acknowledgment: - * "This product includes software developed by the - * Apache Software Foundation (http://www.apache.org/)." - * Alternately, this acknowledgment may appear in the software itself, - * if and wherever such third-party acknowledgments normally appear. - * - * 4. The names "Apache" and "Apache Software Foundation" must - * not be used to endorse or promote products derived from this - * software without prior written permission. For written - * permission, please contact apache@apache.org. - * - * 5. Products derived from this software may not be called "Apache", - * nor may "Apache" appear in their name, without prior written - * permission of the Apache Software Foundation. - * - * THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more - * information on the Apache Software Foundation, please see - * <http://www.apache.org/>. - */ +* The Apache Software License, Version 1.1 +* +* Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, +* if any, must include the following acknowledgment: +* "This product includes software developed by the +* Apache Software Foundation (http://www.apache.org/)." +* Alternately, this acknowledgment may appear in the software itself, +* if and wherever such third-party acknowledgments normally appear. +* +* 4. The names "Apache" and "Apache Software Foundation" must +* not be used to endorse or promote products derived from this +* software without prior written permission. For written +* permission, please contact apache@apache.org. +* +* 5. Products derived from this software may not be called "Apache", +* nor may "Apache" appear in their name, without prior written +* permission of the Apache Software Foundation. +* +* THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more +* information on the Apache Software Foundation, please see +* <http://www.apache.org/>. +*/ #include "apr_general.h" #include "apr_lib.h" @@ -58,8 +58,8 @@ #include "apr_portable.h" ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, - ap_lockscope_e scope, const char *fname, - ap_context_t *cont) + ap_lockscope_e scope, char *fname, + ap_pool_t *cont) { ap_lock_t *newlock; SECURITY_ATTRIBUTES sec; @@ -92,8 +92,8 @@ ap_status_t ap_create_lock(ap_lock_t **lock, ap_locktype_e type, return APR_SUCCESS; } -ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, - ap_context_t *cont) +ap_status_t ap_child_init_lock(ap_lock_t **lock, const char *fname, + ap_pool_t *cont) { /* This routine should not be called (and OpenMutex will fail if called) * on a INTRAPROCESS lock @@ -190,7 +190,7 @@ ap_status_t ap_get_os_lock(ap_os_lock_t *thelock, ap_lock_t *lock) } ap_status_t ap_put_os_lock(ap_lock_t **lock, ap_os_lock_t *thelock, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/locks/win32/locks.h b/locks/win32/locks.h index 7c89002f0..602c2eb67 100644 --- a/locks/win32/locks.h +++ b/locks/win32/locks.h @@ -58,7 +58,7 @@ #include "apr_lock.h" struct ap_lock_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_locktype_e type; ap_lockscope_e scope; HANDLE mutex; diff --git a/memory/unix/apr_pools.c b/memory/unix/apr_pools.c index c9ee7f840..9602bc126 100644 --- a/memory/unix/apr_pools.c +++ b/memory/unix/apr_pools.c @@ -594,7 +594,7 @@ static void ap_register_pool_cleanup(struct ap_pool_t *p, void *data, } #endif -API_EXPORT(void) ap_register_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_register_cleanup(ap_pool_t *p, void *data, ap_status_t (*plain_cleanup) (void *), ap_status_t (*child_cleanup) (void *)) { @@ -605,12 +605,12 @@ API_EXPORT(void) ap_register_cleanup(ap_context_t *p, void *data, c->data = data; c->plain_cleanup = plain_cleanup; c->child_cleanup = child_cleanup; - c->next = p->pool->cleanups; - p->pool->cleanups = c; + c->next = p->cleanups; + p->cleanups = c; } } -API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_kill_cleanup(ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)) { struct cleanup *c; @@ -618,8 +618,8 @@ API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, if (p == NULL) return; - c = p->pool->cleanups; - lastp = &p->pool->cleanups; + c = p->cleanups; + lastp = &p->cleanups; while (c) { if (c->data == data && c->plain_cleanup == cleanup) { *lastp = c->next; @@ -631,7 +631,7 @@ API_EXPORT(void) ap_kill_cleanup(ap_context_t *p, void *data, } } -API_EXPORT(void) ap_run_cleanup(ap_context_t *p, void *data, +API_EXPORT(void) ap_run_cleanup(ap_pool_t *p, void *data, ap_status_t (*cleanup) (void *)) { ap_block_alarms(); /* Run cleanup only once! */ @@ -731,20 +731,18 @@ void ap_term_alloc(void) #endif } -void ap_destroy_real_pool(ap_pool_t *); - /* We only want to lock the mutex if we are being called from ap_clear_pool. * This is because if we also call this function from ap_destroy_real_pool, * which also locks the same mutex, and recursive locks aren't portable. * This way, we are garaunteed that we only lock this mutex once when calling * either one of these functions. */ -static void ap_clear_real_pool(ap_pool_t *a) +API_EXPORT(void) ap_clear_pool(ap_pool_t *a) { ap_block_alarms(); while (a->sub_pools) { - ap_destroy_real_pool(a->sub_pools); + ap_destroy_pool(a->sub_pools); } /* * Don't hold the mutex during cleanups. @@ -776,15 +774,10 @@ static void ap_clear_real_pool(ap_pool_t *a) ap_unblock_alarms(); } -API_EXPORT(void) ap_clear_pool(ap_context_t *a) -{ - ap_clear_real_pool(a->pool); -} - -API_EXPORT(void) ap_destroy_real_pool(ap_pool_t *a) +API_EXPORT(void) ap_destroy_pool(ap_pool_t *a) { ap_block_alarms(); - ap_clear_real_pool(a); + ap_clear_pool(a); #if APR_HAS_THREADS ap_lock(alloc_mutex); #endif @@ -807,11 +800,6 @@ API_EXPORT(void) ap_destroy_real_pool(ap_pool_t *a) ap_unblock_alarms(); } -API_EXPORT(void) ap_destroy_pool(ap_context_t *a) -{ - ap_destroy_real_pool(a->pool); -} - API_EXPORT(long) ap_bytes_in_pool(ap_pool_t *p) { return bytes_in_block_list(p->first); @@ -935,12 +923,15 @@ API_EXPORT(void) ap_pool_join(ap_pool_t *p, ap_pool_t *sub, * Allocating stuff... */ -static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int retcode)) +void * ap_palloc(ap_pool_t *a, int reqsize) { #ifdef ALLOC_USE_MALLOC int size = reqsize + CLICK_SZ; void *ptr; + if (a == NULL) { + return malloc(reqsize); + } ap_block_alarms(); if (c == NULL) { return malloc(reqsize); @@ -972,6 +963,10 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret char *first_avail; char *new_first_avail; + if (a == NULL) { + return malloc(reqsize); + } + nclicks = 1 + ((reqsize - 1) / CLICK_SZ); size = nclicks * CLICK_SZ; @@ -1004,7 +999,7 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret ap_lock(alloc_mutex); #endif - blok = new_block(size, apr_abort); + blok = new_block(size, a->apr_abort); a->last->h.next = blok; a->last = blok; #ifdef POOL_DEBUG @@ -1024,22 +1019,14 @@ static void * ap_pool_palloc(ap_pool_t *a, int reqsize, int (*apr_abort)(int ret #endif } -API_EXPORT(void *) ap_palloc(ap_context_t *c, int reqsize) -{ - if (c == NULL) { - return malloc(reqsize); - } - return ap_pool_palloc(c->pool, reqsize, c->apr_abort); -} - -API_EXPORT(void *) ap_pcalloc(ap_context_t *a, int size) +API_EXPORT(void *) ap_pcalloc(ap_pool_t *a, int size) { void *res = ap_palloc(a, size); memset(res, '\0', size); return res; } -API_EXPORT(char *) ap_pstrdup(ap_context_t *a, const char *s) +API_EXPORT(char *) ap_pstrdup(ap_pool_t *a, const char *s) { char *res; size_t len; @@ -1053,7 +1040,7 @@ API_EXPORT(char *) ap_pstrdup(ap_context_t *a, const char *s) return res; } -API_EXPORT(char *) ap_pstrndup(ap_context_t *a, const char *s, int n) +API_EXPORT(char *) ap_pstrndup(ap_pool_t *a, const char *s, int n) { char *res; @@ -1066,7 +1053,7 @@ API_EXPORT(char *) ap_pstrndup(ap_context_t *a, const char *s, int n) return res; } -API_EXPORT_NONSTD(char *) ap_pstrcat(ap_context_t *a, ...) +API_EXPORT_NONSTD(char *) ap_pstrcat(ap_pool_t *a, ...) { char *cp, *argp, *res; @@ -1113,7 +1100,7 @@ API_EXPORT_NONSTD(char *) ap_pstrcat(ap_context_t *a, ...) * until all the output is done. * * Note that this is completely safe because nothing else can - * allocate in this ap_context_t while ap_psprintf is running. alarms are + * allocate in this ap_pool_t while ap_psprintf is running. alarms are * blocked, and the only thing outside of alloc.c that's invoked * is ap_vformatter -- which was purposefully written to be * self-contained with no callouts. @@ -1191,10 +1178,9 @@ static int psprintf_flush(ap_vformatter_buff_t *vbuff) #endif } -API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) +API_EXPORT(char *) ap_pvsprintf(ap_pool_t *p, const char *fmt, va_list ap) { #ifdef ALLOC_USE_MALLOC - ap_pool_t *p = c->pool; struct psprintf_data ps; void *ptr; @@ -1224,7 +1210,6 @@ API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) struct psprintf_data ps; char *strp; int size; - ap_pool_t *p = c->pool; ap_block_alarms(); ps.blok = p->last; @@ -1256,7 +1241,7 @@ API_EXPORT(char *) ap_pvsprintf(ap_context_t *c, const char *fmt, va_list ap) #endif } -API_EXPORT_NONSTD(char *) ap_psprintf(ap_context_t *p, const char *fmt, ...) +API_EXPORT_NONSTD(char *) ap_psprintf(ap_pool_t *p, const char *fmt, ...) { va_list ap; char *res; @@ -1279,7 +1264,7 @@ API_EXPORT_NONSTD(char *) ap_psprintf(ap_context_t *p, const char *fmt, ...) * generic interface, but for now, it's a special case */ -API_EXPORT(void) ap_note_subprocess(ap_context_t *a, ap_proc_t *pid, +API_EXPORT(void) ap_note_subprocess(ap_pool_t *a, ap_proc_t *pid, enum kill_conditions how) { struct process_chain *new = @@ -1287,8 +1272,8 @@ API_EXPORT(void) ap_note_subprocess(ap_context_t *a, ap_proc_t *pid, new->pid = pid; new->kill_how = how; - new->next = a->pool->subprocesses; - a->pool->subprocesses = new; + new->next = a->subprocesses; + a->subprocesses = new; } #ifdef WIN32 diff --git a/misc/beos/misc.h b/misc/beos/misc.h index c078f0154..c17ded65d 100644 --- a/misc/beos/misc.h +++ b/misc/beos/misc.h @@ -81,7 +81,7 @@ typedef struct datastruct { struct datastruct *prev; } datastruct; -struct ap_context_t { +struct ap_pool_t { struct ap_pool_t *pool; void *prog_data; int (*apr_abort)(int retcode); diff --git a/misc/beos/otherchild.c b/misc/beos/otherchild.c index 0788e8f3d..1239eedbc 100644 --- a/misc/beos/otherchild.c +++ b/misc/beos/otherchild.c @@ -59,7 +59,7 @@ static ap_other_child_rec_t *other_children = NULL; API_EXPORT(void) ap_register_other_child(ap_proc_t *pid, void (*maintenance) (int reason, void *), - void *data, int write_fd, ap_context_t *p) + void *data, int write_fd, ap_pool_t *p) { ap_other_child_rec_t *ocr; diff --git a/misc/beos/start.c b/misc/beos/start.c index 7f41e8c3c..ea728d130 100644 --- a/misc/beos/start.c +++ b/misc/beos/start.c @@ -54,9 +54,9 @@ #include "misc.h" -ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) +ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont) { - ap_context_t *new; + ap_pool_t *new; ap_pool_t *pool; if (cont) { @@ -70,7 +70,7 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_ENOPOOL; } - new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); + new = (ap_pool_t *)ap_palloc(cont, sizeof(ap_pool_t)); new->pool = pool; new->prog_data = NULL; @@ -79,7 +79,7 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_SUCCESS; } -ap_status_t ap_destroy_context(ap_context_t *cont) +ap_status_t ap_destroy_context(ap_pool_t *cont) { ap_destroy_pool(cont); return APR_SUCCESS; @@ -87,7 +87,7 @@ ap_status_t ap_destroy_context(ap_context_t *cont) ap_status_t ap_set_userdata(void *data, char *key, ap_status_t (*cleanup) (void *), - ap_context_t *cont) + ap_pool_t *cont) { datastruct *dptr = NULL, *dptr2 = NULL; if (cont) { @@ -117,7 +117,7 @@ ap_status_t ap_set_userdata(void *data, char *key, return APR_ENOCONT; } -ap_status_t ap_get_userdata(void **data, char *key, ap_context_t *cont) +ap_status_t ap_get_userdata(void **data, char *key, ap_pool_t *cont) { datastruct *dptr = NULL; if (cont) { diff --git a/misc/unix/getopt.c b/misc/unix/getopt.c index c87f29b22..940e5b612 100644 --- a/misc/unix/getopt.c +++ b/misc/unix/getopt.c @@ -41,7 +41,7 @@ char *ap_optarg = ""; /* argument associated with option */ #define EMSG "" -ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap_int32_t *rv, ap_context_t *cont) +ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap_int32_t *rv, ap_pool_t *cont) { char *p; static char *place = EMSG; /* option letter processing */ diff --git a/misc/unix/misc.h b/misc/unix/misc.h index dfe0413a9..4e6b51d62 100644 --- a/misc/unix/misc.h +++ b/misc/unix/misc.h @@ -85,12 +85,6 @@ typedef struct datastruct { struct datastruct *prev; } datastruct; -struct ap_context_t { - struct ap_pool_t *pool; - datastruct *prog_data; - int (*apr_abort)(int retcode); -}; - struct ap_other_child_rec_t { struct ap_other_child_rec_t *next; int pid; diff --git a/misc/unix/otherchild.c b/misc/unix/otherchild.c index 5a8af09f2..eb45e21fe 100644 --- a/misc/unix/otherchild.c +++ b/misc/unix/otherchild.c @@ -63,7 +63,7 @@ static ap_other_child_rec_t *other_children = NULL; API_EXPORT(void) ap_register_other_child(ap_proc_t *pid, void (*maintenance) (int reason, void *), - void *data, int write_fd, ap_context_t *p) + void *data, int write_fd, ap_pool_t *p) { ap_other_child_rec_t *ocr; diff --git a/misc/unix/start.c b/misc/unix/start.c index 18cf26d60..b5c20050e 100644 --- a/misc/unix/start.c +++ b/misc/unix/start.c @@ -59,25 +59,21 @@ #include "../../locks/beos/locks.h" #endif -ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) +ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont) { - ap_context_t *new; - ap_pool_t *pool; + ap_pool_t *new; if (cont) { - pool = ap_make_sub_pool(cont->pool, cont->apr_abort); + new = ap_make_sub_pool(cont, cont->apr_abort); } else { - pool = ap_make_sub_pool(NULL, NULL); + new = ap_make_sub_pool(NULL, NULL); } - if (pool == NULL) { + if (new == NULL) { return APR_ENOPOOL; } - new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); - - new->pool = pool; new->prog_data = NULL; new->apr_abort = NULL; @@ -85,7 +81,7 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_SUCCESS; } -ap_status_t ap_destroy_context(ap_context_t *cont) +ap_status_t ap_destroy_context(ap_pool_t *cont) { ap_destroy_pool(cont); return APR_SUCCESS; @@ -93,7 +89,7 @@ ap_status_t ap_destroy_context(ap_context_t *cont) ap_status_t ap_set_userdata(void *data, char *key, ap_status_t (*cleanup) (void *), - ap_context_t *cont) + ap_pool_t *cont) { datastruct *dptr = NULL, *dptr2 = NULL; if (cont) { @@ -123,7 +119,7 @@ ap_status_t ap_set_userdata(void *data, char *key, return APR_ENOCONT; } -ap_status_t ap_get_userdata(void **data, char *key, ap_context_t *cont) +ap_status_t ap_get_userdata(void **data, char *key, ap_pool_t *cont) { datastruct *dptr = NULL; if (cont) { @@ -160,7 +156,7 @@ void ap_terminate(void) ap_term_alloc(); } -ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_context_t *cont) +ap_status_t ap_set_abort(int (*apr_abort)(int retcode), ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/misc/win32/getopt.c b/misc/win32/getopt.c index 1fcf3664f..bae5406a0 100644 --- a/misc/win32/getopt.c +++ b/misc/win32/getopt.c @@ -44,7 +44,7 @@ char *ap_optarg = ""; /* argument associated with option */ #define EMSG "" -ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap_int32_t *rv, ap_context_t *cont) +ap_status_t ap_getopt(ap_int32_t nargc, char *const *nargv, const char *ostr, ap_int32_t *rv, ap_pool_t *cont) { char *p; static char *place = EMSG; /* option letter processing */ diff --git a/misc/win32/misc.h b/misc/win32/misc.h index a241c1e47..bf93c4266 100644 --- a/misc/win32/misc.h +++ b/misc/win32/misc.h @@ -67,7 +67,7 @@ typedef struct datastruct { struct datastruct *prev; } datastruct; -struct ap_context_t { +struct ap_pool_t { struct ap_pool_t *pool; datastruct *prog_data; int (*apr_abort)(int retcode); diff --git a/misc/win32/names.c b/misc/win32/names.c index 9428d7e60..3123c95fc 100644 --- a/misc/win32/names.c +++ b/misc/win32/names.c @@ -82,7 +82,7 @@ static BOOL OnlyDots(char *pString) * is present on the existing path. This routine also * converts alias names to long names. */ -API_EXPORT(char *) ap_os_systemcase_filename(ap_context_t *pCont, +API_EXPORT(char *) ap_os_systemcase_filename(ap_pool_t *pCont, const char *szFile) { char buf[HUGE_STRING_LEN]; @@ -201,7 +201,7 @@ API_EXPORT(char *) ap_os_systemcase_filename(ap_context_t *pCont, /* Perform canonicalization with the exception that the * input case is preserved. */ -char * canonical_filename(ap_context_t *pCont, const char *szFile) +char * canonical_filename(ap_pool_t *pCont, const char *szFile) { char *pNewStr; char *s; diff --git a/misc/win32/start.c b/misc/win32/start.c index 49cbffb20..eb281e9df 100644 --- a/misc/win32/start.c +++ b/misc/win32/start.c @@ -69,12 +69,12 @@ ap_status_t clean_cont(void *data) } -ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) +ap_status_t ap_create_pool(ap_pool_t **newcont, ap_pool_t *cont) { int iVersionRequested; WSADATA wsaData; int err; - ap_context_t *new; + ap_pool_t *new; ap_pool_t *pool; if (cont) { @@ -88,7 +88,7 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_ENOPOOL; } - new = (ap_context_t *)ap_palloc(cont, sizeof(ap_context_t)); + new = (ap_pool_t *)ap_palloc(cont, sizeof(ap_pool_t)); new->pool = pool; new->prog_data = NULL; @@ -111,13 +111,13 @@ ap_status_t ap_create_context(ap_context_t **newcont, ap_context_t *cont) return APR_SUCCESS; } -ap_status_t ap_destroy_context(ap_context_t *cont) +ap_status_t ap_destroy_context(ap_pool_t *cont) { ap_destroy_pool(cont); return APR_SUCCESS; } -ap_status_t ap_get_oslevel(ap_context_t *cont, ap_oslevel_e *level) +ap_status_t ap_get_oslevel(ap_pool_t *cont, ap_oslevel_e *level) { static OSVERSIONINFO oslev; static unsigned int servpack = 0; @@ -177,7 +177,7 @@ ap_status_t ap_get_oslevel(ap_context_t *cont, ap_oslevel_e *level) ap_status_t ap_set_userdata(void *data, char *key, ap_status_t (*cleanup) (void *), - ap_context_t *cont) + ap_pool_t *cont) { datastruct *dptr = NULL, *dptr2 = NULL; if (cont) { @@ -207,7 +207,7 @@ ap_status_t ap_set_userdata(void *data, char *key, return APR_ENOCONT; } -ap_status_t ap_get_userdata(void **data, char *key, ap_context_t *cont) +ap_status_t ap_get_userdata(void **data, char *key, ap_pool_t *cont) { datastruct *dptr = NULL; if (cont) { diff --git a/mmap/beos/mmap.c b/mmap/beos/mmap.c index 6d56d39f3..f7d97c457 100644 --- a/mmap/beos/mmap.c +++ b/mmap/beos/mmap.c @@ -70,7 +70,7 @@ static ap_status_t mmap_cleanup(void *themmap) } ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset, ap_size_t size, - ap_context_t *cont) + ap_pool_t *cont) { void *mm; area_id aid = -1; diff --git a/mmap/beos/mmap_h.h b/mmap/beos/mmap_h.h index 7033c549f..898953771 100644 --- a/mmap/beos/mmap_h.h +++ b/mmap/beos/mmap_h.h @@ -69,7 +69,7 @@ #include <stdio.h> struct ap_mmap_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; area_id area; void *mm; size_t size; diff --git a/mmap/unix/mmap.c b/mmap/unix/mmap.c index c2c48869a..5e5b571f7 100644 --- a/mmap/unix/mmap.c +++ b/mmap/unix/mmap.c @@ -77,7 +77,7 @@ static ap_status_t mmap_cleanup(void *themmap) } ap_status_t ap_mmap_create(ap_mmap_t **new, ap_file_t *file, ap_off_t offset, - ap_size_t size, ap_context_t *cont) + ap_size_t size, ap_pool_t *cont) { caddr_t mm; diff --git a/mmap/unix/mmap_h.h b/mmap/unix/mmap_h.h index 3a03ed08d..78c91330b 100644 --- a/mmap/unix/mmap_h.h +++ b/mmap/unix/mmap_h.h @@ -85,7 +85,7 @@ /* End System Headers */ struct ap_mmap_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; void *mm; size_t size; }; diff --git a/network_io/beos/networkio.h b/network_io/beos/networkio.h index c085fc332..e971e489f 100644 --- a/network_io/beos/networkio.h +++ b/network_io/beos/networkio.h @@ -86,7 +86,7 @@ #define POLLNVAL 32 struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -96,7 +96,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; struct ap_socket_t *sock; fd_set *read; fd_set *write; diff --git a/network_io/beos/poll.c b/network_io/beos/poll.c index 3d8b34263..a29c3bf73 100644 --- a/network_io/beos/poll.c +++ b/network_io/beos/poll.c @@ -63,7 +63,7 @@ /* select for R4.5 of BeOS. So here we use code that uses the write */ /* bits. */ -ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_context_t *cont) +ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_pool_t *cont) { (*new) = (ap_pollfd_t *)ap_palloc(cont, sizeof(ap_pollfd_t) * num); if ((*new) == NULL) { diff --git a/network_io/beos/sockets.c b/network_io/beos/sockets.c index 5e77798c7..8117db836 100644 --- a/network_io/beos/sockets.c +++ b/network_io/beos/sockets.c @@ -66,7 +66,7 @@ ap_status_t socket_cleanup(void *sock) } } -ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_context_t *cont) +ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_pool_t *cont) { (*new) = (ap_socket_t *)ap_palloc(cont,sizeof(ap_socket_t)); @@ -127,7 +127,7 @@ ap_status_t ap_listen(ap_socket_t *sock, ap_int32_t backlog) return APR_SUCCESS; } -ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_context_t *connection_context) +ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_pool_t *connection_context) { (*new) = (ap_socket_t *)ap_palloc(connection_context, sizeof(ap_socket_t)); @@ -219,7 +219,7 @@ ap_status_t ap_get_os_sock(ap_os_sock_t *thesock, ap_socket_t *sock) } ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/network_io/beos/sockopt.c b/network_io/beos/sockopt.c index c0a85aa21..6472fe4ee 100644 --- a/network_io/beos/sockopt.c +++ b/network_io/beos/sockopt.c @@ -83,7 +83,7 @@ ap_status_t ap_setsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t on) return APR_SUCCESS; } -ap_status_t ap_gethostname(char * buf, int len, ap_context_t *cont) +ap_status_t ap_gethostname(char * buf, int len, ap_pool_t *cont) { if (gethostname(buf, len) == -1){ return errno; diff --git a/network_io/os2/networkio.h b/network_io/os2/networkio.h index a8fd397a5..c0be3720b 100644 --- a/network_io/os2/networkio.h +++ b/network_io/os2/networkio.h @@ -60,7 +60,7 @@ #include "os2calls.h" struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -70,7 +70,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int *socket_list; int *r_socket_list; int num_read; diff --git a/network_io/os2/poll.c b/network_io/os2/poll.c index 2d7b67e8f..32dc2bad4 100644 --- a/network_io/os2/poll.c +++ b/network_io/os2/poll.c @@ -64,7 +64,7 @@ /* OS/2 doesn't have a poll function, implement using OS/2 style select */ -ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_context_t *cont) +ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_pool_t *cont) { *new = (ap_pollfd_t *)ap_palloc(cont, sizeof(ap_pollfd_t)); diff --git a/network_io/os2/sockets.c b/network_io/os2/sockets.c index ef8200304..ced9a179c 100644 --- a/network_io/os2/sockets.c +++ b/network_io/os2/sockets.c @@ -78,7 +78,7 @@ static ap_status_t socket_cleanup(void *sock) } } -ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_context_t *cont) +ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_pool_t *cont) { (*new) = (ap_socket_t *)ap_palloc(cont, sizeof(ap_socket_t)); @@ -147,7 +147,7 @@ ap_status_t ap_listen(ap_socket_t *sock, ap_int32_t backlog) return APR_SUCCESS; } -ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_context_t *connection_context) +ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_pool_t *connection_context) { (*new) = (ap_socket_t *)ap_palloc(connection_context, sizeof(ap_socket_t)); @@ -240,7 +240,7 @@ ap_status_t ap_get_os_sock(ap_os_sock_t *thesock, ap_socket_t *sock) -ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, ap_context_t *cont) +ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/network_io/os2/sockopt.c b/network_io/os2/sockopt.c index 17c1e591f..1da0c6bf6 100644 --- a/network_io/os2/sockopt.c +++ b/network_io/os2/sockopt.c @@ -118,7 +118,7 @@ ap_status_t ap_setsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t on) -ap_status_t ap_gethostname(char *buf, ap_int32_t len, ap_context_t *cont) +ap_status_t ap_gethostname(char *buf, ap_int32_t len, ap_pool_t *cont) { if (gethostname(buf, len) == -1) return APR_OS2_STATUS(sock_errno()); diff --git a/network_io/unix/networkio.h b/network_io/unix/networkio.h index d3e3f732c..951c045a7 100644 --- a/network_io/unix/networkio.h +++ b/network_io/unix/networkio.h @@ -107,7 +107,7 @@ /* End System Headers */ struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int socketdes; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -119,7 +119,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; #ifdef HAVE_POLL int *sock; int curpos; diff --git a/network_io/unix/poll.c b/network_io/unix/poll.c index 99f9beaa2..61fd029fc 100644 --- a/network_io/unix/poll.c +++ b/network_io/unix/poll.c @@ -56,7 +56,7 @@ #ifdef HAVE_POLL /* We can just use poll to do our socket polling. */ -ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_context_t *cont) +ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_pool_t *cont) { (*new) = (ap_pollfd_t *)ap_palloc(cont, sizeof(ap_pollfd_t)); (*new)->sock = ap_palloc(cont, sizeof(ap_socket_t) * num); @@ -211,7 +211,7 @@ ap_status_t ap_clear_poll_sockets(ap_pollfd_t *aprset, ap_int16_t events) #else /* Use select to mimic poll */ -ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_context_t *cont) +ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_pool_t *cont) { (*new) = (ap_pollfd_t *)ap_palloc(cont, sizeof(ap_pollfd_t) * num); if ((*new) == NULL) { diff --git a/network_io/unix/sockets.c b/network_io/unix/sockets.c index 685780b87..aaf360cd6 100644 --- a/network_io/unix/sockets.c +++ b/network_io/unix/sockets.c @@ -67,7 +67,7 @@ static ap_status_t socket_cleanup(void *sock) } } -ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_context_t *cont) +ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_pool_t *cont) { (*new) = (ap_socket_t *)ap_palloc(cont, sizeof(ap_socket_t)); @@ -132,7 +132,7 @@ ap_status_t ap_listen(ap_socket_t *sock, ap_int32_t backlog) return APR_SUCCESS; } -ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_context_t *connection_context) +ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_pool_t *connection_context) { (*new) = (ap_socket_t *)ap_palloc(connection_context, sizeof(ap_socket_t)); @@ -231,7 +231,7 @@ ap_status_t ap_get_os_sock(ap_os_sock_t *thesock, ap_socket_t *sock) } ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/network_io/unix/sockopt.c b/network_io/unix/sockopt.c index eb7a0d2af..45f64a5f5 100644 --- a/network_io/unix/sockopt.c +++ b/network_io/unix/sockopt.c @@ -153,7 +153,7 @@ ap_status_t ap_setsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t on) return APR_SUCCESS; } -ap_status_t ap_gethostname(char *buf, ap_int32_t len, ap_context_t *cont) +ap_status_t ap_gethostname(char *buf, ap_int32_t len, ap_pool_t *cont) { if (gethostname(buf, len) == -1) return errno; diff --git a/network_io/win32/networkio.h b/network_io/win32/networkio.h index a008062ea..5421312e2 100644 --- a/network_io/win32/networkio.h +++ b/network_io/win32/networkio.h @@ -59,7 +59,7 @@ #include "apr_general.h" struct ap_socket_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; SOCKET sock; struct sockaddr_in *local_addr; struct sockaddr_in *remote_addr; @@ -68,7 +68,7 @@ struct ap_socket_t { }; struct ap_pollfd_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; fd_set *read; int numread; fd_set *write; diff --git a/network_io/win32/poll.c b/network_io/win32/poll.c index e5fd905d4..e0fb060f6 100644 --- a/network_io/win32/poll.c +++ b/network_io/win32/poll.c @@ -61,7 +61,7 @@ #include <time.h> -ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_context_t *cont) +ap_status_t ap_setup_poll(ap_pollfd_t **new, ap_int32_t num, ap_pool_t *cont) { (*new) = (ap_pollfd_t *)ap_palloc(cont, sizeof(ap_pollfd_t) * num); if ((*new) == NULL) { diff --git a/network_io/win32/sockets.c b/network_io/win32/sockets.c index 19f159d49..985e21e0f 100644 --- a/network_io/win32/sockets.c +++ b/network_io/win32/sockets.c @@ -74,7 +74,7 @@ static ap_status_t socket_cleanup(void *sock) } } -ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_context_t *cont) +ap_status_t ap_create_tcp_socket(ap_socket_t **new, ap_pool_t *cont) { (*new) = (ap_socket_t *)ap_palloc(cont, sizeof(ap_socket_t)); @@ -158,7 +158,7 @@ ap_status_t ap_listen(ap_socket_t *sock, ap_int32_t backlog) return APR_SUCCESS; } -ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_context_t *connection_context) +ap_status_t ap_accept(ap_socket_t **new, const ap_socket_t *sock, ap_pool_t *connection_context) { (*new) = (ap_socket_t *)ap_palloc(connection_context, sizeof(ap_socket_t)); @@ -259,7 +259,7 @@ ap_status_t ap_get_os_sock(ap_os_sock_t *thesock, ap_socket_t *sock) } ap_status_t ap_put_os_sock(ap_socket_t **sock, ap_os_sock_t *thesock, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/network_io/win32/sockopt.c b/network_io/win32/sockopt.c index ba81d1a7e..d45e7b82e 100644 --- a/network_io/win32/sockopt.c +++ b/network_io/win32/sockopt.c @@ -133,7 +133,7 @@ ap_status_t ap_setsocketopt(ap_socket_t *sock, ap_int32_t opt, ap_int32_t on) return APR_SUCCESS; } -ap_status_t ap_gethostname(char *buf, int len, ap_context_t *cont) +ap_status_t ap_gethostname(char *buf, int len, ap_pool_t *cont) { if (gethostname(buf, len) == -1) return APR_EEXIST; diff --git a/shmem/os2/shmem.c b/shmem/os2/shmem.c index 20702c7dd..364f19415 100644 --- a/shmem/os2/shmem.c +++ b/shmem/os2/shmem.c @@ -68,7 +68,7 @@ struct shmem_t { -ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont) +ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_pool_t *cont) { int rc; struct shmem_t *newm = (struct shmem_t *)ap_palloc(cont, sizeof(struct shmem_t)); diff --git a/shmem/unix/shmem.c b/shmem/unix/shmem.c index 48b6088df..0ab06492a 100644 --- a/shmem/unix/shmem.c +++ b/shmem/unix/shmem.c @@ -61,7 +61,7 @@ struct shmem_t { MM *mm; }; -ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_context_t *cont) +ap_status_t ap_shm_init(struct shmem_t **m, ap_size_t reqsize, const char *file, ap_pool_t *cont) { MM *newmm = mm_create(reqsize, file); if (newmm == NULL) { diff --git a/test/ab_apr.c b/test/ab_apr.c index 6a46fa524..53d284cca 100644 --- a/test/ab_apr.c +++ b/test/ab_apr.c @@ -190,7 +190,7 @@ char buffer[8192]; struct connection *con; /* connection array */ struct data *stats; /* date for each request */ -ap_context_t *cntxt; +ap_pool_t *cntxt; ap_pollfd_t *readbits; @@ -888,7 +888,7 @@ int main(int argc, char **argv) ap_initialize(); atexit(ap_terminate); - ap_create_context(&cntxt, NULL); + ap_create_pool(&cntxt, NULL); ap_optind = 1; while (ap_getopt(argc, argv, "n:c:t:T:p:v:kVhwx:y:z:", &c, cntxt) == APR_SUCCESS) { diff --git a/test/abc.c b/test/abc.c index 0c5b22b87..eeb215e6a 100644 --- a/test/abc.c +++ b/test/abc.c @@ -9,9 +9,9 @@ int main(int argc, char *argv[]) ap_file_t *fd = NULL; char ch; int status = 0; - ap_context_t *context; + ap_pool_t *context; - ap_create_context(&context, NULL); + ap_create_pool(&context, NULL); ap_open(&fd, argv[1], APR_READ, -1, context); diff --git a/test/client.c b/test/client.c index ebc0648e1..dfc2c80d1 100644 --- a/test/client.c +++ b/test/client.c @@ -62,7 +62,7 @@ int main(int argc, char *argv[]) { - ap_context_t *context; + ap_pool_t *context; ap_socket_t *sock; ap_ssize_t length; ap_status_t stat; @@ -85,7 +85,7 @@ int main(int argc, char *argv[]) atexit(ap_terminate); fprintf(stdout, "Creating context......."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Something went wrong\n"); exit(-1); } diff --git a/test/htdigest.c b/test/htdigest.c index 3501ae5f6..d9b895c13 100644 --- a/test/htdigest.c +++ b/test/htdigest.c @@ -97,7 +97,7 @@ #define MAX_STRING_LEN 256 char *tn; -ap_context_t *cntxt; +ap_pool_t *cntxt; static void getword(char *word, char *line, char stop) { @@ -215,7 +215,7 @@ int main(int argc, char *argv[]) char command[MAX_STRING_LEN]; int found; - ap_create_context(&cntxt, NULL); + ap_create_pool(&cntxt, NULL); tn = NULL; ap_signal(SIGINT, (void (*)(int)) interrupted); diff --git a/test/server.c b/test/server.c index 032337f7e..3207915f6 100644 --- a/test/server.c +++ b/test/server.c @@ -61,7 +61,7 @@ int main(int argc, char *argv[]) { - ap_context_t *context; + ap_pool_t *context; ap_socket_t *sock; ap_socket_t *sock2; ap_ssize_t length; @@ -81,7 +81,7 @@ int main(int argc, char *argv[]) atexit(ap_terminate); fprintf(stdout, "Creating context......."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Could not create a context\n"); exit(-1); } diff --git a/test/testargs.c b/test/testargs.c index df4b6bd2d..52ddf668f 100644 --- a/test/testargs.c +++ b/test/testargs.c @@ -65,12 +65,12 @@ int main(int argc, char * const argv[]) { - ap_context_t *context; + ap_pool_t *context; ap_int32_t data; ap_initialize(); atexit(ap_terminate); - ap_create_context(&context, NULL); + ap_create_pool(&context, NULL); while (ap_getopt(argc, argv, "abc:d::", &data, context) == APR_SUCCESS) { switch(data) { diff --git a/test/testcontext.c b/test/testcontext.c index 42401c1dd..0c91d5080 100644 --- a/test/testcontext.c +++ b/test/testcontext.c @@ -69,7 +69,7 @@ ap_status_t string_cleanup(void *data) int main() { - ap_context_t *context; + ap_pool_t *context; char *testdata; char *retdata; @@ -79,7 +79,7 @@ int main() } atexit(ap_terminate); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } diff --git a/test/testdso.c b/test/testdso.c index cdebeb698..d34b2a78d 100644 --- a/test/testdso.c +++ b/test/testdso.c @@ -13,7 +13,7 @@ int main (int argc, char ** argv) ap_dso_handle_t *h = NULL; ap_dso_handle_sym_t func1 = NULL; ap_dso_handle_sym_t func2 = NULL; - ap_context_t *cont; + ap_pool_t *cont; void (*function)(void); void (*function1)(int); int *retval; @@ -26,7 +26,7 @@ int main (int argc, char ** argv) ap_initialize(); atexit(ap_terminate); - if (ap_create_context(&cont, NULL) != APR_SUCCESS) { + if (ap_create_pool(&cont, NULL) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } diff --git a/test/testfile.c b/test/testfile.c index c4660fabb..1b164515e 100644 --- a/test/testfile.c +++ b/test/testfile.c @@ -62,13 +62,13 @@ #include <unistd.h> #endif -int test_filedel(ap_context_t *); -int testdirs(ap_context_t *); +int test_filedel(ap_pool_t *); +int testdirs(ap_pool_t *); int main() { - ap_context_t *context; - ap_context_t *cont2; + ap_pool_t *context; + ap_pool_t *cont2; ap_file_t *thefile = NULL; ap_status_t status = 0; ap_int32_t flag = APR_READ | APR_WRITE | APR_CREATE; @@ -84,11 +84,11 @@ int main() exit(-1); } atexit(ap_terminate); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } - if (ap_create_context(&cont2, context) != APR_SUCCESS) { + if (ap_create_pool(&cont2, context) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } @@ -214,7 +214,7 @@ int main() return 1; } -int test_filedel(ap_context_t *context) +int test_filedel(ap_pool_t *context) { ap_file_t *thefile = NULL; ap_int32_t flag = APR_READ | APR_WRITE | APR_CREATE; @@ -241,7 +241,7 @@ int test_filedel(ap_context_t *context) return APR_SUCCESS; } -int testdirs(ap_context_t *context) +int testdirs(ap_pool_t *context) { ap_dir_t *temp; ap_file_t *file = NULL; diff --git a/test/testmmap.c b/test/testmmap.c index f4310661b..3f58ec3c6 100644 --- a/test/testmmap.c +++ b/test/testmmap.c @@ -69,7 +69,7 @@ int main() { - ap_context_t *context; + ap_pool_t *context; ap_mmap_t *themmap = NULL; ap_file_t *thefile = NULL; ap_finfo_t finfo; @@ -87,7 +87,7 @@ int main() atexit(ap_terminate); fprintf(stdout,"Creating context...................."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Failed.\n"); exit(-1); } diff --git a/test/testoc.c b/test/testoc.c index ad15eb5e0..60b32bbf7 100644 --- a/test/testoc.c +++ b/test/testoc.c @@ -85,7 +85,10 @@ void ocmaint(int reason, void *data) int main(int argc, char *argv[]) { - ap_context_t *context; + ap_pool_t *context; + ap_pool_t *cont2; + ap_status_t status = 0; + ap_ssize_t nbytes = 0; ap_proc_t *newproc = NULL; ap_procattr_t *procattr = NULL; char *args[3]; @@ -99,7 +102,7 @@ int main(int argc, char *argv[]) exit(-1); } atexit(ap_terminate); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } diff --git a/test/testpipe.c b/test/testpipe.c index 81d25a902..fe85ad746 100644 --- a/test/testpipe.c +++ b/test/testpipe.c @@ -62,12 +62,12 @@ #include <unistd.h> #endif -int test_filedel(ap_context_t *); -int testdirs(ap_context_t *); +int test_filedel(ap_pool_t *); +int testdirs(ap_pool_t *); int main() { - ap_context_t *context; + ap_pool_t *context; ap_file_t *readp = NULL; ap_file_t *writep = NULL; ap_size_t nbytes; @@ -78,7 +78,7 @@ int main() exit(-1); } atexit(ap_terminate); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Couldn't allocate context."); exit(-1); } diff --git a/test/testproc.c b/test/testproc.c index 574b58511..74903d246 100644 --- a/test/testproc.c +++ b/test/testproc.c @@ -70,7 +70,7 @@ int testdirs(void); int main(int argc, char *argv[]) { - ap_context_t *context; + ap_pool_t *context; ap_proc_t *newproc; ap_procattr_t *attr; ap_file_t *testfile = NULL; @@ -84,7 +84,7 @@ int main(int argc, char *argv[]) exit(-1); } atexit(ap_terminate); - ap_create_context(&context, NULL); + ap_create_pool(&context, NULL); if (argc > 1) { diff --git a/test/testshmem.c b/test/testshmem.c index d616a6a30..702b8b91e 100644 --- a/test/testshmem.c +++ b/test/testshmem.c @@ -70,7 +70,7 @@ typedef struct mbox { char msg[1024]; int msgavail; } mbox; -ap_context_t *context; +ap_pool_t *context; mbox *boxes; void msgwait(int boxnum) @@ -100,7 +100,7 @@ int main() ap_initialize(); fprintf(stdout, "Initializing the context......."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "could not initialize\n"); exit(-1); } diff --git a/test/testsock.c b/test/testsock.c index 5800ca71f..98f164480 100644 --- a/test/testsock.c +++ b/test/testsock.c @@ -64,7 +64,7 @@ int main(int argc, char *argv[]) { - ap_context_t *context; + ap_pool_t *context; ap_procattr_t *attr1 = NULL; ap_procattr_t *attr2 = NULL; @@ -83,7 +83,7 @@ int main(int argc, char *argv[]) atexit(ap_terminate); fprintf(stdout, "Creating context......."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "Could not create context\n"); exit(-1); } diff --git a/test/testthread.c b/test/testthread.c index 76110426b..f82f496ce 100644 --- a/test/testthread.c +++ b/test/testthread.c @@ -70,7 +70,7 @@ void * API_THREAD_FUNC thread_func4(void *data); ap_lock_t *thread_lock; -ap_context_t *context; +ap_pool_t *context; int x = 0; void * API_THREAD_FUNC thread_func1(void *data) @@ -131,7 +131,7 @@ int main() ap_initialize(); fprintf(stdout, "Initializing the context......."); - if (ap_create_context(&context, NULL) != APR_SUCCESS) { + if (ap_create_pool(&context, NULL) != APR_SUCCESS) { fprintf(stderr, "could not initialize\n"); exit(-1); } diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index 0ea867b8a..b992f0a12 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -60,7 +60,7 @@ struct send_pipe { int err; }; -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_context_t *cont) +ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) { (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); @@ -166,7 +166,7 @@ ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) +ap_status_t ap_fork(ap_proc_t **proc, ap_pool_t *cont) { int pid; @@ -188,7 +188,7 @@ ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_context_t *cont) + ap_procattr_t *attr, ap_pool_t *cont) { int i=0,nargs=0; char **newargs = NULL; @@ -368,7 +368,7 @@ ap_status_t ap_get_os_proc(ap_os_proc_t *theproc, ap_proc_t *proc) } ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/beos/procsup.c b/threadproc/beos/procsup.c index f4b1ecf9a..0038c88ef 100644 --- a/threadproc/beos/procsup.c +++ b/threadproc/beos/procsup.c @@ -54,7 +54,7 @@ #include "threadproc.h" -ap_status_t ap_detach(ap_proc_t **new, ap_context_t *cont) +ap_status_t ap_detach(ap_proc_t **new, ap_pool_t *cont) { int x; diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c index 4eff59d45..85988eb93 100644 --- a/threadproc/beos/thread.c +++ b/threadproc/beos/thread.c @@ -54,7 +54,7 @@ #include "threadproc.h" -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont) +ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) { ap_status_t stat; @@ -93,7 +93,7 @@ ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, ap_thread_start_t func, void *data, - ap_context_t *cont) + ap_pool_t *cont) { int32 temp; ap_status_t stat; @@ -116,7 +116,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, else temp = B_NORMAL_PRIORITY; - stat = ap_create_context(&(*new)->cntxt, cont); + stat = ap_create_pool(&(*new)->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } diff --git a/threadproc/beos/threadcancel.c b/threadproc/beos/threadcancel.c new file mode 100644 index 000000000..94a7e9407 --- /dev/null +++ b/threadproc/beos/threadcancel.c @@ -0,0 +1,88 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +#include "threadproc.h" + + +ap_status_t ap_cancel_thread(ap_thread_t *thd) +{ + if (kill_thread(thd->td) == 0) { + return APR_SUCCESS; + } + else { + return errno; + } +} + + +ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) +{ +/* if (pthread_setcanceltype(type, NULL) == 0) {*/ + return APR_SUCCESS; +/* } + else { + return APR_FAILURE; + }*/ +} + +ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) +{ +/* if (pthread_setcanceltype(type, NULL) == 0) {*/ + return APR_SUCCESS; +/* } + else { + return APR_FAILURE; + }*/ +} + diff --git a/threadproc/beos/threadpriv.c b/threadproc/beos/threadpriv.c index c0d6d8e10..bb81fe23e 100644 --- a/threadproc/beos/threadpriv.c +++ b/threadproc/beos/threadpriv.c @@ -59,7 +59,7 @@ static struct beos_private_data *beos_data[BEOS_MAX_DATAKEYS]; static sem_id lock; ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_context_t *cont) + void (*dest)(void *), ap_pool_t *cont) { (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); if ((*key) == NULL) { diff --git a/threadproc/beos/threadproc.h b/threadproc/beos/threadproc.h index f7ffe559b..4588105d1 100644 --- a/threadproc/beos/threadproc.h +++ b/threadproc/beos/threadproc.h @@ -78,19 +78,19 @@ #define BEOS_MAX_DATAKEYS 128 struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; thread_id td; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int32 attr; int detached; int joinable; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; int32 key; }; @@ -109,7 +109,7 @@ struct beos_key { }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -122,7 +122,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; thread_id pid; struct ap_procattr_t *attr; }; diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index c96a42b78..6964d3617 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -71,7 +71,7 @@ #include <stdlib.h> #include <os2.h> -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_context_t *cont) +ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) { (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); @@ -139,7 +139,7 @@ ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) +ap_status_t ap_fork(ap_proc_t **proc, ap_pool_t *cont) { int pid; @@ -165,7 +165,7 @@ ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) /* quotes in the string are doubled up. * Used to escape quotes in args passed to OS/2's cmd.exe */ -static char *double_quotes(ap_context_t *cntxt, char *str) +static char *double_quotes(ap_pool_t *cntxt, char *str) { int num_quotes = 0; int len = 0; @@ -192,7 +192,7 @@ static char *double_quotes(ap_context_t *cntxt, char *str) ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_context_t *cont) + ap_procattr_t *attr, ap_pool_t *cont) { int i, arg, numargs, cmdlen; ap_status_t status; diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c index abf341756..4a7bea7d7 100644 --- a/threadproc/os2/thread.c +++ b/threadproc/os2/thread.c @@ -61,7 +61,7 @@ #define INCL_DOS #include <os2.h> -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont) +ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) { (*new) = (ap_threadattr_t *)ap_palloc(cont, sizeof(ap_threadattr_t)); @@ -101,7 +101,7 @@ static void ap_thread_begin(void *arg) ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, ap_thread_start_t func, void *data, - ap_context_t *cont) + ap_pool_t *cont) { ap_status_t stat; ap_thread_t *thread; @@ -117,7 +117,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, thread->attr = attr; thread->func = func; thread->data = data; - stat = ap_create_context(&thread->cntxt, cont); + stat = ap_create_pool(&thread->cntxt, cont); if (stat != APR_SUCCESS) { return stat; diff --git a/threadproc/os2/threadcancel.c b/threadproc/os2/threadcancel.c new file mode 100644 index 000000000..ca7a18753 --- /dev/null +++ b/threadproc/os2/threadcancel.c @@ -0,0 +1,85 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +#include "threadproc.h" +#include "apr_thread_proc.h" +#include "apr_general.h" +#include "fileio.h" + +ap_status_t ap_cancel_thread(ap_thread_t *thd) +{ + return APR_OS2_STATUS(DosKillThread(thd->tid)); +} + + + +ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) +{ + ULONG rc, nesting; + + if (type == APR_CANCEL_DEFER) + rc = DosEnterMustComplete(&nesting); + else + rc = DosExitMustComplete(&nesting); + + return APR_OS2_STATUS(rc); +} + + + +ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) +{ +/* There's no way to ignore thread kills altogether in OS/2 (that I know of) */ + return APR_ENOTIMPL; +} diff --git a/threadproc/os2/threadpriv.c b/threadproc/os2/threadpriv.c index a4e009abb..cf436d237 100644 --- a/threadproc/os2/threadpriv.c +++ b/threadproc/os2/threadpriv.c @@ -60,7 +60,7 @@ #include "fileio.h" ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_context_t *cont) + void (*dest)(void *), ap_pool_t *cont) { (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); diff --git a/threadproc/os2/threadproc.h b/threadproc/os2/threadproc.h index a4f2e3ce4..cfcca8d62 100644 --- a/threadproc/os2/threadproc.h +++ b/threadproc/os2/threadproc.h @@ -64,12 +64,12 @@ #define APR_THREAD_STACKSIZE 65536 struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; unsigned long attr; }; struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; struct ap_threadattr_t *attr; unsigned long tid; ap_thread_start_t func; @@ -78,12 +78,12 @@ struct ap_thread_t { }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; unsigned long *key; }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -96,7 +96,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pid_t pid; struct ap_procattr_t *attr; int running; diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index 5c3e9cc8f..ad5b7f9ce 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -55,7 +55,7 @@ #include "threadproc.h" #include "apr_portable.h" -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_context_t *cont) +ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) { (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); @@ -200,7 +200,7 @@ ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) +ap_status_t ap_fork(ap_proc_t **proc, ap_pool_t *cont) { int pid; @@ -221,7 +221,7 @@ ap_status_t ap_fork(ap_proc_t **proc, ap_context_t *cont) ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_context_t *cont) + ap_procattr_t *attr, ap_pool_t *cont) { int i; typedef const char *my_stupid_string; @@ -363,7 +363,7 @@ ap_status_t ap_get_os_proc(ap_os_proc_t *theproc, ap_proc_t *proc) } ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/unix/procsup.c b/threadproc/unix/procsup.c index d1bff1f09..f72d9a8db 100644 --- a/threadproc/unix/procsup.c +++ b/threadproc/unix/procsup.c @@ -54,7 +54,7 @@ #include "threadproc.h" -ap_status_t ap_detach(ap_proc_t **new, ap_context_t *cont) +ap_status_t ap_detach(ap_proc_t **new, ap_pool_t *cont) { int x; diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c index 99f3ab1cf..b96217ab7 100644 --- a/threadproc/unix/thread.c +++ b/threadproc/unix/thread.c @@ -58,7 +58,7 @@ #if APR_HAS_THREADS #ifdef HAVE_PTHREAD_H -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont) +ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) { ap_status_t stat; @@ -101,111 +101,8 @@ ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) return APR_NOTDETACH; } -ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, - ap_thread_start_t func, void *data, - ap_context_t *cont) -{ - ap_status_t stat; - pthread_attr_t *temp; - - (*new) = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t)); - - if ((*new) == NULL) { - return APR_ENOMEM; - } - - (*new)->td = (pthread_t *)ap_palloc(cont, sizeof(pthread_t)); - - if ((*new)->td == NULL) { - return APR_ENOMEM; - } - - (*new)->cntxt = cont; - - if (attr) - temp = attr->attr; - else - temp = NULL; - - stat = ap_create_context(&(*new)->cntxt, cont); - if (stat != APR_SUCCESS) { - return stat; - } - - if ((stat = pthread_create((*new)->td, temp, func, data)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} - -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) -{ - ap_destroy_pool(thd->cntxt); - pthread_exit(retval); - return APR_SUCCESS; -} - -ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) -{ - ap_status_t stat; - - if ((stat = pthread_join(*thd->td,(void *)&retval)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} - -ap_status_t ap_thread_detach(ap_thread_t *thd) -{ - ap_status_t stat; - - if ((stat = pthread_detach(*thd->td)) == 0) { - return APR_SUCCESS; - } - else { - return stat; - } -} - -ap_status_t ap_get_threaddata(void **data, char *key, ap_thread_t *thread) -{ - if (thread != NULL) { - return ap_get_userdata(data, key, thread->cntxt); - } - else { - data = NULL; - return APR_ENOTHREAD; - } -} - -ap_status_t ap_set_threaddata(void *data, char *key, - ap_status_t (*cleanup) (void *), - ap_thread_t *thread) -{ - if (thread != NULL) { - return ap_set_userdata(data, key, cleanup, thread->cntxt); - } - else { - data = NULL; - return APR_ENOTHREAD; - } -} - -ap_status_t ap_get_os_thread(ap_os_thread_t *thethd, ap_thread_t *thd) -{ - if (thd == NULL) { - return APR_ENOTHREAD; - } - thethd = thd->td; - return APR_SUCCESS; -} - ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/unix/threadcancel.c b/threadproc/unix/threadcancel.c new file mode 100644 index 000000000..81e3d3e7c --- /dev/null +++ b/threadproc/unix/threadcancel.c @@ -0,0 +1,114 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +#include "threadproc.h" +#if APR_HAS_THREADS + +#ifdef HAVE_PTHREAD_H + +#if 0 /* some platforms, e.g. FreeBSD 2.2.8, do not have pthread_cancel (they do have an undocumented pthread_kill, though) */ +/* ***APRDOC******************************************************** + * ap_status_t ap_cancel_thread(ap_thread_t *thd) + * Asynchronously kill a thread + * arg 1) The thread to kill. + */ +ap_status_t ap_cancel_thread(ap_thread_t *thd) +{ + ap_status_t stat; + if ((stat = pthread_cancel(*thd->td)) == 0) { + return APR_SUCCESS; + } + else { + return stat; + } +} +#endif + +/* ***APRDOC******************************************************** + * ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) + * Determine how threads are cancelable. + * arg 1) how are threads cancelable. One of: + * APR_CANCEL_ASYNCH -- cancel it no matter where it is + * APR_CANCEL_DEFER -- only cancel the thread if it is safe. + * arg 2) The context to operate on + */ +ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) +{ + ap_status_t stat; + if ((stat = pthread_setcanceltype(type, NULL)) == 0) { + return APR_SUCCESS; + } + else { + return stat; + } +} + +/* ***APRDOC******************************************************** + * ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) + * Determine if threads will be cancelable. + * arg 1) Are threads cancelable. + * arg 2) The context to operate on + */ +ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) +{ + ap_status_t stat; + if ((stat = pthread_setcanceltype(type, NULL)) == 0) { + return APR_SUCCESS; + } + else { + return stat; + } +} +#endif +#endif diff --git a/threadproc/unix/threadpriv.c b/threadproc/unix/threadpriv.c index e57cb8424..48c2cdd96 100644 --- a/threadproc/unix/threadpriv.c +++ b/threadproc/unix/threadpriv.c @@ -59,7 +59,7 @@ #ifdef HAVE_PTHREAD_H ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_context_t *cont) + void (*dest)(void *), ap_pool_t *cont) { ap_status_t stat; (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); @@ -136,7 +136,7 @@ ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *thekey, ap_threadkey_t *key) } ap_status_t ap_put_os_threadkey(ap_threadkey_t **key, - ap_os_threadkey_t *thekey, ap_context_t *cont) + ap_os_threadkey_t *thekey, ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/unix/threadproc.h b/threadproc/unix/threadproc.h index 7aba340f7..45fe78707 100644 --- a/threadproc/unix/threadproc.h +++ b/threadproc/unix/threadproc.h @@ -83,23 +83,23 @@ #if APR_HAS_THREADS struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_t *td; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_attr_t *attr; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pthread_key_t key; }; #endif struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_file_t *parent_in; ap_file_t *child_in; ap_file_t *parent_out; @@ -112,7 +112,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; pid_t pid; struct ap_procattr_t *attr; }; @@ -120,7 +120,7 @@ struct ap_proc_t { /*This will move to ap_threadproc.h in time, but I need to figure it out * on windows first. :) */ -ap_status_t ap_detach(struct ap_proc_t **, ap_context_t *); +ap_status_t ap_detach(struct ap_proc_t **, ap_pool_t *); #endif /* ! THREAD_PROC_H */ diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 891ef42fa..0e358335c 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -65,7 +65,7 @@ #include <string.h> #include <process.h> -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_context_t *cont) +ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) { (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); @@ -185,7 +185,7 @@ ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t det) ap_status_t ap_create_process(ap_proc_t **new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_context_t *cont) + ap_procattr_t *attr, ap_pool_t *cont) { int i, iEnvBlockLen; char *cmdline; @@ -440,7 +440,7 @@ ap_status_t ap_get_os_proc(ap_os_proc_t *theproc, ap_proc_t *proc) } ap_status_t ap_put_os_proc(ap_proc_t **proc, ap_os_proc_t *theproc, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c index 41c07feb8..99a9f0927 100644 --- a/threadproc/win32/thread.c +++ b/threadproc/win32/thread.c @@ -61,7 +61,7 @@ #include <process.h> -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_context_t *cont) +ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) { (*new) = (ap_threadattr_t *)ap_palloc(cont, sizeof(ap_threadattr_t)); @@ -89,7 +89,7 @@ ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, ap_thread_start_t func, void *data, - ap_context_t *cont) + ap_pool_t *cont) { ap_status_t stat; unsigned temp; @@ -103,7 +103,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, (*new)->cntxt = cont; - stat = ap_create_context(&(*new)->cntxt, cont); + stat = ap_create_pool(&(*new)->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } @@ -190,7 +190,7 @@ ap_status_t ap_get_os_thread(ap_os_thread_t *thethd, ap_thread_t *thd) } ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, - ap_context_t *cont) + ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/win32/threadcancel.c b/threadproc/win32/threadcancel.c new file mode 100644 index 000000000..3a509202b --- /dev/null +++ b/threadproc/win32/threadcancel.c @@ -0,0 +1,86 @@ +/* ==================================================================== + * The Apache Software License, Version 1.1 + * + * Copyright (c) 2000 The Apache Software Foundation. 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. The end-user documentation included with the redistribution, + * if any, must include the following acknowledgment: + * "This product includes software developed by the + * Apache Software Foundation (http://www.apache.org/)." + * Alternately, this acknowledgment may appear in the software itself, + * if and wherever such third-party acknowledgments normally appear. + * + * 4. The names "Apache" and "Apache Software Foundation" must + * not be used to endorse or promote products derived from this + * software without prior written permission. For written + * permission, please contact apache@apache.org. + * + * 5. Products derived from this software may not be called "Apache", + * nor may "Apache" appear in their name, without prior written + * permission of the Apache Software Foundation. + * + * THIS SOFTWARE IS PROVIDED ``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 SOFTWARE FOUNDATION 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 Software Foundation. For more + * information on the Apache Software Foundation, please see + * <http://www.apache.org/>. + */ + +#include "threadproc.h" +#include "apr_thread_proc.h" +#include "apr_general.h" + + +ap_status_t ap_cancel_thread(ap_thread_t *thd) +{ + if (TerminateThread(thd->td, APR_SUCCESS) == 0) { + return APR_EEXIST; + } + else { + return APR_SUCCESS; + } +} + +/* Not sure of the best way to do this just yet. +ap_status_t ap_setcanceltype(ap_int32_t type, ap_pool_t *cont) +{ + +} + +ap_status_t ap_setcancelstate(ap_int32_t type, ap_pool_t *cont) +{ + ap_status_t stat; + if ((stat = pthread_setcanceltype(type, NULL)) == 0) { + return APR_SUCCESS; + } + else { + return stat; + } +} +*/ diff --git a/threadproc/win32/threadpriv.c b/threadproc/win32/threadpriv.c index df7d78d1c..085722991 100644 --- a/threadproc/win32/threadpriv.c +++ b/threadproc/win32/threadpriv.c @@ -60,7 +60,7 @@ #include "apr_portable.h" ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_context_t *cont) + void (*dest)(void *), ap_pool_t *cont) { (*key)->key = TlsAlloc(); return APR_SUCCESS; @@ -123,7 +123,7 @@ ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *thekey, ap_threadkey_t *key) } ap_status_t ap_put_os_threadkey(ap_threadkey_t **key, - ap_os_threadkey_t *thekey, ap_context_t *cont) + ap_os_threadkey_t *thekey, ap_pool_t *cont) { if (cont == NULL) { return APR_ENOCONT; diff --git a/threadproc/win32/threadproc.h b/threadproc/win32/threadproc.h index 391c691f5..f486662bc 100644 --- a/threadproc/win32/threadproc.h +++ b/threadproc/win32/threadproc.h @@ -63,24 +63,24 @@ #define SHELL_PATH "cmd.exe" struct ap_thread_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; HANDLE td; ap_int32_t cancel; ap_int32_t cancel_how; }; struct ap_threadattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_int32_t detach; }; struct ap_threadkey_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; DWORD key; }; struct ap_procattr_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; STARTUPINFO si; ap_file_t *parent_in; ap_file_t *child_in; @@ -94,7 +94,7 @@ struct ap_procattr_t { }; struct ap_proc_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; PROCESS_INFORMATION pi; struct ap_procattr_t *attr; }; diff --git a/time/unix/atime.h b/time/unix/atime.h index 039c58233..c5a5846b6 100644 --- a/time/unix/atime.h +++ b/time/unix/atime.h @@ -69,7 +69,7 @@ /* End System Headers */ struct atime_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; struct timeval *currtime; struct tm *explodedtime; int time_ex; /* have we already exploded the time? */ diff --git a/time/unix/time.c b/time/unix/time.c index 4ac606e85..bbd0dd312 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -216,14 +216,14 @@ ap_status_t ap_get_os_exp_time(ap_os_exp_time_t **ostime, ap_exploded_time_t *ap } ap_status_t ap_put_os_imp_time(ap_time_t *aprtime, ap_os_imp_time_t **ostime, - ap_context_t *cont) + ap_pool_t *cont) { *aprtime = (*ostime)->tv_sec * AP_USEC_PER_SEC + (*ostime)->tv_usec; return APR_SUCCESS; } ap_status_t ap_put_os_exp_time(ap_exploded_time_t *aprtime, - ap_os_exp_time_t **ostime, ap_context_t *cont) + ap_os_exp_time_t **ostime, ap_pool_t *cont) { aprtime->tm_sec = (*ostime)->tm_sec; aprtime->tm_min = (*ostime)->tm_min; diff --git a/time/win32/atime.h b/time/win32/atime.h index 1b42d31a5..d24fc4243 100644 --- a/time/win32/atime.h +++ b/time/win32/atime.h @@ -60,7 +60,7 @@ #include <time.h> struct atime_t { - ap_context_t *cntxt; + ap_pool_t *cntxt; ap_time_t currtime; SYSTEMTIME *explodedtime; }; diff --git a/time/win32/time.c b/time/win32/time.c index bcea72472..76d62de33 100644 --- a/time/win32/time.c +++ b/time/win32/time.c @@ -197,14 +197,14 @@ ap_status_t ap_get_os_exp_time(ap_os_exp_time_t **ostime, ap_exploded_time_t *ap } ap_status_t ap_put_os_imp_time(ap_time_t *aprtime, ap_os_imp_time_t **ostime, - ap_context_t *cont) + ap_pool_t *cont) { FileTimeToAprTime(aprtime, *ostime); return APR_SUCCESS; } ap_status_t ap_put_os_exp_time(ap_exploded_time_t *aprtime, - ap_os_exp_time_t **ostime, ap_context_t *cont) + ap_os_exp_time_t **ostime, ap_pool_t *cont) { SystemTimeToAprExpTime(aprtime, *ostime); return APR_SUCCESS; |