diff options
author | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2010-02-25 07:49:54 +0000 |
---|---|---|
committer | Pierre-Yves Ritschard <pyr@cvs.openbsd.org> | 2010-02-25 07:49:54 +0000 |
commit | 6785875505e59b5c2e05ef2bb51896ca41677048 (patch) | |
tree | 90f3dff7d698f9978b2cb116f2844949f8101b37 /usr.sbin/httpd | |
parent | ad386c2ad266f519dcc597e40db025a3353caeab (diff) |
fix some fallout from the >2G commit. namely allow for all byte counters to
report the correct size when it exceeds a long's capacity.
From Dan Harnett <daniel @ harnett . name>
Diffstat (limited to 'usr.sbin/httpd')
-rw-r--r-- | usr.sbin/httpd/src/include/buff.h | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/src/include/httpd.h | 4 | ||||
-rw-r--r-- | usr.sbin/httpd/src/include/scoreboard.h | 8 | ||||
-rw-r--r-- | usr.sbin/httpd/src/main/buff.c | 16 | ||||
-rw-r--r-- | usr.sbin/httpd/src/main/http_main.c | 14 | ||||
-rw-r--r-- | usr.sbin/httpd/src/main/http_protocol.c | 8 | ||||
-rw-r--r-- | usr.sbin/httpd/src/modules/proxy/proxy_cache.c | 2 | ||||
-rw-r--r-- | usr.sbin/httpd/src/modules/standard/mod_log_config.c | 10 | ||||
-rw-r--r-- | usr.sbin/httpd/src/modules/standard/mod_status.c | 4 |
9 files changed, 35 insertions, 35 deletions
diff --git a/usr.sbin/httpd/src/include/buff.h b/usr.sbin/httpd/src/include/buff.h index 3a2b5a5d7dd..8fd8ff47702 100644 --- a/usr.sbin/httpd/src/include/buff.h +++ b/usr.sbin/httpd/src/include/buff.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buff.h,v 1.12 2005/03/28 23:26:51 niallo Exp $ */ +/* $OpenBSD: buff.h,v 1.13 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -105,7 +105,7 @@ struct buff_struct { int bufsiz; void (*error) (BUFF *fb, int op, void *data); void *error_data; - long int bytes_sent; /* number of bytes actually written */ + off_t bytes_sent; /* number of bytes actually written */ ap_pool *pool; diff --git a/usr.sbin/httpd/src/include/httpd.h b/usr.sbin/httpd/src/include/httpd.h index bfcdc5d1038..3d682b339e5 100644 --- a/usr.sbin/httpd/src/include/httpd.h +++ b/usr.sbin/httpd/src/include/httpd.h @@ -1,4 +1,4 @@ -/* $OpenBSD: httpd.h,v 1.29 2009/06/02 23:36:40 pyr Exp $ */ +/* $OpenBSD: httpd.h,v 1.30 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -735,7 +735,7 @@ struct request_rec { int allowed; /* Allowed methods - for 405, OPTIONS, etc */ int sent_bodyct; /* byte count in stream is for body */ - long bytes_sent; /* body byte count, for easy access */ + off_t bytes_sent; /* body byte count, for easy access */ time_t mtime; /* Time the resource was last modified */ /* HTTP/1.1 connection-level features */ diff --git a/usr.sbin/httpd/src/include/scoreboard.h b/usr.sbin/httpd/src/include/scoreboard.h index ad9535fbe86..ff12aab3772 100644 --- a/usr.sbin/httpd/src/include/scoreboard.h +++ b/usr.sbin/httpd/src/include/scoreboard.h @@ -1,4 +1,4 @@ -/* $OpenBSD: scoreboard.h,v 1.12 2006/03/22 13:19:19 ray Exp $ */ +/* $OpenBSD: scoreboard.h,v 1.13 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -132,10 +132,10 @@ typedef struct { unsigned short timeout_len; /* length of the timeout */ unsigned char status; unsigned long access_count; - unsigned long bytes_served; + unsigned long long bytes_served; unsigned long my_access_count; - unsigned long my_bytes_served; - unsigned long conn_bytes; + unsigned long long my_bytes_served; + unsigned long long conn_bytes; unsigned short conn_count; struct timeval start_time; struct timeval stop_time; diff --git a/usr.sbin/httpd/src/main/buff.c b/usr.sbin/httpd/src/main/buff.c index da90327eed5..91174f5f324 100644 --- a/usr.sbin/httpd/src/main/buff.c +++ b/usr.sbin/httpd/src/main/buff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buff.c,v 1.20 2008/05/15 06:05:43 mbalmer Exp $ */ +/* $OpenBSD: buff.c,v 1.21 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -209,7 +209,7 @@ ap_bcreate(pool *p, int flags) fb->outcnt = 0; fb->outchunk = -1; fb->error = NULL; - fb->bytes_sent = 0L; + fb->bytes_sent = 0LL; fb->fd = -1; fb->fd_in = -1; @@ -236,8 +236,8 @@ API_EXPORT(int) ap_bsetopt(BUFF *fb, int optname, const void *optval) { if (optname == BO_BYTECT) { - fb->bytes_sent = *(const long int *)optval - - (long int)fb->outcnt; + fb->bytes_sent = *(off_t *)optval - + (off_t)fb->outcnt; return 0; } else { @@ -250,10 +250,10 @@ API_EXPORT(int) ap_bgetopt(BUFF *fb, int optname, void *optval) { if (optname == BO_BYTECT) { - long int bs = fb->bytes_sent + fb->outcnt; - if (bs < 0L) - bs = 0L; - *(long int *)optval = bs; + off_t bs = fb->bytes_sent + fb->outcnt; + if (bs < 0LL) + bs = 0LL; + *(off_t *)optval = bs; return 0; } else { diff --git a/usr.sbin/httpd/src/main/http_main.c b/usr.sbin/httpd/src/main/http_main.c index bff720f88fa..2f55ee413f5 100644 --- a/usr.sbin/httpd/src/main/http_main.c +++ b/usr.sbin/httpd/src/main/http_main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_main.c,v 1.53 2008/12/02 17:55:35 sthen Exp $ */ +/* $OpenBSD: http_main.c,v 1.54 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -1244,10 +1244,10 @@ API_EXPORT(int) ap_update_child_status(int child_num, int status, request_rec *r */ if (status == SERVER_DEAD) { ss->my_access_count = 0L; - ss->my_bytes_served = 0L; + ss->my_bytes_served = 0ULL; } ss->conn_count = (unsigned short) 0; - ss->conn_bytes = (unsigned long) 0; + ss->conn_bytes = 0ULL; } else if (status == SERVER_STARTING) { /* clean out the start_time so that mod_status will print Req=0 */ @@ -1309,7 +1309,7 @@ void ap_time_process_request(int child_num, int status) static void increment_counts(int child_num, request_rec *r) { - long int bs = 0; + off_t bs = 0; short_score *ss; ss = &ap_scoreboard_image->servers[child_num]; @@ -1321,9 +1321,9 @@ static void increment_counts(int child_num, request_rec *r) ss->access_count++; ss->my_access_count++; ss->conn_count++; - ss->bytes_served += (unsigned long) bs; - ss->my_bytes_served += (unsigned long) bs; - ss->conn_bytes += (unsigned long) bs; + ss->bytes_served += bs; + ss->my_bytes_served += bs; + ss->conn_bytes += bs; } static int find_child_by_pid(int pid) diff --git a/usr.sbin/httpd/src/main/http_protocol.c b/usr.sbin/httpd/src/main/http_protocol.c index 429613078dd..2ddd8c997a5 100644 --- a/usr.sbin/httpd/src/main/http_protocol.c +++ b/usr.sbin/httpd/src/main/http_protocol.c @@ -1,4 +1,4 @@ -/* $OpenBSD: http_protocol.c,v 1.36 2010/02/23 08:15:27 pyr Exp $ */ +/* $OpenBSD: http_protocol.c,v 1.37 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -1582,7 +1582,7 @@ API_EXPORT(void) ap_basic_http_header(request_rec *r) */ static void terminate_header(BUFF *client) { - long int bs; + off_t bs; ap_bgetopt(client, BO_BYTECT, &bs); if (bs >= 255 && bs <= 257) @@ -1645,7 +1645,7 @@ API_EXPORT(int) ap_send_http_trace(request_rec *r) API_EXPORT(int) ap_send_http_options(request_rec *r) { - const long int zero = 0L; + const off_t zero = 0LL; if (r->assbackwards) return DECLINED; @@ -1765,7 +1765,7 @@ static void fixup_vary(request_rec *r) API_EXPORT(void) ap_send_http_header(request_rec *r) { int i; - const long int zero = 0L; + const off_t zero = 0LL; if (r->assbackwards) { if (!r->main) diff --git a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c index 46cded628a6..75eb0094294 100644 --- a/usr.sbin/httpd/src/modules/proxy/proxy_cache.c +++ b/usr.sbin/httpd/src/modules/proxy/proxy_cache.c @@ -1576,7 +1576,7 @@ int ap_proxy_cache_update(cache_req *c, table *resp_hdrs, void ap_proxy_cache_tidy(cache_req *c) { server_rec *s; - long int bc; + off_t bc; if (!c || !c->fp) return; diff --git a/usr.sbin/httpd/src/modules/standard/mod_log_config.c b/usr.sbin/httpd/src/modules/standard/mod_log_config.c index e8898a483a3..74ae4281a95 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_log_config.c +++ b/usr.sbin/httpd/src/modules/standard/mod_log_config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: mod_log_config.c,v 1.18 2008/10/03 19:36:36 mbalmer Exp $ */ +/* $OpenBSD: mod_log_config.c,v 1.19 2010/02/25 07:49:53 pyr Exp $ */ /* ==================================================================== * The Apache Software License, Version 1.1 @@ -385,9 +385,9 @@ clf_log_bytes_sent(request_rec *r, char *a) if (!r->sent_bodyct) return "-"; else { - long int bs; + off_t bs; ap_bgetopt(r->connection->client, BO_BYTECT, &bs); - return ap_psprintf(r->pool, "%ld", bs); + return ap_psprintf(r->pool, "%qd", bs); } } @@ -397,9 +397,9 @@ log_bytes_sent(request_rec *r, char *a) if (!r->sent_bodyct) return "0"; else { - long int bs; + off_t bs; ap_bgetopt(r->connection->client, BO_BYTECT, &bs); - return ap_psprintf(r->pool, "%ld", bs); + return ap_psprintf(r->pool, "%qd", bs); } } diff --git a/usr.sbin/httpd/src/modules/standard/mod_status.c b/usr.sbin/httpd/src/modules/standard/mod_status.c index 6159b7683cf..6f1a897934f 100644 --- a/usr.sbin/httpd/src/modules/standard/mod_status.c +++ b/usr.sbin/httpd/src/modules/standard/mod_status.c @@ -218,8 +218,8 @@ static int status_handler(request_rec *r) int ready = 0; int busy = 0; unsigned long count = 0; - unsigned long lres, bytes; - unsigned long my_lres, my_bytes, conn_bytes; + unsigned long lres, my_lres; + unsigned long long bytes, my_bytes, conn_bytes; unsigned short conn_lres; unsigned long bcount = 0; unsigned long kbcount = 0; |