| 1 | From 976ec8ba8e70e3b5027f441de529f479c11c8507 Mon Sep 17 00:00:00 2001 |
| 2 | From: Anthony Basile <blueness@gentoo.org> |
| 3 | Date: Sun, 23 Jan 2011 01:42:51 -0800 |
| 4 | Subject: [PATCH] Patch to rename beanstalkd's dprintf to dbgprintf |
| 5 | |
| 6 | --- |
| 7 | prot.c | 24 ++++++++++++------------ |
| 8 | util.h | 4 ++-- |
| 9 | 2 files changed, 14 insertions(+), 14 deletions(-) |
| 10 | |
| 11 | diff --git a/prot.c b/prot.c |
| 12 | index 481b0ed..8dd34ec 100644 |
| 13 | --- a/prot.c |
| 14 | +++ b/prot.c |
| 15 | @@ -305,7 +305,7 @@ reply(conn c, const char *line, int len, int state) |
| 16 | c->reply_len = len; |
| 17 | c->reply_sent = 0; |
| 18 | c->state = state; |
| 19 | - dprintf("sending reply: %.*s", len, line); |
| 20 | + dbgprintf("sending reply: %.*s", len, line); |
| 21 | } |
| 22 | |
| 23 | #define reply_msg(c,m) reply((c),(m),CONSTSTRLEN(m),STATE_SENDWORD) |
| 24 | @@ -382,10 +382,10 @@ next_eligible_job(usec now) |
| 25 | size_t i; |
| 26 | job j = NULL, candidate; |
| 27 | |
| 28 | - dprintf("tubes.used = %zu\n", tubes.used); |
| 29 | + dbgprintf("tubes.used = %zu\n", tubes.used); |
| 30 | for (i = 0; i < tubes.used; i++) { |
| 31 | t = tubes.items[i]; |
| 32 | - dprintf("for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n", |
| 33 | + dbgprintf("for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n", |
| 34 | t->name, t->waiting.used, t->ready.used, t->pause); |
| 35 | if (t->pause) { |
| 36 | if (t->deadline_at > now) continue; |
| 37 | @@ -395,7 +395,7 @@ next_eligible_job(usec now) |
| 38 | candidate = pq_peek(&t->ready); |
| 39 | if (!j || job_pri_cmp(candidate, j) < 0) j = candidate; |
| 40 | } |
| 41 | - dprintf("i = %zu, tubes.used = %zu\n", i, tubes.used); |
| 42 | + dbgprintf("i = %zu, tubes.used = %zu\n", i, tubes.used); |
| 43 | } |
| 44 | |
| 45 | return j; |
| 46 | @@ -407,9 +407,9 @@ process_queue() |
| 47 | job j; |
| 48 | usec now = now_usec(); |
| 49 | |
| 50 | - dprintf("processing queue\n"); |
| 51 | + dbgprintf("processing queue\n"); |
| 52 | while ((j = next_eligible_job(now))) { |
| 53 | - dprintf("got eligible job %llu in %s\n", j->id, j->tube->name); |
| 54 | + dbgprintf("got eligible job %llu in %s\n", j->id, j->tube->name); |
| 55 | j = pq_take(&j->tube->ready); |
| 56 | ready_ct--; |
| 57 | if (j->pri < URGENT_THRESHOLD) { |
| 58 | @@ -462,7 +462,7 @@ set_main_delay_timeout() |
| 59 | |
| 60 | if (j && (!deadline_at || j->deadline_at < deadline_at)) deadline_at = j->deadline_at; |
| 61 | |
| 62 | - dprintf("deadline_at=%" PRIu64 "\n", deadline_at); |
| 63 | + dbgprintf("deadline_at=%" PRIu64 "\n", deadline_at); |
| 64 | set_main_timeout(deadline_at); |
| 65 | } |
| 66 | |
| 67 | @@ -1178,7 +1178,7 @@ dispatch_cmd(conn c) |
| 68 | } |
| 69 | |
| 70 | type = which_cmd(c); |
| 71 | - dprintf("got %s command: \"%s\"\n", op_names[(int) type], c->cmd); |
| 72 | + dbgprintf("got %s command: \"%s\"\n", op_names[(int) type], c->cmd); |
| 73 | |
| 74 | switch (type) { |
| 75 | case OP_PUT: |
| 76 | @@ -1578,10 +1578,10 @@ h_conn_timeout(conn c) |
| 77 | } |
| 78 | |
| 79 | if (should_timeout) { |
| 80 | - dprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c)); |
| 81 | + dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c)); |
| 82 | return reply_msg(remove_waiting_conn(c), MSG_DEADLINE_SOON); |
| 83 | } else if (conn_waiting(c) && c->pending_timeout >= 0) { |
| 84 | - dprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c)); |
| 85 | + dbgprintf("conn_waiting(%p) = %d\n", c, conn_waiting(c)); |
| 86 | c->pending_timeout = -1; |
| 87 | return reply_msg(remove_waiting_conn(c), MSG_TIMED_OUT); |
| 88 | } |
| 89 | @@ -1773,7 +1773,7 @@ h_delay() |
| 90 | for (i = 0; i < tubes.used; i++) { |
| 91 | t = tubes.items[i]; |
| 92 | |
| 93 | - dprintf("h_delay for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n", |
| 94 | + dbgprintf("h_delay for %s t->waiting.used=%zu t->ready.used=%d t->pause=%" PRIu64 "\n", |
| 95 | t->name, t->waiting.used, t->ready.used, t->pause); |
| 96 | if (t->pause && t->deadline_at <= now) { |
| 97 | t->pause = 0; |
| 98 | @@ -1811,7 +1811,7 @@ h_accept(const int fd, const short which, struct event *ev) |
| 99 | c = make_conn(cfd, STATE_WANTCOMMAND, default_tube, default_tube); |
| 100 | if (!c) return twarnx("make_conn() failed"), close(cfd), brake(); |
| 101 | |
| 102 | - dprintf("accepted conn, fd=%d\n", cfd); |
| 103 | + dbgprintf("accepted conn, fd=%d\n", cfd); |
| 104 | r = conn_set_evq(c, EV_READ | EV_PERSIST, (evh) h_conn); |
| 105 | if (r == -1) return twarnx("conn_set_evq() failed"), close(cfd), brake(); |
| 106 | } |
| 107 | diff --git a/util.h b/util.h |
| 108 | index c6865fb..0034f1a 100644 |
| 109 | --- a/util.h |
| 110 | +++ b/util.h |
| 111 | @@ -43,9 +43,9 @@ extern char *progname; |
| 112 | __FILE__, __LINE__, __func__, ##args) |
| 113 | |
| 114 | #ifdef DEBUG |
| 115 | -#define dprintf(fmt, args...) ((void) fprintf(stderr, fmt, ##args)) |
| 116 | +#define dbgprintf(fmt, args...) ((void) fprintf(stderr, fmt, ##args)) |
| 117 | #else |
| 118 | -#define dprintf(fmt, ...) ((void) 0) |
| 119 | +#define dbgprintf(fmt, ...) ((void) 0) |
| 120 | #endif |
| 121 | |
| 122 | typedef uint64_t usec; |
| 123 | -- |
| 124 | 1.7.5.4 |
| 125 | |