More as a note for other cygwin users than a general patch, but it should work in any case.

The attached patch allow to enable shmem_sysv.
as  SHM_R | SHM_W are not defined on cygwin (and on posix) [1]

Additional advise :on cygwin the SYSV shared memory requires the
cygserver service running, otherwise it will fail as

$ mpirun -n 4 ./hello_c.exe
Bad system call


Regards
Marco

[1] http://cygwin.com/ml/cygwin/2007-10/msg00284.html
--- orig/openmpi-1.6.3/opal/mca/shmem/sysv/shmem_sysv_component.c       
2012-04-03 16:29:49.000000000 +0200
+++ openmpi-1.6.3/opal/mca/shmem/sysv/shmem_sysv_component.c    2012-11-01 
21:54:18.687021300 +0100
@@ -43,6 +43,7 @@
 #endif /* HAVE_SYS_IPC_H */
 #if HAVE_SYS_SHM_H
 #include <sys/shm.h>
+#include <sys/stat.h>
 #endif /* HAVE_SYS_SHM_H */

 #include "opal/constants.h"
@@ -165,7 +166,7 @@
     /* if we are here, then let the run-time test games begin */

     if (-1 == (shmid = shmget(IPC_PRIVATE, (size_t)(getpagesize()),
-                              IPC_CREAT | IPC_EXCL | SHM_R | SHM_W))) {
+                              IPC_CREAT | IPC_EXCL | S_IRWXU ))) {
         goto out;
     }
     else if ((void *)-1 == (addr = shmat(shmid, NULL, 0))) {
--- orig/openmpi-1.6.3/opal/mca/shmem/sysv/shmem_sysv_module.c  2012-04-03 
16:29:49.000000000 +0200
+++ openmpi-1.6.3/opal/mca/shmem/sysv/shmem_sysv_module.c       2012-11-01 
21:55:21.316603500 +0100
@@ -41,6 +41,7 @@
 #endif /* HAVE_SYS_IPC_H */
 #if HAVE_SYS_SHM_H
 #include <sys/shm.h>
+#include <sys/stat.h>
 #endif /* HAVE_SYS_SHM_H */
 #ifdef HAVE_STRING_H
 #include <string.h>
@@ -197,7 +198,7 @@
      * real_size here
      */
     if (-1 == (ds_buf->seg_id = shmget(IPC_PRIVATE, real_size,
-                                   IPC_CREAT | IPC_EXCL | SHM_R | SHM_W))) {
+                                   IPC_CREAT | IPC_EXCL | S_IRWXU ))) {
         int err = errno;
         char hn[MAXHOSTNAMELEN];
         gethostname(hn, MAXHOSTNAMELEN - 1);

Reply via email to