diff options
author | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-07-28 21:15:17 +0200 |
---|---|---|
committer | dimitri staessens <dimitri.staessens@intec.ugent.be> | 2016-07-29 13:58:38 +0200 |
commit | ce401448d62f65956ed57b077af2b315f59efe94 (patch) | |
tree | afcfd1cb6399811f2275a7ebfc345f8e3f3afd27 /src/lib/shm_du_map.c | |
parent | 2d529f912c089033e2f40fd0978ccb741bfe2bbb (diff) | |
download | ouroboros-ce401448d62f65956ed57b077af2b315f59efe94.tar.gz ouroboros-ce401448d62f65956ed57b077af2b315f59efe94.zip |
lib: Portability to FreeBSD
Various portability fixes for FreeBSD. POSIX requires shm file names
to start with a "/" to be portable. lseek(2) can be undefined on
POSIX shm, replaced with ftruncate(2). IRMd check on existing lockfile
more portable.
FreeBSD 11.0 is preferred as it natively supports robust mutexes.
Full working LLC implementation pending.
Diffstat (limited to 'src/lib/shm_du_map.c')
-rw-r--r-- | src/lib/shm_du_map.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/lib/shm_du_map.c b/src/lib/shm_du_map.c index 9d2d4f6e..6dc4a1bd 100644 --- a/src/lib/shm_du_map.c +++ b/src/lib/shm_du_map.c @@ -161,7 +161,7 @@ struct shm_du_map * shm_du_map_create() return NULL; } - if (lseek(shm_fd, SHM_FILE_SIZE - 1, SEEK_SET) < 0) { + if (ftruncate(shm_fd, SHM_FILE_SIZE - 1) < 0) { LOG_DBGF("Failed to extend shared memory map."); free(dum); return NULL; @@ -235,7 +235,7 @@ struct shm_du_map * shm_du_map_open() } shm_fd = shm_open(SHM_DU_MAP_FILENAME, O_RDWR, 0666); - if (shm_fd == -1) { + if (shm_fd < 0) { LOG_DBGF("Failed opening shared memory."); return NULL; } |