summaryrefslogtreecommitdiff
path: root/src/lib/lockfile.c
diff options
context:
space:
mode:
authordimitri staessens <dimitri.staessens@ugent.be>2017-08-21 09:11:38 +0000
committerSander Vrijders <sander.vrijders@ugent.be>2017-08-21 09:11:38 +0000
commit5b242e7207483860143d3c84438134430ac1448f (patch)
treea04a750b802436a4e244d8224b800a2f26071091 /src/lib/lockfile.c
parentafe8b6f496dd4e0e3aaaa5dec0d6fb32253a49f7 (diff)
parent8f58e5a3ec0e4a15fc8ae0911cc864f5dbf86c6e (diff)
downloadouroboros-5b242e7207483860143d3c84438134430ac1448f.tar.gz
ouroboros-5b242e7207483860143d3c84438134430ac1448f.zip
Merged in dstaesse/ouroboros/be-build (pull request #557)
build: Revise the build system
Diffstat (limited to 'src/lib/lockfile.c')
-rw-r--r--src/lib/lockfile.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/lib/lockfile.c b/src/lib/lockfile.c
index e2e4d289..4a3dcb91 100644
--- a/src/lib/lockfile.c
+++ b/src/lib/lockfile.c
@@ -20,7 +20,10 @@
* Foundation, Inc., http://www.fsf.org/about/contact/.
*/
-#include <ouroboros/config.h>
+#define _POSIX_C_SOURCE 200112L
+
+#include "config.h"
+
#include <ouroboros/lockfile.h>
#include <stdlib.h>
@@ -47,7 +50,7 @@ struct lockfile * lockfile_create() {
mask = umask(0);
- fd = shm_open(LOCKFILE_NAME, O_CREAT | O_EXCL | O_RDWR, 0666);
+ fd = shm_open(SHM_LOCKFILE_NAME, O_CREAT | O_EXCL | O_RDWR, 0666);
if (fd == -1) {
free(lf);
return NULL;
@@ -69,7 +72,7 @@ struct lockfile * lockfile_create() {
close (fd);
if (lf->api == MAP_FAILED) {
- shm_unlink(LOCKFILE_NAME);
+ shm_unlink(SHM_LOCKFILE_NAME);
free(lf);
return NULL;
}
@@ -85,7 +88,7 @@ struct lockfile * lockfile_open() {
if (lf == NULL)
return NULL;
- fd = shm_open(LOCKFILE_NAME, O_RDWR, 0666);
+ fd = shm_open(SHM_LOCKFILE_NAME, O_RDWR, 0666);
if (fd < 0) {
free(lf);
return NULL;
@@ -100,7 +103,7 @@ struct lockfile * lockfile_open() {
close(fd);
if (lf->api == MAP_FAILED) {
- shm_unlink(LOCKFILE_NAME);
+ shm_unlink(SHM_LOCKFILE_NAME);
free(lf);
return NULL;
}
@@ -126,7 +129,7 @@ void lockfile_destroy(struct lockfile * lf)
munmap(lf->api, LF_SIZE);
- shm_unlink(LOCKFILE_NAME);
+ shm_unlink(SHM_LOCKFILE_NAME);
free(lf);
}