/* Licensed to the Apache Software Foundation (ASF) under one or more *contributorlicenseagreements.SeetheNOTICEfiledistributedwith *thisworkforadditionalinformationregardingcopyrightownership. *TheASFlicensesthisfiletoYouundertheApacheLicense,Version2.0 *(the"License");youmaynotusethisfileexceptincompliancewith *theLicense.YoumayobtainacopyoftheLicenseat * *http://www.apache.org/licenses/LICENSE-2.0 * *Unlessrequiredbyapplicablelaworagreedtoinwriting,software *distributedundertheLicenseisdistributedonan"ASIS"BASIS, *WITHOUTWARRANTIESORCONDITIONSOFANYKIND,eitherexpressorimplied. *SeetheLicenseforthespecificlanguagegoverningpermissionsand *limitationsundertheLicense.
*/
/* The purpose of this file is to store the code that MOST mpm's will need *thisdoesnotmeanafunctiononlygoesintothisfileifeveryMPMneeds *it.ItmeansthatifafunctionisneededbymorethanoneMPM,and *futuremaintenancewouldbeservedbymakingthecodecommon,thenthe *functionbelongshere. * *Thisisgoinginsrc/mainbecauseitisnotplatformspecific,itis *specifictomulti-processservers,butNOTtoUnix.Whichiswhyit *doesnotbelonginsrc/os/unix
*/
/* hooks with no args are implemented last, after disabling APR hook probes */ #ifdefined(APR_HOOK_PROBES_ENABLED) #undef APR_HOOK_PROBES_ENABLED #undef APR_HOOK_PROBE_ENTRY #define APR_HOOK_PROBE_ENTRY(ud,ns,name,args) #undef APR_HOOK_PROBE_RETURN #define APR_HOOK_PROBE_RETURN(ud,ns,name,rv,args) #undef APR_HOOK_PROBE_INVOKE #define APR_HOOK_PROBE_INVOKE(ud,ns,name,src,args) #undef APR_HOOK_PROBE_COMPLETE #define APR_HOOK_PROBE_COMPLETE(ud,ns,name,src,rv,args) #undef APR_HOOK_INT_DCL_UD #define APR_HOOK_INT_DCL_UD #endif
AP_IMPLEMENT_HOOK_RUN_FIRST(constchar *, mpm_get_name,
(void),
(), NULL)
typedefstruct mpm_gen_info_t {
APR_RING_ENTRY(mpm_gen_info_t) link; int gen; /* which gen? */ int active; /* number of active processes */ int done; /* gen finished? (whether or not active processes) */
} mpm_gen_info_t;
/* variables representing config directives implemented here */
AP_DECLARE_DATA constchar *ap_pid_fname;
AP_DECLARE_DATA int ap_max_requests_per_child;
AP_DECLARE_DATA char ap_coredump_dir[MAX_STRING_LEN];
AP_DECLARE_DATA int ap_coredumpdir_configured;
AP_DECLARE_DATA int ap_graceful_shutdown_timeout;
AP_DECLARE_DATA apr_uint32_t ap_max_mem_free;
AP_DECLARE_DATA apr_size_t ap_thread_stacksize;
#define ALLOCATOR_MAX_FREE_DEFAULT (2048*1024)
/* Set defaults for config directives implemented here. This is *calledfromcore'spre-confighook,soMPMswhichneedtooverride *oneoftheseshouldruntheirpre-confighookafterthatofcore.
*/ void mpm_common_pre_config(apr_pool_t *pconf)
{
ap_pid_fname = DEFAULT_PIDLOG;
ap_max_requests_per_child = 0; /* unlimited */
apr_cpystrn(ap_coredump_dir, ap_server_root, sizeof(ap_coredump_dir));
ap_coredumpdir_configured = 0;
ap_graceful_shutdown_timeout = 0; /* unlimited */
ap_max_mem_free = ALLOCATOR_MAX_FREE_DEFAULT;
ap_thread_stacksize = 0; /* use system default */
}
/* number of calls to wait_or_timeout between writable probes */ #ifndef INTERVAL_OF_WRITABLE_PROBES #define INTERVAL_OF_WRITABLE_PROBES 10 #endif staticint wait_or_timeout_counter;
if (!(ent = getpwnam(name))) {
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00543) "%s: bad user name %s", ap_server_argv0, name); exit(1);
}
return (ent->pw_uid);
} #endif
#ifdef HAVE_GETGRNAM
AP_DECLARE(gid_t) ap_gname2id(constchar *name)
{ struct group *ent;
if (name[0] == '#') return (atoi(&name[1]));
if (!(ent = getgrnam(name))) {
ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00544) "%s: bad group name %s", ap_server_argv0, name); exit(1);
}
return (ent->gr_gid);
} #endif
#ifndef HAVE_INITGROUPS int initgroups(constchar *name, gid_t basegid)
{ #ifdefined(_OSD_POSIX) || defined(OS2) || defined(WIN32) || defined(NETWARE) return0; #else
gid_t groups[NGROUPS_MAX]; struct group *g; int index = 0;
setgrent();
groups[index++] = basegid;
while (index < NGROUPS_MAX && ((g = getgrent()) != NULL)) { if (g->gr_gid != basegid) { char **names;
for (names = g->gr_mem; *names != NULL; ++names) { if (!strcmp(*names, name))
groups[index++] = g->gr_gid;
}
}
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.