summaryrefslogtreecommitdiff
path: root/src/lib/lockfile.c
diff options
context:
space:
mode:
authorDimitri Staessens <dimitri.staessens@ugent.be>2017-12-02 14:01:03 +0100
committerSander Vrijders <sander.vrijders@ugent.be>2017-12-02 14:56:20 +0100
commit9b8a3e11c558877c09416991ff1ec840fea6d0ab (patch)
treef2faf7a4ab45687782a010fb6e48829e8ee1bdeb /src/lib/lockfile.c
parentf43e5e2329fb798047d15dd0748e5eef3359c966 (diff)
downloadouroboros-9b8a3e11c558877c09416991ff1ec840fea6d0ab.tar.gz
ouroboros-9b8a3e11c558877c09416991ff1ec840fea6d0ab.zip
lib, tools: Rename application process and instance
This refactors ouroboros to use "program" instead of "application process" and "process" instead of "application process instance" to align with current naming in current Operating Systems courses instead of the ISO nomenclature adopted by RINA. This change permeates through the entire implementation. Also contains some minor other refactors. Signed-off-by: Dimitri Staessens <dimitri.staessens@ugent.be> Signed-off-by: Sander Vrijders <sander.vrijders@ugent.be>
Diffstat (limited to 'src/lib/lockfile.c')
-rw-r--r--src/lib/lockfile.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/lib/lockfile.c b/src/lib/lockfile.c
index 4a3dcb91..0d1bcd17 100644
--- a/src/lib/lockfile.c
+++ b/src/lib/lockfile.c
@@ -38,7 +38,7 @@
#define LF_SIZE (sizeof(pid_t))
struct lockfile {
- pid_t * api;
+ pid_t * pid;
};
struct lockfile * lockfile_create() {
@@ -63,7 +63,7 @@ struct lockfile * lockfile_create() {
return NULL;
}
- lf->api = mmap(NULL,
+ lf->pid = mmap(NULL,
LF_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED,
fd,
@@ -71,13 +71,13 @@ struct lockfile * lockfile_create() {
close (fd);
- if (lf->api == MAP_FAILED) {
+ if (lf->pid == MAP_FAILED) {
shm_unlink(SHM_LOCKFILE_NAME);
free(lf);
return NULL;
}
- *lf->api = getpid();
+ *lf->pid = getpid();
return lf;
}
@@ -94,7 +94,7 @@ struct lockfile * lockfile_open() {
return NULL;
}
- lf->api = mmap(NULL,
+ lf->pid = mmap(NULL,
LF_SIZE, PROT_READ | PROT_WRITE,
MAP_SHARED,
fd,
@@ -102,7 +102,7 @@ struct lockfile * lockfile_open() {
close(fd);
- if (lf->api == MAP_FAILED) {
+ if (lf->pid == MAP_FAILED) {
shm_unlink(SHM_LOCKFILE_NAME);
free(lf);
return NULL;
@@ -115,7 +115,7 @@ void lockfile_close(struct lockfile * lf)
{
assert(lf);
- munmap(lf->api, LF_SIZE);
+ munmap(lf->pid, LF_SIZE);
free(lf);
}
@@ -124,10 +124,10 @@ void lockfile_destroy(struct lockfile * lf)
{
assert(lf);
- if (getpid() != *lf->api && kill(*lf->api, 0) == 0)
+ if (getpid() != *lf->pid && kill(*lf->pid, 0) == 0)
return;
- munmap(lf->api, LF_SIZE);
+ munmap(lf->pid, LF_SIZE);
shm_unlink(SHM_LOCKFILE_NAME);
@@ -138,5 +138,5 @@ pid_t lockfile_owner(struct lockfile * lf)
{
assert(lf);
- return *lf->api;
+ return *lf->pid;
}