[core] rename lib apr symbols to fspr

This commit is contained in:
Chris Rienzo authored and Andrey Volk committed 2022-08-29 20:17:08 +03:00
1 parent 3c7e8ff989
commit 5c2726f413
354 files changed
+11614 -11614

No files matched your search

+71 -71
View File
@@ -14,8 +14,8 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "apr_strings.h"
#include "fspr_arch_threadproc.h"
#include "fspr_strings.h"
struct send_pipe {
int in;
@@ -23,10 +23,10 @@ struct send_pipe {
int err;
};
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, fspr_pool_t *pool)
{
(*new) = (apr_procattr_t *)apr_palloc(pool,
sizeof(apr_procattr_t));
(*new) = (fspr_procattr_t *)fspr_palloc(pool,
sizeof(fspr_procattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -44,65 +44,65 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in,
apr_int32_t out, apr_int32_t err)
APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in,
fspr_int32_t out, fspr_int32_t err)
{
apr_status_t status;
fspr_status_t status;
if (in != 0) {
if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in,
if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in,
attr->pool)) != APR_SUCCESS) {
return status;
}
switch (in) {
case APR_FULL_BLOCK:
apr_file_pipe_timeout_set(attr->child_in, -1);
apr_file_pipe_timeout_set(attr->parent_in, -1);
fspr_file_pipe_timeout_set(attr->child_in, -1);
fspr_file_pipe_timeout_set(attr->parent_in, -1);
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_in, -1);
fspr_file_pipe_timeout_set(attr->child_in, -1);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_in, -1);
fspr_file_pipe_timeout_set(attr->parent_in, -1);
break;
default:
break;
}
}
if (out) {
if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out,
if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out,
attr->pool)) != APR_SUCCESS) {
return status;
}
switch (out) {
case APR_FULL_BLOCK:
apr_file_pipe_timeout_set(attr->child_out, -1);
apr_file_pipe_timeout_set(attr->parent_out, -1);
fspr_file_pipe_timeout_set(attr->child_out, -1);
fspr_file_pipe_timeout_set(attr->parent_out, -1);
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_out, -1);
fspr_file_pipe_timeout_set(attr->child_out, -1);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_out, -1);
fspr_file_pipe_timeout_set(attr->parent_out, -1);
break;
default:
break;
}
}
if (err) {
if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err,
if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err,
attr->pool)) != APR_SUCCESS) {
return status;
}
switch (err) {
case APR_FULL_BLOCK:
apr_file_pipe_timeout_set(attr->child_err, -1);
apr_file_pipe_timeout_set(attr->parent_err, -1);
fspr_file_pipe_timeout_set(attr->child_err, -1);
fspr_file_pipe_timeout_set(attr->parent_err, -1);
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_err, -1);
fspr_file_pipe_timeout_set(attr->child_err, -1);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_err, -1);
fspr_file_pipe_timeout_set(attr->parent_err, -1);
break;
default:
break;
@@ -111,17 +111,17 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr,
const char *dir)
{
char * cwd;
if (dir[0] != '/') {
cwd = (char*)malloc(sizeof(char) * PATH_MAX);
getcwd(cwd, PATH_MAX);
attr->currdir = (char *)apr_pstrcat(attr->pool, cwd, "/", dir, NULL);
attr->currdir = (char *)fspr_pstrcat(attr->pool, cwd, "/", dir, NULL);
free(cwd);
} else {
attr->currdir = (char *)apr_pstrdup(attr->pool, dir);
attr->currdir = (char *)fspr_pstrdup(attr->pool, dir);
}
if (attr->currdir) {
return APR_SUCCESS;
@@ -129,20 +129,20 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
return APR_ENOMEM;
}
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
apr_cmdtype_e cmd)
APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr,
fspr_cmdtype_e cmd)
{
attr->cmdtype = cmd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach)
APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach)
{
attr->detached = detach;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool)
{
int pid;
@@ -195,32 +195,32 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
return APR_INPARENT;
}
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
apr_child_errfn_t *errfn)
APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr,
fspr_child_errfn_t *errfn)
{
/* won't ever be called on this platform, so don't save the function pointer */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
apr_int32_t chk)
APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr,
fspr_int32_t chk)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
apr_int32_t addrspace)
APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr,
fspr_int32_t addrspace)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new, const char *progname,
const char * const *args,
const char * const *env,
apr_procattr_t *attr,
apr_pool_t *pool)
fspr_procattr_t *attr,
fspr_pool_t *pool)
{
int i=0,nargs=0;
char **newargs = NULL;
@@ -228,7 +228,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
struct send_pipe *sp;
char * dir = NULL;
sp = (struct send_pipe *)apr_palloc(pool, sizeof(struct send_pipe));
sp = (struct send_pipe *)fspr_palloc(pool, sizeof(struct send_pipe));
new->in = attr->parent_in;
new->err = attr->parent_err;
@@ -243,7 +243,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
}
newargs = (char**)malloc(sizeof(char *) * (i + 4));
newargs[0] = strdup("/boot/home/config/bin/apr_proc_stub");
newargs[0] = strdup("/boot/home/config/bin/fspr_proc_stub");
if (attr->currdir == NULL) {
/* we require the directory , so use a temp. variable */
dir = malloc(sizeof(char) * PATH_MAX);
@@ -278,13 +278,13 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
resume_thread(newproc);
if (attr->child_in) {
apr_file_close(attr->child_in);
fspr_file_close(attr->child_in);
}
if (attr->child_out) {
apr_file_close(attr->child_out);
fspr_file_close(attr->child_out);
}
if (attr->child_err) {
apr_file_close(attr->child_err);
fspr_file_close(attr->child_err);
}
send_data(newproc, 0, (void*)sp, sizeof(struct send_pipe));
@@ -298,26 +298,26 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new, const char *progname,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow,
apr_pool_t *p)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow,
fspr_pool_t *p)
{
proc->pid = -1;
return apr_proc_wait(proc, exitcode, exitwhy, waithow);
return fspr_proc_wait(proc, exitcode, exitwhy, waithow);
}
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow)
{
pid_t pstatus;
int waitpid_options = WUNTRACED;
int exit_int;
int ignore;
apr_exit_why_e ignorewhy;
fspr_exit_why_e ignorewhy;
if (exitcode == NULL) {
exitcode = &ignore;
@@ -354,65 +354,65 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
return errno;
}
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in,
apr_file_t *parent_in)
APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in,
fspr_file_t *parent_in)
{
if (attr->child_in == NULL && attr->parent_in == NULL)
apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
if (child_in != NULL)
apr_file_dup(&attr->child_in, child_in, attr->pool);
fspr_file_dup(&attr->child_in, child_in, attr->pool);
if (parent_in != NULL)
apr_file_dup(&attr->parent_in, parent_in, attr->pool);
fspr_file_dup(&attr->parent_in, parent_in, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out,
apr_file_t *parent_out)
APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out,
fspr_file_t *parent_out)
{
if (attr->child_out == NULL && attr->parent_out == NULL)
apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
if (child_out != NULL)
apr_file_dup(&attr->child_out, child_out, attr->pool);
fspr_file_dup(&attr->child_out, child_out, attr->pool);
if (parent_out != NULL)
apr_file_dup(&attr->parent_out, parent_out, attr->pool);
fspr_file_dup(&attr->parent_out, parent_out, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err,
apr_file_t *parent_err)
APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err,
fspr_file_t *parent_err)
{
if (attr->child_err == NULL && attr->parent_err == NULL)
apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
if (child_err != NULL)
apr_file_dup(&attr->child_err, child_err, attr->pool);
fspr_file_dup(&attr->child_err, child_err, attr->pool);
if (parent_err != NULL)
apr_file_dup(&attr->parent_err, parent_err, attr->pool);
fspr_file_dup(&attr->parent_err, parent_err, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what,
APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, fspr_int32_t what,
void *limit)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr,
const char *username,
const char *password)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr,
const char *groupname)
{
return APR_ENOTIMPL;
+42 -42
View File
@@ -14,13 +14,13 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "apr_portable.h"
#include "fspr_arch_threadproc.h"
#include "fspr_portable.h"
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, fspr_pool_t *pool)
{
(*new) = (apr_threadattr_t *)apr_palloc(pool,
sizeof(apr_threadattr_t));
(*new) = (fspr_threadattr_t *)fspr_palloc(pool,
sizeof(fspr_threadattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -32,7 +32,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, fspr_int32_t on)
{
if (on == 1){
attr->detached = 1;
@@ -42,7 +42,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr)
{
if (attr->detached == 1){
return APR_DETACH;
@@ -50,32 +50,32 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
return APR_NOTDETACH;
}
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
apr_size_t stacksize)
APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr,
fspr_size_t stacksize)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
apr_size_t size)
APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr,
fspr_size_t size)
{
return APR_ENOTIMPL;
}
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t*)opaque;
fspr_thread_t *thd = (fspr_thread_t*)opaque;
return thd->func(thd, thd->data);
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
apr_thread_start_t func, void *data,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, fspr_threadattr_t *attr,
fspr_thread_start_t func, void *data,
fspr_pool_t *pool)
{
int32 temp;
apr_status_t stat;
fspr_status_t stat;
(*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
(*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
if ((*new) == NULL) {
return APR_ENOMEM;
}
@@ -91,7 +91,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t
else
temp = B_NORMAL_PRIORITY;
stat = apr_pool_create(&(*new)->pool, pool);
stat = fspr_pool_create(&(*new)->pool, pool);
if (stat != APR_SUCCESS) {
return stat;
}
@@ -110,26 +110,26 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t
}
}
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void)
{
return find_thread(NULL);
}
int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2)
{
return tid1 == tid2;
}
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, fspr_status_t retval)
{
apr_pool_destroy(thd->pool);
fspr_pool_destroy(thd->pool);
thd->exitval = retval;
exit_thread ((status_t)(retval));
/* This will never be reached... */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, fspr_thread_t *thd)
{
status_t rv = 0, ret;
ret = wait_for_thread(thd->td, &rv);
@@ -149,7 +149,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *th
}
}
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd)
{
if (suspend_thread(thd->td) == B_NO_ERROR){
return APR_SUCCESS;
@@ -159,45 +159,45 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
}
}
void apr_thread_yield()
void fspr_thread_yield()
{
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, fspr_thread_t *thread)
{
return apr_pool_userdata_get(data, key, thread->pool);
return fspr_pool_userdata_get(data, key, thread->pool);
}
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_thread_t *thread)
{
return apr_pool_userdata_set(data, key, cleanup, thread->pool);
return fspr_pool_userdata_set(data, key, cleanup, thread->pool);
}
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, fspr_thread_t *thd)
{
*thethd = &thd->td;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, fspr_os_thread_t *thethd,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*thd) == NULL) {
(*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t));
(*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t));
(*thd)->pool = pool;
}
(*thd)->td = *thethd;
return APR_SUCCESS;
}
static apr_status_t thread_once_cleanup(void *vcontrol)
static fspr_status_t thread_once_cleanup(void *vcontrol)
{
apr_thread_once_t *control = (apr_thread_once_t *)vcontrol;
fspr_thread_once_t *control = (fspr_thread_once_t *)vcontrol;
if (control->sem) {
release_sem(control->sem);
@@ -207,23 +207,23 @@ static apr_status_t thread_once_cleanup(void *vcontrol)
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control,
fspr_pool_t *p)
{
int rc;
*control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t));
*control = (fspr_thread_once_t *)fspr_pcalloc(p, sizeof(fspr_thread_once_t));
(*control)->hit = 0; /* we haven't done it yet... */
rc = ((*control)->sem = create_sem(1, "thread_once"));
if (rc < 0)
return rc;
apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null);
fspr_pool_cleanup_register(p, control, thread_once_cleanup, fspr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control,
void (*func)(void))
{
if (!control->hit) {
+18 -18
View File
@@ -14,16 +14,16 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "fspr_arch_threadproc.h"
static struct beos_key key_table[BEOS_MAX_DATAKEYS];
static struct beos_private_data *beos_data[BEOS_MAX_DATAKEYS];
static sem_id lock;
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
void (*dest)(void *), apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key,
void (*dest)(void *), fspr_pool_t *pool)
{
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
if ((*key) == NULL) {
return APR_ENOMEM;
}
@@ -44,7 +44,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
return APR_ENOMEM;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, fspr_threadkey_t *key)
{
thread_id tid;
int i, index=0;
@@ -76,7 +76,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key)
{
thread_id tid;
int i,index = 0, ret = 0;
@@ -131,7 +131,7 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t
return APR_ENOMEM;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key)
{
if (key->key < BEOS_MAX_DATAKEYS){
acquire_sem(key_table[key->key].lock);
@@ -146,33 +146,33 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key,
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_get(data, key, threadkey->pool);
return fspr_pool_userdata_get(data, key, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_set(data, key, cleanup, threadkey->pool);
return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, fspr_threadkey_t *key)
{
*thekey = key->key;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
apr_os_threadkey_t *thekey, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key,
fspr_os_threadkey_t *thekey, fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*key) == NULL) {
(*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t));
(*key)->pool = pool;
}
(*key)->key = *thekey;
+83 -83
View File
@@ -14,16 +14,16 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "apr_arch_file_io.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "fspr_arch_threadproc.h"
#include "fspr_arch_file_io.h"
#include "fspr_strings.h"
#include "fspr_portable.h"
#include <proc.h>
apr_status_t apr_netware_proc_cleanup(void *theproc)
fspr_status_t fspr_netware_proc_cleanup(void *theproc)
{
apr_proc_t *proc = theproc;
fspr_proc_t *proc = theproc;
int exit_int;
int waitpid_options = WUNTRACED | WNOHANG;
@@ -35,9 +35,9 @@ apr_status_t apr_netware_proc_cleanup(void *theproc)
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new,fspr_pool_t *pool)
{
(*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t));
(*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -45,18 +45,18 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,apr_pool_t *p
(*new)->pool = pool;
(*new)->cmdtype = APR_PROGRAM;
/* Default to a current path since NetWare doesn't handle it very well */
apr_filepath_get(&((*new)->currdir), APR_FILEPATH_NATIVE, pool);
fspr_filepath_get(&((*new)->currdir), APR_FILEPATH_NATIVE, pool);
(*new)->detached = 1;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in,
apr_int32_t out, apr_int32_t err)
APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in,
fspr_int32_t out, fspr_int32_t err)
{
apr_status_t status;
fspr_status_t status;
if (in != 0) {
if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in,
if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -64,18 +64,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_in, 0);
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
}
}
if (out) {
if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out,
if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -83,18 +83,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_out, 0);
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
}
}
if (err) {
if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err,
if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -102,90 +102,90 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_err, 0);
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
}
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in,
apr_file_t *parent_in)
APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in,
fspr_file_t *parent_in)
{
if (attr->child_in == NULL && attr->parent_in == NULL)
apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
if (child_in != NULL)
apr_file_dup2(attr->child_in, child_in, attr->pool);
fspr_file_dup2(attr->child_in, child_in, attr->pool);
if (parent_in != NULL)
apr_file_dup2(attr->parent_in, parent_in, attr->pool);
fspr_file_dup2(attr->parent_in, parent_in, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out,
apr_file_t *parent_out)
APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out,
fspr_file_t *parent_out)
{
if (attr->child_out == NULL && attr->parent_out == NULL)
apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
if (child_out != NULL)
apr_file_dup2(attr->child_out, child_out, attr->pool);
fspr_file_dup2(attr->child_out, child_out, attr->pool);
if (parent_out != NULL)
apr_file_dup2(attr->parent_out, parent_out, attr->pool);
fspr_file_dup2(attr->parent_out, parent_out, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err,
apr_file_t *parent_err)
APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err,
fspr_file_t *parent_err)
{
if (attr->child_err == NULL && attr->parent_err == NULL)
apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
if (child_err != NULL)
apr_file_dup2(attr->child_err, child_err, attr->pool);
fspr_file_dup2(attr->child_err, child_err, attr->pool);
if (parent_err != NULL)
apr_file_dup2(attr->parent_err, parent_err, attr->pool);
fspr_file_dup2(attr->parent_err, parent_err, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr,
const char *dir)
{
return apr_filepath_merge(&attr->currdir, NULL, dir,
return fspr_filepath_merge(&attr->currdir, NULL, dir,
APR_FILEPATH_NATIVE, attr->pool);
}
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
apr_cmdtype_e cmd)
APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr,
fspr_cmdtype_e cmd)
{
/* won't ever be called on this platform, so don't save the function pointer */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach)
APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach)
{
attr->detached = detach;
return APR_SUCCESS;
}
#if APR_HAS_FORK
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool)
{
int pid;
@@ -207,7 +207,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
}
#endif
static apr_status_t limit_proc(apr_procattr_t *attr)
static fspr_status_t limit_proc(fspr_procattr_t *attr)
{
#if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT
#ifdef RLIMIT_CPU
@@ -252,33 +252,33 @@ static apr_status_t limit_proc(apr_procattr_t *attr)
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
apr_child_errfn_t *errfn)
APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr,
fspr_child_errfn_t *errfn)
{
/* won't ever be called on this platform, so don't save the function pointer */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
apr_int32_t chk)
APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr,
fspr_int32_t chk)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
apr_int32_t addrspace)
APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr,
fspr_int32_t addrspace)
{
attr->addrspace = addrspace;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *newproc,
const char *progname,
const char * const *args,
const char * const *env,
apr_procattr_t *attr,
apr_pool_t *pool)
fspr_procattr_t *attr,
fspr_pool_t *pool)
{
wiring_t wire;
int addr_space;
@@ -299,9 +299,9 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
if (attr->currdir) {
char *fullpath = NULL;
apr_status_t rv;
fspr_status_t rv;
if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname,
if ((rv = fspr_filepath_merge(&fullpath, attr->currdir, progname,
APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) {
return rv;
}
@@ -314,47 +314,47 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *newproc,
}
if (attr->child_in) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in),
attr->child_in, apr_unix_file_cleanup);
apr_file_close(attr->child_in);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_in),
attr->child_in, fspr_unix_file_cleanup);
fspr_file_close(attr->child_in);
}
if (attr->child_out) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out),
attr->child_out, apr_unix_file_cleanup);
apr_file_close(attr->child_out);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_out),
attr->child_out, fspr_unix_file_cleanup);
fspr_file_close(attr->child_out);
}
if (attr->child_err) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err),
attr->child_err, apr_unix_file_cleanup);
apr_file_close(attr->child_err);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_err),
attr->child_err, fspr_unix_file_cleanup);
fspr_file_close(attr->child_err);
}
apr_pool_cleanup_register(pool, (void *)newproc, apr_netware_proc_cleanup,
apr_pool_cleanup_null);
fspr_pool_cleanup_register(pool, (void *)newproc, fspr_netware_proc_cleanup,
fspr_pool_cleanup_null);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow,
apr_pool_t *p)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow,
fspr_pool_t *p)
{
proc->pid = -1;
return apr_proc_wait(proc, exitcode, exitwhy, waithow);
return fspr_proc_wait(proc, exitcode, exitwhy, waithow);
}
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
int *exitcode, apr_exit_why_e *exitwhy,
apr_wait_how_e waithow)
APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc,
int *exitcode, fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow)
{
pid_t pstatus;
int waitpid_options = WUNTRACED;
int exit_int;
int ignore;
apr_exit_why_e ignorewhy;
fspr_exit_why_e ignorewhy;
if (exitcode == NULL) {
exitcode = &ignore;
@@ -407,7 +407,7 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
return errno;
}
APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32_t what,
APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr, fspr_int32_t what,
struct rlimit *limit)
{
switch(what) {
@@ -436,7 +436,7 @@ APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr, apr_int32
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr,
const char *username,
const char *password)
{
@@ -444,7 +444,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr,
const char *groupname)
{
/* Always return SUCCESS because NetWare threads don't run within a group */
+2 -2
View File
@@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "fspr_arch_threadproc.h"
apr_status_t apr_proc_detach(int daemonize)
fspr_status_t fspr_proc_detach(int daemonize)
{
#if 0
int x;
+11 -11
View File
@@ -14,29 +14,29 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "fspr_arch_threadproc.h"
#include <nks/thread.h>
#include "apr_private.h"
#include "apr_pools.h"
#include "apr_signal.h"
#include "apr_strings.h"
#include "fspr_private.h"
#include "fspr_pools.h"
#include "fspr_signal.h"
#include "fspr_strings.h"
#include <assert.h>
#if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
#include <pthread.h>
#endif
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signum)
APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signum)
{
return APR_ENOTIMPL;
}
void apr_signal_init(apr_pool_t *pglobal)
void fspr_signal_init(fspr_pool_t *pglobal)
{
}
const char *apr_signal_description_get(int signum)
const char *fspr_signal_description_get(int signum)
{
switch (signum)
{
@@ -64,19 +64,19 @@ static void *signal_thread_func(void *signal_handler)
return NULL;
}
APR_DECLARE(apr_status_t) apr_setup_signal_thread(void)
APR_DECLARE(fspr_status_t) fspr_setup_signal_thread(void)
{
int rv = 0;
return rv;
}
APR_DECLARE(apr_status_t) apr_signal_block(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_block(int signum)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_signal_unblock(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum)
{
return APR_ENOTIMPL;
}
+50 -50
View File
@@ -14,18 +14,18 @@
* limitations under the License.
*/
#include "apr.h"
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_arch_threadproc.h"
#include "fspr.h"
#include "fspr_portable.h"
#include "fspr_strings.h"
#include "fspr_arch_threadproc.h"
static int thread_count = 0;
apr_status_t apr_threadattr_create(apr_threadattr_t **new,
apr_pool_t *pool)
fspr_status_t fspr_threadattr_create(fspr_threadattr_t **new,
fspr_pool_t *pool)
{
(*new) = (apr_threadattr_t *)apr_palloc(pool,
sizeof(apr_threadattr_t));
(*new) = (fspr_threadattr_t *)fspr_palloc(pool,
sizeof(fspr_threadattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -38,45 +38,45 @@ apr_status_t apr_threadattr_create(apr_threadattr_t **new,
return APR_SUCCESS;
}
apr_status_t apr_threadattr_detach_set(apr_threadattr_t *attr,apr_int32_t on)
fspr_status_t fspr_threadattr_detach_set(fspr_threadattr_t *attr,fspr_int32_t on)
{
attr->detach = on;
return APR_SUCCESS;
}
apr_status_t apr_threadattr_detach_get(apr_threadattr_t *attr)
fspr_status_t fspr_threadattr_detach_get(fspr_threadattr_t *attr)
{
if (attr->detach == 1)
return APR_DETACH;
return APR_NOTDETACH;
}
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
apr_size_t stacksize)
APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr,
fspr_size_t stacksize)
{
attr->stack_size = stacksize;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
apr_size_t size)
APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr,
fspr_size_t size)
{
return APR_ENOTIMPL;
}
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t *)opaque;
fspr_thread_t *thd = (fspr_thread_t *)opaque;
return thd->func(thd, thd->data);
}
apr_status_t apr_thread_create(apr_thread_t **new,
apr_threadattr_t *attr,
apr_thread_start_t func,
fspr_status_t fspr_thread_create(fspr_thread_t **new,
fspr_threadattr_t *attr,
fspr_thread_start_t func,
void *data,
apr_pool_t *pool)
fspr_pool_t *pool)
{
apr_status_t stat;
fspr_status_t stat;
long flags = NX_THR_BIND_CONTEXT;
char threadName[NX_MAX_OBJECT_NAME_LEN+1];
size_t stack_size = APR_DEFAULT_STACK_SIZE;
@@ -97,7 +97,7 @@ apr_status_t apr_thread_create(apr_thread_t **new,
stack_size = attr->stack_size;
}
(*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
(*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -106,9 +106,9 @@ apr_status_t apr_thread_create(apr_thread_t **new,
(*new)->pool = pool;
(*new)->data = data;
(*new)->func = func;
(*new)->thread_name = (char*)apr_pstrdup(pool, threadName);
(*new)->thread_name = (char*)fspr_pstrdup(pool, threadName);
stat = apr_pool_create(&(*new)->pool, pool);
stat = fspr_pool_create(&(*new)->pool, pool);
if (stat != APR_SUCCESS) {
return stat;
}
@@ -141,34 +141,34 @@ apr_status_t apr_thread_create(apr_thread_t **new,
return(stat);// if error
}
apr_os_thread_t apr_os_thread_current()
fspr_os_thread_t fspr_os_thread_current()
{
return NXThreadGetId();
}
int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2)
{
return (tid1 == tid2);
}
void apr_thread_yield()
void fspr_thread_yield()
{
NXThreadYield();
}
apr_status_t apr_thread_exit(apr_thread_t *thd,
apr_status_t retval)
fspr_status_t fspr_thread_exit(fspr_thread_t *thd,
fspr_status_t retval)
{
thd->exitval = retval;
apr_pool_destroy(thd->pool);
fspr_pool_destroy(thd->pool);
NXThreadExit(NULL);
return APR_SUCCESS;
}
apr_status_t apr_thread_join(apr_status_t *retval,
apr_thread_t *thd)
fspr_status_t fspr_thread_join(fspr_status_t *retval,
fspr_thread_t *thd)
{
apr_status_t stat;
fspr_status_t stat;
NXThreadId_t dthr;
if ((stat = NXThreadJoin(thd->td, &dthr, NULL)) == 0) {
@@ -180,16 +180,16 @@ apr_status_t apr_thread_join(apr_status_t *retval,
}
}
apr_status_t apr_thread_detach(apr_thread_t *thd)
fspr_status_t fspr_thread_detach(fspr_thread_t *thd)
{
return APR_SUCCESS;
}
apr_status_t apr_thread_data_get(void **data, const char *key,
apr_thread_t *thread)
fspr_status_t fspr_thread_data_get(void **data, const char *key,
fspr_thread_t *thread)
{
if (thread != NULL) {
return apr_pool_userdata_get(data, key, thread->pool);
return fspr_pool_userdata_get(data, key, thread->pool);
}
else {
data = NULL;
@@ -197,12 +197,12 @@ apr_status_t apr_thread_data_get(void **data, const char *key,
}
}
apr_status_t apr_thread_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_thread_t *thread)
fspr_status_t fspr_thread_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_thread_t *thread)
{
if (thread != NULL) {
return apr_pool_userdata_set(data, key, cleanup, thread->pool);
return fspr_pool_userdata_set(data, key, cleanup, thread->pool);
}
else {
data = NULL;
@@ -210,8 +210,8 @@ apr_status_t apr_thread_data_set(void *data, const char *key,
}
}
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd,
fspr_thread_t *thd)
{
if (thd == NULL) {
return APR_ENOTHREAD;
@@ -220,29 +220,29 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
apr_os_thread_t *thethd,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd,
fspr_os_thread_t *thethd,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*thd) == NULL) {
(*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
(*thd) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
(*thd)->pool = pool;
}
(*thd)->td = *thethd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control,
fspr_pool_t *p)
{
(*control) = apr_pcalloc(p, sizeof(**control));
(*control) = fspr_pcalloc(p, sizeof(**control));
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control,
void (*func)(void))
{
if (!atomic_xchg(&control->value, 1)) {
+23 -23
View File
@@ -14,15 +14,15 @@
* limitations under the License.
*/
#include "apr_portable.h"
#include "apr_arch_threadproc.h"
#include "fspr_portable.h"
#include "fspr_arch_threadproc.h"
apr_status_t apr_threadkey_private_create(apr_threadkey_t **key,
void (*dest)(void *), apr_pool_t *pool)
fspr_status_t fspr_threadkey_private_create(fspr_threadkey_t **key,
void (*dest)(void *), fspr_pool_t *pool)
{
apr_status_t stat;
fspr_status_t stat;
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
if ((*key) == NULL) {
return APR_ENOMEM;
}
@@ -35,9 +35,9 @@ apr_status_t apr_threadkey_private_create(apr_threadkey_t **key,
return stat;
}
apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key)
fspr_status_t fspr_threadkey_private_get(void **new, fspr_threadkey_t *key)
{
apr_status_t stat;
fspr_status_t stat;
if ((stat = NXKeyGetValue(key->key, new)) == 0) {
return APR_SUCCESS;
@@ -47,9 +47,9 @@ apr_status_t apr_threadkey_private_get(void **new, apr_threadkey_t *key)
}
}
apr_status_t apr_threadkey_private_set(void *priv, apr_threadkey_t *key)
fspr_status_t fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key)
{
apr_status_t stat;
fspr_status_t stat;
if ((stat = NXKeySetValue(key->key, priv)) == 0) {
return APR_SUCCESS;
}
@@ -58,42 +58,42 @@ apr_status_t apr_threadkey_private_set(void *priv, apr_threadkey_t *key)
}
}
apr_status_t apr_threadkey_private_delete(apr_threadkey_t *key)
fspr_status_t fspr_threadkey_private_delete(fspr_threadkey_t *key)
{
apr_status_t stat;
fspr_status_t stat;
if ((stat = NXKeyDelete(key->key)) == 0) {
return APR_SUCCESS;
}
return stat;
}
apr_status_t apr_threadkey_data_get(void **data, const char *key, apr_threadkey_t *threadkey)
fspr_status_t fspr_threadkey_data_get(void **data, const char *key, fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_get(data, key, threadkey->pool);
return fspr_pool_userdata_get(data, key, threadkey->pool);
}
apr_status_t apr_threadkey_data_set(void *data,
const char *key, apr_status_t (*cleanup) (void *),
apr_threadkey_t *threadkey)
fspr_status_t fspr_threadkey_data_set(void *data,
const char *key, fspr_status_t (*cleanup) (void *),
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_set(data, key, cleanup, threadkey->pool);
return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool);
}
apr_status_t apr_os_threadkey_get(apr_os_threadkey_t *thekey,
apr_threadkey_t *key)
fspr_status_t fspr_os_threadkey_get(fspr_os_threadkey_t *thekey,
fspr_threadkey_t *key)
{
thekey = &(key->key);
return APR_SUCCESS;
}
apr_status_t apr_os_threadkey_put(apr_threadkey_t **key,
apr_os_threadkey_t *thekey, apr_pool_t *pool)
fspr_status_t fspr_os_threadkey_put(fspr_threadkey_t **key,
fspr_os_threadkey_t *thekey, fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*key) == NULL) {
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
(*key)->pool = pool;
}
(*key)->key = *thekey;
+90 -90
View File
@@ -17,16 +17,16 @@
#define INCL_DOS
#define INCL_DOSERRORS
#include "apr_arch_threadproc.h"
#include "apr_arch_file_io.h"
#include "apr_private.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_portable.h"
#include "apr_strings.h"
#include "apr_signal.h"
#include "fspr_arch_threadproc.h"
#include "fspr_arch_file_io.h"
#include "fspr_private.h"
#include "fspr_thread_proc.h"
#include "fspr_file_io.h"
#include "fspr_general.h"
#include "fspr_lib.h"
#include "fspr_portable.h"
#include "fspr_strings.h"
#include "fspr_signal.h"
#include <signal.h>
#include <string.h>
#include <sys/wait.h>
@@ -34,10 +34,10 @@
#include <process.h>
#include <stdlib.h>
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new, fspr_pool_t *pool)
{
(*new) = (apr_procattr_t *)apr_palloc(pool,
sizeof(apr_procattr_t));
(*new) = (fspr_procattr_t *)fspr_palloc(pool,
sizeof(fspr_procattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -55,12 +55,12 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new, apr_pool_t *
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t in,
apr_int32_t out, apr_int32_t err)
APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr, fspr_int32_t in,
fspr_int32_t out, fspr_int32_t err)
{
apr_status_t stat;
fspr_status_t stat;
if (in) {
if ((stat = apr_file_pipe_create(&attr->child_in, &attr->parent_in,
if ((stat = fspr_file_pipe_create(&attr->child_in, &attr->parent_in,
attr->pool)) != APR_SUCCESS) {
return stat;
}
@@ -68,18 +68,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_in, 0);
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
}
}
if (out) {
if ((stat = apr_file_pipe_create(&attr->parent_out, &attr->child_out,
if ((stat = fspr_file_pipe_create(&attr->parent_out, &attr->child_out,
attr->pool)) != APR_SUCCESS) {
return stat;
}
@@ -87,18 +87,18 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_out, 0);
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
}
}
if (err) {
if ((stat = apr_file_pipe_create(&attr->parent_err, &attr->child_err,
if ((stat = fspr_file_pipe_create(&attr->parent_err, &attr->child_err,
attr->pool)) != APR_SUCCESS) {
return stat;
}
@@ -106,90 +106,90 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr, apr_int32_t
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_err, 0);
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
}
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr, apr_file_t *child_in,
apr_file_t *parent_in)
APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr, fspr_file_t *child_in,
fspr_file_t *parent_in)
{
if (attr->child_in == NULL && attr->parent_in == NULL)
apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
if (child_in != NULL)
apr_file_dup(&attr->child_in, child_in, attr->pool);
fspr_file_dup(&attr->child_in, child_in, attr->pool);
if (parent_in != NULL)
apr_file_dup(&attr->parent_in, parent_in, attr->pool);
fspr_file_dup(&attr->parent_in, parent_in, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr, apr_file_t *child_out,
apr_file_t *parent_out)
APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr, fspr_file_t *child_out,
fspr_file_t *parent_out)
{
if (attr->child_out == NULL && attr->parent_out == NULL)
apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
if (child_out != NULL)
apr_file_dup(&attr->child_out, child_out, attr->pool);
fspr_file_dup(&attr->child_out, child_out, attr->pool);
if (parent_out != NULL)
apr_file_dup(&attr->parent_out, parent_out, attr->pool);
fspr_file_dup(&attr->parent_out, parent_out, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr, apr_file_t *child_err,
apr_file_t *parent_err)
APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr, fspr_file_t *child_err,
fspr_file_t *parent_err)
{
if (attr->child_err == NULL && attr->parent_err == NULL)
apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
if (child_err != NULL)
apr_file_dup(&attr->child_err, child_err, attr->pool);
fspr_file_dup(&attr->child_err, child_err, attr->pool);
if (parent_err != NULL)
apr_file_dup(&attr->parent_err, parent_err, attr->pool);
fspr_file_dup(&attr->parent_err, parent_err, attr->pool);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr, const char *dir)
APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr, const char *dir)
{
attr->currdir = apr_pstrdup(attr->pool, dir);
attr->currdir = fspr_pstrdup(attr->pool, dir);
if (attr->currdir) {
return APR_SUCCESS;
}
return APR_ENOMEM;
}
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
apr_cmdtype_e cmd)
APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr,
fspr_cmdtype_e cmd)
{
attr->cmdtype = cmd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr, apr_int32_t detach)
APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr, fspr_int32_t detach)
{
attr->detached = detach;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool)
{
int pid;
@@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
/* quotes in the string are doubled up.
* Used to escape quotes in args passed to OS/2's cmd.exe
*/
static char *double_quotes(apr_pool_t *pool, const char *str)
static char *double_quotes(fspr_pool_t *pool, const char *str)
{
int num_quotes = 0;
int len = 0;
@@ -225,7 +225,7 @@ static char *double_quotes(apr_pool_t *pool, const char *str)
num_quotes += str[len++] == '\"';
}
quote_doubled_str = apr_palloc(pool, len + num_quotes + 1);
quote_doubled_str = fspr_palloc(pool, len + num_quotes + 1);
dest = quote_doubled_str;
while (*str) {
@@ -240,8 +240,8 @@ static char *double_quotes(apr_pool_t *pool, const char *str)
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
apr_child_errfn_t *errfn)
APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr,
fspr_child_errfn_t *errfn)
{
/* won't ever be called on this platform, so don't save the function pointer */
return APR_SUCCESS;
@@ -249,15 +249,15 @@ APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
apr_int32_t chk)
APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr,
fspr_int32_t chk)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
apr_int32_t addrspace)
APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr,
fspr_int32_t addrspace)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
@@ -265,13 +265,13 @@ APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname,
APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *proc, const char *progname,
const char * const *args,
const char * const *env,
apr_procattr_t *attr, apr_pool_t *pool)
fspr_procattr_t *attr, fspr_pool_t *pool)
{
int i, arg, numargs, cmdlen;
apr_status_t status;
fspr_status_t status;
const char **newargs;
char savedir[300];
HFILE save_in, save_out, save_err, dup;
@@ -279,7 +279,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
char *extension, *newprogname, *extra_arg = NULL, *cmdline, *cmdline_pos;
char interpreter[1024];
char error_object[260];
apr_file_t *progfile;
fspr_file_t *progfile;
int env_len, e;
char *env_block, *env_block_pos;
RESULTCODES rescodes;
@@ -314,7 +314,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
DosSetFHState(attr->parent_err->filedes, OPEN_FLAGS_NOINHERIT);
}
apr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */
fspr_signal(SIGCHLD, SIG_DFL); /*not sure if this is needed or not */
if (attr->currdir != NULL) {
_getcwd2(savedir, sizeof(savedir));
@@ -340,21 +340,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
strcpy(interpreter, "#!" SHELL_PATH);
extra_arg = "/C";
} else if (stricmp(extension, ".exe") != 0) {
status = apr_file_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, pool);
status = fspr_file_open(&progfile, progname, APR_READ|APR_BUFFERED, 0, pool);
if (status != APR_SUCCESS && APR_STATUS_IS_ENOENT(status)) {
progname = apr_pstrcat(pool, progname, ".exe", NULL);
progname = fspr_pstrcat(pool, progname, ".exe", NULL);
}
if (status == APR_SUCCESS) {
status = apr_file_gets(interpreter, sizeof(interpreter), progfile);
status = fspr_file_gets(interpreter, sizeof(interpreter), progfile);
if (status == APR_SUCCESS) {
if (interpreter[0] == '#' && interpreter[1] == '!') {
/* delete CR/LF & any other whitespace off the end */
int end = strlen(interpreter) - 1;
while (end >= 0 && apr_isspace(interpreter[end])) {
while (end >= 0 && fspr_isspace(interpreter[end])) {
interpreter[end] = '\0';
end--;
}
@@ -376,7 +376,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
}
}
apr_file_close(progfile);
fspr_file_close(progfile);
}
}
@@ -386,7 +386,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
i++;
}
newargs = (const char **)apr_palloc(pool, sizeof (char *) * (i + 4));
newargs = (const char **)fspr_palloc(pool, sizeof (char *) * (i + 4));
numargs = 0;
if (interpreter[0])
@@ -394,7 +394,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
if (extra_arg)
newargs[numargs++] = "/c";
newargs[numargs++] = newprogname = apr_pstrdup(pool, progname);
newargs[numargs++] = newprogname = fspr_pstrdup(pool, progname);
arg = 1;
while (args && args[arg]) {
@@ -412,14 +412,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
for (i=0; i<numargs; i++)
cmdlen += strlen(newargs[i]) + 3;
cmdline = apr_palloc(pool, cmdlen + 2);
cmdline = fspr_palloc(pool, cmdlen + 2);
cmdline_pos = cmdline;
for (i=0; i<numargs; i++) {
const char *a = newargs[i];
if (strpbrk(a, "&|<>\" "))
a = apr_pstrcat(pool, "\"", double_quotes(pool, a), "\"", NULL);
a = fspr_pstrcat(pool, "\"", double_quotes(pool, a), "\"", NULL);
if (i)
*(cmdline_pos++) = ' ';
@@ -441,7 +441,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
for (env_len=1, e=0; env[e]; e++)
env_len += strlen(env[e]) + 1;
env_block = apr_palloc(pool, env_len);
env_block = fspr_palloc(pool, env_len);
env_block_pos = env_block;
for (e=0; env[e]; e++) {
@@ -464,21 +464,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
}
if (attr->child_in) {
apr_file_close(attr->child_in);
fspr_file_close(attr->child_in);
dup = STDIN_FILENO;
DosDupHandle(save_in, &dup);
DosClose(save_in);
}
if (attr->child_out) {
apr_file_close(attr->child_out);
fspr_file_close(attr->child_out);
dup = STDOUT_FILENO;
DosDupHandle(save_out, &dup);
DosClose(save_out);
}
if (attr->child_err) {
apr_file_close(attr->child_err);
fspr_file_close(attr->child_err);
dup = STDERR_FILENO;
DosDupHandle(save_err, &dup);
DosClose(save_err);
@@ -497,10 +497,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *proc, const char *progname
static void proces_result_codes(RESULTCODES codes,
int *exitcode,
apr_exit_why_e *exitwhy)
fspr_exit_why_e *exitwhy)
{
int result = 0;
apr_exit_why_e why = APR_PROC_EXIT;
fspr_exit_why_e why = APR_PROC_EXIT;
switch (codes.codeTerminate) {
case TC_EXIT: /* Normal exit */
@@ -553,11 +553,11 @@ static void proces_result_codes(RESULTCODES codes,
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow,
apr_pool_t *p)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow,
fspr_pool_t *p)
{
RESULTCODES codes;
ULONG rc;
@@ -578,9 +578,9 @@ APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
int *exitcode, apr_exit_why_e *exitwhy,
apr_wait_how_e waithow)
APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc,
int *exitcode, fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow)
{
RESULTCODES codes;
ULONG rc;
@@ -599,19 +599,19 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize)
APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr,
const char *username,
const char *password)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr,
const char *groupname)
{
return APR_ENOTIMPL;
+48 -48
View File
@@ -16,17 +16,17 @@
#define INCL_DOSERRORS
#define INCL_DOS
#include "apr_arch_threadproc.h"
#include "apr_thread_proc.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_portable.h"
#include "apr_arch_file_io.h"
#include "fspr_arch_threadproc.h"
#include "fspr_thread_proc.h"
#include "fspr_general.h"
#include "fspr_lib.h"
#include "fspr_portable.h"
#include "fspr_arch_file_io.h"
#include <stdlib.h>
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new, fspr_pool_t *pool)
{
(*new) = (apr_threadattr_t *)apr_palloc(pool, sizeof(apr_threadattr_t));
(*new) = (fspr_threadattr_t *)fspr_palloc(pool, sizeof(fspr_threadattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -40,7 +40,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new, apr_pool
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_int32_t on)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr, fspr_int32_t on)
{
attr->attr |= APR_THREADATTR_DETACHED;
return APR_SUCCESS;
@@ -48,40 +48,40 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr, apr_
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr)
{
return (attr->attr & APR_THREADATTR_DETACHED) ? APR_DETACH : APR_NOTDETACH;
}
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
apr_size_t stacksize)
APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr,
fspr_size_t stacksize)
{
attr->stacksize = stacksize;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
apr_size_t size)
APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr,
fspr_size_t size)
{
return APR_ENOTIMPL;
}
static void apr_thread_begin(void *arg)
static void fspr_thread_begin(void *arg)
{
apr_thread_t *thread = (apr_thread_t *)arg;
fspr_thread_t *thread = (fspr_thread_t *)arg;
thread->exitval = thread->func(thread, thread->data);
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t *attr,
apr_thread_start_t func, void *data,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new, fspr_threadattr_t *attr,
fspr_thread_start_t func, void *data,
fspr_pool_t *pool)
{
apr_status_t stat;
apr_thread_t *thread;
fspr_status_t stat;
fspr_thread_t *thread;
thread = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
thread = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
*new = thread;
if (thread == NULL) {
@@ -92,21 +92,21 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t
thread->attr = attr;
thread->func = func;
thread->data = data;
stat = apr_pool_create(&thread->pool, pool);
stat = fspr_pool_create(&thread->pool, pool);
if (stat != APR_SUCCESS) {
return stat;
}
if (attr == NULL) {
stat = apr_threadattr_create(&thread->attr, thread->pool);
stat = fspr_threadattr_create(&thread->attr, thread->pool);
if (stat != APR_SUCCESS) {
return stat;
}
}
thread->tid = _beginthread(apr_thread_begin, NULL,
thread->tid = _beginthread(fspr_thread_begin, NULL,
thread->attr->stacksize > 0 ?
thread->attr->stacksize : APR_THREAD_STACKSIZE,
thread);
@@ -120,7 +120,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new, apr_threadattr_t
APR_DECLARE(apr_os_thread_t) apr_os_thread_current()
APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current()
{
PIB *ppib;
TIB *ptib;
@@ -130,7 +130,7 @@ APR_DECLARE(apr_os_thread_t) apr_os_thread_current()
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval)
APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd, fspr_status_t retval)
{
thd->exitval = retval;
_endthread();
@@ -139,7 +139,7 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd, apr_status_t retval
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval, fspr_thread_t *thd)
{
ULONG rc;
TID waittid = thd->tid;
@@ -158,7 +158,7 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval, apr_thread_t *th
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd)
{
thd->attr->attr |= APR_THREADATTR_DETACHED;
return APR_SUCCESS;
@@ -166,14 +166,14 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
void apr_thread_yield()
void fspr_thread_yield()
{
DosSleep(0);
}
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd, fspr_thread_t *thd)
{
*thethd = &thd->tid;
return APR_SUCCESS;
@@ -181,11 +181,11 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd, apr_thread
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t *thethd,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd, fspr_os_thread_t *thethd,
fspr_pool_t *pool)
{
if ((*thd) == NULL) {
(*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t));
(*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t));
(*thd)->pool = pool;
}
(*thd)->tid = *thethd;
@@ -194,34 +194,34 @@ APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd, apr_os_thread_t
int apr_os_thread_equal(apr_os_thread_t tid1, apr_os_thread_t tid2)
int fspr_os_thread_equal(fspr_os_thread_t tid1, fspr_os_thread_t tid2)
{
return tid1 == tid2;
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key, apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key, fspr_thread_t *thread)
{
return apr_pool_userdata_get(data, key, thread->pool);
return fspr_pool_userdata_get(data, key, thread->pool);
}
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_thread_t *thread)
{
return apr_pool_userdata_set(data, key, cleanup, thread->pool);
return fspr_pool_userdata_set(data, key, cleanup, thread->pool);
}
APR_POOL_IMPLEMENT_ACCESSOR(thread)
static apr_status_t thread_once_cleanup(void *vcontrol)
static fspr_status_t thread_once_cleanup(void *vcontrol)
{
apr_thread_once_t *control = (apr_thread_once_t *)vcontrol;
fspr_thread_once_t *control = (fspr_thread_once_t *)vcontrol;
if (control->sem) {
DosCloseEventSem(control->sem);
@@ -232,19 +232,19 @@ static apr_status_t thread_once_cleanup(void *vcontrol)
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control,
fspr_pool_t *p)
{
ULONG rc;
*control = (apr_thread_once_t *)apr_pcalloc(p, sizeof(apr_thread_once_t));
*control = (fspr_thread_once_t *)fspr_pcalloc(p, sizeof(fspr_thread_once_t));
rc = DosCreateEventSem(NULL, &(*control)->sem, 0, TRUE);
apr_pool_cleanup_register(p, control, thread_once_cleanup, apr_pool_cleanup_null);
fspr_pool_cleanup_register(p, control, thread_once_cleanup, fspr_pool_cleanup_null);
return APR_FROM_OS_ERROR(rc);
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control,
void (*func)(void))
{
if (!control->hit) {
+25 -25
View File
@@ -14,19 +14,19 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "apr_thread_proc.h"
#include "apr_portable.h"
#include "apr_general.h"
#include "apr_errno.h"
#include "apr_lib.h"
#include "apr_arch_file_io.h"
#include "fspr_arch_threadproc.h"
#include "fspr_thread_proc.h"
#include "fspr_portable.h"
#include "fspr_general.h"
#include "fspr_errno.h"
#include "fspr_lib.h"
#include "fspr_arch_file_io.h"
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key,
void (*dest)(void *),
apr_pool_t *pool)
fspr_pool_t *pool)
{
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
if ((*key) == NULL) {
return APR_ENOMEM;
@@ -36,51 +36,51 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
return APR_OS2_STATUS(DosAllocThreadLocalMemory(1, &((*key)->key)));
}
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new, fspr_threadkey_t *key)
{
(*new) = (void *)*(key->key);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv, fspr_threadkey_t *key)
{
*(key->key) = (ULONG)priv;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key)
{
return APR_OS2_STATUS(DosFreeThreadLocalMemory(key->key));
}
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key,
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_get(data, key, threadkey->pool);
return fspr_pool_userdata_get(data, key, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_set(data, key, cleanup, threadkey->pool);
return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey, apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey, fspr_threadkey_t *key)
{
*thekey = key->key;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
apr_os_threadkey_t *thekey,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key,
fspr_os_threadkey_t *thekey,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*key) == NULL) {
(*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t));
(*key)->pool = pool;
}
(*key)->key = *thekey;
+108 -108
View File
@@ -14,16 +14,16 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_signal.h"
#include "apr_random.h"
#include "fspr_arch_threadproc.h"
#include "fspr_strings.h"
#include "fspr_portable.h"
#include "fspr_signal.h"
#include "fspr_random.h"
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new,
fspr_pool_t *pool)
{
(*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t));
(*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -34,14 +34,14 @@ APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
apr_int32_t in,
apr_int32_t out,
apr_int32_t err)
APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr,
fspr_int32_t in,
fspr_int32_t out,
fspr_int32_t err)
{
apr_status_t status;
fspr_status_t status;
if (in != 0) {
if ((status = apr_file_pipe_create(&attr->child_in, &attr->parent_in,
if ((status = fspr_file_pipe_create(&attr->child_in, &attr->parent_in,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -50,19 +50,19 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_in, 0);
apr_file_pipe_timeout_set(attr->parent_in, 0);
fspr_file_pipe_timeout_set(attr->child_in, 0);
fspr_file_pipe_timeout_set(attr->parent_in, 0);
}
}
if (out) {
if ((status = apr_file_pipe_create(&attr->parent_out, &attr->child_out,
if ((status = fspr_file_pipe_create(&attr->parent_out, &attr->child_out,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -71,19 +71,19 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_out, 0);
apr_file_pipe_timeout_set(attr->parent_out, 0);
fspr_file_pipe_timeout_set(attr->child_out, 0);
fspr_file_pipe_timeout_set(attr->parent_out, 0);
}
}
if (err) {
if ((status = apr_file_pipe_create(&attr->parent_err, &attr->child_err,
if ((status = fspr_file_pipe_create(&attr->parent_err, &attr->child_err,
attr->pool)) != APR_SUCCESS) {
return status;
}
@@ -92,14 +92,14 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
case APR_FULL_BLOCK:
break;
case APR_PARENT_BLOCK:
apr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
break;
case APR_CHILD_BLOCK:
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
break;
default:
apr_file_pipe_timeout_set(attr->child_err, 0);
apr_file_pipe_timeout_set(attr->parent_err, 0);
fspr_file_pipe_timeout_set(attr->child_err, 0);
fspr_file_pipe_timeout_set(attr->parent_err, 0);
}
}
@@ -107,67 +107,67 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
}
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr,
apr_file_t *child_in,
apr_file_t *parent_in)
APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr,
fspr_file_t *child_in,
fspr_file_t *parent_in)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (attr->child_in == NULL && attr->parent_in == NULL)
rv = apr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
rv = fspr_file_pipe_create(&attr->child_in, &attr->parent_in, attr->pool);
if (child_in != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->child_in, child_in, attr->pool);
rv = fspr_file_dup2(attr->child_in, child_in, attr->pool);
if (parent_in != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->parent_in, parent_in, attr->pool);
rv = fspr_file_dup2(attr->parent_in, parent_in, attr->pool);
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr,
apr_file_t *child_out,
apr_file_t *parent_out)
APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr,
fspr_file_t *child_out,
fspr_file_t *parent_out)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (attr->child_out == NULL && attr->parent_out == NULL)
rv = apr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
rv = fspr_file_pipe_create(&attr->child_out, &attr->parent_out, attr->pool);
if (child_out != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->child_out, child_out, attr->pool);
rv = fspr_file_dup2(attr->child_out, child_out, attr->pool);
if (parent_out != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->parent_out, parent_out, attr->pool);
rv = fspr_file_dup2(attr->parent_out, parent_out, attr->pool);
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr,
apr_file_t *child_err,
apr_file_t *parent_err)
APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr,
fspr_file_t *child_err,
fspr_file_t *parent_err)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (attr->child_err == NULL && attr->parent_err == NULL)
rv = apr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
rv = fspr_file_pipe_create(&attr->child_err, &attr->parent_err, attr->pool);
if (child_err != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->child_err, child_err, attr->pool);
rv = fspr_file_dup2(attr->child_err, child_err, attr->pool);
if (parent_err != NULL && rv == APR_SUCCESS)
rv = apr_file_dup2(attr->parent_err, parent_err, attr->pool);
rv = fspr_file_dup2(attr->parent_err, parent_err, attr->pool);
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr,
const char *dir)
{
attr->currdir = apr_pstrdup(attr->pool, dir);
attr->currdir = fspr_pstrdup(attr->pool, dir);
if (attr->currdir) {
return APR_SUCCESS;
}
@@ -175,21 +175,21 @@ APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
return APR_ENOMEM;
}
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
apr_cmdtype_e cmd)
APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr,
fspr_cmdtype_e cmd)
{
attr->cmdtype = cmd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr,
apr_int32_t detach)
APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr,
fspr_int32_t detach)
{
attr->detached = detach;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_proc_fork(fspr_proc_t *proc, fspr_pool_t *pool)
{
int pid;
@@ -202,7 +202,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
proc->out = NULL;
proc->err = NULL;
apr_random_after_fork(proc);
fspr_random_after_fork(proc);
return APR_INCHILD;
}
@@ -215,7 +215,7 @@ APR_DECLARE(apr_status_t) apr_proc_fork(apr_proc_t *proc, apr_pool_t *pool)
return APR_INPARENT;
}
static apr_status_t limit_proc(apr_procattr_t *attr)
static fspr_status_t limit_proc(fspr_procattr_t *attr)
{
#if APR_HAVE_STRUCT_RLIMIT && APR_HAVE_SETRLIMIT
#ifdef RLIMIT_CPU
@@ -267,35 +267,35 @@ static apr_status_t limit_proc(apr_procattr_t *attr)
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
apr_child_errfn_t *errfn)
APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr,
fspr_child_errfn_t *errfn)
{
attr->errfn = errfn;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
apr_int32_t chk)
APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr,
fspr_int32_t chk)
{
attr->errchk = chk;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
apr_int32_t addrspace)
APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr,
fspr_int32_t addrspace)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr,
const char *username,
const char *password)
{
apr_status_t rv;
apr_gid_t gid;
fspr_status_t rv;
fspr_gid_t gid;
if ((rv = apr_uid_get(&attr->uid, &gid, username,
if ((rv = fspr_uid_get(&attr->uid, &gid, username,
attr->pool)) != APR_SUCCESS) {
attr->uid = -1;
return rv;
@@ -308,22 +308,22 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr,
const char *groupname)
{
apr_status_t rv;
fspr_status_t rv;
if ((rv = apr_gid_get(&attr->gid, groupname, attr->pool)) != APR_SUCCESS)
if ((rv = fspr_gid_get(&attr->gid, groupname, attr->pool)) != APR_SUCCESS)
attr->gid = -1;
return rv;
}
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new,
const char *progname,
const char * const *args,
const char * const *env,
apr_procattr_t *attr,
apr_pool_t *pool)
fspr_procattr_t *attr,
fspr_pool_t *pool)
{
int i;
const char * const empty_envp[] = {NULL};
@@ -385,41 +385,41 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
*/
if (attr->child_in) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_in),
attr->child_in, apr_unix_file_cleanup);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_in),
attr->child_in, fspr_unix_file_cleanup);
}
if (attr->child_out) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_out),
attr->child_out, apr_unix_file_cleanup);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_out),
attr->child_out, fspr_unix_file_cleanup);
}
if (attr->child_err) {
apr_pool_cleanup_kill(apr_file_pool_get(attr->child_err),
attr->child_err, apr_unix_file_cleanup);
fspr_pool_cleanup_kill(fspr_file_pool_get(attr->child_err),
attr->child_err, fspr_unix_file_cleanup);
}
apr_pool_cleanup_for_exec();
fspr_pool_cleanup_for_exec();
if (attr->child_in) {
apr_file_close(attr->parent_in);
fspr_file_close(attr->parent_in);
dup2(attr->child_in->filedes, STDIN_FILENO);
apr_file_close(attr->child_in);
fspr_file_close(attr->child_in);
}
if (attr->child_out) {
apr_file_close(attr->parent_out);
fspr_file_close(attr->parent_out);
dup2(attr->child_out->filedes, STDOUT_FILENO);
apr_file_close(attr->child_out);
fspr_file_close(attr->child_out);
}
if (attr->child_err) {
apr_file_close(attr->parent_err);
fspr_file_close(attr->parent_err);
dup2(attr->child_err->filedes, STDERR_FILENO);
apr_file_close(attr->child_err);
fspr_file_close(attr->child_err);
}
apr_signal(SIGCHLD, SIG_DFL); /* not sure if this is needed or not */
fspr_signal(SIGCHLD, SIG_DFL); /* not sure if this is needed or not */
if (attr->currdir != NULL) {
if (chdir(attr->currdir) == -1) {
@@ -485,7 +485,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
{
char *ch, *onearg;
ch = onearg = apr_palloc(pool, onearg_len);
ch = onearg = fspr_palloc(pool, onearg_len);
i = 0;
while (args[i]) {
size_t len = strlen(args[i]);
@@ -505,7 +505,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
newargs[3] = NULL;
if (attr->detached) {
apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
}
if (attr->cmdtype == APR_SHELLCMD) {
@@ -517,14 +517,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
}
else if (attr->cmdtype == APR_PROGRAM) {
if (attr->detached) {
apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
}
execve(progname, (char * const *)args, (char * const *)env);
}
else if (attr->cmdtype == APR_PROGRAM_ENV) {
if (attr->detached) {
apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
}
execv(progname, (char * const *)args);
@@ -532,7 +532,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
else {
/* APR_PROGRAM_PATH */
if (attr->detached) {
apr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
fspr_proc_detach(APR_PROC_DETACH_DAEMONIZE);
}
execvp(progname, (char * const *)args);
@@ -540,7 +540,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
if (attr->errfn) {
char *desc;
desc = apr_psprintf(pool, "exec of '%s' failed",
desc = fspr_psprintf(pool, "exec of '%s' failed",
progname);
attr->errfn(pool, errno, desc);
}
@@ -551,39 +551,39 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
/* Parent process */
if (attr->child_in) {
apr_file_close(attr->child_in);
fspr_file_close(attr->child_in);
}
if (attr->child_out) {
apr_file_close(attr->child_out);
fspr_file_close(attr->child_out);
}
if (attr->child_err) {
apr_file_close(attr->child_err);
fspr_file_close(attr->child_err);
}
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow,
apr_pool_t *p)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow,
fspr_pool_t *p)
{
proc->pid = -1;
return apr_proc_wait(proc, exitcode, exitwhy, waithow);
return fspr_proc_wait(proc, exitcode, exitwhy, waithow);
}
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
int *exitcode, apr_exit_why_e *exitwhy,
apr_wait_how_e waithow)
APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc,
int *exitcode, fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow)
{
pid_t pstatus;
int waitpid_options = WUNTRACED;
int exit_int;
int ignore;
apr_exit_why_e ignorewhy;
fspr_exit_why_e ignorewhy;
if (exitcode == NULL) {
exitcode = &ignore;
@@ -633,8 +633,8 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
return errno;
}
APR_DECLARE(apr_status_t) apr_procattr_limit_set(apr_procattr_t *attr,
apr_int32_t what,
APR_DECLARE(fspr_status_t) fspr_procattr_limit_set(fspr_procattr_t *attr,
fspr_int32_t what,
struct rlimit *limit)
{
switch(what) {
+2 -2
View File
@@ -14,9 +14,9 @@
* limitations under the License.
*/
#include "apr_arch_threadproc.h"
#include "fspr_arch_threadproc.h"
APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize)
APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize)
{
int x;
+20 -20
View File
@@ -15,11 +15,11 @@
*/
#define INCL_DOSEXCEPTIONS /* for OS2 */
#include "apr_arch_threadproc.h"
#include "apr_private.h"
#include "apr_pools.h"
#include "apr_signal.h"
#include "apr_strings.h"
#include "fspr_arch_threadproc.h"
#include "fspr_private.h"
#include "fspr_pools.h"
#include "fspr_signal.h"
#include "fspr_strings.h"
#include <assert.h>
#if APR_HAS_THREADS && APR_HAVE_PTHREAD_H
@@ -27,12 +27,12 @@
#endif
#ifdef SIGWAIT_TAKES_ONE_ARG
#define apr_sigwait(a,b) ((*(b)=sigwait((a)))<0?-1:0)
#define fspr_sigwait(a,b) ((*(b)=sigwait((a)))<0?-1:0)
#else
#define apr_sigwait(a,b) sigwait((a),(b))
#define fspr_sigwait(a,b) sigwait((a),(b))
#endif
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signum)
APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signum)
{
#ifdef OS2
/* SIGTERM's don't work too well in OS/2 (only affects other EMX
@@ -71,7 +71,7 @@ static void avoid_zombies(int signo)
* from W. Richard Stevens' "Advanced Programming in the UNIX Environment"
* (the version that does not automatically restart system calls).
*/
APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func)
APR_DECLARE(fspr_sigfunc_t *) fspr_signal(int signo, fspr_sigfunc_t * func)
{
struct sigaction act, oact;
@@ -111,10 +111,10 @@ APR_DECLARE(apr_sigfunc_t *) apr_signal(int signo, apr_sigfunc_t * func)
* on the version of autoconf used. */
#if defined(SYS_SIGLIST_DECLARED) || HAVE_DECL_SYS_SIGLIST
void apr_signal_init(apr_pool_t *pglobal)
void fspr_signal_init(fspr_pool_t *pglobal)
{
}
const char *apr_signal_description_get(int signum)
const char *fspr_signal_description_get(int signum)
{
return sys_siglist[signum];
}
@@ -145,7 +145,7 @@ static const char *signal_description[APR_NUMSIG];
} \
} while (0)
void apr_signal_init(apr_pool_t *pglobal)
void fspr_signal_init(fspr_pool_t *pglobal)
{
int sig;
@@ -256,10 +256,10 @@ void apr_signal_init(apr_pool_t *pglobal)
for (sig = 0; sig < APR_NUMSIG; ++sig)
if (signal_description[sig] == NULL)
signal_description[sig] = apr_psprintf(pglobal, "signal #%d", sig);
signal_description[sig] = fspr_psprintf(pglobal, "signal #%d", sig);
}
const char *apr_signal_description_get(int signum)
const char *fspr_signal_description_get(int signum)
{
return
signum < APR_NUMSIG
@@ -316,7 +316,7 @@ static void remove_sync_sigs(sigset_t *sig_mask)
#endif
}
APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum))
APR_DECLARE(fspr_status_t) fspr_signal_thread(int(*signal_handler)(int signum))
{
sigset_t sig_mask;
#if APR_HAVE_SIGWAIT
@@ -380,7 +380,7 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum))
#if APR_HAVE_SIGWAIT
int signal_received;
if (apr_sigwait(&sig_mask, &signal_received) != 0)
if (fspr_sigwait(&sig_mask, &signal_received) != 0)
{
/* handle sigwait() error here */
}
@@ -391,12 +391,12 @@ APR_DECLARE(apr_status_t) apr_signal_thread(int(*signal_handler)(int signum))
#elif HAVE_SIGSUSPEND
sigsuspend(&sig_mask);
#else
#error No apr_sigwait() and no sigsuspend()
#error No fspr_sigwait() and no sigsuspend()
#endif
}
}
APR_DECLARE(apr_status_t) apr_setup_signal_thread(void)
APR_DECLARE(fspr_status_t) fspr_setup_signal_thread(void)
{
sigset_t sig_mask;
int rv;
@@ -432,7 +432,7 @@ APR_DECLARE(apr_status_t) apr_setup_signal_thread(void)
#endif /* APR_HAS_THREADS && ... */
APR_DECLARE(apr_status_t) apr_signal_block(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_block(int signum)
{
#if APR_HAVE_SIGACTION
sigset_t sig_mask;
@@ -459,7 +459,7 @@ APR_DECLARE(apr_status_t) apr_signal_block(int signum)
#endif
}
APR_DECLARE(apr_status_t) apr_signal_unblock(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum)
{
#if APR_HAVE_SIGACTION
sigset_t sig_mask;
+62 -62
View File
@@ -14,19 +14,19 @@
* limitations under the License.
*/
#include "apr.h"
#include "apr_portable.h"
#include "apr_arch_threadproc.h"
#include "fspr.h"
#include "fspr_portable.h"
#include "fspr_arch_threadproc.h"
#if APR_HAS_THREADS
#if APR_HAVE_PTHREAD_H
/* Destroy the threadattr object */
static apr_status_t threadattr_cleanup(void *data)
static fspr_status_t threadattr_cleanup(void *data)
{
apr_threadattr_t *attr = data;
apr_status_t rv;
fspr_threadattr_t *attr = data;
fspr_status_t rv;
rv = pthread_attr_destroy(&attr->attr);
#ifdef PTHREAD_SETS_ERRNO
@@ -37,18 +37,18 @@ static apr_status_t threadattr_cleanup(void *data)
return rv;
}
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new,
fspr_pool_t *pool)
{
apr_status_t stat;
fspr_status_t stat;
(*new) = apr_palloc(pool, sizeof(apr_threadattr_t));
(*new) = fspr_palloc(pool, sizeof(fspr_threadattr_t));
(*new)->pool = pool;
stat = pthread_attr_init(&(*new)->attr);
if (stat == 0) {
apr_pool_cleanup_register(pool, *new, threadattr_cleanup,
apr_pool_cleanup_null);
fspr_pool_cleanup_register(pool, *new, threadattr_cleanup,
fspr_pool_cleanup_null);
return APR_SUCCESS;
}
#ifdef PTHREAD_SETS_ERRNO
@@ -60,10 +60,10 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
#define DETACH_ARG(v) ((v) ? PTHREAD_CREATE_DETACHED : PTHREAD_CREATE_JOINABLE)
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
apr_int32_t on)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr,
fspr_int32_t on)
{
apr_status_t stat;
fspr_status_t stat;
#ifdef PTHREAD_ATTR_SETDETACHSTATE_ARG2_ADDR
int arg = DETACH_ARG(v);
@@ -83,7 +83,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
}
}
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr)
{
int state;
@@ -97,8 +97,8 @@ APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
return APR_NOTDETACH;
}
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
apr_size_t stacksize)
APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr,
fspr_size_t stacksize)
{
int stat;
@@ -113,11 +113,11 @@ APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
return stat;
}
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
apr_size_t size)
APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr,
fspr_size_t size)
{
#ifdef HAVE_PTHREAD_ATTR_SETGUARDSIZE
apr_status_t rv;
fspr_status_t rv;
rv = pthread_attr_setguardsize(&attr->attr, size);
if (rv == 0) {
@@ -134,7 +134,7 @@ APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
static void *dummy_worker(void *opaque)
{
apr_thread_t *thread = (apr_thread_t*)opaque;
fspr_thread_t *thread = (fspr_thread_t*)opaque;
#ifdef HAVE_PTHREAD_SETSCHEDPARAM
if (thread->priority) {
@@ -151,23 +151,23 @@ static void *dummy_worker(void *opaque)
return thread->func(thread, thread->data);
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
apr_threadattr_t *attr,
apr_thread_start_t func,
APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new,
fspr_threadattr_t *attr,
fspr_thread_start_t func,
void *data,
apr_pool_t *pool)
fspr_pool_t *pool)
{
apr_status_t stat;
fspr_status_t stat;
pthread_attr_t *temp;
pthread_t tt;
(*new) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t));
(*new) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t));
if ((*new) == NULL) {
return APR_ENOMEM;
}
(*new)->td = (pthread_t *)apr_pcalloc(pool, sizeof(pthread_t));
(*new)->td = (pthread_t *)fspr_pcalloc(pool, sizeof(pthread_t));
if ((*new)->td == NULL) {
return APR_ENOMEM;
@@ -182,7 +182,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
else
temp = NULL;
stat = apr_pool_create(&(*new)->pool, pool);
stat = fspr_pool_create(&(*new)->pool, pool);
if (stat != APR_SUCCESS) {
return stat;
}
@@ -205,31 +205,31 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
}
}
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void)
{
return pthread_self();
}
APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
apr_os_thread_t tid2)
APR_DECLARE(int) fspr_os_thread_equal(fspr_os_thread_t tid1,
fspr_os_thread_t tid2)
{
return pthread_equal(tid1, tid2);
}
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
apr_status_t retval)
APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd,
fspr_status_t retval)
{
thd->exitval = retval;
apr_pool_destroy(thd->pool);
fspr_pool_destroy(thd->pool);
pthread_exit(NULL);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval,
fspr_thread_t *thd)
{
apr_status_t stat;
apr_status_t *thread_stat;
fspr_status_t stat;
fspr_status_t *thread_stat;
if ((stat = pthread_join(*thd->td,(void *)&thread_stat)) == 0) {
*retval = thd->exitval;
@@ -244,9 +244,9 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
}
}
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd)
{
apr_status_t stat;
fspr_status_t stat;
#ifdef PTHREAD_DETACH_ARG1_ADDR
if ((stat = pthread_detach(thd->td)) == 0) {
@@ -265,40 +265,40 @@ APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
}
}
void apr_thread_yield()
void fspr_thread_yield()
{
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key,
fspr_thread_t *thread)
{
return apr_pool_userdata_get(data, key, thread->pool);
return fspr_pool_userdata_get(data, key, thread->pool);
}
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
apr_status_t (*cleanup)(void *),
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key,
fspr_status_t (*cleanup)(void *),
fspr_thread_t *thread)
{
return apr_pool_userdata_set(data, key, cleanup, thread->pool);
return fspr_pool_userdata_set(data, key, cleanup, thread->pool);
}
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd,
fspr_thread_t *thd)
{
*thethd = thd->td;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
apr_os_thread_t *thethd,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd,
fspr_os_thread_t *thethd,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*thd) == NULL) {
(*thd) = (apr_thread_t *)apr_pcalloc(pool, sizeof(apr_thread_t));
(*thd) = (fspr_thread_t *)fspr_pcalloc(pool, sizeof(fspr_thread_t));
(*thd)->pool = pool;
}
@@ -306,17 +306,17 @@ APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control,
fspr_pool_t *p)
{
static const pthread_once_t once_init = PTHREAD_ONCE_INIT;
*control = apr_palloc(p, sizeof(**control));
*control = fspr_palloc(p, sizeof(**control));
(*control)->once = once_init;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control,
void (*func)(void))
{
return pthread_once(&control->once, func);
@@ -330,9 +330,9 @@ APR_POOL_IMPLEMENT_ACCESSOR(thread)
#if !APR_HAS_THREADS
/* avoid warning for no prototype */
APR_DECLARE(apr_status_t) apr_os_thread_get(void);
APR_DECLARE(fspr_status_t) fspr_os_thread_get(void);
APR_DECLARE(apr_status_t) apr_os_thread_get(void)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(void)
{
return APR_ENOTIMPL;
}
+28 -28
View File
@@ -14,18 +14,18 @@
* limitations under the License.
*/
#include "apr.h"
#include "apr_portable.h"
#include "apr_arch_threadproc.h"
#include "fspr.h"
#include "fspr_portable.h"
#include "fspr_arch_threadproc.h"
#if APR_HAS_THREADS
#if APR_HAVE_PTHREAD_H
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key,
void (*dest)(void *),
apr_pool_t *pool)
fspr_pool_t *pool)
{
(*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t));
if ((*key) == NULL) {
return APR_ENOMEM;
@@ -37,8 +37,8 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
}
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new,
fspr_threadkey_t *key)
{
#ifdef PTHREAD_GETSPECIFIC_TAKES_TWO_ARGS
if (pthread_getspecific(key->key,new))
@@ -49,10 +49,10 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv,
fspr_threadkey_t *key)
{
apr_status_t stat;
fspr_status_t stat;
if ((stat = pthread_setspecific(key->key, priv)) == 0) {
return APR_SUCCESS;
@@ -62,10 +62,10 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv,
}
}
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key)
{
#ifdef HAVE_PTHREAD_KEY_DELETE
apr_status_t stat;
fspr_status_t stat;
if ((stat = pthread_key_delete(key->key)) == 0) {
return APR_SUCCESS;
@@ -77,36 +77,36 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
#endif
}
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key,
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_get(data, key, threadkey->pool);
return fspr_pool_userdata_get(data, key, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
apr_status_t (*cleanup)(void *),
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key,
fspr_status_t (*cleanup)(void *),
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_set(data, key, cleanup, threadkey->pool);
return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey,
fspr_threadkey_t *key)
{
*thekey = key->key;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
apr_os_threadkey_t *thekey,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key,
fspr_os_threadkey_t *thekey,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*key) == NULL) {
(*key) = (apr_threadkey_t *)apr_pcalloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_pcalloc(pool, sizeof(fspr_threadkey_t));
(*key)->pool = pool;
}
@@ -119,9 +119,9 @@ APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
#if !APR_HAS_THREADS
/* avoid warning for no prototype */
APR_DECLARE(apr_status_t) apr_os_threadkey_get(void);
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(void);
APR_DECLARE(apr_status_t) apr_os_threadkey_get(void)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(void)
{
return APR_ENOTIMPL;
}
+157 -157
View File
@@ -14,15 +14,15 @@
* limitations under the License.
*/
#include "win32/apr_arch_threadproc.h"
#include "win32/apr_arch_file_io.h"
#include "win32/fspr_arch_threadproc.h"
#include "win32/fspr_arch_file_io.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "apr_strings.h"
#include "apr_portable.h"
#include "apr_lib.h"
#include "fspr_thread_proc.h"
#include "fspr_file_io.h"
#include "fspr_general.h"
#include "fspr_strings.h"
#include "fspr_portable.h"
#include "fspr_lib.h"
#include <stdlib.h>
#if APR_HAVE_SIGNAL_H
#include <signal.h>
@@ -52,21 +52,21 @@
*
*/
APR_DECLARE(apr_status_t) apr_procattr_create(apr_procattr_t **new,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_procattr_create(fspr_procattr_t **new,
fspr_pool_t *pool)
{
(*new) = (apr_procattr_t *)apr_pcalloc(pool, sizeof(apr_procattr_t));
(*new) = (fspr_procattr_t *)fspr_pcalloc(pool, sizeof(fspr_procattr_t));
(*new)->pool = pool;
(*new)->cmdtype = APR_PROGRAM;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
apr_int32_t in,
apr_int32_t out,
apr_int32_t err)
APR_DECLARE(fspr_status_t) fspr_procattr_io_set(fspr_procattr_t *attr,
fspr_int32_t in,
fspr_int32_t out,
fspr_int32_t err)
{
apr_status_t stat = APR_SUCCESS;
fspr_status_t stat = APR_SUCCESS;
if (in) {
/* APR_CHILD_BLOCK maps to APR_WRITE_BLOCK, while
@@ -79,138 +79,138 @@ APR_DECLARE(apr_status_t) apr_procattr_io_set(apr_procattr_t *attr,
in = APR_READ_BLOCK;
else if (in == APR_PARENT_BLOCK)
in = APR_WRITE_BLOCK;
stat = apr_create_nt_pipe(&attr->child_in, &attr->parent_in, in,
stat = fspr_create_nt_pipe(&attr->child_in, &attr->parent_in, in,
attr->pool);
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_in);
stat = fspr_file_inherit_unset(attr->parent_in);
}
if (out && stat == APR_SUCCESS) {
stat = apr_create_nt_pipe(&attr->parent_out, &attr->child_out, out,
stat = fspr_create_nt_pipe(&attr->parent_out, &attr->child_out, out,
attr->pool);
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_out);
stat = fspr_file_inherit_unset(attr->parent_out);
}
if (err && stat == APR_SUCCESS) {
stat = apr_create_nt_pipe(&attr->parent_err, &attr->child_err, err,
stat = fspr_create_nt_pipe(&attr->parent_err, &attr->child_err, err,
attr->pool);
if (stat == APR_SUCCESS)
stat = apr_file_inherit_unset(attr->parent_err);
stat = fspr_file_inherit_unset(attr->parent_err);
}
return stat;
}
APR_DECLARE(apr_status_t) apr_procattr_child_in_set(apr_procattr_t *attr,
apr_file_t *child_in,
apr_file_t *parent_in)
APR_DECLARE(fspr_status_t) fspr_procattr_child_in_set(fspr_procattr_t *attr,
fspr_file_t *child_in,
fspr_file_t *parent_in)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (child_in) {
if (attr->child_in == NULL)
rv = apr_file_dup(&attr->child_in, child_in, attr->pool);
rv = fspr_file_dup(&attr->child_in, child_in, attr->pool);
else
rv = apr_file_dup2(attr->child_in, child_in, attr->pool);
rv = fspr_file_dup2(attr->child_in, child_in, attr->pool);
if (rv == APR_SUCCESS)
rv = apr_file_inherit_set(attr->child_in);
rv = fspr_file_inherit_set(attr->child_in);
}
if (parent_in && rv == APR_SUCCESS) {
if (attr->parent_in == NULL)
rv = apr_file_dup(&attr->parent_in, parent_in, attr->pool);
rv = fspr_file_dup(&attr->parent_in, parent_in, attr->pool);
else
rv = apr_file_dup2(attr->parent_in, parent_in, attr->pool);
rv = fspr_file_dup2(attr->parent_in, parent_in, attr->pool);
}
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_child_out_set(apr_procattr_t *attr,
apr_file_t *child_out,
apr_file_t *parent_out)
APR_DECLARE(fspr_status_t) fspr_procattr_child_out_set(fspr_procattr_t *attr,
fspr_file_t *child_out,
fspr_file_t *parent_out)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (child_out) {
if (attr->child_out == NULL)
rv = apr_file_dup(&attr->child_out, child_out, attr->pool);
rv = fspr_file_dup(&attr->child_out, child_out, attr->pool);
else
rv = apr_file_dup2(attr->child_out, child_out, attr->pool);
rv = fspr_file_dup2(attr->child_out, child_out, attr->pool);
if (rv == APR_SUCCESS)
rv = apr_file_inherit_set(attr->child_out);
rv = fspr_file_inherit_set(attr->child_out);
}
if (parent_out && rv == APR_SUCCESS) {
if (attr->parent_out == NULL)
rv = apr_file_dup(&attr->parent_out, parent_out, attr->pool);
rv = fspr_file_dup(&attr->parent_out, parent_out, attr->pool);
else
rv = apr_file_dup2(attr->parent_out, parent_out, attr->pool);
rv = fspr_file_dup2(attr->parent_out, parent_out, attr->pool);
}
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_child_err_set(apr_procattr_t *attr,
apr_file_t *child_err,
apr_file_t *parent_err)
APR_DECLARE(fspr_status_t) fspr_procattr_child_err_set(fspr_procattr_t *attr,
fspr_file_t *child_err,
fspr_file_t *parent_err)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (child_err) {
if (attr->child_err == NULL)
rv = apr_file_dup(&attr->child_err, child_err, attr->pool);
rv = fspr_file_dup(&attr->child_err, child_err, attr->pool);
else
rv = apr_file_dup2(attr->child_err, child_err, attr->pool);
rv = fspr_file_dup2(attr->child_err, child_err, attr->pool);
if (rv == APR_SUCCESS)
rv = apr_file_inherit_set(attr->child_err);
rv = fspr_file_inherit_set(attr->child_err);
}
if (parent_err && rv == APR_SUCCESS) {
if (attr->parent_err == NULL)
rv = apr_file_dup(&attr->parent_err, parent_err, attr->pool);
rv = fspr_file_dup(&attr->parent_err, parent_err, attr->pool);
else
rv = apr_file_dup2(attr->parent_err, parent_err, attr->pool);
rv = fspr_file_dup2(attr->parent_err, parent_err, attr->pool);
}
return rv;
}
APR_DECLARE(apr_status_t) apr_procattr_dir_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_dir_set(fspr_procattr_t *attr,
const char *dir)
{
/* curr dir must be in native format, there are all sorts of bugs in
* the NT library loading code that flunk the '/' parsing test.
*/
return apr_filepath_merge(&attr->currdir, NULL, dir,
return fspr_filepath_merge(&attr->currdir, NULL, dir,
APR_FILEPATH_NATIVE, attr->pool);
}
APR_DECLARE(apr_status_t) apr_procattr_cmdtype_set(apr_procattr_t *attr,
apr_cmdtype_e cmd)
APR_DECLARE(fspr_status_t) fspr_procattr_cmdtype_set(fspr_procattr_t *attr,
fspr_cmdtype_e cmd)
{
attr->cmdtype = cmd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_detach_set(apr_procattr_t *attr,
apr_int32_t det)
APR_DECLARE(fspr_status_t) fspr_procattr_detach_set(fspr_procattr_t *attr,
fspr_int32_t det)
{
attr->detached = det;
return APR_SUCCESS;
}
static apr_status_t attr_cleanup(void *theattr)
static fspr_status_t attr_cleanup(void *theattr)
{
apr_procattr_t *attr = (apr_procattr_t *)theattr;
fspr_procattr_t *attr = (fspr_procattr_t *)theattr;
if (attr->user_token)
CloseHandle(attr->user_token);
attr->user_token = NULL;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_user_set(fspr_procattr_t *attr,
const char *username,
const char *password)
{
@@ -218,18 +218,18 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
return APR_ENOTIMPL;
#else
HANDLE user;
apr_wchar_t *wusername = NULL;
apr_wchar_t *wpassword = NULL;
apr_status_t rv;
apr_size_t len, wlen;
fspr_wchar_t *wusername = NULL;
fspr_wchar_t *wpassword = NULL;
fspr_status_t rv;
fspr_size_t len, wlen;
if (apr_os_level >= APR_WIN_NT_4)
if (fspr_os_level >= APR_WIN_NT_4)
{
if (attr->user_token) {
/* Cannot set that twice */
if (attr->errfn) {
attr->errfn(attr->pool, 0,
apr_pstrcat(attr->pool,
fspr_pstrcat(attr->pool,
"function called twice"
" on username: ", username, NULL));
}
@@ -237,12 +237,12 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
}
len = strlen(username) + 1;
wlen = len;
wusername = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t));
if ((rv = apr_conv_utf8_to_ucs2(username, &len, wusername, &wlen))
wusername = fspr_palloc(attr->pool, wlen * sizeof(fspr_wchar_t));
if ((rv = fspr_conv_utf8_to_ucs2(username, &len, wusername, &wlen))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(attr->pool, rv,
apr_pstrcat(attr->pool,
fspr_pstrcat(attr->pool,
"utf8 to ucs2 conversion failed"
" on username: ", username, NULL));
}
@@ -251,12 +251,12 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
if (password) {
len = strlen(password) + 1;
wlen = len;
wpassword = apr_palloc(attr->pool, wlen * sizeof(apr_wchar_t));
if ((rv = apr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen))
wpassword = fspr_palloc(attr->pool, wlen * sizeof(fspr_wchar_t));
if ((rv = fspr_conv_utf8_to_ucs2(password, &len, wpassword, &wlen))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(attr->pool, rv,
apr_pstrcat(attr->pool,
fspr_pstrcat(attr->pool,
"utf8 to ucs2 conversion failed"
" on password: ", password, NULL));
}
@@ -270,10 +270,10 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
LOGON32_PROVIDER_DEFAULT,
&user)) {
/* Logon Failed */
return apr_get_os_error();
return fspr_get_os_error();
}
if (wpassword)
memset(wpassword, 0, wlen * sizeof(apr_wchar_t));
memset(wpassword, 0, wlen * sizeof(fspr_wchar_t));
/* Get the primary token for user */
if (!DuplicateTokenEx(user,
TOKEN_QUERY | TOKEN_DUPLICATE | TOKEN_ASSIGN_PRIMARY,
@@ -282,24 +282,24 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
TokenPrimary,
&(attr->user_token))) {
/* Failed to duplicate the user token */
rv = apr_get_os_error();
rv = fspr_get_os_error();
CloseHandle(user);
return rv;
}
CloseHandle(user);
attr->sd = apr_pcalloc(attr->pool, SECURITY_DESCRIPTOR_MIN_LENGTH);
attr->sd = fspr_pcalloc(attr->pool, SECURITY_DESCRIPTOR_MIN_LENGTH);
InitializeSecurityDescriptor(attr->sd, SECURITY_DESCRIPTOR_REVISION);
SetSecurityDescriptorDacl(attr->sd, -1, 0, 0);
attr->sa = apr_palloc(attr->pool, sizeof(SECURITY_ATTRIBUTES));
attr->sa = fspr_palloc(attr->pool, sizeof(SECURITY_ATTRIBUTES));
attr->sa->nLength = sizeof (SECURITY_ATTRIBUTES);
attr->sa->lpSecurityDescriptor = attr->sd;
attr->sa->bInheritHandle = TRUE;
/* register the cleanup */
apr_pool_cleanup_register(attr->pool, (void *)attr,
fspr_pool_cleanup_register(attr->pool, (void *)attr,
attr_cleanup,
apr_pool_cleanup_null);
fspr_pool_cleanup_null);
return APR_SUCCESS;
}
else
@@ -307,7 +307,7 @@ APR_DECLARE(apr_status_t) apr_procattr_user_set(apr_procattr_t *attr,
#endif
}
APR_DECLARE(apr_status_t) apr_procattr_group_set(apr_procattr_t *attr,
APR_DECLARE(fspr_status_t) fspr_procattr_group_set(fspr_procattr_t *attr,
const char *groupname)
{
/* Always return SUCCESS cause groups are irrelevant */
@@ -318,20 +318,20 @@ static const char* has_space(const char *str)
{
const char *ch;
for (ch = str; *ch; ++ch) {
if (apr_isspace(*ch)) {
if (fspr_isspace(*ch)) {
return ch;
}
}
return NULL;
}
static char *apr_caret_escape_args(apr_pool_t *p, const char *str)
static char *fspr_caret_escape_args(fspr_pool_t *p, const char *str)
{
char *cmd;
unsigned char *d;
const unsigned char *s;
cmd = apr_palloc(p, 2 * strlen(str) + 1); /* Be safe */
cmd = fspr_palloc(p, 2 * strlen(str) + 1); /* Be safe */
d = (unsigned char *)cmd;
s = (const unsigned char *)str;
for (; *s; ++s) {
@@ -356,36 +356,36 @@ static char *apr_caret_escape_args(apr_pool_t *p, const char *str)
return cmd;
}
APR_DECLARE(apr_status_t) apr_procattr_child_errfn_set(apr_procattr_t *attr,
apr_child_errfn_t *errfn)
APR_DECLARE(fspr_status_t) fspr_procattr_child_errfn_set(fspr_procattr_t *attr,
fspr_child_errfn_t *errfn)
{
attr->errfn = errfn;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_error_check_set(apr_procattr_t *attr,
apr_int32_t chk)
APR_DECLARE(fspr_status_t) fspr_procattr_error_check_set(fspr_procattr_t *attr,
fspr_int32_t chk)
{
attr->errchk = chk;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_procattr_addrspace_set(apr_procattr_t *attr,
apr_int32_t addrspace)
APR_DECLARE(fspr_status_t) fspr_procattr_addrspace_set(fspr_procattr_t *attr,
fspr_int32_t addrspace)
{
/* won't ever be used on this platform, so don't save the flag */
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
APR_DECLARE(fspr_status_t) fspr_proc_create(fspr_proc_t *new,
const char *progname,
const char * const *args,
const char * const *env,
apr_procattr_t *attr,
apr_pool_t *pool)
fspr_procattr_t *attr,
fspr_pool_t *pool)
{
apr_status_t rv;
apr_size_t i;
fspr_status_t rv;
fspr_size_t i;
const char *argv0;
char *cmdline;
char *pEnvBlock;
@@ -404,7 +404,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
* not manage the stdio handles properly when running old 16
* bit executables if the detached attribute is set.
*/
if (apr_os_level >= APR_WIN_NT) {
if (fspr_os_level >= APR_WIN_NT) {
/*
* XXX DETACHED_PROCESS won't on Win9x at all; on NT/W2K
* 16 bit executables fail (MS KB: Q150956)
@@ -418,16 +418,16 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
* XXX progname must be NULL if this is a 16 bit app running in WOW
*/
if (progname[0] == '\"') {
progname = apr_pstrndup(pool, progname + 1, strlen(progname) - 2);
progname = fspr_pstrndup(pool, progname + 1, strlen(progname) - 2);
}
if (attr->cmdtype == APR_PROGRAM || attr->cmdtype == APR_PROGRAM_ENV) {
char *fullpath = NULL;
if ((rv = apr_filepath_merge(&fullpath, attr->currdir, progname,
if ((rv = fspr_filepath_merge(&fullpath, attr->currdir, progname,
APR_FILEPATH_NATIVE, pool)) != APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(pool, rv,
apr_pstrcat(pool, "filepath_merge failed.",
fspr_pstrcat(pool, "filepath_merge failed.",
" currdir: ", attr->currdir,
" progname: ", progname, NULL));
}
@@ -437,21 +437,21 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
}
else {
/* Do not fail if the path isn't parseable for APR_PROGRAM_PATH
* or APR_SHELLCMD. We only invoke apr_filepath_merge (with no
* or APR_SHELLCMD. We only invoke fspr_filepath_merge (with no
* left hand side expression) in order to correct the path slash
* delimiters. But the filename doesn't need to be in the CWD,
* nor does it need to be a filename at all (it could be a
* built-in shell command.)
*/
char *fullpath = NULL;
if ((rv = apr_filepath_merge(&fullpath, "", progname,
if ((rv = fspr_filepath_merge(&fullpath, "", progname,
APR_FILEPATH_NATIVE, pool)) == APR_SUCCESS) {
progname = fullpath;
}
}
if (has_space(progname)) {
argv0 = apr_pstrcat(pool, "\"", progname, "\"", NULL);
argv0 = fspr_pstrcat(pool, "\"", progname, "\"", NULL);
}
else {
argv0 = progname;
@@ -461,10 +461,10 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
cmdline = "";
for (i = 1; args && args[i]; ++i) {
if (has_space(args[i]) || !args[i][0]) {
cmdline = apr_pstrcat(pool, cmdline, " \"", args[i], "\"", NULL);
cmdline = fspr_pstrcat(pool, cmdline, " \"", args[i], "\"", NULL);
}
else {
cmdline = apr_pstrcat(pool, cmdline, " ", args[i], NULL);
cmdline = fspr_pstrcat(pool, cmdline, " ", args[i], NULL);
}
}
@@ -478,22 +478,22 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
return APR_EINVAL;
}
if (shellcmd[0] == '"') {
progname = apr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2);
progname = fspr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2);
}
else {
progname = shellcmd;
if (has_space(shellcmd)) {
shellcmd = apr_pstrcat(pool, "\"", shellcmd, "\"", NULL);
shellcmd = fspr_pstrcat(pool, "\"", shellcmd, "\"", NULL);
}
}
/* Command.com does not support a quoted command, while cmd.exe demands one.
*/
i = strlen(progname);
if (i >= 11 && strcasecmp(progname + i - 11, "command.com") == 0) {
cmdline = apr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL);
cmdline = fspr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL);
}
else {
cmdline = apr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL);
cmdline = fspr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL);
}
}
else
@@ -517,12 +517,12 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
return APR_EINVAL;
}
if (shellcmd[0] == '"') {
progname = apr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2);
progname = fspr_pstrndup(pool, shellcmd + 1, strlen(shellcmd) - 2);
}
else {
progname = shellcmd;
if (has_space(shellcmd)) {
shellcmd = apr_pstrcat(pool, "\"", shellcmd, "\"", NULL);
shellcmd = fspr_pstrcat(pool, "\"", shellcmd, "\"", NULL);
}
}
i = strlen(progname);
@@ -532,7 +532,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
* until this moment in all four code paths, with some flags
* to toggle 'which flavor' is needed.
*/
cmdline = apr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL);
cmdline = fspr_pstrcat(pool, shellcmd, " /C ", argv0, cmdline, NULL);
}
else {
/* We must protect the cmdline args from any interpolation - this
@@ -542,16 +542,16 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
* the shift-state to be toggled, and the application will
* not see the caret escapes.
*/
cmdline = apr_caret_escape_args(pool, cmdline);
cmdline = fspr_caret_escape_args(pool, cmdline);
/*
* Our app name must always be quoted so the quotes surrounding
* the entire /c "command args" are unambigious.
*/
if (*argv0 != '"') {
cmdline = apr_pstrcat(pool, shellcmd, " /C \"\"", argv0, "\"", cmdline, "\"", NULL);
cmdline = fspr_pstrcat(pool, shellcmd, " /C \"\"", argv0, "\"", cmdline, "\"", NULL);
}
else {
cmdline = apr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL);
cmdline = fspr_pstrcat(pool, shellcmd, " /C \"", argv0, cmdline, "\"", NULL);
}
}
}
@@ -563,7 +563,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
* would succeed, but "c:\bin\aprtest" or "aprtest.exe"
* can fail.
*/
cmdline = apr_pstrcat(pool, argv0, cmdline, NULL);
cmdline = fspr_pstrcat(pool, argv0, cmdline, NULL);
if (attr->cmdtype == APR_PROGRAM_PATH) {
progname = NULL;
@@ -576,7 +576,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
pEnvBlock = NULL;
}
else {
apr_size_t iEnvBlockLen;
fspr_size_t iEnvBlockLen;
/*
* Win32's CreateProcess call requires that the environment
* be passed in an environment block, a null terminated block of
@@ -594,20 +594,20 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
#if APR_HAS_UNICODE_FS
IF_WIN_OS_IS_UNICODE
{
apr_wchar_t *pNext;
pEnvBlock = (char *)apr_palloc(pool, iEnvBlockLen * 2);
fspr_wchar_t *pNext;
pEnvBlock = (char *)fspr_palloc(pool, iEnvBlockLen * 2);
dwCreationFlags |= CREATE_UNICODE_ENVIRONMENT;
i = 0;
pNext = (apr_wchar_t*)pEnvBlock;
pNext = (fspr_wchar_t*)pEnvBlock;
while (env[i]) {
apr_size_t in = strlen(env[i]) + 1;
if ((rv = apr_conv_utf8_to_ucs2(env[i], &in,
fspr_size_t in = strlen(env[i]) + 1;
if ((rv = fspr_conv_utf8_to_ucs2(env[i], &in,
pNext, &iEnvBlockLen))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(pool, rv,
apr_pstrcat(pool,
fspr_pstrcat(pool,
"utf8 to ucs2 conversion failed"
" on this string: ", env[i], NULL));
}
@@ -625,7 +625,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
ELSE_WIN_OS_IS_ANSI
{
char *pNext;
pEnvBlock = (char *)apr_palloc(pool, iEnvBlockLen);
pEnvBlock = (char *)fspr_palloc(pool, iEnvBlockLen);
i = 0;
pNext = pEnvBlock;
@@ -647,19 +647,19 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
IF_WIN_OS_IS_UNICODE
{
STARTUPINFOW si;
apr_wchar_t *wprg = NULL;
apr_wchar_t *wcmd = NULL;
apr_wchar_t *wcwd = NULL;
fspr_wchar_t *wprg = NULL;
fspr_wchar_t *wcmd = NULL;
fspr_wchar_t *wcwd = NULL;
if (progname) {
apr_size_t nprg = strlen(progname) + 1;
apr_size_t nwprg = nprg + 6;
wprg = apr_palloc(pool, nwprg * sizeof(wprg[0]));
if ((rv = apr_conv_utf8_to_ucs2(progname, &nprg, wprg, &nwprg))
fspr_size_t nprg = strlen(progname) + 1;
fspr_size_t nwprg = nprg + 6;
wprg = fspr_palloc(pool, nwprg * sizeof(wprg[0]));
if ((rv = fspr_conv_utf8_to_ucs2(progname, &nprg, wprg, &nwprg))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(pool, rv,
apr_pstrcat(pool,
fspr_pstrcat(pool,
"utf8 to ucs2 conversion failed"
" on progname: ", progname, NULL));
}
@@ -668,14 +668,14 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
}
if (cmdline) {
apr_size_t ncmd = strlen(cmdline) + 1;
apr_size_t nwcmd = ncmd;
wcmd = apr_palloc(pool, nwcmd * sizeof(wcmd[0]));
if ((rv = apr_conv_utf8_to_ucs2(cmdline, &ncmd, wcmd, &nwcmd))
fspr_size_t ncmd = strlen(cmdline) + 1;
fspr_size_t nwcmd = ncmd;
wcmd = fspr_palloc(pool, nwcmd * sizeof(wcmd[0]));
if ((rv = fspr_conv_utf8_to_ucs2(cmdline, &ncmd, wcmd, &nwcmd))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(pool, rv,
apr_pstrcat(pool,
fspr_pstrcat(pool,
"utf8 to ucs2 conversion failed"
" on cmdline: ", cmdline, NULL));
}
@@ -685,15 +685,15 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
if (attr->currdir)
{
apr_size_t ncwd = strlen(attr->currdir) + 1;
apr_size_t nwcwd = ncwd;
wcwd = apr_palloc(pool, ncwd * sizeof(wcwd[0]));
if ((rv = apr_conv_utf8_to_ucs2(attr->currdir, &ncwd,
fspr_size_t ncwd = strlen(attr->currdir) + 1;
fspr_size_t nwcwd = ncwd;
wcwd = fspr_palloc(pool, ncwd * sizeof(wcwd[0]));
if ((rv = fspr_conv_utf8_to_ucs2(attr->currdir, &ncwd,
wcwd, &nwcwd))
!= APR_SUCCESS) {
if (attr->errfn) {
attr->errfn(pool, rv,
apr_pstrcat(pool,
fspr_pstrcat(pool,
"utf8 to ucs2 conversion failed"
" on currdir: ", attr->currdir, NULL));
}
@@ -732,7 +732,7 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
si.lpDesktop = L"Winsta0\\Default";
if (!ImpersonateLoggedOnUser(attr->user_token)) {
/* failed to impersonate the logged user */
rv = apr_get_os_error();
rv = fspr_get_os_error();
CloseHandle(attr->user_token);
attr->user_token = NULL;
return rv;
@@ -814,43 +814,43 @@ APR_DECLARE(apr_status_t) apr_proc_create(apr_proc_t *new,
/* Check CreateProcess result
*/
if (!rv)
return apr_get_os_error();
return fspr_get_os_error();
/* XXX Orphaned handle warning - no fix due to broken apr_proc_t api.
/* XXX Orphaned handle warning - no fix due to broken fspr_proc_t api.
*/
new->hproc = pi.hProcess;
new->pid = pi.dwProcessId;
if (attr->child_in) {
apr_file_close(attr->child_in);
fspr_file_close(attr->child_in);
}
if (attr->child_out) {
apr_file_close(attr->child_out);
fspr_file_close(attr->child_out);
}
if (attr->child_err) {
apr_file_close(attr->child_err);
fspr_file_close(attr->child_err);
}
CloseHandle(pi.hThread);
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_proc_wait_all_procs(apr_proc_t *proc,
APR_DECLARE(fspr_status_t) fspr_proc_wait_all_procs(fspr_proc_t *proc,
int *exitcode,
apr_exit_why_e *exitwhy,
apr_wait_how_e waithow,
apr_pool_t *p)
fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow,
fspr_pool_t *p)
{
/* Unix does apr_proc_wait(proc(-1), exitcode, exitwhy, waithow)
* but Win32's apr_proc_wait won't work that way. We can either
/* Unix does fspr_proc_wait(proc(-1), exitcode, exitwhy, waithow)
* but Win32's fspr_proc_wait won't work that way. We can either
* register all APR created processes in some sort of AsyncWait
* thread, or simply walk from the global process pool for all
* apr_pool_note_subprocess()es registered with APR.
* fspr_pool_note_subprocess()es registered with APR.
*/
return APR_ENOTIMPL;
}
static apr_exit_why_e why_from_exit_code(DWORD exit) {
static fspr_exit_why_e why_from_exit_code(DWORD exit) {
/* See WinNT.h STATUS_ACCESS_VIOLATION and family for how
* this class of failures was determined
*/
@@ -863,9 +863,9 @@ static apr_exit_why_e why_from_exit_code(DWORD exit) {
/* ### No way to tell if Dr Watson grabbed a core, AFAICT. */
}
APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
int *exitcode, apr_exit_why_e *exitwhy,
apr_wait_how_e waithow)
APR_DECLARE(fspr_status_t) fspr_proc_wait(fspr_proc_t *proc,
int *exitcode, fspr_exit_why_e *exitwhy,
fspr_wait_how_e waithow)
{
DWORD stat;
DWORD time;
@@ -889,10 +889,10 @@ APR_DECLARE(apr_status_t) apr_proc_wait(apr_proc_t *proc,
else if (stat == WAIT_TIMEOUT) {
return APR_CHILD_NOTDONE;
}
return apr_get_os_error();
return fspr_get_os_error();
}
APR_DECLARE(apr_status_t) apr_proc_detach(int daemonize)
APR_DECLARE(fspr_status_t) fspr_proc_detach(int daemonize)
{
return APR_ENOTIMPL;
}
+13 -13
View File
@@ -14,11 +14,11 @@
* limitations under the License.
*/
#include "win32/apr_arch_threadproc.h"
#include "win32/apr_arch_file_io.h"
#include "apr_thread_proc.h"
#include "apr_file_io.h"
#include "apr_general.h"
#include "win32/fspr_arch_threadproc.h"
#include "win32/fspr_arch_file_io.h"
#include "fspr_thread_proc.h"
#include "fspr_file_io.h"
#include "fspr_general.h"
#if APR_HAVE_SIGNAL_H
#include <signal.h>
#endif
@@ -32,35 +32,35 @@
* ### Actually, closing the input handle to the proc should also do fine
* for most console apps. This definately needs improvement...
*/
APR_DECLARE(apr_status_t) apr_proc_kill(apr_proc_t *proc, int signal)
APR_DECLARE(fspr_status_t) fspr_proc_kill(fspr_proc_t *proc, int signal)
{
if (proc->hproc != NULL) {
if (TerminateProcess(proc->hproc, signal) == 0) {
return apr_get_os_error();
return fspr_get_os_error();
}
/* On unix, SIGKILL leaves a apr_proc_wait()able pid lying around,
* so we will leave hproc alone until the app calls apr_proc_wait().
/* On unix, SIGKILL leaves a fspr_proc_wait()able pid lying around,
* so we will leave hproc alone until the app calls fspr_proc_wait().
*/
return APR_SUCCESS;
}
return APR_EPROC_UNKNOWN;
}
void apr_signal_init(apr_pool_t *pglobal)
void fspr_signal_init(fspr_pool_t *pglobal)
{
}
const char *apr_signal_description_get(int signum)
const char *fspr_signal_description_get(int signum)
{
return "unknown signal (not supported)";
}
APR_DECLARE(apr_status_t) apr_signal_block(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_block(int signum)
{
return APR_ENOTIMPL;
}
APR_DECLARE(apr_status_t) apr_signal_unblock(int signum)
APR_DECLARE(fspr_status_t) fspr_signal_unblock(int signum)
{
return APR_ENOTIMPL;
}
+64 -64
View File
@@ -14,25 +14,25 @@
* limitations under the License.
*/
#include "apr_private.h"
#include "win32/apr_arch_threadproc.h"
#include "apr_thread_proc.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_portable.h"
#include "fspr_private.h"
#include "win32/fspr_arch_threadproc.h"
#include "fspr_thread_proc.h"
#include "fspr_general.h"
#include "fspr_lib.h"
#include "fspr_portable.h"
#if APR_HAVE_PROCESS_H
#include <process.h>
#endif
#include "apr_arch_misc.h"
#include "fspr_arch_misc.h"
/* Chosen for us by apr_initialize */
DWORD tls_apr_thread = 0;
/* Chosen for us by fspr_initialize */
DWORD tls_fspr_thread = 0;
APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_threadattr_create(fspr_threadattr_t **new,
fspr_pool_t *pool)
{
(*new) = (apr_threadattr_t *)apr_palloc(pool,
sizeof(apr_threadattr_t));
(*new) = (fspr_threadattr_t *)fspr_palloc(pool,
sizeof(fspr_threadattr_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -45,51 +45,51 @@ APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
apr_int32_t on)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_set(fspr_threadattr_t *attr,
fspr_int32_t on)
{
attr->detach = on;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
APR_DECLARE(fspr_status_t) fspr_threadattr_detach_get(fspr_threadattr_t *attr)
{
if (attr->detach == 1)
return APR_DETACH;
return APR_NOTDETACH;
}
APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
apr_size_t stacksize)
APR_DECLARE(fspr_status_t) fspr_threadattr_stacksize_set(fspr_threadattr_t *attr,
fspr_size_t stacksize)
{
attr->stacksize = stacksize;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
apr_size_t size)
APR_DECLARE(fspr_status_t) fspr_threadattr_guardsize_set(fspr_threadattr_t *attr,
fspr_size_t size)
{
return APR_ENOTIMPL;
}
static void *dummy_worker(void *opaque)
{
apr_thread_t *thd = (apr_thread_t *)opaque;
TlsSetValue(tls_apr_thread, thd->td);
fspr_thread_t *thd = (fspr_thread_t *)opaque;
TlsSetValue(tls_fspr_thread, thd->td);
return thd->func(thd, thd->data);
}
APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
apr_threadattr_t *attr,
apr_thread_start_t func,
void *data, apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_thread_create(fspr_thread_t **new,
fspr_threadattr_t *attr,
fspr_thread_start_t func,
void *data, fspr_pool_t *pool)
{
apr_status_t stat;
fspr_status_t stat;
unsigned temp;
HANDLE handle;
int priority = THREAD_PRIORITY_NORMAL;
(*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
(*new) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
if ((*new) == NULL) {
return APR_ENOMEM;
@@ -99,7 +99,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
(*new)->data = data;
(*new)->func = func;
(*new)->td = NULL;
stat = apr_pool_create(&(*new)->pool, pool);
stat = fspr_pool_create(&(*new)->pool, pool);
if (stat != APR_SUCCESS) {
return stat;
}
@@ -131,7 +131,7 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
attr && attr->stacksize > 0 ? attr->stacksize : 0,
(unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
(*new), 0, &temp)) == 0) {
return apr_get_os_error();
return fspr_get_os_error();
}
#endif
@@ -148,11 +148,11 @@ APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
apr_status_t retval)
APR_DECLARE(fspr_status_t) fspr_thread_exit(fspr_thread_t *thd,
fspr_status_t retval)
{
thd->exitval = retval;
apr_pool_destroy(thd->pool);
fspr_pool_destroy(thd->pool);
thd->pool = NULL;
#ifndef _WIN32_WCE
_endthreadex(0);
@@ -162,10 +162,10 @@ APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_join(fspr_status_t *retval,
fspr_thread_t *thd)
{
apr_status_t rv = APR_SUCCESS;
fspr_status_t rv = APR_SUCCESS;
if (!thd->td) {
/* Can not join on detached threads */
@@ -180,25 +180,25 @@ APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
rv = APR_INCOMPLETE;
}
else
rv = apr_get_os_error();
rv = fspr_get_os_error();
CloseHandle(thd->td);
thd->td = NULL;
return rv;
}
APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_thread_detach(fspr_thread_t *thd)
{
if (thd->td && CloseHandle(thd->td)) {
thd->td = NULL;
return APR_SUCCESS;
}
else {
return apr_get_os_error();
return fspr_get_os_error();
}
}
APR_DECLARE(void) apr_thread_yield()
APR_DECLARE(void) fspr_thread_yield()
{
/* SwitchToThread is not supported on Win9x, but since it's
* primarily a noop (entering time consuming code, therefore
@@ -206,29 +206,29 @@ APR_DECLARE(void) apr_thread_yield()
* we won't worry too much if it's not available.
*/
#ifndef _WIN32_WCE
if (apr_os_level >= APR_WIN_NT) {
if (fspr_os_level >= APR_WIN_NT) {
SwitchToThread();
}
#endif
}
APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_get(void **data, const char *key,
fspr_thread_t *thread)
{
return apr_pool_userdata_get(data, key, thread->pool);
return fspr_pool_userdata_get(data, key, thread->pool);
}
APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
apr_status_t (*cleanup) (void *),
apr_thread_t *thread)
APR_DECLARE(fspr_status_t) fspr_thread_data_set(void *data, const char *key,
fspr_status_t (*cleanup) (void *),
fspr_thread_t *thread)
{
return apr_pool_userdata_set(data, key, cleanup, thread->pool);
return fspr_pool_userdata_set(data, key, cleanup, thread->pool);
}
APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
APR_DECLARE(fspr_os_thread_t) fspr_os_thread_current(void)
{
HANDLE hthread = (HANDLE)TlsGetValue(tls_apr_thread);
HANDLE hthread = (HANDLE)TlsGetValue(tls_fspr_thread);
HANDLE hproc;
if (hthread) {
@@ -242,12 +242,12 @@ APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
DUPLICATE_SAME_ACCESS)) {
return NULL;
}
TlsSetValue(tls_apr_thread, hthread);
TlsSetValue(tls_fspr_thread, hthread);
return hthread;
}
APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
apr_thread_t *thd)
APR_DECLARE(fspr_status_t) fspr_os_thread_get(fspr_os_thread_t **thethd,
fspr_thread_t *thd)
{
if (thd == NULL) {
return APR_ENOTHREAD;
@@ -256,29 +256,29 @@ APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
apr_os_thread_t *thethd,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_thread_put(fspr_thread_t **thd,
fspr_os_thread_t *thethd,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*thd) == NULL) {
(*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
(*thd) = (fspr_thread_t *)fspr_palloc(pool, sizeof(fspr_thread_t));
(*thd)->pool = pool;
}
(*thd)->td = thethd;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
apr_pool_t *p)
APR_DECLARE(fspr_status_t) fspr_thread_once_init(fspr_thread_once_t **control,
fspr_pool_t *p)
{
(*control) = apr_pcalloc(p, sizeof(**control));
(*control) = fspr_pcalloc(p, sizeof(**control));
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
APR_DECLARE(fspr_status_t) fspr_thread_once(fspr_thread_once_t *control,
void (*func)(void))
{
if (!InterlockedExchange(&control->value, 1)) {
@@ -287,11 +287,11 @@ APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
return APR_SUCCESS;
}
APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
apr_os_thread_t tid2)
APR_DECLARE(int) fspr_os_thread_equal(fspr_os_thread_t tid1,
fspr_os_thread_t tid2)
{
/* Since the only tid's we support our are own, and
* apr_os_thread_current returns the identical handle
* fspr_os_thread_current returns the identical handle
* to the one we created initially, the test is simple.
*/
return (tid1 == tid2);
+31 -31
View File
@@ -14,18 +14,18 @@
* limitations under the License.
*/
#include "win32/apr_arch_threadproc.h"
#include "apr_thread_proc.h"
#include "apr_general.h"
#include "apr_lib.h"
#include "apr_errno.h"
#include "apr_portable.h"
#include "win32/fspr_arch_threadproc.h"
#include "fspr_thread_proc.h"
#include "fspr_general.h"
#include "fspr_lib.h"
#include "fspr_errno.h"
#include "fspr_portable.h"
APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
APR_DECLARE(fspr_status_t) fspr_threadkey_private_create(fspr_threadkey_t **key,
void (*dest)(void *),
apr_pool_t *pool)
fspr_pool_t *pool)
{
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
if ((*key) == NULL) {
return APR_ENOMEM;
}
@@ -35,64 +35,64 @@ APR_DECLARE(apr_status_t) apr_threadkey_private_create(apr_threadkey_t **key,
if (((*key)->key = TlsAlloc()) != 0xFFFFFFFF) {
return APR_SUCCESS;
}
return apr_get_os_error();
return fspr_get_os_error();
}
APR_DECLARE(apr_status_t) apr_threadkey_private_get(void **new,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_get(void **new,
fspr_threadkey_t *key)
{
if ((*new) = TlsGetValue(key->key)) {
return APR_SUCCESS;
}
return apr_get_os_error();
return fspr_get_os_error();
}
APR_DECLARE(apr_status_t) apr_threadkey_private_set(void *priv,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_set(void *priv,
fspr_threadkey_t *key)
{
if (TlsSetValue(key->key, priv)) {
return APR_SUCCESS;
}
return apr_get_os_error();
return fspr_get_os_error();
}
APR_DECLARE(apr_status_t) apr_threadkey_private_delete(apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_threadkey_private_delete(fspr_threadkey_t *key)
{
if (TlsFree(key->key)) {
return APR_SUCCESS;
}
return apr_get_os_error();
return fspr_get_os_error();
}
APR_DECLARE(apr_status_t) apr_threadkey_data_get(void **data, const char *key,
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_get(void **data, const char *key,
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_get(data, key, threadkey->pool);
return fspr_pool_userdata_get(data, key, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_threadkey_data_set(void *data, const char *key,
apr_status_t (*cleanup)(void *),
apr_threadkey_t *threadkey)
APR_DECLARE(fspr_status_t) fspr_threadkey_data_set(void *data, const char *key,
fspr_status_t (*cleanup)(void *),
fspr_threadkey_t *threadkey)
{
return apr_pool_userdata_set(data, key, cleanup, threadkey->pool);
return fspr_pool_userdata_set(data, key, cleanup, threadkey->pool);
}
APR_DECLARE(apr_status_t) apr_os_threadkey_get(apr_os_threadkey_t *thekey,
apr_threadkey_t *key)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_get(fspr_os_threadkey_t *thekey,
fspr_threadkey_t *key)
{
*thekey = key->key;
return APR_SUCCESS;
}
APR_DECLARE(apr_status_t) apr_os_threadkey_put(apr_threadkey_t **key,
apr_os_threadkey_t *thekey,
apr_pool_t *pool)
APR_DECLARE(fspr_status_t) fspr_os_threadkey_put(fspr_threadkey_t **key,
fspr_os_threadkey_t *thekey,
fspr_pool_t *pool)
{
if (pool == NULL) {
return APR_ENOPOOL;
}
if ((*key) == NULL) {
(*key) = (apr_threadkey_t *)apr_palloc(pool, sizeof(apr_threadkey_t));
(*key) = (fspr_threadkey_t *)fspr_palloc(pool, sizeof(fspr_threadkey_t));
(*key)->pool = pool;
}
(*key)->key = *thekey;