diff options
-rw-r--r-- | server/mpm/event/event.c | 20 | ||||
-rw-r--r-- | server/mpm/simple/simple_run.c | 12 | ||||
-rw-r--r-- | support/htcacheclean.c | 37 |
3 files changed, 34 insertions, 35 deletions
diff --git a/server/mpm/event/event.c b/server/mpm/event/event.c index dbfe65c513..3cea9d8a32 100644 --- a/server/mpm/event/event.c +++ b/server/mpm/event/event.c @@ -1469,7 +1469,7 @@ static void get_worker(int *have_idle_worker_p, int blocking, int *all_busy) } /* Structures to reuse */ -static APR_RING_HEAD(timer_free_ring_t, timer_event_t) timer_free_ring; +static timer_event_t timer_free_ring; static apr_skiplist *timer_skiplist; static volatile apr_time_t timers_next_expiry; @@ -1516,8 +1516,8 @@ static timer_event_t * event_get_timer_event(apr_time_t t, apr_thread_mutex_lock(g_timer_skiplist_mtx); - if (!APR_RING_EMPTY(&timer_free_ring, timer_event_t, link)) { - te = APR_RING_FIRST(&timer_free_ring); + if (!APR_RING_EMPTY(&timer_free_ring.link, timer_event_t, link)) { + te = APR_RING_FIRST(&timer_free_ring.link); APR_RING_REMOVE(te, link); } else { @@ -1715,7 +1715,7 @@ static void process_timeout_queue(struct timeout_queue *q, { apr_uint32_t total = 0, count; event_conn_state_t *first, *cs, *last; - struct timeout_head_t trash; + struct event_conn_state_t trash; struct timeout_queue *qp; apr_status_t rv; @@ -1723,7 +1723,7 @@ static void process_timeout_queue(struct timeout_queue *q, return; } - APR_RING_INIT(&trash, event_conn_state_t, timeout_list); + APR_RING_INIT(&trash.timeout_list, event_conn_state_t, timeout_list); for (qp = q; qp; qp = qp->next) { count = 0; cs = first = last = APR_RING_FIRST(&qp->head); @@ -1769,7 +1769,7 @@ static void process_timeout_queue(struct timeout_queue *q, continue; APR_RING_UNSPLICE(first, last, timeout_list); - APR_RING_SPLICE_TAIL(&trash, first, last, event_conn_state_t, + APR_RING_SPLICE_TAIL(&trash.timeout_list, first, last, event_conn_state_t, timeout_list); AP_DEBUG_ASSERT(*q->total >= count && qp->count >= count); *q->total -= count; @@ -1780,7 +1780,7 @@ static void process_timeout_queue(struct timeout_queue *q, return; apr_thread_mutex_unlock(timeout_mutex); - first = APR_RING_FIRST(&trash); + first = APR_RING_FIRST(&trash.timeout_list); do { cs = APR_RING_NEXT(first, timeout_list); TO_QUEUE_ELEM_INIT(first); @@ -1910,7 +1910,7 @@ static void * APR_THREAD_FUNC listener_thread(apr_thread_t * thd, void *dummy) push_timer2worker(te); } else { - APR_RING_INSERT_TAIL(&timer_free_ring, te, + APR_RING_INSERT_TAIL(&timer_free_ring.link, te, timer_event_t, link); } } @@ -2372,7 +2372,7 @@ static void *APR_THREAD_FUNC worker_thread(apr_thread_t * thd, void *dummy) te->cbfunc(te->baton); { apr_thread_mutex_lock(g_timer_skiplist_mtx); - APR_RING_INSERT_TAIL(&timer_free_ring, te, timer_event_t, link); + APR_RING_INSERT_TAIL(&timer_free_ring.link, te, timer_event_t, link); apr_thread_mutex_unlock(g_timer_skiplist_mtx); } } @@ -2477,7 +2477,7 @@ static void setup_threads_runtime(void) apr_pool_create(&pskip, pconf); apr_pool_tag(pskip, "mpm_skiplist"); apr_thread_mutex_create(&g_timer_skiplist_mtx, APR_THREAD_MUTEX_DEFAULT, pskip); - APR_RING_INIT(&timer_free_ring, timer_event_t, link); + APR_RING_INIT(&timer_free_ring.link, timer_event_t, link); apr_skiplist_init(&timer_skiplist, pskip); apr_skiplist_set_compare(timer_skiplist, timer_comp, timer_comp); diff --git a/server/mpm/simple/simple_run.c b/server/mpm/simple/simple_run.c index 102eed55e2..fe68d269f1 100644 --- a/server/mpm/simple/simple_run.c +++ b/server/mpm/simple/simple_run.c @@ -151,7 +151,7 @@ static int simple_run_loop(simple_core_t * sc) apr_time_t tnow = apr_time_now(); simple_timer_t *head; apr_interval_time_t timeout = apr_time_from_msec(500); - APR_RING_HEAD(simple_temp_timer_ring_t, simple_timer_t) tmp_ring; + simple_timer_t tmp_ring; apr_thread_mutex_lock(sc->mtx); head = APR_RING_FIRST(&sc->timer_ring); @@ -183,7 +183,7 @@ static int simple_run_loop(simple_core_t * sc) } } - APR_RING_INIT(&tmp_ring, simple_timer_t, link); + APR_RING_INIT(&tmp_ring.link, simple_timer_t, link); apr_thread_mutex_lock(sc->mtx); @@ -201,7 +201,7 @@ static int simple_run_loop(simple_core_t * sc) APR_RING_REMOVE(ep, link); APR_RING_CHECK_CONSISTENCY(&sc->timer_ring, simple_timer_t, link); - APR_RING_INSERT_TAIL(&tmp_ring, ep, simple_timer_t, link); + APR_RING_INSERT_TAIL(&tmp_ring.link, ep, simple_timer_t, link); ep = next; } else { @@ -214,9 +214,9 @@ static int simple_run_loop(simple_core_t * sc) apr_thread_mutex_unlock(sc->mtx); - if (!APR_RING_EMPTY(&tmp_ring, simple_timer_t, link)) { - for (ep = APR_RING_FIRST(&tmp_ring); - ep != APR_RING_SENTINEL(&tmp_ring, + if (!APR_RING_EMPTY(&tmp_ring.link, simple_timer_t, link)) { + for (ep = APR_RING_FIRST(&tmp_ring.link); + ep != APR_RING_SENTINEL(&tmp_ring.link, simple_timer_t, link); ep = APR_RING_NEXT(ep, link)) { apr_thread_pool_push(sc->workers, diff --git a/support/htcacheclean.c b/support/htcacheclean.c index 609b2e5cc1..b4eabbf348 100644 --- a/support/htcacheclean.c +++ b/support/htcacheclean.c @@ -110,7 +110,7 @@ static apr_file_t *errfile; /* stderr file handle */ static apr_file_t *outfile; /* stdout file handle */ static apr_off_t unsolicited; /* file size summary for deleted unsolicited files */ -static APR_RING_ENTRY(_entry) root; /* ENTRY ring anchor */ +static ENTRY root; /* ENTRY ring anchor */ /* short program name as called */ static const char *shortname = "htcacheclean"; @@ -605,13 +605,12 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes) apr_size_t len; apr_time_t current, deviation; char *nextpath, *base, *ext; - APR_RING_ENTRY(_direntry) anchor; - DIRENTRY *d, *t, *n; + DIRENTRY *d, *t, *n, anchor; ENTRY *e; int skip, retries; disk_cache_info_t disk_info; - APR_RING_INIT(&anchor, _direntry, link); + APR_RING_INIT(&anchor.link, _direntry, link); apr_pool_create(&p, pool); h = apr_hash_make(p); fd = NULL; @@ -627,7 +626,7 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes) } d = apr_pcalloc(p, sizeof(DIRENTRY)); d->basename = apr_pstrcat(p, path, "/", info.name, NULL); - APR_RING_INSERT_TAIL(&anchor, d, _direntry, link); + APR_RING_INSERT_TAIL(&anchor.link, d, _direntry, link); (*nodes)++; } @@ -639,8 +638,8 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes) skip = baselen + 1; - for (d = APR_RING_FIRST(&anchor); - !interrupted && d != APR_RING_SENTINEL(&anchor, _direntry, link); + for (d = APR_RING_FIRST(&anchor.link); + !interrupted && d != APR_RING_SENTINEL(&anchor.link, _direntry, link); d=n) { n = APR_RING_NEXT(d, link); base = strrchr(d->basename, '/'); @@ -785,7 +784,7 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes) &len) == APR_SUCCESS) { apr_file_close(fd); e = apr_palloc(pool, sizeof(ENTRY)); - APR_RING_INSERT_TAIL(&root, e, _entry, link); + APR_RING_INSERT_TAIL(&root.link, e, _entry, link); e->expire = disk_info.expire; e->response_time = disk_info.response_time; e->htime = d->htime; @@ -901,7 +900,7 @@ static int process_dir(char *path, apr_pool_t *pool, apr_off_t *nodes) &len) == APR_SUCCESS) { apr_file_close(fd); e = apr_palloc(pool, sizeof(ENTRY)); - APR_RING_INSERT_TAIL(&root, e, _entry, link); + APR_RING_INSERT_TAIL(&root.link, e, _entry, link); e->expire = disk_info.expire; e->response_time = disk_info.response_time; e->htime = d->htime; @@ -988,8 +987,8 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max, s.inodes = inodes; s.ntotal = nodes; - for (e = APR_RING_FIRST(&root); - e != APR_RING_SENTINEL(&root, _entry, link); + for (e = APR_RING_FIRST(&root.link); + e != APR_RING_SENTINEL(&root.link, _entry, link); e = APR_RING_NEXT(e, link)) { s.sum += round_up((apr_size_t)e->hsize, round); s.sum += round_up((apr_size_t)e->dsize, round); @@ -1008,8 +1007,8 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max, * happen if a wrong system time is corrected */ - for (e = APR_RING_FIRST(&root); - e != APR_RING_SENTINEL(&root, _entry, link) && !interrupted;) { + for (e = APR_RING_FIRST(&root.link); + e != APR_RING_SENTINEL(&root.link, _entry, link) && !interrupted;) { n = APR_RING_NEXT(e, link); if (e->response_time > now || e->htime > now || e->dtime > now) { delete_entry(path, e->basename, &s.nodes, pool); @@ -1033,8 +1032,8 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max, } /* process all entries which are expired */ - for (e = APR_RING_FIRST(&root); - e != APR_RING_SENTINEL(&root, _entry, link) && !interrupted;) { + for (e = APR_RING_FIRST(&root.link); + e != APR_RING_SENTINEL(&root.link, _entry, link) && !interrupted;) { n = APR_RING_NEXT(e, link); if (e->expire != APR_DATE_BAD && e->expire < now) { delete_entry(path, e->basename, &s.nodes, pool); @@ -1063,11 +1062,11 @@ static void purge(char *path, apr_pool_t *pool, apr_off_t max, * than sorry */ while (!((!s.max || s.sum <= s.max) && (!s.inodes || s.nodes <= s.inodes)) - && !interrupted && !APR_RING_EMPTY(&root, _entry, link)) { - oldest = APR_RING_FIRST(&root); + && !interrupted && !APR_RING_EMPTY(&root.link, _entry, link)) { + oldest = APR_RING_FIRST(&root.link); for (e = APR_RING_NEXT(oldest, link); - e != APR_RING_SENTINEL(&root, _entry, link); + e != APR_RING_SENTINEL(&root.link, _entry, link); e = APR_RING_NEXT(e, link)) { if (e->dtime < oldest->dtime) { oldest = e; @@ -1718,7 +1717,7 @@ int main(int argc, const char * const argv[]) apr_pool_create(&instance, pool); now = apr_time_now(); - APR_RING_INIT(&root, _entry, link); + APR_RING_INIT(&root.link, _entry, link); delcount = 0; unsolicited = 0; dowork = 0; |