summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-14 09:58:13 +0800
committerpiaip <piaip@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2009-09-14 09:58:13 +0800
commit31b9bab65b95c6ccabff24b90fa80dc3a8344122 (patch)
tree33a64e8cd2c1f253a690ce88fad87d255c83aff7
parent833d86de55341c2790a09d6770af1458d54fb0a6 (diff)
downloadpttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar.gz
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar.bz2
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar.lz
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar.xz
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.tar.zst
pttbbs-31b9bab65b95c6ccabff24b90fa80dc3a8344122.zip
* enable size tag in shm
git-svn-id: http://opensvn.csie.org/pttbbs/trunk/pttbbs@4842 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r--UPDATING4
-rw-r--r--common/bbs/cache.c6
-rw-r--r--include/pttstruct.h7
-rw-r--r--util/uhash_loader.c1
4 files changed, 14 insertions, 4 deletions
diff --git a/UPDATING b/UPDATING
index 863bf7ff..26967506 100644
--- a/UPDATING
+++ b/UPDATING
@@ -21,6 +21,10 @@ https://opensvn.csie.org/traccgi/pttbbs/changeset/2273
make r4826_numlogin
-----------------------------------------------------------------------------
+r4841: [shm size tag]
+由於站台設定變動後導致 SHM 大小不同 (eg, MAX_BOARDS) 然後有 utility 沒 build
+到的問題再次發生,所以我們開啟了 size check. 請重 build 所有程式並重開 SHM。
+
r4826: [numlogindays, lastseen]
numlogins 的算法有調整,並且改名為 numlogindays;
lastlogin 也多了一個叫 lastseen (別人 talk->query 到的值)
diff --git a/common/bbs/cache.c b/common/bbs/cache.c
index a23326bd..e224e5f4 100644
--- a/common/bbs/cache.c
+++ b/common/bbs/cache.c
@@ -104,6 +104,12 @@ attach_SHM(void)
"or use ipcrm(1) command to clean share memory.\n");
exit(1);
}
+ if(SHM->size != sizeof(SHM_t)) {
+ fprintf(stderr, "Error: SHM->size(%d) != sizeof(SHM_t)(%d)\n", SHM->size, sizeof(SHM_t));
+ fprintf(stderr, "Please use the configuration corresponding to SHM,\n"
+ "or use ipcrm(1) command to clean share memory.\n");
+ exit(1);
+ }
if (!SHM->loaded) /* (uhash) assume fresh shared memory is
* zeroed */
exit(1);
diff --git a/include/pttstruct.h b/include/pttstruct.h
index e9453f5a..6b76a965 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -482,13 +482,12 @@ typedef struct keeploc_t {
// TODO
// 哪天請好心人整理 shm:
-// (1) 增加 shmsize
// (2) userinfo_t 可以移掉一些已不用的
-#define SHM_VERSION 3276
+#define SHM_VERSION 4842
typedef struct {
- int version;
- // int shmsize; // TODO add this: sizeof(SHM_t), for verification
+ int version; // SHM_VERSION for verification
+ int size; // sizeof(SHM_t) for verification
/* uhash */
/* uhash is a userid->uid hash table -- jochang */
diff --git a/util/uhash_loader.c b/util/uhash_loader.c
index 8696b3c4..4fac0b21 100644
--- a/util/uhash_loader.c
+++ b/util/uhash_loader.c
@@ -45,6 +45,7 @@ void load_uhash(void) {
if( err != EEXIST ) {
SHM->number=SHM->loaded = 0;
SHM->version = SHM_VERSION;
+ SHM->size = sizeof(SHM_t);
}
if(SHM->version != SHM_VERSION) {