MCPcopy Create free account
hub / github.com/apache/httpd / piped_log_maintenance

Function piped_log_maintenance

server/log.c:1827–1876  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1825
1826
1827static void piped_log_maintenance(int reason, void *data, apr_wait_t status)
1828{
1829 piped_log *pl = data;
1830 apr_status_t rv;
1831 int mpm_state;
1832
1833 switch (reason) {
1834 case APR_OC_REASON_DEATH:
1835 case APR_OC_REASON_LOST:
1836 pl->pid = NULL; /* in case we don't get it going again, this
1837 * tells other logic not to try to kill it
1838 */
1839 apr_proc_other_child_unregister(pl);
1840 rv = ap_mpm_query(AP_MPMQ_MPM_STATE, &mpm_state);
1841 if (rv != APR_SUCCESS) {
1842 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00105)
1843 "can't query MPM state; not restarting "
1844 "piped log program '%s'",
1845 pl->program);
1846 }
1847 else if (mpm_state != AP_MPMQ_STOPPING) {
1848 ap_log_error(APLOG_MARK, APLOG_STARTUP, 0, NULL, APLOGNO(00106)
1849 "piped log program '%s' failed unexpectedly",
1850 pl->program);
1851 if ((rv = piped_log_spawn(pl)) != APR_SUCCESS) {
1852 /* what can we do? This could be the error log we're having
1853 * problems opening up... */
1854 ap_log_error(APLOG_MARK, APLOG_STARTUP, rv, NULL, APLOGNO(00107)
1855 "piped_log_maintenance: unable to respawn '%s'",
1856 pl->program);
1857 }
1858 }
1859 break;
1860
1861 case APR_OC_REASON_UNWRITABLE:
1862 /* We should not kill off the pipe here, since it may only be full.
1863 * If it really is locked, we should kill it off manually. */
1864 break;
1865
1866 case APR_OC_REASON_RESTART:
1867 if (pl->pid != NULL) {
1868 apr_proc_kill(pl->pid, SIGTERM);
1869 pl->pid = NULL;
1870 }
1871 break;
1872
1873 case APR_OC_REASON_UNREGISTER:
1874 break;
1875 }
1876}
1877
1878
1879static apr_status_t piped_log_cleanup_for_exec(void *data)

Callers

nothing calls this directly

Calls 3

ap_mpm_queryFunction · 0.85
piped_log_spawnFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected