From: Paul Querna Date: Tue, 2 Dec 2008 08:13:36 +0000 (+0000) Subject: API Cleanup in preperation for 2.4.x, make sure all exported functions or variables... X-Git-Tag: 2.3.0~56 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a73acf02f615ee2e109eb3018289f9dfb87775f8;p=apache API Cleanup in preperation for 2.4.x, make sure all exported functions or variables contain an ap_ prefix. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@722399 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/CHANGES b/CHANGES index 4c65f5bbc4..55057a39b4 100644 --- a/CHANGES +++ b/CHANGES @@ -2,6 +2,18 @@ Changes with Apache 2.3.0 [ When backported to 2.2.x, remove entry from this file ] + *) Rename APIs to include ap_ prefix: + find_child_by_pid -> ap_find_child_by_pid + suck_in_APR -> ap_suck_in_APR + sys_privileges_handlers -> ap_sys_privileges_handlers + unixd_accept -> ap_unixd_accept + unixd_config -> ap_unixd_config + unixd_killpg -> ap_unixd_killpg + unixd_set_global_mutex_perms -> ap_unixd_set_global_mutex_perms + unixd_set_proc_mutex_perms -> ap_unixd_set_proc_mutex_perms + unixd_set_rlimit -> ap_unixd_set_rlimit + [Paul Querna] + *) core: When the ap_http_header_filter processes an error bucket, cleanup the passed brigade before returning AP_FILTER_ERROR down the filter chain. This unambiguously ensures the same error bucket isn't revisited diff --git a/include/ap_mmn.h b/include/ap_mmn.h index 1efcb753e8..ef9f4dff24 100644 --- a/include/ap_mmn.h +++ b/include/ap_mmn.h @@ -181,12 +181,13 @@ * from util_filter.h to httpd.h and change their * numeric values so they do not overlap with other * potential status codes + * 20081201.0 (2.3.0-dev) Rename several APIs to include ap_ prefix. */ #define MODULE_MAGIC_COOKIE 0x41503234UL /* "AP24" */ #ifndef MODULE_MAGIC_NUMBER_MAJOR -#define MODULE_MAGIC_NUMBER_MAJOR 20081129 +#define MODULE_MAGIC_NUMBER_MAJOR 20081201 #endif #define MODULE_MAGIC_NUMBER_MINOR 0 /* 0...n */ diff --git a/include/mpm_common.h b/include/mpm_common.h index 82ab37ca55..ee3634e52c 100644 --- a/include/mpm_common.h +++ b/include/mpm_common.h @@ -365,7 +365,7 @@ extern const char *ap_mpm_set_exception_hook(cmd_parms *cmd, void *dummy, AP_DECLARE_HOOK(int,monitor,(apr_pool_t *p)) /* register modules that undertake to manage system security */ -AP_DECLARE(int) sys_privileges_handlers(int inc); +AP_DECLARE(int) ap_sys_privileges_handlers(int inc); AP_DECLARE_HOOK(int, drop_privileges, (apr_pool_t * pchild, server_rec * s)) #ifdef __cplusplus diff --git a/include/scoreboard.h b/include/scoreboard.h index 5b79debd41..211a3a20e1 100644 --- a/include/scoreboard.h +++ b/include/scoreboard.h @@ -172,7 +172,7 @@ apr_status_t ap_cleanup_scoreboard(void *d); AP_DECLARE(void) ap_create_sb_handle(ap_sb_handle_t **new_sbh, apr_pool_t *p, int child_num, int thread_num); -int find_child_by_pid(apr_proc_t *pid); +AP_DECLARE(int) ap_find_child_by_pid(apr_proc_t *pid); AP_DECLARE(int) ap_update_child_status(ap_sb_handle_t *sbh, int status, request_rec *r); AP_DECLARE(int) ap_update_child_status_from_indexes(int child_num, int thread_num, int status, request_rec *r); diff --git a/modules/arch/netware/mod_netware.c b/modules/arch/netware/mod_netware.c index ea9e0f62dd..aa8f496242 100644 --- a/modules/arch/netware/mod_netware.c +++ b/modules/arch/netware/mod_netware.c @@ -171,7 +171,7 @@ static int netware_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { - sys_privileges_handlers(1); + ap_sys_privileges_handlers(1); return OK; } diff --git a/modules/arch/unix/mod_unixd.c b/modules/arch/unix/mod_unixd.c index 8d83d13060..30fa59f30e 100644 --- a/modules/arch/unix/mod_unixd.c +++ b/modules/arch/unix/mod_unixd.c @@ -89,9 +89,9 @@ static int set_group_privs(void) /* Get username if passed as a uid */ - if (unixd_config.user_name[0] == '#') { + if (ap_unixd_config.user_name[0] == '#') { struct passwd *ent; - uid_t uid = atol(&unixd_config.user_name[1]); + uid_t uid = atol(&ap_unixd_config.user_name[1]); if ((ent = getpwuid(uid)) == NULL) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, @@ -104,7 +104,7 @@ static int set_group_privs(void) name = ent->pw_name; } else - name = unixd_config.user_name; + name = ap_unixd_config.user_name; #if !defined(OS2) && !defined(TPF) /* OS/2 and TPF don't support groups. */ @@ -113,19 +113,19 @@ static int set_group_privs(void) * Set the GID before initgroups(), since on some platforms * setgid() is known to zap the group list. */ - if (setgid(unixd_config.group_id) == -1) { + if (setgid(ap_unixd_config.group_id) == -1) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setgid: unable to set group id to Group %u", - (unsigned)unixd_config.group_id); + (unsigned)ap_unixd_config.group_id); return -1; } /* Reset `groups' attributes. */ - if (initgroups(name, unixd_config.group_id) == -1) { + if (initgroups(name, ap_unixd_config.group_id) == -1) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "initgroups: unable to set groups for User %s " - "and Group %u", name, (unsigned)unixd_config.group_id); + "and Group %u", name, (unsigned)ap_unixd_config.group_id); return -1; } #endif /* !defined(OS2) && !defined(TPF) */ @@ -143,7 +143,7 @@ unixd_drop_privileges(apr_pool_t *pool, server_rec *s) return rv; } - if (NULL != unixd_config.chroot_dir) { + if (NULL != ap_unixd_config.chroot_dir) { if (geteuid()) { rv = errno; ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, @@ -151,17 +151,17 @@ unixd_drop_privileges(apr_pool_t *pool, server_rec *s) return rv; } - if (chdir(unixd_config.chroot_dir) != 0) { + if (chdir(ap_unixd_config.chroot_dir) != 0) { rv = errno; ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "Can't chdir to %s", unixd_config.chroot_dir); + "Can't chdir to %s", ap_unixd_config.chroot_dir); return rv; } - if (chroot(unixd_config.chroot_dir) != 0) { + if (chroot(ap_unixd_config.chroot_dir) != 0) { rv = errno; ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "Can't chroot to %s", unixd_config.chroot_dir); + "Can't chroot to %s", ap_unixd_config.chroot_dir); return rv; } @@ -175,14 +175,14 @@ unixd_drop_privileges(apr_pool_t *pool, server_rec *s) #ifdef MPE /* Only try to switch if we're running as MANAGER.SYS */ - if (geteuid() == 1 && unixd_config.user_id > 1) { + if (geteuid() == 1 && ap_unixd_config.user_id > 1) { GETPRIVMODE(); - if (setuid(unixd_config.user_id) == -1) { + if (setuid(ap_unixd_config.user_id) == -1) { GETUSERMODE(); rv = errno; ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", - (long) unixd_config.user_id); + (long) ap_unixd_config.user_id); return rv; } GETUSERMODE(); @@ -191,13 +191,13 @@ unixd_drop_privileges(apr_pool_t *pool, server_rec *s) /* Only try to switch if we're running as root */ if (!geteuid() && ( #ifdef _OSD_POSIX - os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 || + os_init_job_environment(NULL, ap_unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 || #endif - setuid(unixd_config.user_id) == -1)) { + setuid(ap_unixd_config.user_id) == -1)) { rv = errno; ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", - (long) unixd_config.user_id); + (long) ap_unixd_config.user_id); return rv; } #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) @@ -229,10 +229,10 @@ unixd_set_user(cmd_parms *cmd, void *dummy, return err; } - unixd_config.user_name = arg; - unixd_config.user_id = ap_uname2id(arg); + ap_unixd_config.user_name = arg; + ap_unixd_config.user_id = ap_uname2id(arg); #if !defined (BIG_SECURITY_HOLE) && !defined (OS2) - if (unixd_config.user_id == 0) { + if (ap_unixd_config.user_id == 0) { return "Error:\tApache has not been designed to serve pages while\n" "\trunning as root. There are known race conditions that\n" "\twill allow any local user to read any file on the system.\n" @@ -257,7 +257,7 @@ unixd_set_group(cmd_parms *cmd, void *dummy, return err; } - unixd_config.group_id = ap_gname2id(arg); + ap_unixd_config.group_id = ap_gname2id(arg); return NULL; } @@ -274,7 +274,7 @@ unixd_set_chroot_dir(cmd_parms *cmd, void *dummy, return "ChrootDir must be a valid directory"; } - unixd_config.chroot_dir = arg; + ap_unixd_config.chroot_dir = arg; return NULL; } @@ -283,22 +283,22 @@ unixd_pre_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp) { apr_finfo_t wrapper; - unixd_config.user_name = DEFAULT_USER; - unixd_config.user_id = ap_uname2id(DEFAULT_USER); - unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); + ap_unixd_config.user_name = DEFAULT_USER; + ap_unixd_config.user_id = ap_uname2id(DEFAULT_USER); + ap_unixd_config.group_id = ap_gname2id(DEFAULT_GROUP); - unixd_config.chroot_dir = NULL; /* none */ + ap_unixd_config.chroot_dir = NULL; /* none */ /* Check for suexec */ - unixd_config.suexec_enabled = 0; + ap_unixd_config.suexec_enabled = 0; if ((apr_stat(&wrapper, SUEXEC_BIN, APR_FINFO_NORM, ptemp)) == APR_SUCCESS) { if ((wrapper.protection & APR_USETID) && wrapper.user == 0) { - unixd_config.suexec_enabled = 1; + ap_unixd_config.suexec_enabled = 1; } } - sys_privileges_handlers(1); + ap_sys_privileges_handlers(1); return OK; } @@ -308,20 +308,20 @@ AP_DECLARE(int) unixd_setup_child(void) return -1; } - if (NULL != unixd_config.chroot_dir) { + if (NULL != ap_unixd_config.chroot_dir) { if (geteuid()) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "Cannot chroot when not started as root"); return -1; } - if (chdir(unixd_config.chroot_dir) != 0) { + if (chdir(ap_unixd_config.chroot_dir) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "Can't chdir to %s", unixd_config.chroot_dir); + "Can't chdir to %s", ap_unixd_config.chroot_dir); return -1; } - if (chroot(unixd_config.chroot_dir) != 0) { + if (chroot(ap_unixd_config.chroot_dir) != 0) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, - "Can't chroot to %s", unixd_config.chroot_dir); + "Can't chroot to %s", ap_unixd_config.chroot_dir); return -1; } if (chdir("/") != 0) { @@ -333,13 +333,13 @@ AP_DECLARE(int) unixd_setup_child(void) #ifdef MPE /* Only try to switch if we're running as MANAGER.SYS */ - if (geteuid() == 1 && unixd_config.user_id > 1) { + if (geteuid() == 1 && ap_unixd_config.user_id > 1) { GETPRIVMODE(); - if (setuid(unixd_config.user_id) == -1) { + if (setuid(ap_unixd_config.user_id) == -1) { GETUSERMODE(); ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", - (long) unixd_config.user_id); + (long) ap_unixd_config.user_id); exit(1); } GETUSERMODE(); @@ -348,12 +348,12 @@ AP_DECLARE(int) unixd_setup_child(void) /* Only try to switch if we're running as root */ if (!geteuid() && ( #ifdef _OSD_POSIX - os_init_job_environment(NULL, unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 || + os_init_job_environment(NULL, ap_unixd_config.user_name, ap_exists_config_define("DEBUG")) != 0 || #endif - setuid(unixd_config.user_id) == -1)) { + setuid(ap_unixd_config.user_id) == -1)) { ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, "setuid: unable to change to uid: %ld", - (long) unixd_config.user_id); + (long) ap_unixd_config.user_id); return -1; } #if defined(HAVE_PRCTL) && defined(PR_SET_DUMPABLE) diff --git a/modules/cache/mod_socache_dbm.c b/modules/cache/mod_socache_dbm.c index 4efe4fb442..c73cf5f169 100644 --- a/modules/cache/mod_socache_dbm.c +++ b/modules/cache/mod_socache_dbm.c @@ -128,20 +128,20 @@ static apr_status_t socache_dbm_init(ap_socache_instance_t *ctx, * cannot exactly determine the suffixes we try all possibilities. */ if (geteuid() == 0 /* is superuser */) { - chown(ctx->data_file, unixd_config.user_id, -1 /* no gid change */); + chown(ctx->data_file, ap_unixd_config.user_id, -1 /* no gid change */); if (chown(apr_pstrcat(p, ctx->data_file, SSL_DBM_FILE_SUFFIX_DIR, NULL), - unixd_config.user_id, -1) == -1) { + ap_unixd_config.user_id, -1) == -1) { if (chown(apr_pstrcat(p, ctx->data_file, ".db", NULL), - unixd_config.user_id, -1) == -1) + ap_unixd_config.user_id, -1) == -1) chown(apr_pstrcat(p, ctx->data_file, ".dir", NULL), - unixd_config.user_id, -1); + ap_unixd_config.user_id, -1); } if (chown(apr_pstrcat(p, ctx->data_file, SSL_DBM_FILE_SUFFIX_PAG, NULL), - unixd_config.user_id, -1) == -1) { + ap_unixd_config.user_id, -1) == -1) { if (chown(apr_pstrcat(p, ctx->data_file, ".db", NULL), - unixd_config.user_id, -1) == -1) + ap_unixd_config.user_id, -1) == -1) chown(apr_pstrcat(p, ctx->data_file, ".pag", NULL), - unixd_config.user_id, -1); + ap_unixd_config.user_id, -1); } } #endif diff --git a/modules/generators/mod_cgid.c b/modules/generators/mod_cgid.c index f07ff7a755..c3aa26d66f 100644 --- a/modules/generators/mod_cgid.c +++ b/modules/generators/mod_cgid.c @@ -622,7 +622,7 @@ static int cgid_server(void *data) } if (!geteuid()) { - if (chown(sockname, unixd_config.user_id, -1) < 0) { + if (chown(sockname, ap_unixd_config.user_id, -1) < 0) { ap_log_error(APLOG_MARK, APLOG_ERR, errno, main_server, "Couldn't change owner of unix domain socket %s", sockname); diff --git a/modules/mappers/mod_rewrite.c b/modules/mappers/mod_rewrite.c index b47b221180..84676395bc 100644 --- a/modules/mappers/mod_rewrite.c +++ b/modules/mappers/mod_rewrite.c @@ -2607,7 +2607,7 @@ static apr_status_t rewritelock_create(server_rec *s, apr_pool_t *p) } #ifdef AP_NEED_SET_MUTEX_PERMS - rc = unixd_set_global_mutex_perms(rewrite_mapr_lock_acquire); + rc = ap_unixd_set_global_mutex_perms(rewrite_mapr_lock_acquire); if (rc != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rc, s, "mod_rewrite: Parent could not set permissions " @@ -4245,7 +4245,7 @@ static int post_config(apr_pool_t *p, } #ifdef AP_NEED_SET_MUTEX_PERMS - rv = unixd_set_global_mutex_perms(rewrite_log_lock); + rv = ap_unixd_set_global_mutex_perms(rewrite_log_lock); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_CRIT, rv, s, "mod_rewrite: Could not set permissions on " diff --git a/os/unix/unixd.c b/os/unix/unixd.c index bd0baeb163..91263d9fd3 100644 --- a/os/unix/unixd.c +++ b/os/unix/unixd.c @@ -50,11 +50,12 @@ #include #endif -unixd_config_rec unixd_config; +unixd_config_rec ap_unixd_config; -AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, - const char *arg, const char * arg2, int type) +AP_DECLARE(void) ap_unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, + const char *arg, + const char * arg2, int type) { #if (defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS)) && APR_HAVE_STRUCT_RLIMIT && APR_HAVE_GETRLIMIT char *str; @@ -133,7 +134,7 @@ static apr_status_t ap_unix_create_privileged_process( char *execuser, *execgroup; const char *argv0; - if (!unixd_config.suexec_enabled) { + if (!ap_unixd_config.suexec_enabled) { return apr_proc_create(newproc, progname, args, env, attr, p); } @@ -221,7 +222,7 @@ static apr_lockmech_e proc_mutex_mech(apr_proc_mutex_t *pmutex) return APR_LOCK_DEFAULT; } -AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) +AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) { if (!geteuid()) { apr_lockmech_e mech = proc_mutex_mech(pmutex); @@ -242,8 +243,8 @@ AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) struct semid_ds buf; apr_os_proc_mutex_get(&ospmutex, pmutex); - buf.sem_perm.uid = unixd_config.user_id; - buf.sem_perm.gid = unixd_config.group_id; + buf.sem_perm.uid = ap_unixd_config.user_id; + buf.sem_perm.gid = ap_unixd_config.group_id; buf.sem_perm.mode = 0600; ick.buf = &buf; if (semctl(ospmutex.crossproc, 0, IPC_SET, ick) < 0) { @@ -258,7 +259,7 @@ AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) const char *lockfile = apr_proc_mutex_lockfile(pmutex); if (lockfile) { - if (chown(lockfile, unixd_config.user_id, + if (chown(lockfile, ap_unixd_config.user_id, -1 /* no gid change */) < 0) { return errno; } @@ -274,20 +275,20 @@ AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex) return APR_SUCCESS; } -AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) +AP_DECLARE(apr_status_t) ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex) { #if !APR_PROC_MUTEX_IS_GLOBAL apr_os_global_mutex_t osgmutex; apr_os_global_mutex_get(&osgmutex, gmutex); - return unixd_set_proc_mutex_perms(osgmutex.proc_mutex); + return ap_unixd_set_proc_mutex_perms(osgmutex.proc_mutex); #else /* APR_PROC_MUTEX_IS_GLOBAL */ /* In this case, apr_proc_mutex_t and apr_global_mutex_t are the same. */ - return unixd_set_proc_mutex_perms(gmutex); + return ap_unixd_set_proc_mutex_perms(gmutex); #endif /* APR_PROC_MUTEX_IS_GLOBAL */ } -AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr, - apr_pool_t *ptrans) +AP_DECLARE(apr_status_t) ap_unixd_accept(void **accepted, ap_listen_rec *lr, + apr_pool_t *ptrans) { apr_socket_t *csd; apr_status_t status; diff --git a/os/unix/unixd.h b/os/unix/unixd.h index 80006eb73b..882dd5f5ea 100644 --- a/os/unix/unixd.h +++ b/os/unix/unixd.h @@ -78,11 +78,12 @@ typedef struct { int suexec_enabled; const char *chroot_dir; } unixd_config_rec; -AP_DECLARE_DATA extern unixd_config_rec unixd_config; +AP_DECLARE_DATA extern unixd_config_rec ap_unixd_config; #if defined(RLIMIT_CPU) || defined(RLIMIT_DATA) || defined(RLIMIT_VMEM) || defined(RLIMIT_NPROC) || defined(RLIMIT_AS) -AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, - const char *arg, const char * arg2, int type); +AP_DECLARE(void) ap_unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, + const char *arg, + const char * arg2, int type); #endif /** @@ -94,15 +95,15 @@ AP_DECLARE(void) unixd_set_rlimit(cmd_parms *cmd, struct rlimit **plimit, * for SysV semaphores. Otherwise, it is safe to call it for all * mutex types. */ -AP_DECLARE(apr_status_t) unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex); -AP_DECLARE(apr_status_t) unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex); -AP_DECLARE(apr_status_t) unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans); +AP_DECLARE(apr_status_t) ap_unixd_set_proc_mutex_perms(apr_proc_mutex_t *pmutex); +AP_DECLARE(apr_status_t) ap_unixd_set_global_mutex_perms(apr_global_mutex_t *gmutex); +AP_DECLARE(apr_status_t) ap_unixd_accept(void **accepted, ap_listen_rec *lr, apr_pool_t *ptrans); #ifdef HAVE_KILLPG -#define unixd_killpg(x, y) (killpg ((x), (y))) +#define ap_unixd_killpg(x, y) (killpg ((x), (y))) #define ap_os_killpg(x, y) (killpg ((x), (y))) #else /* HAVE_KILLPG */ -#define unixd_killpg(x, y) (kill (-(x), (y))) +#define ap_unixd_killpg(x, y) (kill (-(x), (y))) #define ap_os_killpg(x, y) (kill (-(x), (y))) #endif /* HAVE_KILLPG */ diff --git a/server/core.c b/server/core.c index 4199cfc65c..e5a09bad76 100644 --- a/server/core.c +++ b/server/core.c @@ -3680,23 +3680,23 @@ static int default_handler(request_rec *r) /* Optional function coming from mod_logio, used for logging of output * traffic */ -APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out; -APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *authz_ap_some_auth_required; +APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *ap__logio_add_bytes_out; +APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *ap__authz_ap_some_auth_required; /* Insist that at least one module will undertake to provide system * security by dropping startup privileges. */ static int sys_privileges = 0; -AP_DECLARE(int) sys_privileges_handlers(int inc) +AP_DECLARE(int) ap_sys_privileges_handlers(int inc) { sys_privileges += inc; return sys_privileges; } static int core_post_config(apr_pool_t *pconf, apr_pool_t *plog, apr_pool_t *ptemp, server_rec *s) { - logio_add_bytes_out = APR_RETRIEVE_OPTIONAL_FN(ap_logio_add_bytes_out); + ap__logio_add_bytes_out = APR_RETRIEVE_OPTIONAL_FN(ap_logio_add_bytes_out); ident_lookup = APR_RETRIEVE_OPTIONAL_FN(ap_ident_lookup); - authz_ap_some_auth_required = APR_RETRIEVE_OPTIONAL_FN(authz_some_auth_required); + ap__authz_ap_some_auth_required = APR_RETRIEVE_OPTIONAL_FN(authz_some_auth_required); authn_ap_auth_type = APR_RETRIEVE_OPTIONAL_FN(authn_ap_auth_type); authn_ap_auth_name = APR_RETRIEVE_OPTIONAL_FN(authn_ap_auth_name); access_compat_ap_satisfies = APR_RETRIEVE_OPTIONAL_FN(access_compat_ap_satisfies); diff --git a/server/core_filters.c b/server/core_filters.c index 9a07252e05..82a7f8def3 100644 --- a/server/core_filters.c +++ b/server/core_filters.c @@ -371,7 +371,7 @@ static apr_status_t sendfile_nonblocking(apr_socket_t *s, /* Optional function coming from mod_logio, used for logging of output * traffic */ -extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *logio_add_bytes_out; +extern APR_OPTIONAL_FN_TYPE(ap_logio_add_bytes_out) *ap__logio_add_bytes_out; apr_status_t ap_core_output_filter(ap_filter_t *f, apr_bucket_brigade *new_bb) { @@ -751,8 +751,8 @@ static apr_status_t writev_nonblocking(apr_socket_t *s, break; } } - if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) { - logio_add_bytes_out(c, bytes_written); + if ((ap__logio_add_bytes_out != NULL) && (bytes_written > 0)) { + ap__logio_add_bytes_out(c, bytes_written); } *cumulative_bytes_written += bytes_written; @@ -813,8 +813,8 @@ static apr_status_t sendfile_nonblocking(apr_socket_t *s, rv = arv; } } - if ((logio_add_bytes_out != NULL) && (bytes_written > 0)) { - logio_add_bytes_out(c, bytes_written); + if ((ap__logio_add_bytes_out != NULL) && (bytes_written > 0)) { + ap__logio_add_bytes_out(c, bytes_written); } *cumulative_bytes_written += bytes_written; if ((bytes_written < file_length) && (bytes_written > 0)) { diff --git a/server/main.c b/server/main.c index 02a66a5234..f9c8d89f22 100644 --- a/server/main.c +++ b/server/main.c @@ -798,8 +798,8 @@ int main(int argc, const char * const argv[]) * has all of the APR functions specified by the apr/apr.exports and * apr-util/aprutil.exports files. */ -const void *suck_in_APR(void); -const void *suck_in_APR(void) +const void *ap_suck_in_APR(void); +const void *ap_suck_in_APR(void) { extern const void *ap_ugly_hack; diff --git a/server/mpm/experimental/event/event.c b/server/mpm/experimental/event/event.c index 2fc5c69b68..21c3e70a84 100644 --- a/server/mpm/experimental/event/event.c +++ b/server/mpm/experimental/event/event.c @@ -160,7 +160,7 @@ static fd_queue_info_t *worker_queue_info; static int mpm_state = AP_MPMQ_STARTING; static int sick_child_detected; -apr_thread_mutex_t *timeout_mutex; +static apr_thread_mutex_t *timeout_mutex; APR_RING_HEAD(timeout_head_t, conn_state_t); static struct timeout_head_t timeout_head, keepalive_timeout_head; @@ -2025,7 +2025,7 @@ static void server_main_loop(int remaining_children_to_start) sick_child_detected = 1; } /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); + child_slot = ap_find_child_by_pid(&pid); if (child_slot >= 0) { for (i = 0; i < ap_threads_per_child; i++) ap_update_child_status_from_indexes(child_slot, i, diff --git a/server/mpm/experimental/event/mpm.h b/server/mpm/experimental/event/mpm.h index 94f87e29ad..d38c1f1e3a 100644 --- a/server/mpm/experimental/event/mpm.h +++ b/server/mpm/experimental/event/mpm.h @@ -53,7 +53,7 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept extern int ap_threads_per_child; extern int ap_max_daemons_limit; diff --git a/server/mpm/experimental/leader/leader.c b/server/mpm/experimental/leader/leader.c index 7bc652e756..df5b0c27fd 100644 --- a/server/mpm/experimental/leader/leader.c +++ b/server/mpm/experimental/leader/leader.c @@ -1020,7 +1020,7 @@ static void child_main(int child_num_arg) clean_child_exit(APEXIT_CHILDFATAL); } - if (unixd_setup_child()) { + if (ap_unixd_setup_child()) { clean_child_exit(APEXIT_CHILDFATAL); } @@ -1372,7 +1372,7 @@ static void server_main_loop(int remaining_children_to_start) return; } /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); + child_slot = ap_find_child_by_pid(&pid); if (child_slot >= 0) { for (i = 0; i < ap_threads_per_child; i++) ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD, @@ -1469,7 +1469,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) #else if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { #endif - rv = unixd_set_proc_mutex_perms(accept_mutex); + rv = ap_unixd_set_proc_mutex_perms(accept_mutex); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't set permissions on cross-process lock; " @@ -1540,7 +1540,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) * (By "gracefully" we don't mean graceful in the same sense as * "apachectl graceful" where we allow old connections to finish.) */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { + if (ap_unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); } ap_reclaim_child_processes(1); /* Start with SIGTERM */ @@ -1704,7 +1704,7 @@ static int leader_pre_config(apr_pool_t *pconf, apr_pool_t *plog, parent_pid = ap_my_pid = getpid(); } - unixd_pre_config(ptemp); + ap_unixd_pre_config(ptemp); ap_listen_pre_config(); ap_daemons_to_start = DEFAULT_START_DAEMON; min_spare_threads = DEFAULT_MIN_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; diff --git a/server/mpm/experimental/leader/mpm.h b/server/mpm/experimental/leader/mpm.h index d30be86a1f..8c4b846368 100644 --- a/server/mpm/experimental/leader/mpm.h +++ b/server/mpm/experimental/leader/mpm.h @@ -51,7 +51,7 @@ #define AP_MPM_USES_POD 1 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept extern int ap_threads_per_child; extern int ap_max_daemons_limit; diff --git a/server/mpm/experimental/perchild/mpm.h b/server/mpm/experimental/perchild/mpm.h index af97238728..d4ed6e5713 100644 --- a/server/mpm/experimental/perchild/mpm.h +++ b/server/mpm/experimental/perchild/mpm.h @@ -50,7 +50,7 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept /* Table of child status */ #define SERVER_DEAD 0 diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index bf0295eb8b..8dfdb86472 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -859,7 +859,7 @@ static int perchild_setup_child(int childnum) child_info_t *ug = &child_info_table[childnum]; if (ug->uid == -1 && ug->gid == -1) { - return unixd_setup_child(); + return ap_unixd_setup_child(); } if (set_group_privs(ug->uid, ug->gid)) { return -1; @@ -868,7 +868,7 @@ static int perchild_setup_child(int childnum) if (!geteuid() && ( #ifdef _OSD_POSIX - os_init_job_environment(server_conf, unixd_config.user_name, + os_init_job_environment(server_conf, ap_unixd_config.user_name, one_process) != 0 || #endif setuid(ug->uid) == -1)) { @@ -1329,7 +1329,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) /* Time to gracefully shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { + if (ap_unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); } @@ -1392,7 +1392,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) * and a SIGHUP, we may as well use the same signal, because some user * pthreads are stealing signals from us left and right. */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { + if (ap_unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); } @@ -1483,7 +1483,7 @@ static int perchild_pre_config(apr_pool_t *p, apr_pool_t *plog, apr_pool_t *ptem my_pid = getpid(); } - unixd_pre_config(ptemp); + ap_unixd_pre_config(ptemp); ap_listen_pre_config(); num_daemons = DEFAULT_NUM_DAEMON; threads_to_start = DEFAULT_START_THREAD; diff --git a/server/mpm/experimental/threadpool/mpm.h b/server/mpm/experimental/threadpool/mpm.h index 806011b885..d42d245963 100644 --- a/server/mpm/experimental/threadpool/mpm.h +++ b/server/mpm/experimental/threadpool/mpm.h @@ -50,7 +50,7 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept extern int ap_threads_per_child; extern int ap_max_daemons_limit; diff --git a/server/mpm/experimental/threadpool/threadpool.c b/server/mpm/experimental/threadpool/threadpool.c index 938816af42..df8575284f 100644 --- a/server/mpm/experimental/threadpool/threadpool.c +++ b/server/mpm/experimental/threadpool/threadpool.c @@ -1243,7 +1243,7 @@ static void child_main(int child_num_arg) clean_child_exit(APEXIT_CHILDFATAL); } - if (unixd_setup_child()) { + if (ap_unixd_setup_child()) { clean_child_exit(APEXIT_CHILDFATAL); } @@ -1629,7 +1629,7 @@ static void server_main_loop(int remaining_children_to_start) return; } /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); + child_slot = ap_find_child_by_pid(&pid); if (child_slot >= 0) { for (i = 0; i < ap_threads_per_child; i++) ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD, @@ -1726,7 +1726,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) #else if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { #endif - rv = unixd_set_proc_mutex_perms(accept_mutex); + rv = ap_unixd_set_proc_mutex_perms(accept_mutex); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't set permissions on cross-process lock; " @@ -1966,7 +1966,7 @@ static int worker_pre_config(apr_pool_t *pconf, apr_pool_t *plog, parent_pid = ap_my_pid = getpid(); } - unixd_pre_config(ptemp); + ap_unixd_pre_config(ptemp); ap_listen_pre_config(); ap_daemons_to_start = DEFAULT_START_DAEMON; min_spare_threads = DEFAULT_MIN_FREE_DAEMON * DEFAULT_THREADS_PER_CHILD; diff --git a/server/mpm/prefork/mpm.h b/server/mpm/prefork/mpm.h index bf1fb94999..36c7b57607 100644 --- a/server/mpm/prefork/mpm.h +++ b/server/mpm/prefork/mpm.h @@ -53,7 +53,7 @@ #define AP_MPM_USES_POD 1 #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept extern int ap_threads_per_child; extern int ap_max_daemons_limit; diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 326d4d3627..c7b27dd39a 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -664,7 +664,7 @@ static int make_child(server_rec *s, int slot) #ifdef _OSD_POSIX /* BS2000 requires a "special" version of fork() before a setuid() call */ - if ((pid = os_fork(unixd_config.user_name)) == -1) { + if ((pid = os_fork(ap_unixd_config.user_name)) == -1) { #elif defined(TPF) if ((pid = os_fork(s, slot)) == -1) { #else @@ -897,7 +897,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) #else if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { #endif - rv = unixd_set_proc_mutex_perms(accept_mutex); + rv = ap_unixd_set_proc_mutex_perms(accept_mutex); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't set permissions on cross-process lock; " @@ -987,7 +987,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); + child_slot = ap_find_child_by_pid(&pid); if (child_slot >= 0) { (void) ap_update_child_status_from_indexes(child_slot, 0, SERVER_DEAD, (request_rec *) NULL); @@ -1056,7 +1056,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) /* Time to shut down: * Kill child processes, tell them to call child_exit, etc... */ - if (unixd_killpg(getpgrp(), SIGTERM) < 0) { + if (ap_unixd_killpg(getpgrp(), SIGTERM) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGTERM"); } ap_reclaim_child_processes(1); /* Start with SIGTERM */ @@ -1147,7 +1147,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) * way, try and make sure that all of our processes are * really dead. */ - unixd_killpg(getpgrp(), SIGTERM); + ap_unixd_killpg(getpgrp(), SIGTERM); return 1; } @@ -1195,7 +1195,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) } else { /* Kill 'em off */ - if (unixd_killpg(getpgrp(), SIGHUP) < 0) { + if (ap_unixd_killpg(getpgrp(), SIGHUP) < 0) { ap_log_error(APLOG_MARK, APLOG_WARNING, errno, ap_server_conf, "killpg SIGHUP"); } ap_reclaim_child_processes(0); /* Not when just starting up */ diff --git a/server/mpm/worker/mpm.h b/server/mpm/worker/mpm.h index 335f4b6ace..59fe752b02 100644 --- a/server/mpm/worker/mpm.h +++ b/server/mpm/worker/mpm.h @@ -51,7 +51,7 @@ #define MPM_CHILD_PID(i) (ap_scoreboard_image->parent[i].pid) #define MPM_NOTE_CHILD_KILLED(i) (MPM_CHILD_PID(i) = 0) -#define MPM_ACCEPT_FUNC unixd_accept +#define MPM_ACCEPT_FUNC ap_unixd_accept extern int ap_threads_per_child; extern int ap_max_daemons_limit; diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index fd71aa9aac..accf4c71fe 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -1583,7 +1583,7 @@ static void server_main_loop(int remaining_children_to_start) sick_child_detected = 1; } /* non-fatal death... note that it's gone in the scoreboard. */ - child_slot = find_child_by_pid(&pid); + child_slot = ap_find_child_by_pid(&pid); if (child_slot >= 0) { for (i = 0; i < ap_threads_per_child; i++) ap_update_child_status_from_indexes(child_slot, i, SERVER_DEAD, @@ -1674,7 +1674,7 @@ int ap_mpm_run(apr_pool_t *_pconf, apr_pool_t *plog, server_rec *s) #else if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { #endif - rv = unixd_set_proc_mutex_perms(accept_mutex); + rv = ap_unixd_set_proc_mutex_perms(accept_mutex); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't set permissions on cross-process lock; " diff --git a/server/mpm_common.c b/server/mpm_common.c index 1b292814f4..f5941f51be 100644 --- a/server/mpm_common.c +++ b/server/mpm_common.c @@ -1139,7 +1139,7 @@ const char *ap_mpm_set_thread_stacksize(cmd_parms *cmd, void *dummy, #ifdef AP_MPM_WANT_FATAL_SIGNAL_HANDLER static pid_t parent_pid, my_pid; -apr_pool_t *pconf; +static apr_pool_t *pconf; #if AP_ENABLE_EXCEPTION_HOOK diff --git a/server/request.c b/server/request.c index 75b7930551..f34f9f5723 100644 --- a/server/request.c +++ b/server/request.c @@ -1666,13 +1666,13 @@ AP_CORE_DECLARE_NONSTD(apr_status_t) ap_sub_req_output_filter(ap_filter_t *f, return APR_SUCCESS; } -extern APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *authz_ap_some_auth_required; +extern APR_OPTIONAL_FN_TYPE(authz_some_auth_required) *ap__authz_ap_some_auth_required; AP_DECLARE(int) ap_some_auth_required(request_rec *r) { /* Is there a require line configured for the type of *this* req? */ - if (authz_ap_some_auth_required) { - return authz_ap_some_auth_required(r); + if (ap__authz_ap_some_auth_required) { + return ap__authz_ap_some_auth_required(r); } else return 0; diff --git a/server/scoreboard.c b/server/scoreboard.c index ae834dcd9c..43e0513f5f 100644 --- a/server/scoreboard.c +++ b/server/scoreboard.c @@ -368,7 +368,7 @@ AP_DECLARE(void) ap_increment_counts(ap_sb_handle_t *sb, request_rec *r) ws->conn_bytes += r->bytes_sent; } -int find_child_by_pid(apr_proc_t *pid) +AP_DECLARE(int) ap_find_child_by_pid(apr_proc_t *pid) { int i; int max_daemons_limit;