Ver Fonte

- fixed mmap

Andrei Pelinescu-Onciul há 24 anos atrás
pai
commit
454ef89a50
4 ficheiros alterados com 6 adições e 5 exclusões
  1. 2 2
      Makefile.defs
  2. 2 2
      shm_mem.c
  3. 1 1
      t_debug.cfg
  4. 1 0
      timer.c

+ 2 - 2
Makefile.defs

@@ -45,8 +45,8 @@ ARCH = $(shell uname -s)
 #		twice, trying to free a pointer alloc'ed with a different
 #		malloc etc.)
 DEFS= -DNAME='"$(NAME)"' -DVERSION='"$(RELEASE)"' -DARCH='"$(ARCH)"' \
-	 -DDNS_IP_HACK  -DSHM_MEM -DSHM_MMAP\
-	 -DPKG_MALLOC -DNO_DEBUG #-DDBG_QM_MALLOC 
+	 -DDNS_IP_HACK  -DPKG_MALLOC -DSHM_MEM  -DSHM_MMAP \
+	 -DNO_DEBUG #-DDBG_QM_MALLOC 
 #-DEXTRA_DEBUG
 # -DUSE_SHM_MEM
 #-DNO_DEBUG 

+ 2 - 2
shm_mem.c

@@ -65,13 +65,13 @@ int shm_mem_init()
 	}
 	
 #ifdef SHM_MMAP
-	fd=open("/dev/zero", O_RDONLY);
+	fd=open("/dev/zero", O_RDWR);
 	if (fd==-1){
 		LOG(L_CRIT, "ERROR: shm_mem_init: could not open /dev/zero: %s\n",
 				strerror(errno));
 		return -1;
 	}
-	shm_mempool=mmap(0, SHM_MEM_SIZE, PROT_READ|PROT_WRITE, MAP_PRIVATE,
+	shm_mempool=mmap(0, SHM_MEM_SIZE, PROT_READ|PROT_WRITE, MAP_SHARED,
 						fd ,0);
 	/* close /dev/zero */
 	close(fd);

+ 1 - 1
t_debug.cfg

@@ -2,7 +2,7 @@ debug=3          # debug level (cmd line: -dddddddddd)
 check_via=yes     # (cmd. line: -v)
 dns=on           # (cmd. line: -r)
 rev_dns=yes      # (cmd. line: -R)
-fork=yes          # (cmd. line: -D)
+fork=no	         # (cmd. line: -D)
 children=4
 log_stderror=yes # (cmd line: -E)
 #port=5080

+ 1 - 0
timer.c

@@ -108,5 +108,6 @@ unsigned int get_ticks()
 			", returning 0 (probably wrong)");
 	return 0;
 #endif
+	DBG("- get_ticks:returning %d\n", *jiffies);
 	return *jiffies;
 }