]> git.pld-linux.org Git - packages/c-icap.git/commitdiff
- 64 bit alignment patch taken from Debian
authorhawk <hawk@pld-linux.org>
Fri, 18 Mar 2011 14:20:40 +0000 (14:20 +0000)
committercvs2git <feedback@pld-linux.org>
Sun, 24 Jun 2012 12:13:13 +0000 (12:13 +0000)
Changed files:
    c-icap-align-64bit.patch -> 1.1

c-icap-align-64bit.patch [new file with mode: 0644]

diff --git a/c-icap-align-64bit.patch b/c-icap-align-64bit.patch
new file mode 100644 (file)
index 0000000..dfc2f0a
--- /dev/null
@@ -0,0 +1,50 @@
+Align 64 Bit Patch
+--- a/stats.c
++++ b/stats.c
+@@ -29,10 +29,11 @@
+ struct stat_area *STATS = NULL;
+ #define STEP 128
++#define ALIGN64(val) ((val+7)&~7)
+ int ci_stat_memblock_size(void)
+ {
+-   return sizeof(struct stat_memblock)+STAT_INT64.entries_num*sizeof(uint64_t)+STAT_KBS.entries_num*sizeof(kbs_t);
++   return ALIGN64(sizeof(struct stat_memblock))+STAT_INT64.entries_num*sizeof(uint64_t)+STAT_KBS.entries_num*sizeof(kbs_t);
+ }
+ int stat_entry_by_name(struct stat_entry_list *list, const char *label);
+@@ -202,8 +203,8 @@
+      ci_thread_mutex_init(&(area->mtx));
+      area->mem_block = mem_block;
+      area->release_mem = release_mem;
+-     area->mem_block->counters64 = mem_block + sizeof(struct stat_memblock);
+-     area->mem_block->counterskbs = mem_block + sizeof(struct stat_memblock) + STAT_INT64.entries_num*sizeof(uint64_t);
++     area->mem_block->counters64 = mem_block + ALIGN64(sizeof(struct stat_memblock));
++     area->mem_block->counterskbs = mem_block + ALIGN64(sizeof(struct stat_memblock)) + STAT_INT64.entries_num*sizeof(uint64_t);
+      area->mem_block->counters64_size =  STAT_INT64.entries_num;
+      area->mem_block->counterskbs_size = STAT_KBS.entries_num;
+      ci_stat_area_reset(area);
+@@ -267,17 +268,17 @@
+      assert(mem_block->sig == MEMBLOCK_SIG);
+      mem_block->counters64_size =  STAT_INT64.entries_num;
+      mem_block->counterskbs_size = STAT_KBS.entries_num;
+-     mem_block->counters64 = (void *)mem_block + sizeof(struct stat_memblock);
+-     mem_block->counterskbs = (void *)mem_block + sizeof(struct stat_memblock)
+-                              + mem_block->counters64_size*sizeof(uint64_t);
++     mem_block->counters64 = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock));
++     mem_block->counterskbs = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock))
++                               + mem_block->counters64_size*sizeof(uint64_t);
+ }
+ /*Reconstruct a memblock which is located to a continues memory block*/
+ void stat_memblock_reconstruct(struct stat_memblock *mem_block)
+ {
+      assert(mem_block->sig == MEMBLOCK_SIG);
+-     mem_block->counters64 = (void *)mem_block + sizeof(struct stat_memblock);
+-     mem_block->counterskbs = (void *)mem_block + sizeof(struct stat_memblock)
++     mem_block->counters64 = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock));
++     mem_block->counterskbs = (void *)mem_block + ALIGN64(sizeof(struct stat_memblock))
+                               + mem_block->counters64_size*sizeof(uint64_t);
+ }
This page took 0.106857 seconds and 4 git commands to generate.