Fossil SCM

Enable large-file support for stat() on linux. Fix the "stat" webpage to handle repositories larger than 2GB. Ticket [b1934313bcfb3a90d4027b]

drh 2010-09-18 22:22 trunk
Commit 31fdc347aceb975e9ebcd7687250326f3b52d5ec
2 files changed +10 +4 -3
+10
--- src/config.h
+++ src/config.h
@@ -15,10 +15,20 @@
1515
**
1616
*******************************************************************************
1717
**
1818
** A common header file used by all modules.
1919
*/
20
+
21
+/* The following macros are necessary for large-file support under
22
+** some linux distributions, and possibly other unixes as well.
23
+*/
24
+#define _LARGE_FILE 1
25
+#ifndef _FILE_OFFSET_BITS
26
+# define _FILE_OFFSET_BITS 64
27
+#endif
28
+#define _LARGEFILE_SOURCE 1
29
+
2030
2131
/*
2232
** System header files used by all modules
2333
*/
2434
#include <unistd.h>
2535
--- src/config.h
+++ src/config.h
@@ -15,10 +15,20 @@
15 **
16 *******************************************************************************
17 **
18 ** A common header file used by all modules.
19 */
 
 
 
 
 
 
 
 
 
 
20
21 /*
22 ** System header files used by all modules
23 */
24 #include <unistd.h>
25
--- src/config.h
+++ src/config.h
@@ -15,10 +15,20 @@
15 **
16 *******************************************************************************
17 **
18 ** A common header file used by all modules.
19 */
20
21 /* The following macros are necessary for large-file support under
22 ** some linux distributions, and possibly other unixes as well.
23 */
24 #define _LARGE_FILE 1
25 #ifndef _FILE_OFFSET_BITS
26 # define _FILE_OFFSET_BITS 64
27 #endif
28 #define _LARGEFILE_SOURCE 1
29
30
31 /*
32 ** System header files used by all modules
33 */
34 #include <unistd.h>
35
+4 -3
--- src/stat.c
+++ src/stat.c
@@ -26,22 +26,23 @@
2626
** WEBPAGE: stat
2727
**
2828
** Show statistics and global information about the repository.
2929
*/
3030
void stat_page(void){
31
- i64 t;
32
- int n, m, fsize;
31
+ i64 t, fsize;
32
+ int n, m;
3333
int szMax, szAvg;
3434
char zBuf[100];
3535
3636
login_check_credentials();
3737
if( !g.okRead ){ login_needed(); return; }
3838
style_header("Repository Statistics");
3939
@ <table class="label-value">
4040
@ <tr><th>Repository&nbsp;Size:</th><td>
4141
fsize = file_size(g.zRepositoryName);
42
- @ %d(fsize) bytes
42
+ sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", fsize);
43
+ @ %s(zBuf) bytes
4344
@ </td></tr>
4445
@ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
4546
n = db_int(0, "SELECT count(*) FROM blob");
4647
m = db_int(0, "SELECT count(*) FROM delta");
4748
@ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
4849
--- src/stat.c
+++ src/stat.c
@@ -26,22 +26,23 @@
26 ** WEBPAGE: stat
27 **
28 ** Show statistics and global information about the repository.
29 */
30 void stat_page(void){
31 i64 t;
32 int n, m, fsize;
33 int szMax, szAvg;
34 char zBuf[100];
35
36 login_check_credentials();
37 if( !g.okRead ){ login_needed(); return; }
38 style_header("Repository Statistics");
39 @ <table class="label-value">
40 @ <tr><th>Repository&nbsp;Size:</th><td>
41 fsize = file_size(g.zRepositoryName);
42 @ %d(fsize) bytes
 
43 @ </td></tr>
44 @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
45 n = db_int(0, "SELECT count(*) FROM blob");
46 m = db_int(0, "SELECT count(*) FROM delta");
47 @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
48
--- src/stat.c
+++ src/stat.c
@@ -26,22 +26,23 @@
26 ** WEBPAGE: stat
27 **
28 ** Show statistics and global information about the repository.
29 */
30 void stat_page(void){
31 i64 t, fsize;
32 int n, m;
33 int szMax, szAvg;
34 char zBuf[100];
35
36 login_check_credentials();
37 if( !g.okRead ){ login_needed(); return; }
38 style_header("Repository Statistics");
39 @ <table class="label-value">
40 @ <tr><th>Repository&nbsp;Size:</th><td>
41 fsize = file_size(g.zRepositoryName);
42 sqlite3_snprintf(sizeof(zBuf), zBuf, "%lld", fsize);
43 @ %s(zBuf) bytes
44 @ </td></tr>
45 @ <tr><th>Number&nbsp;Of&nbsp;Artifacts:</th><td>
46 n = db_int(0, "SELECT count(*) FROM blob");
47 m = db_int(0, "SELECT count(*) FROM delta");
48 @ %d(n) (stored as %d(n-m) full text and %d(m) delta blobs)
49

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button