summaryrefslogtreecommitdiff
path: root/src/lib/shm_du_map.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-06 02:45:17 +0200
committerdimitri staessens <dimitri.staessens@intec.ugent.be>2016-08-06 02:51:53 +0200
commitd2cd2e05bb6e7e92fc6fadaa318ec37c8b3e062b (patch)
treeac331f1014424121bcd0f735fec8749490925a2d /src/lib/shm_du_map.c
parentcb8ad2d29475a907b4f662aa86c18b45ff5a2c0a (diff)
downloadouroboros-d2cd2e05bb6e7e92fc6fadaa318ec37c8b3e062b.tar.gz
ouroboros-d2cd2e05bb6e7e92fc6fadaa318ec37c8b3e062b.zip
lib: shm_du_map: Fix wrong padding
Padding was miscalculated, causing lockups in the fast path.
Diffstat (limited to 'src/lib/shm_du_map.c')
-rw-r--r--src/lib/shm_du_map.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c
index 8d197232..3e2c99d4 100644
--- a/src/lib/shm_du_map.c
+++ b/src/lib/shm_du_map.c
@@ -332,7 +332,7 @@ void * shm_du_map_sanitize(void * o)
}
if (ret == ETIMEDOUT) {
- LOG_DBGF("SDU timed out.");
+ LOG_DBGF("SDU timed out (dst: %d).", api);
clean_sdus(dum, api, false);
}
}
@@ -439,7 +439,7 @@ ssize_t shm_du_map_write(struct shm_du_map * dum,
++blocks;
}
- if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE - 1)
+ if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE)
padblocks = SHM_BUFFER_SIZE - *dum->ptr_head;
if (!shm_map_free(dum, (blocks + padblocks))) {
@@ -528,7 +528,7 @@ ssize_t shm_du_map_write_b(struct shm_du_map * dum,
++blocks;
}
- if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE - 1)
+ if (blocks + *dum->ptr_head > SHM_BUFFER_SIZE)
padblocks = SHM_BUFFER_SIZE - *dum->ptr_head;
while (!shm_map_free(dum, (blocks + padblocks))) {