Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[smpi] Fix ENAMETOOLONG with shm_open in smpi_shared_malloc on MacOS X
authorGabriel Corona <gabriel.corona@loria.fr>
Tue, 1 Mar 2016 08:43:28 +0000 (09:43 +0100)
committerGabriel Corona <gabriel.corona@loria.fr>
Tue, 1 Mar 2016 08:47:32 +0000 (09:47 +0100)
Max length is PSHMNAMLEN = 31.

src/smpi/smpi_bench.cpp

index 516d22a..21f2fd0 100644 (file)
@@ -490,7 +490,7 @@ void *smpi_shared_malloc(size_t size, const char *file, int line)
       // The insertion did not take place.
       // Generate a shared memory name from the address of the shared_data:
       char shmname[256];
-      sprintf(shmname, "/smpi_shared_malloc_%p", &*data);
+      sprintf(shmname, "/shmalloc%p", &*data);
       fd = shm_open(shmname, O_RDWR | O_CREAT | O_EXCL,
                     S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);
       if (fd < 0) {