--- ./b/server/mpm/peruser/peruser.c 2025-02-26 18:20:46.038158495 +0200 +++ ./j/server/mpm/peruser/peruser.c 2025-02-26 18:21:38.232908991 +0200 @@ -141,6 +141,8 @@ #include "cpu_usage.h" #endif +#include + #ifdef MPM_PERUSER_DEBUG # define _DBG(text,par...) \ ap_log_error(APLOG_MARK, APLOG_WARNING, 0, NULL, \ @@ -704,11 +706,11 @@ if (ap_my_generation != ap_scoreboard_image->global->running_generation) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg); clean_child_exit(0); } else { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg); exit(APEXIT_CHILDFATAL); } } @@ -722,14 +724,14 @@ if (ap_my_generation != ap_scoreboard_image->global->running_generation) { - ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL,"%s", msg); /* don't exit here... we have a connection to * process, after which point we'll see that the * generation changed and we'll exit cleanly */ } else { - ap_log_error(APLOG_MARK, APLOG_EMERG, rv, NULL, msg); + ap_log_error(APLOG_MARK, APLOG_DEBUG, rv, NULL, "%s", msg); exit(APEXIT_CHILDFATAL); } } @@ -1913,7 +1915,12 @@ _DBG("function called"); if (senv->nice_lvl != 0) { - nice(senv->nice_lvl); + errno = 0; + if (nice(senv->nice_lvl) == -1 && errno != 0) { + ap_log_error(APLOG_MARK, APLOG_ALERT, errno, NULL, + "nice: unable to change nice level to :%d", + senv->nice_lvl); + } } if (senv->chroot) { @@ -2954,8 +2961,9 @@ ap_server_root_relative(_pconf, ap_lock_fname), ap_my_pid); + ap_unixd_mpm_set_accept_mutex_mech("default", _pconf); rv = apr_proc_mutex_create(&accept_mutex, ap_lock_fname, - ap_accept_lock_mech, _pconf); + APR_LOCK_DEFAULT, _pconf); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, "Couldn't create accept lock"); @@ -2963,12 +2971,7 @@ return 1; } -#if APR_USE_SYSVSEM_SERIALIZE - if (ap_accept_lock_mech == APR_LOCK_DEFAULT || - ap_accept_lock_mech == APR_LOCK_SYSVSEM) { -#else - if (ap_accept_lock_mech == APR_LOCK_SYSVSEM) { -#endif + if (ap_unixd_mpm_set_accept_mutex_mech("sysvsem", _pconf) == APR_SUCCESS) { rv = ap_unixd_set_proc_mutex_perms(accept_mutex); if (rv != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, @@ -3586,7 +3589,7 @@ } } } else { - ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, r); + //ap_log_error(APLOG_MARK, APLOG_STARTUP, NULL, "%s", (char *)r); return -1; } @@ -4642,8 +4645,17 @@ return NULL; } -static const command_rec peruser_cmds[] = { UNIX_DAEMON_COMMANDS, -LISTEN_COMMANDS, +extern const char *unixd_set_user(cmd_parms *cmd, void *dummy, const char *arg); +extern const char *unixd_set_group(cmd_parms *cmd, void *dummy, const char *arg); +extern const char *unixd_set_chroot_dir(cmd_parms *cmd, void *dummy, const char *arg); + +static const command_rec peruser_cmds[] = { LISTEN_COMMANDS, +AP_INIT_TAKE1("User", unixd_set_user, NULL, RSRC_CONF, + "Effective user id for this server"), +AP_INIT_TAKE1("Group", unixd_set_group, NULL, RSRC_CONF, + "Effective group id for this server"), +AP_INIT_TAKE1("ChrootDir", unixd_set_chroot_dir, NULL, RSRC_CONF, \ + "The directory to chroot(2) into"), AP_INIT_TAKE1("MinSpareProcessors", set_min_free_processors, NULL, RSRC_CONF, "Minimum number of idle children, to handle request spikes"), AP_INIT_TAKE1("MinSpareServers", set_min_free_servers, NULL, RSRC_CONF,