diff options
author | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-05 03:46:16 +0800 |
---|---|---|
committer | in2 <in2@63ad8ddf-47c3-0310-b6dd-a9e9d9715204> | 2002-07-05 03:46:16 +0800 |
commit | 72199b0c7909510d40b68afdc538ff535dff4939 (patch) | |
tree | ba5b7534a5675ddaca9bed681c52a67e6a8f4642 | |
parent | 11d6ed75c8a8ccdef78727e8c3748fabe7ee7015 (diff) | |
download | pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar.gz pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar.bz2 pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar.lz pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar.xz pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.tar.zst pttbbs-72199b0c7909510d40b68afdc538ff535dff4939.zip |
remove mmap
git-svn-id: http://opensvn.csie.org/pttbbs/pttbbs/trunk@411 63ad8ddf-47c3-0310-b6dd-a9e9d9715204
-rw-r--r-- | pttbbs/include/proto.h | 4 | ||||
-rw-r--r-- | pttbbs/mbbsd/cache.c | 19 | ||||
-rw-r--r-- | pttbbs/mbbsd/mbbsd.c | 6 | ||||
-rw-r--r-- | pttbbs/mbbsd/passwd.c | 4 |
4 files changed, 8 insertions, 25 deletions
diff --git a/pttbbs/include/proto.h b/pttbbs/include/proto.h index 2f916219..5e3d8f91 100644 --- a/pttbbs/include/proto.h +++ b/pttbbs/include/proto.h @@ -1,4 +1,4 @@ -/* $Id: proto.h,v 1.23 2002/06/26 09:51:33 ptt Exp $ */ +/* $Id: proto.h,v 1.24 2002/07/04 19:46:14 in2 Exp $ */ #ifndef INCLUDE_PROTO_H #define INCLUDE_PROTO_H @@ -550,7 +550,7 @@ int Goodbye(); unsigned StringHash(unsigned char *s); /* passwd */ -int passwd_mmap(); +int passwd_init(); int passwd_update(int num, userec_t *buf); int passwd_query(int num, userec_t *buf); int passwd_apply(int (*fptr)(userec_t *)); diff --git a/pttbbs/mbbsd/cache.c b/pttbbs/mbbsd/cache.c index 9b14eb8a..206b39e3 100644 --- a/pttbbs/mbbsd/cache.c +++ b/pttbbs/mbbsd/cache.c @@ -1,4 +1,4 @@ -/* $Id: cache.c,v 1.39 2002/06/26 01:55:30 in2 Exp $ */ +/* $Id: cache.c,v 1.40 2002/07/04 19:46:16 in2 Exp $ */ #include "bbs.h" #ifndef __FreeBSD__ @@ -56,19 +56,6 @@ void *attach_shm(int shmkey, int shmsize) { void *shmptr; int shmid; - char *empty_addr; - /* set up one page in-accessible -- jochang */ - { - int fd = open("/dev/zero",O_RDONLY); - int size = ((shmsize + 4095) / 4096) * 4096; - - munmap( - (empty_addr=mmap(0,4096+size,PROT_NONE,MAP_PRIVATE,fd,0))+4096 - ,size); - - close(fd); - } - shmid = shmget(shmkey, shmsize, 0); if(shmid < 0) { shmid = shmget(shmkey, shmsize, IPC_CREAT | 0600); @@ -83,10 +70,6 @@ void *attach_shm(int shmkey, int shmsize) { attach_err(shmkey, "shmat"); } - /* unmap the page -- jochang */ - { - munmap(empty_addr,4096); - } return shmptr; } diff --git a/pttbbs/mbbsd/mbbsd.c b/pttbbs/mbbsd/mbbsd.c index 2b33fc2c..ae560338 100644 --- a/pttbbs/mbbsd/mbbsd.c +++ b/pttbbs/mbbsd/mbbsd.c @@ -1,4 +1,4 @@ -/* $Id: mbbsd.c,v 1.36 2002/06/30 14:33:14 in2 Exp $ */ +/* $Id: mbbsd.c,v 1.37 2002/07/04 19:46:16 in2 Exp $ */ #include "bbs.h" #define SOCKET_QLEN 4 @@ -956,8 +956,8 @@ start_client () dup2 (0, 1); - /* mmap passwd file */ - if (passwd_mmap ()) + /* initialize passwd semaphores */ + if( passwd_init() ) exit (1); do_term_init (); diff --git a/pttbbs/mbbsd/passwd.c b/pttbbs/mbbsd/passwd.c index 4291fa3e..06a26d32 100644 --- a/pttbbs/mbbsd/passwd.c +++ b/pttbbs/mbbsd/passwd.c @@ -1,4 +1,4 @@ -/* $Id: passwd.c,v 1.5 2002/07/02 19:17:31 in2 Exp $ */ +/* $Id: passwd.c,v 1.6 2002/07/04 19:46:16 in2 Exp $ */ #include "bbs.h" static int semid = -1; @@ -20,7 +20,7 @@ union semun { }; #endif -int passwd_mmap() { +int passwd_init() { semid = semget(PASSWDSEM_KEY, 1, SEM_R | SEM_A | IPC_CREAT | IPC_EXCL); if(semid == -1) { if(errno == EEXIST) { |