mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
shmem: unlink previously existing shmem regions (closes #139)
This commit is contained in:
parent
bc110a9c24
commit
6aeef09196
1 changed files with 10 additions and 2 deletions
12
lib/shmem.c
12
lib/shmem.c
|
@ -70,9 +70,17 @@ int shmem_int_open(const char *wname, const char* rname, struct shmem_int *shm,
|
|||
return -2;
|
||||
|
||||
/* Open and initialize the shared region for the output queue */
|
||||
fd = shm_open(wname, O_RDWR|O_CREAT|O_EXCL, 0600);
|
||||
if (fd < 0)
|
||||
retry: fd = shm_open(wname, O_RDWR|O_CREAT|O_EXCL, 0600);
|
||||
if (fd < 0) {
|
||||
if (errno == EEXIST) {
|
||||
ret = shm_unlink(wname);
|
||||
if (ret)
|
||||
return -12;
|
||||
goto retry;
|
||||
}
|
||||
|
||||
return -3;
|
||||
}
|
||||
|
||||
len = shmem_total_size(conf->queuelen, conf->samplelen);
|
||||
if (ftruncate(fd, len) < 0)
|
||||
|
|
Loading…
Add table
Reference in a new issue