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
* 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 */
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
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);
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;
}
/* 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,
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. */
* 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) */
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,
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;
}
#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();
/* 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)
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"
return err;
}
- unixd_config.group_id = ap_gname2id(arg);
+ ap_unixd_config.group_id = ap_gname2id(arg);
return NULL;
}
return "ChrootDir must be a valid directory";
}
- unixd_config.chroot_dir = arg;
+ ap_unixd_config.chroot_dir = arg;
return NULL;
}
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;
}
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) {
#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();
/* 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)
* 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
}
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);
}
#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 "
}
#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 "
#include <sys/prctl.h>
#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;
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);
}
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);
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) {
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;
}
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;
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
/**
* 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 */
/* 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);
/* 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)
{
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;
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)) {
* 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;
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;
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,
#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;
clean_child_exit(APEXIT_CHILDFATAL);
}
- if (unixd_setup_child()) {
+ if (ap_unixd_setup_child()) {
clean_child_exit(APEXIT_CHILDFATAL);
}
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,
#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; "
* (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 */
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;
#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;
#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
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;
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)) {
/* 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");
}
* 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");
}
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;
#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;
clean_child_exit(APEXIT_CHILDFATAL);
}
- if (unixd_setup_child()) {
+ if (ap_unixd_setup_child()) {
clean_child_exit(APEXIT_CHILDFATAL);
}
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,
#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; "
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;
#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;
#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
#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; "
}
/* 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);
/* 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 */
* way, try and make sure that all of our processes are
* really dead.
*/
- unixd_killpg(getpgrp(), SIGTERM);
+ ap_unixd_killpg(getpgrp(), SIGTERM);
return 1;
}
}
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 */
#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;
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,
#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; "
#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
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;
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;