summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 05:35:23 +0800
committerin2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204>2002-06-07 05:35:23 +0800
commite8fc08b9800ba86163e5bf43469cdc9f4b478b13 (patch)
treeeb2dcd75cad19ac57b7e9d9cc29c63a850d8ad86 /include
parentc0a6419aeceaeb93d5d9ccde393236d67ff8c72f (diff)
downloadpttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.gz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.bz2
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.lz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.xz
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.tar.zst
pttbbs-e8fc08b9800ba86163e5bf43469cdc9f4b478b13.zip
only one shared memory
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk/pttbbs@296 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
Diffstat (limited to 'include')
-rw-r--r--include/bbs.h2
-rw-r--r--include/config.h5
-rw-r--r--include/proto.h8
-rw-r--r--include/pttstruct.h117
4 files changed, 72 insertions, 60 deletions
diff --git a/include/bbs.h b/include/bbs.h
index 5d1469f9..7d2ef8d1 100644
--- a/include/bbs.h
+++ b/include/bbs.h
@@ -26,9 +26,9 @@
#include <arpa/inet.h>
#include <arpa/telnet.h>
#include <sys/types.h>
+#include <dirent.h>
#include <sys/mman.h>
#include <machine/param.h>
-#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/sem.h>
diff --git a/include/config.h b/include/config.h
index edec26dd..971c84be 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1,4 +1,4 @@
-/* $Id: config.h,v 1.4 2002/06/04 13:07:12 in2 Exp $ */
+/* $Id: config.h,v 1.5 2002/06/06 21:34:09 in2 Exp $ */
#ifndef INCLUDE_CONFIG_H
#define INCLUDE_CONFIG_H
@@ -168,11 +168,14 @@
#define MAGIC_KEY 1234 /* 身分認證信函編碼 */
+#define SHM_KEY 1228
+#if 0
#define BRDSHM_KEY 1208
#define UHASH_KEY 1218 /* userid->uid hash */
#define UTMPSHM_KEY 2221
#define PTTSHM_KEY 1220 /* 動態看版 , 節日 */
#define FROMSHM_KEY 1223 /* whereis, 最多使用者 */
+#endif
#define BRDSEM_KEY 2005 /* semaphore key */
#define PTTSEM_KEY 2000 /* semaphore key */
diff --git a/include/proto.h b/include/proto.h
index 7d8d886f..ee32cd2d 100644
--- a/include/proto.h
+++ b/include/proto.h
@@ -1,4 +1,4 @@
-/* $Id: proto.h,v 1.20 2002/06/04 13:07:12 in2 Exp $ */
+/* $Id: proto.h,v 1.21 2002/06/06 21:34:09 in2 Exp $ */
#ifndef INCLUDE_PROTO_H
#define INCLUDE_PROTO_H
@@ -115,6 +115,9 @@ int mdcacheopen(char *fpath);
void touchdircache(int bid);
int get_fileheader_cache(int bid, char *direct, fileheader_t *headers,
int recbase, int nlines);
+void *attach_shm(int shmkey, int shmsize);
+void attach_SHM(void);
+
/* cal */
int give_tax(int money);
int vice(int money, char* item);
@@ -559,4 +562,7 @@ int calendar();
/* util */
void touchbtotal(int bid);
+
+/* util_cache.c */
+void reload_pttcache(void);
#endif
diff --git a/include/pttstruct.h b/include/pttstruct.h
index 91a0d036..a9c4db57 100644
--- a/include/pttstruct.h
+++ b/include/pttstruct.h
@@ -1,4 +1,4 @@
-/* $Id: pttstruct.h,v 1.13 2002/06/04 13:07:12 in2 Exp $ */
+/* $Id: pttstruct.h,v 1.14 2002/06/06 21:34:09 in2 Exp $ */
#ifndef INCLUDE_STRUCT_H
#define INCLUDE_STRUCT_H
@@ -165,12 +165,6 @@ typedef struct fileheader_t {
#define HASH_BITS 16
typedef struct uhash_t {
- char userid[MAX_USERS][IDLEN + 1];
- int next_in_hash[MAX_USERS];
- int money[MAX_USERS];
- int hash_head[1 << HASH_BITS];
- int number; /* # of users total */
- int loaded; /* .PASSWD has been loaded? */
} uhash_t;
union xitem_t {
@@ -291,20 +285,6 @@ typedef struct crosspost_t {
#define SORT_BY_FIVE 4
#define SORT_BY_SEX 5
-typedef struct bcache_t {
- boardheader_t bcache[MAX_BOARD];
- boardheader_t *sorted[2][MAX_BOARD]; /* 0: by name 1: by class */
- fileheader_t dircache[MAX_BOARD][DIRCACHESIZE];
- time_t busystate_b[MAX_BOARD];
- int total[MAX_BOARD];
- int hbfl[MAX_BOARD][MAX_FRIEND + 1];
- time_t lastposttime[MAX_BOARD];
- time_t uptime;
- time_t touchtime;
- int number;
- int busystate;
-} bcache_t;
-
typedef struct keeploc_t {
char *key;
int top_ln;
@@ -314,42 +294,65 @@ typedef struct keeploc_t {
#define USHM_SIZE (MAX_ACTIVE + 4) /* why+4? */
-struct utmpfile_t {
- userinfo_t uinfo[USHM_SIZE];
- userinfo_t *sorted[2][8][USHM_SIZE];
- /* 第一維double buffer 由currsorted指向目前使用的
- 第二維sort type */
- int currsorted;
- time_t uptime;
- int number;
- int busystate;
-};
-
-struct pttcache_t {
- char notes[MAX_MOVIE][200*11];
- char today_is[20];
- int n_notes[MAX_MOVIE_SECTION]; /* 一節中有幾個 看板 */
- int next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */
- int max_film;
- int max_history;
- time_t uptime;
- time_t touchtime;
- int busystate;
-
- int GLOBALVAR[10]; /* mbbsd間的 global variable
- 用以做統計等資料 (非常態) */
-};
-
-typedef struct fromcache_t {
- char domain[MAX_FROM][50];
- char replace[MAX_FROM][50];
- int top;
- int max_user;
- time_t max_time;
- time_t uptime;
- time_t touchtime;
- int busystate;
-} fromcache_t;
+typedef struct {
+ /* uhash */
+ char userid[MAX_USERS][IDLEN + 1];
+ int next_in_hash[MAX_USERS];
+ int money[MAX_USERS];
+ int hash_head[1 << HASH_BITS];
+ int number; /* # of users total */
+ int loaded; /* .PASSWD has been loaded? */
+
+ /* utmpshm */
+ userinfo_t uinfo[USHM_SIZE];
+ userinfo_t *sorted[2][8][USHM_SIZE];
+ /* 第一維double buffer 由currsorted指向目前使用的
+ 第二維sort type */
+ int currsorted;
+ time_t UTMPuptime;
+ int UTMPnumber;
+ int UTMPbusystate;
+
+ char gap[1024]; /* avoid some memory error / buffer overflow */
+ /* brdshm */
+ boardheader_t bcache[MAX_BOARD];
+ boardheader_t *bsorted[2][MAX_BOARD]; /* 0: by name 1: by class */
+ fileheader_t dircache[MAX_BOARD][DIRCACHESIZE];
+ time_t busystate_b[MAX_BOARD];
+ int total[MAX_BOARD];
+ int hbfl[MAX_BOARD][MAX_FRIEND + 1];
+ time_t lastposttime[MAX_BOARD];
+ time_t Buptime;
+ time_t Btouchtime;
+ int Bnumber;
+ int Bbusystate;
+
+ char gap2[1024]; /* avoid some memory error / buffer overflow */
+ /* pttcache */
+ char notes[MAX_MOVIE][200*11];
+ char today_is[20];
+ int n_notes[MAX_MOVIE_SECTION]; /* 一節中有幾個 看板 */
+ int next_refresh[MAX_MOVIE_SECTION]; /* 下一次要refresh的 看板 */
+ int max_film;
+ int max_history;
+ time_t Puptime;
+ time_t Ptouchtime;
+ int Pbusystate;
+
+ int GLOBALVAR[10]; /* mbbsd間的 global variable
+ 用以做統計等資料 (非常態) */
+
+ char gap3[1024]; /* avoid some memory error / buffer overflow */
+ /* fromcache */
+ char domain[MAX_FROM][50];
+ char replace[MAX_FROM][50];
+ int top;
+ int max_user;
+ time_t max_time;
+ time_t Fuptime;
+ time_t Ftouchtime;
+ int Fbusystate;
+} SHM_t;
typedef struct {
unsigned char oldlen; /* previous line length */