mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
more whitespace fixes
This commit is contained in:
parent
a495d97242
commit
c5eb7c8e73
3 changed files with 10 additions and 5 deletions
|
@ -40,11 +40,10 @@
|
|||
* @see node_type
|
||||
*/
|
||||
struct shmem {
|
||||
const char* name; /**< Name of the shm object. */
|
||||
const char* name; /**< Name of the shm object. */
|
||||
struct shmem_conf conf; /**< Interface configuration struct. */
|
||||
char **exec; /**< External program to execute on start. */
|
||||
|
||||
struct shmem_int intf; /**< Shmem interface */
|
||||
char **exec; /**< External program to execute on start. */
|
||||
struct shmem_int intf; /**< Shmem interface */
|
||||
};
|
||||
|
||||
/** @see node_type::print */
|
||||
|
|
|
@ -83,6 +83,7 @@ int shmem_open(struct node *n)
|
|||
if (!ret)
|
||||
serror("Failed to spawn external program");
|
||||
}
|
||||
|
||||
ret = shmem_int_open(shm->name, &shm->intf, &shm->conf);
|
||||
if (ret < 0)
|
||||
serror("Opening shared memory interface failed");
|
||||
|
|
|
@ -68,6 +68,7 @@ int shmem_int_open(const char *name, struct shmem_int* shm, struct shmem_conf* c
|
|||
fd = shm_open(name, O_RDWR, 0);
|
||||
if (fd < 0)
|
||||
return -1;
|
||||
|
||||
/* Theoretically, the other process might have created the object, but
|
||||
* isn't done with initializing it yet. So in the creating process,
|
||||
* we only reserve a small amount of memory, just enough for the barrier,
|
||||
|
@ -80,8 +81,8 @@ int shmem_int_open(const char *name, struct shmem_int* shm, struct shmem_conf* c
|
|||
if (stat.st_size > SHMEM_MIN_SIZE)
|
||||
break;
|
||||
}
|
||||
len = stat.st_size;
|
||||
|
||||
len = stat.st_size;
|
||||
base = mmap(NULL, len, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||
if (base == MAP_FAILED)
|
||||
return -1;
|
||||
|
@ -92,6 +93,7 @@ int shmem_int_open(const char *name, struct shmem_int* shm, struct shmem_conf* c
|
|||
shared = (struct shmem_shared *) cptr;
|
||||
|
||||
pthread_barrier_wait(&shared->start_bar);
|
||||
|
||||
shm->base = base;
|
||||
shm->shared = shared;
|
||||
shm->len = 0;
|
||||
|
@ -154,11 +156,14 @@ int shmem_int_open(const char *name, struct shmem_int* shm, struct shmem_conf* c
|
|||
errno = ENOMEM;
|
||||
return -1;
|
||||
}
|
||||
|
||||
shm->base = base;
|
||||
shm->len = len;
|
||||
shm->shared = shared;
|
||||
shm->secondary = 0;
|
||||
|
||||
pthread_barrier_wait(&shared->start_bar);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue