diff options
author | dougm <dougm@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-02 05:26:45 +0000 |
---|---|---|
committer | dougm <dougm@13f79535-47bb-0310-9956-ffa450edef68> | 2000-08-02 05:26:45 +0000 |
commit | 8fcf6e0fadd7ec31d02e7249dc69922b24747c11 (patch) | |
tree | 4da0bfd73d36292921960aaabc877a57e680b8c4 /threadproc | |
parent | 5198c260c1982414023e984799ce1c3b04bb6b43 (diff) | |
download | libapr-8fcf6e0fadd7ec31d02e7249dc69922b24747c11.tar.gz |
prefix libapr functions and types with apr_
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@60470 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'threadproc')
-rw-r--r-- | threadproc/beos/proc.c | 106 | ||||
-rw-r--r-- | threadproc/beos/thread.c | 34 | ||||
-rw-r--r-- | threadproc/beos/threadpriv.c | 12 | ||||
-rw-r--r-- | threadproc/beos/threadproc.h | 32 | ||||
-rw-r--r-- | threadproc/os2/proc.c | 134 | ||||
-rw-r--r-- | threadproc/os2/signals.c | 4 | ||||
-rw-r--r-- | threadproc/os2/thread.c | 34 | ||||
-rw-r--r-- | threadproc/os2/threadpriv.c | 12 | ||||
-rw-r--r-- | threadproc/os2/threadproc.h | 36 | ||||
-rw-r--r-- | threadproc/unix/proc.c | 126 | ||||
-rw-r--r-- | threadproc/unix/procsup.c | 2 | ||||
-rw-r--r-- | threadproc/unix/signals.c | 4 | ||||
-rw-r--r-- | threadproc/unix/thread.c | 60 | ||||
-rw-r--r-- | threadproc/unix/threadpriv.c | 40 | ||||
-rw-r--r-- | threadproc/unix/threadproc.h | 32 | ||||
-rw-r--r-- | threadproc/win32/proc.c | 92 | ||||
-rw-r--r-- | threadproc/win32/signals.c | 2 | ||||
-rw-r--r-- | threadproc/win32/thread.c | 52 | ||||
-rw-r--r-- | threadproc/win32/threadpriv.c | 32 | ||||
-rw-r--r-- | threadproc/win32/threadproc.h | 38 |
20 files changed, 442 insertions, 442 deletions
diff --git a/threadproc/beos/proc.c b/threadproc/beos/proc.c index de3b04737..4092455f5 100644 --- a/threadproc/beos/proc.c +++ b/threadproc/beos/proc.c @@ -60,10 +60,10 @@ struct send_pipe { int err; }; -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) +apr_status_t apr_createprocattr_init(apr_procattr_t **new, apr_pool_t *cont) { - (*new) = (ap_procattr_t *)ap_palloc(cont, - sizeof(ap_procattr_t)); + (*new) = (apr_procattr_t *)apr_palloc(cont, + sizeof(apr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -81,12 +81,12 @@ ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, - ap_int32_t out, ap_int32_t err) +apr_status_t apr_setprocattr_io(apr_procattr_t *attr, apr_int32_t in, + apr_int32_t out, apr_int32_t err) { - ap_status_t status; + apr_status_t status; if (in != 0) { - if ((status = ap_create_pipe(&attr->child_in, &attr->parent_in, + if ((status = apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -94,18 +94,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); break; default: - ap_set_pipe_timeout(attr->child_in, 0); - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); } } if (out) { - if ((status = ap_create_pipe(&attr->parent_out, &attr->child_out, + if ((status = apr_create_pipe(&attr->parent_out, &attr->child_out, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -113,18 +113,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); break; default: - ap_set_pipe_timeout(attr->child_out, 0); - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); } } if (err) { - if ((status = ap_create_pipe(&attr->parent_err, &attr->child_err, + if ((status = apr_create_pipe(&attr->parent_err, &attr->child_err, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -132,20 +132,20 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); break; default: - ap_set_pipe_timeout(attr->child_err, 0); - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); } } return APR_SUCCESS; } -ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, +apr_status_t apr_setprocattr_dir(apr_procattr_t *attr, const char *dir) { char * cwd; @@ -154,10 +154,10 @@ ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, getcwd(cwd, PATH_MAX); strncat(cwd,"/\0",2); strcat(cwd,dir); - attr->currdir = (char *)ap_pstrdup(attr->cntxt, cwd); + attr->currdir = (char *)apr_pstrdup(attr->cntxt, cwd); free(cwd); } else { - attr->currdir = (char *)ap_pstrdup(attr->cntxt, dir); + attr->currdir = (char *)apr_pstrdup(attr->cntxt, dir); } if (attr->currdir) { return APR_SUCCESS; @@ -165,20 +165,20 @@ ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, return APR_ENOMEM; } -ap_status_t ap_setprocattr_cmdtype(ap_procattr_t *attr, - ap_cmdtype_e cmd) +apr_status_t apr_setprocattr_cmdtype(apr_procattr_t *attr, + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) +apr_status_t apr_setprocattr_detach(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t *proc, ap_pool_t *cont) +apr_status_t apr_fork(apr_proc_t *proc, apr_pool_t *cont) { int pid; @@ -200,9 +200,9 @@ ap_status_t ap_fork(ap_proc_t *proc, ap_pool_t *cont) } -ap_status_t ap_create_process(ap_proc_t *new, const char *progname, +apr_status_t apr_create_process(apr_proc_t *new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_pool_t *cont) + apr_procattr_t *attr, apr_pool_t *cont) { int i=0,nargs=0; char **newargs = NULL; @@ -210,7 +210,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, struct send_pipe *sp; char * dir = NULL; - sp = (struct send_pipe *)ap_palloc(cont, sizeof(struct send_pipe)); + sp = (struct send_pipe *)apr_palloc(cont, sizeof(struct send_pipe)); new->in = attr->parent_in; new->err = attr->parent_err; @@ -257,13 +257,13 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, resume_thread(newproc); if (attr->child_in) { - ap_close(attr->child_in); + apr_close(attr->child_in); } if (attr->child_out) { - ap_close(attr->child_out); + apr_close(attr->child_out); } if (attr->child_err) { - ap_close(attr->child_err); + apr_close(attr->child_err); } send_data(newproc, 0, (void*)sp, sizeof(struct send_pipe)); @@ -277,8 +277,8 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, return APR_SUCCESS; } -ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, - ap_wait_how_e waithow, ap_pool_t *p) +apr_status_t apr_wait_all_procs(apr_proc_t *proc, ap_wait_t *status, + apr_wait_how_e waithow, apr_pool_t *p) { int waitpid_options = WUNTRACED; @@ -295,8 +295,8 @@ ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, return errno; } -ap_status_t ap_wait_proc(ap_proc_t *proc, - ap_wait_how_e wait) +apr_status_t apr_wait_proc(apr_proc_t *proc, + apr_wait_how_e wait) { status_t exitval; thread_info tinfo; @@ -320,47 +320,47 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, return APR_CHILD_NOTDONE; } -ap_status_t ap_setprocattr_childin(ap_procattr_t *attr, ap_file_t *child_in, - ap_file_t *parent_in) +apr_status_t apr_setprocattr_childin(apr_procattr_t *attr, apr_file_t *child_in, + apr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - ap_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); + apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); if (child_in != NULL) - ap_dupfile(&attr->child_in, child_in, attr->cntxt); + apr_dupfile(&attr->child_in, child_in, attr->cntxt); if (parent_in != NULL) - ap_dupfile(&attr->parent_in, parent_in, attr->cntxt); + apr_dupfile(&attr->parent_in, parent_in, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childout(ap_procattr_t *attr, ap_file_t *child_out, - ap_file_t *parent_out) +apr_status_t apr_setprocattr_childout(apr_procattr_t *attr, apr_file_t *child_out, + apr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - ap_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); + apr_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); if (child_out != NULL) - ap_dupfile(&attr->child_out, child_out, attr->cntxt); + apr_dupfile(&attr->child_out, child_out, attr->cntxt); if (parent_out != NULL) - ap_dupfile(&attr->parent_out, parent_out, attr->cntxt); + apr_dupfile(&attr->parent_out, parent_out, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childerr(ap_procattr_t *attr, ap_file_t *child_err, - ap_file_t *parent_err) +apr_status_t apr_setprocattr_childerr(apr_procattr_t *attr, apr_file_t *child_err, + apr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - ap_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); + apr_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); if (child_err != NULL) - ap_dupfile(&attr->child_err, child_err, attr->cntxt); + apr_dupfile(&attr->child_err, child_err, attr->cntxt); if (parent_err != NULL) - ap_dupfile(&attr->parent_err, parent_err, attr->cntxt); + apr_dupfile(&attr->parent_err, parent_err, attr->cntxt); return APR_SUCCESS; } diff --git a/threadproc/beos/thread.c b/threadproc/beos/thread.c index 0793f1e80..c646b0ae5 100644 --- a/threadproc/beos/thread.c +++ b/threadproc/beos/thread.c @@ -54,11 +54,11 @@ #include "threadproc.h" -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) +apr_status_t apr_create_threadattr(apr_threadattr_t **new, apr_pool_t *cont) { - (*new) = (ap_threadattr_t *)ap_palloc(cont, - sizeof(ap_threadattr_t)); - (*new)->attr = (int32)ap_palloc(cont, + (*new) = (apr_threadattr_t *)apr_palloc(cont, + sizeof(apr_threadattr_t)); + (*new)->attr = (int32)apr_palloc(cont, sizeof(int32)); if ((*new) == NULL) { @@ -71,7 +71,7 @@ ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) +apr_status_t apr_setthreadattr_detach(apr_threadattr_t *attr, apr_int32_t on) { if (on == 1){ attr->detached = 1; @@ -81,7 +81,7 @@ ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) return APR_SUCCESS; } -ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) +apr_status_t apr_getthreadattr_detach(apr_threadattr_t *attr) { if (attr->detached == 1){ return APR_DETACH; @@ -89,19 +89,19 @@ 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_pool_t *cont) +apr_status_t apr_create_thread(apr_thread_t **new, apr_threadattr_t *attr, + apr_thread_start_t func, void *data, + apr_pool_t *cont) { int32 temp; - ap_status_t stat; + apr_status_t stat; - (*new) = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t)); + (*new) = (apr_thread_t *)apr_palloc(cont, sizeof(apr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; } - (*new)->td = (thread_id) ap_palloc(cont, sizeof(thread_id)); + (*new)->td = (thread_id) apr_palloc(cont, sizeof(thread_id)); if ((*new)->td == (thread_id)NULL) { return APR_ENOMEM; } @@ -114,7 +114,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, else temp = B_NORMAL_PRIORITY; - stat = ap_create_pool(&(*new)->cntxt, cont); + stat = apr_create_pool(&(*new)->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } @@ -129,14 +129,14 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, } } -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) +apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval) { - ap_destroy_pool(thd->cntxt); + apr_destroy_pool(thd->cntxt); exit_thread ((status_t)retval); return APR_SUCCESS; } -ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) +apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { if (wait_for_thread(thd->td,(void *)&retval) == B_NO_ERROR) { return APR_SUCCESS; @@ -146,7 +146,7 @@ ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) } } -ap_status_t ap_thread_detach(ap_thread_t *thd) +apr_status_t apr_thread_detach(apr_thread_t *thd) { if (suspend_thread(thd->td) == B_NO_ERROR){ return APR_SUCCESS; diff --git a/threadproc/beos/threadpriv.c b/threadproc/beos/threadpriv.c index a2d7de6f4..0044944f6 100644 --- a/threadproc/beos/threadpriv.c +++ b/threadproc/beos/threadpriv.c @@ -58,10 +58,10 @@ static struct beos_key key_table[BEOS_MAX_DATAKEYS]; 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_pool_t *cont) +apr_status_t apr_create_thread_private(apr_threadkey_t **key, + void (*dest)(void *), apr_pool_t *cont) { - (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); + (*key) = (apr_threadkey_t *)apr_palloc(cont, sizeof(apr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; } @@ -82,7 +82,7 @@ ap_status_t ap_create_thread_private(ap_threadkey_t **key, return APR_ENOMEM; } -ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) +apr_status_t apr_get_thread_private(void **new, apr_threadkey_t *key) { thread_id tid; int i, index=0; @@ -114,7 +114,7 @@ ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) return APR_SUCCESS; } -ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) +apr_status_t apr_set_thread_private(void *priv, apr_threadkey_t *key) { thread_id tid; int i,index = 0, ret; @@ -169,7 +169,7 @@ ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) return APR_ENOMEM; } -ap_status_t ap_delete_thread_private(ap_threadkey_t *key) +apr_status_t apr_delete_thread_private(apr_threadkey_t *key) { if (key->key < BEOS_MAX_DATAKEYS){ acquire_sem(key_table[key->key].lock); diff --git a/threadproc/beos/threadproc.h b/threadproc/beos/threadproc.h index 4cb9c31e0..58c4fb67b 100644 --- a/threadproc/beos/threadproc.h +++ b/threadproc/beos/threadproc.h @@ -78,20 +78,20 @@ #define BEOS_MAX_DATAKEYS 128 -struct ap_thread_t { - ap_pool_t *cntxt; +struct apr_thread_t { + apr_pool_t *cntxt; thread_id td; }; -struct ap_threadattr_t { - ap_pool_t *cntxt; +struct apr_threadattr_t { + apr_pool_t *cntxt; int32 attr; int detached; int joinable; }; -struct ap_threadkey_t { - ap_pool_t *cntxt; +struct apr_threadkey_t { + apr_pool_t *cntxt; int32 key; }; @@ -109,17 +109,17 @@ struct beos_key { void (* destructor) (void *); }; -struct ap_procattr_t { - ap_pool_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; +struct apr_procattr_t { + apr_pool_t *cntxt; + apr_file_t *parent_in; + apr_file_t *child_in; + apr_file_t *parent_out; + apr_file_t *child_out; + apr_file_t *parent_err; + apr_file_t *child_err; char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; + apr_int32_t cmdtype; + apr_int32_t detached; }; #endif /* ! THREAD_PROC_H */ diff --git a/threadproc/os2/proc.c b/threadproc/os2/proc.c index d98952b36..ea5e73fe3 100644 --- a/threadproc/os2/proc.c +++ b/threadproc/os2/proc.c @@ -71,10 +71,10 @@ #include <stdlib.h> #include <os2.h> -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) +apr_status_t apr_createprocattr_init(apr_procattr_t **new, apr_pool_t *cont) { - (*new) = (ap_procattr_t *)ap_palloc(cont, - sizeof(ap_procattr_t)); + (*new) = (apr_procattr_t *)apr_palloc(cont, + sizeof(apr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -92,12 +92,12 @@ ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, - ap_int32_t out, ap_int32_t err) +apr_status_t apr_setprocattr_io(apr_procattr_t *attr, apr_int32_t in, + apr_int32_t out, apr_int32_t err) { - ap_status_t stat; + apr_status_t stat; if (in) { - if ((stat = ap_create_pipe(&attr->child_in, &attr->parent_in, + if ((stat = apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt)) != APR_SUCCESS) { return stat; } @@ -105,18 +105,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); break; default: - ap_set_pipe_timeout(attr->child_in, 0); - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); } } if (out) { - if ((stat = ap_create_pipe(&attr->parent_out, &attr->child_out, + if ((stat = apr_create_pipe(&attr->parent_out, &attr->child_out, attr->cntxt)) != APR_SUCCESS) { return stat; } @@ -124,18 +124,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); break; default: - ap_set_pipe_timeout(attr->child_out, 0); - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); } } if (err) { - if ((stat = ap_create_pipe(&attr->parent_err, &attr->child_err, + if ((stat = apr_create_pipe(&attr->parent_err, &attr->child_err, attr->cntxt)) != APR_SUCCESS) { return stat; } @@ -143,90 +143,90 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); break; default: - ap_set_pipe_timeout(attr->child_err, 0); - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); } } return APR_SUCCESS; } -ap_status_t ap_setprocattr_childin(ap_procattr_t *attr, ap_file_t *child_in, - ap_file_t *parent_in) +apr_status_t apr_setprocattr_childin(apr_procattr_t *attr, apr_file_t *child_in, + apr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - ap_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); + apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); if (child_in != NULL) - ap_dupfile(&attr->child_in, child_in, attr->cntxt); + apr_dupfile(&attr->child_in, child_in, attr->cntxt); if (parent_in != NULL) - ap_dupfile(&attr->parent_in, parent_in, attr->cntxt); + apr_dupfile(&attr->parent_in, parent_in, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childout(ap_procattr_t *attr, ap_file_t *child_out, - ap_file_t *parent_out) +apr_status_t apr_setprocattr_childout(apr_procattr_t *attr, apr_file_t *child_out, + apr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - ap_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); + apr_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); if (child_out != NULL) - ap_dupfile(&attr->child_out, child_out, attr->cntxt); + apr_dupfile(&attr->child_out, child_out, attr->cntxt); if (parent_out != NULL) - ap_dupfile(&attr->parent_out, parent_out, attr->cntxt); + apr_dupfile(&attr->parent_out, parent_out, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childerr(ap_procattr_t *attr, ap_file_t *child_err, - ap_file_t *parent_err) +apr_status_t apr_setprocattr_childerr(apr_procattr_t *attr, apr_file_t *child_err, + apr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - ap_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); + apr_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); if (child_err != NULL) - ap_dupfile(&attr->child_err, child_err, attr->cntxt); + apr_dupfile(&attr->child_err, child_err, attr->cntxt); if (parent_err != NULL) - ap_dupfile(&attr->parent_err, parent_err, attr->cntxt); + apr_dupfile(&attr->parent_err, parent_err, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, const char *dir) +apr_status_t apr_setprocattr_dir(apr_procattr_t *attr, const char *dir) { - attr->currdir = ap_pstrdup(attr->cntxt, dir); + attr->currdir = apr_pstrdup(attr->cntxt, dir); if (attr->currdir) { return APR_SUCCESS; } return APR_ENOMEM; } -ap_status_t ap_setprocattr_cmdtype(ap_procattr_t *attr, - ap_cmdtype_e cmd) +apr_status_t apr_setprocattr_cmdtype(apr_procattr_t *attr, + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) +apr_status_t apr_setprocattr_detach(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t *proc, ap_pool_t *cont) +apr_status_t apr_fork(apr_proc_t *proc, apr_pool_t *cont) { int pid; @@ -252,7 +252,7 @@ ap_status_t ap_fork(ap_proc_t *proc, ap_pool_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_pool_t *cntxt, char *str) +static char *double_quotes(apr_pool_t *cntxt, char *str) { int num_quotes = 0; int len = 0; @@ -262,7 +262,7 @@ static char *double_quotes(ap_pool_t *cntxt, char *str) num_quotes += str[len++] == '\"'; } - quote_doubled_str = ap_palloc(cntxt, len + num_quotes + 1); + quote_doubled_str = apr_palloc(cntxt, len + num_quotes + 1); dest = quote_doubled_str; while (*str) { @@ -277,12 +277,12 @@ static char *double_quotes(ap_pool_t *cntxt, char *str) -ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, +apr_status_t apr_create_process(apr_proc_t *proc, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_pool_t *cont) + apr_procattr_t *attr, apr_pool_t *cont) { int i, arg, numargs, cmdlen; - ap_status_t status; + apr_status_t status; char **newargs; char savedir[300]; HFILE save_in, save_out, save_err, dup; @@ -290,7 +290,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, char *extension, *newprogname, *extra_arg = NULL, *cmdline, *cmdline_pos; char interpreter[1024]; char error_object[260]; - ap_file_t *progfile; + apr_file_t *progfile; int env_len, e; char *env_block, *env_block_pos; RESULTCODES rescodes; @@ -325,7 +325,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, DosSetFHState(attr->parent_err->filedes, OPEN_FLAGS_NOINHERIT); } - ap_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ + apr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ if (attr->currdir != NULL) { _getcwd2(savedir, sizeof(savedir)); @@ -347,14 +347,14 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, strcpy(interpreter, "#!" SHELL_PATH); extra_arg = "/C"; } else if (stricmp(extension, ".exe") != 0) { - status = ap_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, cont); + status = apr_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, cont); - if (status != APR_SUCCESS && ap_canonical_error(status) == APR_ENOENT) { - progname = ap_pstrcat(cont, progname, ".exe", NULL); + if (status != APR_SUCCESS && apr_canonical_error(status) == APR_ENOENT) { + progname = apr_pstrcat(cont, progname, ".exe", NULL); } if (status == APR_SUCCESS) { - status = ap_fgets(interpreter, sizeof(interpreter), progfile); + status = apr_fgets(interpreter, sizeof(interpreter), progfile); if (status == APR_SUCCESS) { if (interpreter[0] == '#' && interpreter[1] == '!') { @@ -375,7 +375,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, } } } - ap_close(progfile); + apr_close(progfile); } i = 0; @@ -384,7 +384,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, i++; } - newargs = (char **)ap_palloc(cont, sizeof (char *) * (i + 4)); + newargs = (char **)apr_palloc(cont, sizeof (char *) * (i + 4)); numargs = 0; if (interpreter[0]) @@ -392,7 +392,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, if (extra_arg) newargs[numargs++] = "/c"; - newargs[numargs++] = newprogname = ap_pstrdup(cont, progname); + newargs[numargs++] = newprogname = apr_pstrdup(cont, progname); arg = 1; while (args && args[arg]) { @@ -410,14 +410,14 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, for (i=0; i<numargs; i++) cmdlen += strlen(newargs[i]) + 3; - cmdline = ap_pstrndup(cont, newargs[0], cmdlen + 2); + cmdline = apr_pstrndup(cont, newargs[0], cmdlen + 2); cmdline_pos = cmdline + strlen(cmdline); for (i=1; i<numargs; i++) { char *a = newargs[i]; if (strpbrk(a, "&|<>\" ")) - a = ap_pstrcat(cont, "\"", double_quotes(cont, a), "\"", NULL); + a = apr_pstrcat(cont, "\"", double_quotes(cont, a), "\"", NULL); *(cmdline_pos++) = ' '; strcpy(cmdline_pos, a); @@ -437,7 +437,7 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, for (env_len=1, e=0; env[e]; e++) env_len += strlen(env[e]) + 1; - env_block = ap_palloc(cont, env_len); + env_block = apr_palloc(cont, env_len); env_block_pos = env_block; for (e=0; env[e]; e++) { @@ -460,21 +460,21 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, } if (attr->child_in) { - ap_close(attr->child_in); + apr_close(attr->child_in); dup = STDIN_FILENO; DosDupHandle(save_in, &dup); DosClose(save_in); } if (attr->child_out) { - ap_close(attr->child_out); + apr_close(attr->child_out); dup = STDOUT_FILENO; DosDupHandle(save_out, &dup); DosClose(save_out); } if (attr->child_err) { - ap_close(attr->child_err); + apr_close(attr->child_err); dup = STDERR_FILENO; DosDupHandle(save_err, &dup); DosClose(save_err); @@ -491,8 +491,8 @@ ap_status_t ap_create_process(ap_proc_t *proc, const char *progname, -ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, - ap_wait_how_e waithow, ap_pool_t *p) +apr_status_t apr_wait_all_procs(apr_proc_t *proc, ap_wait_t *status, + apr_wait_how_e waithow, apr_pool_t *p) { RESULTCODES codes; ULONG rc; @@ -519,8 +519,8 @@ ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, -ap_status_t ap_wait_proc(ap_proc_t *proc, - ap_wait_how_e wait) +apr_status_t apr_wait_proc(apr_proc_t *proc, + apr_wait_how_e wait) { RESULTCODES codes; ULONG rc; @@ -542,7 +542,7 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, -ap_status_t ap_get_os_proc(ap_os_proc_t *theproc, ap_proc_t *proc) +apr_status_t ap_get_os_proc(apr_os_proc_t *theproc, apr_proc_t *proc) { if (proc == NULL) { return APR_ENOPROC; diff --git a/threadproc/os2/signals.c b/threadproc/os2/signals.c index 6ba71bada..5d7e7aee0 100644 --- a/threadproc/os2/signals.c +++ b/threadproc/os2/signals.c @@ -63,12 +63,12 @@ #define INCL_DOS #include <os2.h> -ap_status_t ap_kill(ap_proc_t *proc, int signal) +apr_status_t apr_kill(apr_proc_t *proc, int signal) { /* SIGTERM's don't work too well in OS/2 (only affects other EMX programs). CGIs may not be, esp. REXX scripts, so use a native call instead */ - ap_status_t rc; + apr_status_t rc; if ( signal == SIGTERM ) { rc = APR_OS2_STATUS(DosSendSignalException(proc->pid, XCPT_SIGNAL_BREAK)); diff --git a/threadproc/os2/thread.c b/threadproc/os2/thread.c index dbfa34825..e44106be0 100644 --- a/threadproc/os2/thread.c +++ b/threadproc/os2/thread.c @@ -62,9 +62,9 @@ #include <stdlib.h> #include <os2.h> -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) +apr_status_t apr_create_threadattr(apr_threadattr_t **new, apr_pool_t *cont) { - (*new) = (ap_threadattr_t *)ap_palloc(cont, sizeof(ap_threadattr_t)); + (*new) = (apr_threadattr_t *)apr_palloc(cont, sizeof(apr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -77,7 +77,7 @@ ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) -ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) +apr_status_t apr_setthreadattr_detach(apr_threadattr_t *attr, apr_int32_t on) { attr->attr |= APR_THREADATTR_DETACHED; return APR_SUCCESS; @@ -85,7 +85,7 @@ ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) -ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) +apr_status_t apr_getthreadattr_detach(apr_threadattr_t *attr) { return (attr->attr & APR_THREADATTR_DETACHED) ? APR_DETACH : APR_NOTDETACH; } @@ -94,20 +94,20 @@ ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) static void ap_thread_begin(void *arg) { - ap_thread_t *thread = (ap_thread_t *)arg; + apr_thread_t *thread = (apr_thread_t *)arg; thread->rv = thread->func(thread->data); } -ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, - ap_thread_start_t func, void *data, - ap_pool_t *cont) +apr_status_t apr_create_thread(apr_thread_t **new, apr_threadattr_t *attr, + apr_thread_start_t func, void *data, + apr_pool_t *cont) { - ap_status_t stat; - ap_thread_t *thread; + apr_status_t stat; + apr_thread_t *thread; - thread = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t)); + thread = (apr_thread_t *)apr_palloc(cont, sizeof(apr_thread_t)); *new = thread; if (thread == NULL) { @@ -118,14 +118,14 @@ 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_pool(&thread->cntxt, cont); + stat = apr_create_pool(&thread->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } if (attr == NULL) { - stat = ap_create_threadattr(&thread->attr, thread->cntxt); + stat = apr_create_threadattr(&thread->attr, thread->cntxt); if (stat != APR_SUCCESS) { return stat; @@ -146,7 +146,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) +apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval) { thd->rv = retval; _endthread(); @@ -155,7 +155,7 @@ ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) -ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) +apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { ULONG rc; TID waittid = thd->tid; @@ -168,13 +168,13 @@ ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) if (rc == ERROR_INVALID_THREADID) rc = 0; /* Thread had already terminated */ - *retval = (ap_status_t)thd->rv; + *retval = (apr_status_t)thd->rv; return APR_OS2_STATUS(rc); } -ap_status_t ap_thread_detach(ap_thread_t *thd) +apr_status_t apr_thread_detach(apr_thread_t *thd) { thd->attr->attr |= APR_THREADATTR_DETACHED; return APR_SUCCESS; diff --git a/threadproc/os2/threadpriv.c b/threadproc/os2/threadpriv.c index cf436d237..15143e512 100644 --- a/threadproc/os2/threadpriv.c +++ b/threadproc/os2/threadpriv.c @@ -59,10 +59,10 @@ #include "apr_lib.h" #include "fileio.h" -ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_pool_t *cont) +apr_status_t apr_create_thread_private(apr_threadkey_t **key, + void (*dest)(void *), apr_pool_t *cont) { - (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); + (*key) = (apr_threadkey_t *)apr_palloc(cont, sizeof(apr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; @@ -72,19 +72,19 @@ ap_status_t ap_create_thread_private(ap_threadkey_t **key, return APR_OS2_STATUS(DosAllocThreadLocalMemory(1, &((*key)->key))); } -ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) +apr_status_t apr_get_thread_private(void **new, apr_threadkey_t *key) { (*new) = (void *)*(key->key); return APR_SUCCESS; } -ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) +apr_status_t apr_set_thread_private(void *priv, apr_threadkey_t *key) { *(key->key) = (ULONG)priv; return APR_SUCCESS; } -ap_status_t ap_delete_thread_private(ap_threadkey_t *key) +apr_status_t apr_delete_thread_private(apr_threadkey_t *key) { return APR_OS2_STATUS(DosFreeThreadLocalMemory(key->key)); } diff --git a/threadproc/os2/threadproc.h b/threadproc/os2/threadproc.h index d6971dbb3..c14c54aa0 100644 --- a/threadproc/os2/threadproc.h +++ b/threadproc/os2/threadproc.h @@ -63,36 +63,36 @@ #define SHELL_PATH "cmd.exe" #define APR_THREAD_STACKSIZE 65536 -struct ap_threadattr_t { - ap_pool_t *cntxt; +struct apr_threadattr_t { + apr_pool_t *cntxt; unsigned long attr; }; -struct ap_thread_t { - ap_pool_t *cntxt; - struct ap_threadattr_t *attr; +struct apr_thread_t { + apr_pool_t *cntxt; + struct apr_threadattr_t *attr; unsigned long tid; - ap_thread_start_t func; + apr_thread_start_t func; void *data; void *rv; }; -struct ap_threadkey_t { - ap_pool_t *cntxt; +struct apr_threadkey_t { + apr_pool_t *cntxt; unsigned long *key; }; -struct ap_procattr_t { - ap_pool_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; +struct apr_procattr_t { + apr_pool_t *cntxt; + apr_file_t *parent_in; + apr_file_t *child_in; + apr_file_t *parent_out; + apr_file_t *child_out; + apr_file_t *parent_err; + apr_file_t *child_err; char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; + apr_int32_t cmdtype; + apr_int32_t detached; }; typedef void (*os2_thread_start_t)(void *); diff --git a/threadproc/unix/proc.c b/threadproc/unix/proc.c index 07f977b60..25a4b45c6 100644 --- a/threadproc/unix/proc.c +++ b/threadproc/unix/proc.c @@ -56,9 +56,9 @@ #include "apr_strings.h" #include "apr_portable.h" -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) +apr_status_t apr_createprocattr_init(apr_procattr_t **new, apr_pool_t *cont) { - (*new) = (ap_procattr_t *)ap_pcalloc(cont, sizeof(ap_procattr_t)); + (*new) = (apr_procattr_t *)apr_pcalloc(cont, sizeof(apr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -68,12 +68,12 @@ ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, - ap_int32_t out, ap_int32_t err) +apr_status_t apr_setprocattr_io(apr_procattr_t *attr, apr_int32_t in, + apr_int32_t out, apr_int32_t err) { - ap_status_t status; + apr_status_t status; if (in != 0) { - if ((status = ap_create_pipe(&attr->child_in, &attr->parent_in, + if ((status = apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -81,18 +81,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); break; default: - ap_set_pipe_timeout(attr->child_in, 0); - ap_set_pipe_timeout(attr->parent_in, 0); + apr_set_pipe_timeout(attr->child_in, 0); + apr_set_pipe_timeout(attr->parent_in, 0); } } if (out) { - if ((status = ap_create_pipe(&attr->parent_out, &attr->child_out, + if ((status = apr_create_pipe(&attr->parent_out, &attr->child_out, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -100,18 +100,18 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); break; default: - ap_set_pipe_timeout(attr->child_out, 0); - ap_set_pipe_timeout(attr->parent_out, 0); + apr_set_pipe_timeout(attr->child_out, 0); + apr_set_pipe_timeout(attr->parent_out, 0); } } if (err) { - if ((status = ap_create_pipe(&attr->parent_err, &attr->child_err, + if ((status = apr_create_pipe(&attr->parent_err, &attr->child_err, attr->cntxt)) != APR_SUCCESS) { return status; } @@ -119,92 +119,92 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, case APR_FULL_BLOCK: break; case APR_PARENT_BLOCK: - ap_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); break; case APR_CHILD_BLOCK: - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); break; default: - ap_set_pipe_timeout(attr->child_err, 0); - ap_set_pipe_timeout(attr->parent_err, 0); + apr_set_pipe_timeout(attr->child_err, 0); + apr_set_pipe_timeout(attr->parent_err, 0); } } return APR_SUCCESS; } -ap_status_t ap_setprocattr_childin(ap_procattr_t *attr, ap_file_t *child_in, - ap_file_t *parent_in) +apr_status_t apr_setprocattr_childin(apr_procattr_t *attr, apr_file_t *child_in, + apr_file_t *parent_in) { if (attr->child_in == NULL && attr->parent_in == NULL) - ap_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); + apr_create_pipe(&attr->child_in, &attr->parent_in, attr->cntxt); if (child_in != NULL) - ap_dupfile(&attr->child_in, child_in, attr->cntxt); + apr_dupfile(&attr->child_in, child_in, attr->cntxt); if (parent_in != NULL) - ap_dupfile(&attr->parent_in, parent_in, attr->cntxt); + apr_dupfile(&attr->parent_in, parent_in, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childout(ap_procattr_t *attr, ap_file_t *child_out, - ap_file_t *parent_out) +apr_status_t apr_setprocattr_childout(apr_procattr_t *attr, apr_file_t *child_out, + apr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - ap_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); + apr_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); if (child_out != NULL) - ap_dupfile(&attr->child_out, child_out, attr->cntxt); + apr_dupfile(&attr->child_out, child_out, attr->cntxt); if (parent_out != NULL) - ap_dupfile(&attr->parent_out, parent_out, attr->cntxt); + apr_dupfile(&attr->parent_out, parent_out, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childerr(ap_procattr_t *attr, ap_file_t *child_err, - ap_file_t *parent_err) +apr_status_t apr_setprocattr_childerr(apr_procattr_t *attr, apr_file_t *child_err, + apr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - ap_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); + apr_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); if (child_err != NULL) - ap_dupfile(&attr->child_err, child_err, attr->cntxt); + apr_dupfile(&attr->child_err, child_err, attr->cntxt); if (parent_err != NULL) - ap_dupfile(&attr->parent_err, parent_err, attr->cntxt); + apr_dupfile(&attr->parent_err, parent_err, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, +apr_status_t apr_setprocattr_dir(apr_procattr_t *attr, const char *dir) { - attr->currdir = ap_pstrdup(attr->cntxt, dir); + attr->currdir = apr_pstrdup(attr->cntxt, dir); if (attr->currdir) { return APR_SUCCESS; } return APR_ENOMEM; } -ap_status_t ap_setprocattr_cmdtype(ap_procattr_t *attr, - ap_cmdtype_e cmd) +apr_status_t apr_setprocattr_cmdtype(apr_procattr_t *attr, + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t detach) +apr_status_t apr_setprocattr_detach(apr_procattr_t *attr, apr_int32_t detach) { attr->detached = detach; return APR_SUCCESS; } -ap_status_t ap_fork(ap_proc_t *proc, ap_pool_t *cont) +apr_status_t apr_fork(apr_proc_t *proc, apr_pool_t *cont) { int pid; @@ -227,7 +227,7 @@ ap_status_t ap_fork(ap_proc_t *proc, ap_pool_t *cont) #if APR_HAVE_STRUCT_RLIMIT #if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) -static ap_status_t limit_proc(ap_procattr_t *attr) +static apr_status_t limit_proc(apr_procattr_t *attr) { #ifdef RLIMIT_CPU if (attr->limit_cpu != NULL) { @@ -267,9 +267,9 @@ static ap_status_t limit_proc(ap_procattr_t *attr) #endif #endif -ap_status_t ap_create_process(ap_proc_t *new, const char *progname, +apr_status_t apr_create_process(apr_proc_t *new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_pool_t *cont) + apr_procattr_t *attr, apr_pool_t *cont) { int i; typedef const char *my_stupid_string; @@ -285,22 +285,22 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, int status; /* child process */ if (attr->child_in) { - ap_close(attr->parent_in); + apr_close(attr->parent_in); dup2(attr->child_in->filedes, STDIN_FILENO); - ap_close(attr->child_in); + apr_close(attr->child_in); } if (attr->child_out) { - ap_close(attr->parent_out); + apr_close(attr->parent_out); dup2(attr->child_out->filedes, STDOUT_FILENO); - ap_close(attr->child_out); + apr_close(attr->child_out); } if (attr->child_err) { - ap_close(attr->parent_err); + apr_close(attr->parent_err); dup2(attr->child_err->filedes, STDERR_FILENO); - ap_close(attr->child_err); + apr_close(attr->child_err); } - ap_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ + apr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */ if (attr->currdir != NULL) { if (chdir(attr->currdir) == -1) { @@ -308,7 +308,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, } } - ap_cleanup_for_exec(); + apr_cleanup_for_exec(); #if defined(RLIMIT_CPU) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) if ((status = limit_proc(attr)) != APR_SUCCESS) { @@ -322,7 +322,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, i++; } newargs = - (my_stupid_string *) ap_palloc(cont, sizeof (char *) * (i + 3)); + (my_stupid_string *) apr_palloc(cont, sizeof (char *) * (i + 3)); newargs[0] = SHELL_PATH; newargs[1] = "-c"; i = 0; @@ -332,13 +332,13 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, } newargs[i + 3] = NULL; if (attr->detached) { - ap_detach(); + apr_detach(); } execve(SHELL_PATH, (char **) newargs, env); } else { if (attr->detached) { - ap_detach(); + apr_detach(); } execve(progname, args, env); } @@ -347,19 +347,19 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, } /* Parent process */ if (attr->child_in) { - ap_close(attr->child_in); + apr_close(attr->child_in); } if (attr->child_out) { - ap_close(attr->child_out); + apr_close(attr->child_out); } if (attr->child_err) { - ap_close(attr->child_err); + apr_close(attr->child_err); } return APR_SUCCESS; } -ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, - ap_wait_how_e waithow, ap_pool_t *p) +apr_status_t apr_wait_all_procs(apr_proc_t *proc, ap_wait_t *status, + apr_wait_how_e waithow, apr_pool_t *p) { int waitpid_options = WUNTRACED; @@ -376,8 +376,8 @@ ap_status_t ap_wait_all_procs(ap_proc_t *proc, ap_wait_t *status, return errno; } -ap_status_t ap_wait_proc(ap_proc_t *proc, - ap_wait_how_e waithow) +apr_status_t apr_wait_proc(apr_proc_t *proc, + apr_wait_how_e waithow) { pid_t status; if (!proc) @@ -400,7 +400,7 @@ ap_status_t ap_wait_proc(ap_proc_t *proc, return errno; } -ap_status_t ap_setprocattr_limit(ap_procattr_t *attr, ap_int32_t what, +apr_status_t apr_setprocattr_limit(apr_procattr_t *attr, apr_int32_t what, struct rlimit *limit) { switch(what) { diff --git a/threadproc/unix/procsup.c b/threadproc/unix/procsup.c index d92805882..c2f0fc6ec 100644 --- a/threadproc/unix/procsup.c +++ b/threadproc/unix/procsup.c @@ -54,7 +54,7 @@ #include "threadproc.h" -ap_status_t ap_detach(void) +apr_status_t apr_detach(void) { int x; pid_t pgrp; diff --git a/threadproc/unix/signals.c b/threadproc/unix/signals.c index 39292c14f..61184423f 100644 --- a/threadproc/unix/signals.c +++ b/threadproc/unix/signals.c @@ -63,7 +63,7 @@ #include <signal.h> #endif -ap_status_t ap_kill(ap_proc_t *proc, int sig) +apr_status_t apr_kill(apr_proc_t *proc, int sig) { if (kill(proc->pid, sig) == -1) { return errno; @@ -77,7 +77,7 @@ ap_status_t ap_kill(ap_proc_t *proc, int sig) * from W. Richard Stevens' "Advanced Programming in the UNIX Environment" * (the version that does not automatically restart system calls). */ -Sigfunc *ap_signal(int signo, Sigfunc * func) +Sigfunc *apr_signal(int signo, Sigfunc * func) { struct sigaction act, oact; diff --git a/threadproc/unix/thread.c b/threadproc/unix/thread.c index 469722d25..482ef124d 100644 --- a/threadproc/unix/thread.c +++ b/threadproc/unix/thread.c @@ -59,12 +59,12 @@ #if APR_HAS_THREADS #if APR_HAVE_PTHREAD_H -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) +apr_status_t apr_create_threadattr(apr_threadattr_t **new, apr_pool_t *cont) { - ap_status_t stat; + apr_status_t stat; - (*new) = (ap_threadattr_t *)ap_pcalloc(cont, sizeof(ap_threadattr_t)); - (*new)->attr = (pthread_attr_t *)ap_pcalloc(cont, sizeof(pthread_attr_t)); + (*new) = (apr_threadattr_t *)apr_pcalloc(cont, sizeof(apr_threadattr_t)); + (*new)->attr = (pthread_attr_t *)apr_pcalloc(cont, sizeof(pthread_attr_t)); if ((*new) == NULL || (*new)->attr == NULL) { return APR_ENOMEM; @@ -82,9 +82,9 @@ ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) return stat; } -ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) +apr_status_t apr_setthreadattr_detach(apr_threadattr_t *attr, apr_int32_t on) { - ap_status_t stat; + apr_status_t stat; #ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR int arg = on; @@ -102,7 +102,7 @@ ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) } } -ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) +apr_status_t apr_getthreadattr_detach(apr_threadattr_t *attr) { int state; @@ -116,20 +116,20 @@ 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_pool_t *cont) +apr_status_t apr_create_thread(apr_thread_t **new, apr_threadattr_t *attr, + apr_thread_start_t func, void *data, + apr_pool_t *cont) { - ap_status_t stat; + apr_status_t stat; pthread_attr_t *temp; - (*new) = (ap_thread_t *)ap_pcalloc(cont, sizeof(ap_thread_t)); + (*new) = (apr_thread_t *)apr_pcalloc(cont, sizeof(apr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; } - (*new)->td = (pthread_t *)ap_pcalloc(cont, sizeof(pthread_t)); + (*new)->td = (pthread_t *)apr_pcalloc(cont, sizeof(pthread_t)); if ((*new)->td == NULL) { return APR_ENOMEM; @@ -142,7 +142,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, else temp = NULL; - stat = ap_create_pool(&(*new)->cntxt, cont); + stat = apr_create_pool(&(*new)->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } @@ -158,16 +158,16 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, } } -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) +apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval) { - ap_destroy_pool(thd->cntxt); + apr_destroy_pool(thd->cntxt); pthread_exit(retval); return APR_SUCCESS; } -ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) +apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { - ap_status_t stat; + apr_status_t stat; if ((stat = pthread_join(*thd->td,(void *)&retval)) == 0) { return APR_SUCCESS; @@ -180,9 +180,9 @@ ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) } } -ap_status_t ap_thread_detach(ap_thread_t *thd) +apr_status_t apr_thread_detach(apr_thread_t *thd) { - ap_status_t stat; + apr_status_t stat; #ifdef PTHREAD_DETACH_ARG1_ADDR if ((stat = pthread_detach(thd->td)) == 0) { @@ -199,32 +199,32 @@ ap_status_t ap_thread_detach(ap_thread_t *thd) } } -ap_status_t ap_get_threaddata(void **data, const char *key, ap_thread_t *thread) +apr_status_t apr_get_threaddata(void **data, const char *key, apr_thread_t *thread) { - return ap_get_userdata(data, key, thread->cntxt); + return apr_get_userdata(data, key, thread->cntxt); } -ap_status_t ap_set_threaddata(void *data, const char *key, - ap_status_t (*cleanup) (void *), - ap_thread_t *thread) +apr_status_t apr_set_threaddata(void *data, const char *key, + apr_status_t (*cleanup) (void *), + apr_thread_t *thread) { - return ap_set_userdata(data, key, cleanup, thread->cntxt); + return apr_set_userdata(data, key, cleanup, thread->cntxt); } -ap_status_t ap_get_os_thread(ap_os_thread_t **thethd, ap_thread_t *thd) +apr_status_t apr_get_os_thread(apr_os_thread_t **thethd, apr_thread_t *thd) { *thethd = thd->td; return APR_SUCCESS; } -ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, - ap_pool_t *cont) +apr_status_t apr_put_os_thread(apr_thread_t **thd, apr_os_thread_t *thethd, + apr_pool_t *cont) { if (cont == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (ap_thread_t *)ap_pcalloc(cont, sizeof(ap_thread_t)); + (*thd) = (apr_thread_t *)apr_pcalloc(cont, sizeof(apr_thread_t)); (*thd)->cntxt = cont; } (*thd)->td = thethd; diff --git a/threadproc/unix/threadpriv.c b/threadproc/unix/threadpriv.c index e872dc979..6c02dd130 100644 --- a/threadproc/unix/threadpriv.c +++ b/threadproc/unix/threadpriv.c @@ -59,11 +59,11 @@ #if APR_HAS_THREADS #if APR_HAVE_PTHREAD_H -ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_pool_t *cont) +apr_status_t apr_create_thread_private(apr_threadkey_t **key, + void (*dest)(void *), apr_pool_t *cont) { - ap_status_t stat; - (*key) = (ap_threadkey_t *)ap_pcalloc(cont, sizeof(ap_threadkey_t)); + apr_status_t stat; + (*key) = (apr_threadkey_t *)apr_pcalloc(cont, sizeof(apr_threadkey_t)); if ((*key) == NULL) { return APR_ENOMEM; @@ -77,7 +77,7 @@ ap_status_t ap_create_thread_private(ap_threadkey_t **key, return stat; } -ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) +apr_status_t apr_get_thread_private(void **new, apr_threadkey_t *key) { #ifdef PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS if (pthread_getspecific(key->key,new)) @@ -88,9 +88,9 @@ ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) return APR_SUCCESS; } -ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) +apr_status_t apr_set_thread_private(void *priv, apr_threadkey_t *key) { - ap_status_t stat; + apr_status_t stat; if ((stat = pthread_setspecific(key->key, priv)) == 0) { return APR_SUCCESS; } @@ -99,42 +99,42 @@ ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) } } -ap_status_t ap_delete_thread_private(ap_threadkey_t *key) +apr_status_t apr_delete_thread_private(apr_threadkey_t *key) { - ap_status_t stat; + apr_status_t stat; if ((stat = pthread_key_delete(key->key)) == 0) { return APR_SUCCESS; } return stat; } -ap_status_t ap_get_threadkeydata(void **data, const char *key, - ap_threadkey_t *threadkey) +apr_status_t apr_get_threadkeydata(void **data, const char *key, + apr_threadkey_t *threadkey) { - return ap_get_userdata(data, key, threadkey->cntxt); + return apr_get_userdata(data, key, threadkey->cntxt); } -ap_status_t ap_set_threadkeydata(void *data, const char *key, - ap_status_t (*cleanup) (void *), - ap_threadkey_t *threadkey) +apr_status_t apr_set_threadkeydata(void *data, const char *key, + apr_status_t (*cleanup) (void *), + apr_threadkey_t *threadkey) { - return ap_set_userdata(data, key, cleanup, threadkey->cntxt); + return apr_set_userdata(data, key, cleanup, threadkey->cntxt); } -ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *thekey, ap_threadkey_t *key) +apr_status_t apr_get_os_threadkey(apr_os_threadkey_t *thekey, apr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -ap_status_t ap_put_os_threadkey(ap_threadkey_t **key, - ap_os_threadkey_t *thekey, ap_pool_t *cont) +apr_status_t apr_put_os_threadkey(apr_threadkey_t **key, + apr_os_threadkey_t *thekey, apr_pool_t *cont) { if (cont == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (ap_threadkey_t *)ap_pcalloc(cont, sizeof(ap_threadkey_t)); + (*key) = (apr_threadkey_t *)apr_pcalloc(cont, sizeof(apr_threadkey_t)); (*key)->cntxt = cont; } (*key)->key = *thekey; diff --git a/threadproc/unix/threadproc.h b/threadproc/unix/threadproc.h index e6d9e36aa..d5f0a679f 100644 --- a/threadproc/unix/threadproc.h +++ b/threadproc/unix/threadproc.h @@ -86,33 +86,33 @@ #define SHELL_PATH "/bin/sh" #if APR_HAS_THREADS -struct ap_thread_t { - ap_pool_t *cntxt; +struct apr_thread_t { + apr_pool_t *cntxt; pthread_t *td; }; -struct ap_threadattr_t { - ap_pool_t *cntxt; +struct apr_threadattr_t { + apr_pool_t *cntxt; pthread_attr_t *attr; }; -struct ap_threadkey_t { - ap_pool_t *cntxt; +struct apr_threadkey_t { + apr_pool_t *cntxt; pthread_key_t key; }; #endif -struct ap_procattr_t { - ap_pool_t *cntxt; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; +struct apr_procattr_t { + apr_pool_t *cntxt; + apr_file_t *parent_in; + apr_file_t *child_in; + apr_file_t *parent_out; + apr_file_t *child_out; + apr_file_t *parent_err; + apr_file_t *child_err; char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; + apr_int32_t cmdtype; + apr_int32_t detached; #ifdef RLIMIT_CPU struct rlimit *limit_cpu; #endif diff --git a/threadproc/win32/proc.c b/threadproc/win32/proc.c index 14819bfd7..1741b87d7 100644 --- a/threadproc/win32/proc.c +++ b/threadproc/win32/proc.c @@ -65,9 +65,9 @@ #include <string.h> #include <process.h> -ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) +apr_status_t apr_createprocattr_init(apr_procattr_t **new, apr_pool_t *cont) { - (*new) = (ap_procattr_t *)ap_palloc(cont, sizeof(ap_procattr_t)); + (*new) = (apr_procattr_t *)apr_palloc(cont, sizeof(apr_procattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -88,10 +88,10 @@ ap_status_t ap_createprocattr_init(ap_procattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, - ap_int32_t out, ap_int32_t err) +apr_status_t apr_setprocattr_io(apr_procattr_t *attr, apr_int32_t in, + apr_int32_t out, apr_int32_t err) { - ap_status_t stat; + apr_status_t stat; BOOLEAN bAsyncRead, bAsyncWrite; if (in) { switch (in) { @@ -165,39 +165,39 @@ ap_status_t ap_setprocattr_io(ap_procattr_t *attr, ap_int32_t in, return APR_SUCCESS; } #if 0 -ap_status_t ap_setprocattr_childin(ap_procattr_t *attr, ap_file_t *child_in, - ap_file_t *parent_in) +apr_status_t apr_setprocattr_childin(apr_procattr_t *attr, apr_file_t *child_in, + apr_file_t *parent_in) { } -ap_status_t ap_setprocattr_childout(ap_procattr_t *attr, ap_file_t *child_out, - ap_file_t *parent_out) +apr_status_t apr_setprocattr_childout(apr_procattr_t *attr, apr_file_t *child_out, + apr_file_t *parent_out) { if (attr->child_out == NULL && attr->parent_out == NULL) - ap_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); + apr_create_pipe(&attr->child_out, &attr->parent_out, attr->cntxt); if (child_out != NULL) - ap_dupfile(&attr->child_out, child_out, attr->cntxt); + apr_dupfile(&attr->child_out, child_out, attr->cntxt); if (parent_out != NULL) - ap_dupfile(&attr->parent_out, parent_out, attr->cntxt); + apr_dupfile(&attr->parent_out, parent_out, attr->cntxt); return APR_SUCCESS; } -ap_status_t ap_setprocattr_childerr(ap_procattr_t *attr, ap_file_t *child_err, - ap_file_t *parent_err) +apr_status_t apr_setprocattr_childerr(apr_procattr_t *attr, apr_file_t *child_err, + apr_file_t *parent_err) { if (attr->child_err == NULL && attr->parent_err == NULL) - ap_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); + apr_create_pipe(&attr->child_err, &attr->parent_err, attr->cntxt); if (child_err != NULL) - ap_dupfile(&attr->child_err, child_err, attr->cntxt); + apr_dupfile(&attr->child_err, child_err, attr->cntxt); if (parent_err != NULL) - ap_dupfile(&attr->parent_err, parent_err, attr->cntxt); + apr_dupfile(&attr->parent_err, parent_err, attr->cntxt); return APR_SUCCESS; } #endif -ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, +apr_status_t apr_setprocattr_dir(apr_procattr_t *attr, const char *dir) { char path[MAX_PATH]; @@ -209,10 +209,10 @@ ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, if (length == 0 || length + strlen(dir) + 1 >= MAX_PATH) return APR_ENOMEM; - attr->currdir = ap_pstrcat(attr->cntxt, path, "\\", dir, NULL); + attr->currdir = apr_pstrcat(attr->cntxt, path, "\\", dir, NULL); } else { - attr->currdir = ap_pstrdup(attr->cntxt, dir); + attr->currdir = apr_pstrdup(attr->cntxt, dir); } if (attr->currdir) { @@ -221,22 +221,22 @@ ap_status_t ap_setprocattr_dir(ap_procattr_t *attr, return APR_ENOMEM; } -ap_status_t ap_setprocattr_cmdtype(ap_procattr_t *attr, - ap_cmdtype_e cmd) +apr_status_t apr_setprocattr_cmdtype(apr_procattr_t *attr, + apr_cmdtype_e cmd) { attr->cmdtype = cmd; return APR_SUCCESS; } -ap_status_t ap_setprocattr_detach(ap_procattr_t *attr, ap_int32_t det) +apr_status_t apr_setprocattr_detach(apr_procattr_t *attr, apr_int32_t det) { attr->detached = det; return APR_SUCCESS; } -ap_status_t ap_create_process(ap_proc_t *new, const char *progname, +apr_status_t apr_create_process(apr_proc_t *new, const char *progname, char *const args[], char **env, - ap_procattr_t *attr, ap_pool_t *cont) + apr_procattr_t *attr, apr_pool_t *cont) { int i, iEnvBlockLen; char *cmdline; @@ -245,7 +245,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, char ppid[20]; char *envstr; char *pEnvBlock, *pNext; - ap_status_t rv; + apr_status_t rv; PROCESS_INFORMATION pi; new->in = attr->parent_in; @@ -282,18 +282,18 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, } if (*ptr == '\\' || *++ptr == ':') { - cmdline = ap_pstrdup(cont, progname); + cmdline = apr_pstrdup(cont, progname); } else if (attr->currdir == NULL) { - cmdline = ap_pstrdup(cont, progname); + cmdline = apr_pstrdup(cont, progname); } else { char lastchar = attr->currdir[strlen(attr->currdir)-1]; if ( lastchar == '\\' || lastchar == '/') { - cmdline = ap_pstrcat(cont, attr->currdir, progname, NULL); + cmdline = apr_pstrcat(cont, attr->currdir, progname, NULL); } else { - cmdline = ap_pstrcat(cont, attr->currdir, "\\", progname, NULL); + cmdline = apr_pstrcat(cont, attr->currdir, "\\", progname, NULL); } } } @@ -301,13 +301,13 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, char * shell_cmd = getenv("COMSPEC"); if (!shell_cmd) shell_cmd = SHELL_PATH; - shell_cmd = ap_pstrdup(cont, shell_cmd); - cmdline = ap_pstrcat(cont, shell_cmd, " /C ", progname, NULL); + shell_cmd = apr_pstrdup(cont, shell_cmd); + cmdline = apr_pstrcat(cont, shell_cmd, " /C ", progname, NULL); } i = 1; while (args && args[i]) { - cmdline = ap_pstrcat(cont, cmdline, " ", args[i], NULL); + cmdline = apr_pstrcat(cont, cmdline, " ", args[i], NULL); i++; } /* @@ -335,16 +335,16 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, 0, FALSE, DUPLICATE_SAME_ACCESS))) { rv = GetLastError(); if (attr->child_in) { - ap_close(attr->child_in); - ap_close(attr->parent_in); + apr_close(attr->child_in); + apr_close(attr->parent_in); } if (attr->child_out) { - ap_close(attr->child_out); - ap_close(attr->parent_out); + apr_close(attr->child_out); + apr_close(attr->parent_out); } if (attr->child_err) { - ap_close(attr->child_err); - ap_close(attr->parent_err); + apr_close(attr->child_err); + apr_close(attr->parent_err); } return rv; } @@ -365,7 +365,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, _itoa(_getpid(), ppid, 10); if (env) { - envstr = ap_pstrcat(cont, "parentpid=", ppid, NULL); + envstr = apr_pstrcat(cont, "parentpid=", ppid, NULL); /* * Win32's CreateProcess call requires that the environment * be passed in an environment block, a null terminated block of @@ -378,7 +378,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, i++; } - pEnvBlock = (char *)ap_pcalloc(cont, iEnvBlockLen + strlen(envstr)); + pEnvBlock = (char *)apr_pcalloc(cont, iEnvBlockLen + strlen(envstr)); i = 0; pNext = pEnvBlock; @@ -401,7 +401,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, &attr->si, &pi)) { // TODO: THIS IS BADNESS - // The completion of the ap_proc_t type leaves us ill equiped to track both + // The completion of the apr_proc_t type leaves us ill equiped to track both // the pid (Process ID) and handle to the process, which are entirely // different things and each useful in their own rights. // @@ -410,13 +410,13 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, new->pid = (pid_t) pi.hProcess; if (attr->child_in) { - ap_close(attr->child_in); + apr_close(attr->child_in); } if (attr->child_out) { - ap_close(attr->child_out); + apr_close(attr->child_out); } if (attr->child_err) { - ap_close(attr->child_err); + apr_close(attr->child_err); } CloseHandle(pi.hThread); @@ -426,7 +426,7 @@ ap_status_t ap_create_process(ap_proc_t *new, const char *progname, return GetLastError(); } -ap_status_t ap_wait_proc(ap_proc_t *proc, ap_wait_how_e wait) +apr_status_t apr_wait_proc(apr_proc_t *proc, apr_wait_how_e wait) { DWORD stat; if (!proc) diff --git a/threadproc/win32/signals.c b/threadproc/win32/signals.c index 0de2653f1..a75cd5309 100644 --- a/threadproc/win32/signals.c +++ b/threadproc/win32/signals.c @@ -64,7 +64,7 @@ #endif /* Windows only really support killing process, but that will do for now. */ -ap_status_t ap_kill(ap_proc_t *proc, int signal) +apr_status_t apr_kill(apr_proc_t *proc, int signal) { if (TerminateProcess(proc->pid, signal) == 0) { return GetLastError(); diff --git a/threadproc/win32/thread.c b/threadproc/win32/thread.c index beed161c4..1d10d27d2 100644 --- a/threadproc/win32/thread.c +++ b/threadproc/win32/thread.c @@ -61,10 +61,10 @@ #include <process.h> -ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) +apr_status_t apr_create_threadattr(apr_threadattr_t **new, apr_pool_t *cont) { - (*new) = (ap_threadattr_t *)ap_palloc(cont, - sizeof(ap_threadattr_t)); + (*new) = (apr_threadattr_t *)apr_palloc(cont, + sizeof(apr_threadattr_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -74,28 +74,28 @@ ap_status_t ap_create_threadattr(ap_threadattr_t **new, ap_pool_t *cont) return APR_SUCCESS; } -ap_status_t ap_setthreadattr_detach(ap_threadattr_t *attr, ap_int32_t on) +apr_status_t apr_setthreadattr_detach(apr_threadattr_t *attr, apr_int32_t on) { attr->detach = on; return APR_SUCCESS; } -ap_status_t ap_getthreadattr_detach(ap_threadattr_t *attr) +apr_status_t apr_getthreadattr_detach(apr_threadattr_t *attr) { if (attr->detach == 1) return APR_DETACH; 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_pool_t *cont) +apr_status_t apr_create_thread(apr_thread_t **new, apr_threadattr_t *attr, + apr_thread_start_t func, void *data, + apr_pool_t *cont) { - ap_status_t stat; + apr_status_t stat; unsigned temp; int lasterror; - (*new) = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t)); + (*new) = (apr_thread_t *)apr_palloc(cont, sizeof(apr_thread_t)); if ((*new) == NULL) { return APR_ENOMEM; @@ -103,7 +103,7 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, (*new)->cntxt = cont; - stat = ap_create_pool(&(*new)->cntxt, cont); + stat = apr_create_pool(&(*new)->cntxt, cont); if (stat != APR_SUCCESS) { return stat; } @@ -124,16 +124,16 @@ ap_status_t ap_create_thread(ap_thread_t **new, ap_threadattr_t *attr, return APR_SUCCESS; } -ap_status_t ap_thread_exit(ap_thread_t *thd, ap_status_t *retval) +apr_status_t apr_thread_exit(apr_thread_t *thd, apr_status_t *retval) { - ap_destroy_pool(thd->cntxt); + apr_destroy_pool(thd->cntxt); _endthreadex(*retval); return APR_SUCCESS; } -ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) +apr_status_t apr_thread_join(apr_status_t *retval, apr_thread_t *thd) { - ap_status_t stat; + apr_status_t stat; if ((stat = WaitForSingleObject(thd->td, INFINITE)) == WAIT_OBJECT_0) { if (GetExitCodeThread(thd->td, retval) == 0) { @@ -146,7 +146,7 @@ ap_status_t ap_thread_join(ap_status_t *retval, ap_thread_t *thd) } } -ap_status_t ap_thread_detach(ap_thread_t *thd) +apr_status_t apr_thread_detach(apr_thread_t *thd) { if (CloseHandle(thd->td)) { return APR_SUCCESS; @@ -156,19 +156,19 @@ ap_status_t ap_thread_detach(ap_thread_t *thd) } } -ap_status_t ap_get_threaddata(void **data, const char *key, ap_thread_t *thread) +apr_status_t apr_get_threaddata(void **data, const char *key, apr_thread_t *thread) { - return ap_get_userdata(data, key, thread->cntxt); + return apr_get_userdata(data, key, thread->cntxt); } -ap_status_t ap_set_threaddata(void *data, const char *key, - ap_status_t (*cleanup) (void *), - ap_thread_t *thread) +apr_status_t apr_set_threaddata(void *data, const char *key, + apr_status_t (*cleanup) (void *), + apr_thread_t *thread) { - return ap_set_userdata(data, key, cleanup, thread->cntxt); + return apr_set_userdata(data, key, cleanup, thread->cntxt); } -ap_status_t ap_get_os_thread(ap_os_thread_t **thethd, ap_thread_t *thd) +apr_status_t apr_get_os_thread(apr_os_thread_t **thethd, apr_thread_t *thd) { if (thd == NULL) { return APR_ENOTHREAD; @@ -177,14 +177,14 @@ ap_status_t ap_get_os_thread(ap_os_thread_t **thethd, ap_thread_t *thd) return APR_SUCCESS; } -ap_status_t ap_put_os_thread(ap_thread_t **thd, ap_os_thread_t *thethd, - ap_pool_t *cont) +apr_status_t apr_put_os_thread(apr_thread_t **thd, apr_os_thread_t *thethd, + apr_pool_t *cont) { if (cont == NULL) { return APR_ENOPOOL; } if ((*thd) == NULL) { - (*thd) = (ap_thread_t *)ap_palloc(cont, sizeof(ap_thread_t)); + (*thd) = (apr_thread_t *)apr_palloc(cont, sizeof(apr_thread_t)); (*thd)->cntxt = cont; } (*thd)->td = thethd; diff --git a/threadproc/win32/threadpriv.c b/threadproc/win32/threadpriv.c index 275326cf5..f7fca12f0 100644 --- a/threadproc/win32/threadpriv.c +++ b/threadproc/win32/threadpriv.c @@ -59,8 +59,8 @@ #include "apr_errno.h" #include "apr_portable.h" -ap_status_t ap_create_thread_private(ap_threadkey_t **key, - void (*dest)(void *), ap_pool_t *cont) +apr_status_t apr_create_thread_private(apr_threadkey_t **key, + void (*dest)(void *), apr_pool_t *cont) { if (((*key)->key = TlsAlloc()) != 0xFFFFFFFF) { return APR_SUCCESS; @@ -68,7 +68,7 @@ ap_status_t ap_create_thread_private(ap_threadkey_t **key, return GetLastError(); } -ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) +apr_status_t apr_get_thread_private(void **new, apr_threadkey_t *key) { if ((*new) = TlsGetValue(key->key)) { return APR_SUCCESS; @@ -76,7 +76,7 @@ ap_status_t ap_get_thread_private(void **new, ap_threadkey_t *key) return GetLastError(); } -ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) +apr_status_t apr_set_thread_private(void *priv, apr_threadkey_t *key) { if (TlsSetValue(key->key, priv)) { return APR_SUCCESS; @@ -84,7 +84,7 @@ ap_status_t ap_set_thread_private(void *priv, ap_threadkey_t *key) return GetLastError(); } -ap_status_t ap_delete_thread_private(ap_threadkey_t *key) +apr_status_t apr_delete_thread_private(apr_threadkey_t *key) { if (TlsFree(key->key)) { return APR_SUCCESS; @@ -92,33 +92,33 @@ ap_status_t ap_delete_thread_private(ap_threadkey_t *key) return GetLastError(); } -ap_status_t ap_get_threadkeydata(void **data, const char *key, - ap_threadkey_t *threadkey) +apr_status_t apr_get_threadkeydata(void **data, const char *key, + apr_threadkey_t *threadkey) { - return ap_get_userdata(data, key, threadkey->cntxt); + return apr_get_userdata(data, key, threadkey->cntxt); } -ap_status_t ap_set_threadkeydata(void *data, const char *key, - ap_status_t (*cleanup) (void *), - ap_threadkey_t *threadkey) +apr_status_t apr_set_threadkeydata(void *data, const char *key, + apr_status_t (*cleanup) (void *), + apr_threadkey_t *threadkey) { - return ap_set_userdata(data, key, cleanup, threadkey->cntxt); + return apr_set_userdata(data, key, cleanup, threadkey->cntxt); } -ap_status_t ap_get_os_threadkey(ap_os_threadkey_t *thekey, ap_threadkey_t *key) +apr_status_t apr_get_os_threadkey(apr_os_threadkey_t *thekey, apr_threadkey_t *key) { *thekey = key->key; return APR_SUCCESS; } -ap_status_t ap_put_os_threadkey(ap_threadkey_t **key, - ap_os_threadkey_t *thekey, ap_pool_t *cont) +apr_status_t apr_put_os_threadkey(apr_threadkey_t **key, + apr_os_threadkey_t *thekey, apr_pool_t *cont) { if (cont == NULL) { return APR_ENOPOOL; } if ((*key) == NULL) { - (*key) = (ap_threadkey_t *)ap_palloc(cont, sizeof(ap_threadkey_t)); + (*key) = (apr_threadkey_t *)apr_palloc(cont, sizeof(apr_threadkey_t)); (*key)->cntxt = cont; } (*key)->key = *thekey; diff --git a/threadproc/win32/threadproc.h b/threadproc/win32/threadproc.h index 936747783..24a140bb1 100644 --- a/threadproc/win32/threadproc.h +++ b/threadproc/win32/threadproc.h @@ -61,35 +61,35 @@ #define SHELL_PATH "cmd.exe" -struct ap_thread_t { - ap_pool_t *cntxt; +struct apr_thread_t { + apr_pool_t *cntxt; HANDLE td; - ap_int32_t cancel; - ap_int32_t cancel_how; + apr_int32_t cancel; + apr_int32_t cancel_how; }; -struct ap_threadattr_t { - ap_pool_t *cntxt; - ap_int32_t detach; +struct apr_threadattr_t { + apr_pool_t *cntxt; + apr_int32_t detach; }; -struct ap_threadkey_t { - ap_pool_t *cntxt; +struct apr_threadkey_t { + apr_pool_t *cntxt; DWORD key; }; -struct ap_procattr_t { - ap_pool_t *cntxt; +struct apr_procattr_t { + apr_pool_t *cntxt; STARTUPINFO si; - ap_file_t *parent_in; - ap_file_t *child_in; - ap_file_t *parent_out; - ap_file_t *child_out; - ap_file_t *parent_err; - ap_file_t *child_err; + apr_file_t *parent_in; + apr_file_t *child_in; + apr_file_t *parent_out; + apr_file_t *child_out; + apr_file_t *parent_err; + apr_file_t *child_err; char *currdir; - ap_int32_t cmdtype; - ap_int32_t detached; + apr_int32_t cmdtype; + apr_int32_t detached; }; #endif /* ! THREAD_PROC_H */ |