[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2a2-171-g5a10283

Service Account noreply at mpich.org
Thu Feb 26 11:27:43 CST 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  5a10283bf7fdda65ba48bac088aacf052ac232ca (commit)
       via  4e80e1d2b9e08c8795d78093e5f436fdf0a92617 (commit)
      from  a8137ff9785f823ec2d661e34e395b98410a3dc0 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/5a10283bf7fdda65ba48bac088aacf052ac232ca

commit 5a10283bf7fdda65ba48bac088aacf052ac232ca
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Mon Feb 16 16:01:58 2015 -0600

    remove _XOPEN_SOURCE in code
    
    lustre, or specifically the header files lustre brings in (quota.h) show
    a problem with caddr_t not being defined if XOPEN_SOURCE is set.  We
    provided this define so we could make use of pread/pwrite, but instead
    we will use our replacement pread/pwrite if one does not exist.
    
    See #1973
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c b/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
index 5f1c232..cb187a3 100644
--- a/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
+++ b/src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c
@@ -8,11 +8,6 @@
  *   Copyright (C) 2008 Sun Microsystems, Lustre group
  */
 
-#ifdef _STDC_C99
-#define _XOPEN_SOURCE 600
-#else
-#define _XOPEN_SOURCE 500
-#endif
 #include <unistd.h>
 
 #include <stdlib.h>
diff --git a/src/mpi/romio/adio/ad_xfs/ad_xfs.h b/src/mpi/romio/adio/ad_xfs/ad_xfs.h
index 1a4d4cc..d14858d 100644
--- a/src/mpi/romio/adio/ad_xfs/ad_xfs.h
+++ b/src/mpi/romio/adio/ad_xfs/ad_xfs.h
@@ -8,11 +8,6 @@
 #ifndef AD_XFS_INCLUDE
 #define AD_XFS_INCLUDE
 
-#ifdef _STDC_C99
-#define _XOPEN_SOURCE 600
-#else
-#define _XOPEN_SOURCE 500
-#endif
 #include <unistd.h>
 #include <sys/types.h>
 #include <fcntl.h>
diff --git a/src/mpi/romio/adio/common/ad_read.c b/src/mpi/romio/adio/common/ad_read.c
index 544ccf4..19f2908 100644
--- a/src/mpi/romio/adio/common/ad_read.c
+++ b/src/mpi/romio/adio/common/ad_read.c
@@ -6,11 +6,6 @@
  */
 
 
-#ifdef _STDC_C99
-#define _XOPEN_SOURCE 600
-#else
-#define _XOPEN_SOURCE 500
-#endif
 #include <unistd.h>
 
 #include "adio.h"
diff --git a/src/mpi/romio/adio/common/ad_write.c b/src/mpi/romio/adio/common/ad_write.c
index ad318e4..34a31d9 100644
--- a/src/mpi/romio/adio/common/ad_write.c
+++ b/src/mpi/romio/adio/common/ad_write.c
@@ -6,11 +6,6 @@
  */
 
 
-#ifdef _STDC_C99
-#define _XOPEN_SOURCE 600
-#else
-#define _XOPEN_SOURCE 500
-#endif
 #include <unistd.h>
 
 #include "adio.h"

http://git.mpich.org/mpich.git/commitdiff/4e80e1d2b9e08c8795d78093e5f436fdf0a92617

commit 4e80e1d2b9e08c8795d78093e5f436fdf0a92617
Author: Rob Latham <robl at mcs.anl.gov>
Date:   Tue Feb 17 15:02:43 2015 -0600

    check for avialablity of pwrite
    
    We can test at configure-time if pread/pwrite is available.
    XOPEN_SOURCE set low enough will not provide this feature, for example
    (as is the case with --enable-strict).
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/mpi/romio/adio/common/utils.c b/src/mpi/romio/adio/common/utils.c
index eef48cb..533ff07 100644
--- a/src/mpi/romio/adio/common/utils.c
+++ b/src/mpi/romio/adio/common/utils.c
@@ -105,6 +105,35 @@ int ADIOI_Type_create_hindexed_x(int count,
     return ret;
 }
 
+/* some systems do not have pread/pwrite, or requrie XOPEN_SOURCE set higher
+ * than we would like.  see #1973 */
+#if (HAVE_DECL_PWRITE == 0)
+
+#include <sys/types.h>
+#include <unistd.h>
+
+ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+
+ssize_t pread(int fd, void *buf, size_t count, off_t offset) {
+    off_t lseek_ret;
+
+    lseek_ret = lseek(fd, offset, SEEK_SET);
+    if (lseek_ret == -1)
+	return lseek_ret;
+    return (read(fd, buf, count));
+}
+
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset) {
+    off_t lseek_ret;
+
+    lseek_ret = lseek(fd, offset, SEEK_SET);
+    if (lseek_ret == -1)
+	return lseek_ret;
+    return (write(fd, buf, count));
+}
+#endif
+
 /*
  * vim: ts=8 sts=4 sw=4 noexpandtab
  */
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index eab98e5..b20ca82 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -1044,3 +1044,10 @@ void *ADIOI_IO_Thread_Func(void *vptr_args);
 
 #endif
 
+
+#if (HAVE_DECL_PWRITE == 0)
+#include <sys/types.h>
+#include <unistd.h>
+ssize_t pread(int fd, void *buf, size_t count, off_t offset);
+ssize_t pwrite(int fd, const void *buf, size_t count, off_t offset);
+#endif
diff --git a/src/mpi/romio/configure.ac b/src/mpi/romio/configure.ac
index 68801ad..f975e1c 100644
--- a/src/mpi/romio/configure.ac
+++ b/src/mpi/romio/configure.ac
@@ -1414,6 +1414,14 @@ if test "$ac_cv_header_unistd_h" = "yes" ; then
     fi
 fi
 
+# pread and pwrite are useful to ROMIO: if implemented well, they help us avoid
+# an extra system call.  But --enable-strict or CFLAGS="--std=c99" does not
+# expose this feature.  If we define XOPEN_SOURCE in ROMIO, we cause headaches
+# for some versions of lustre, quota.h, and caddr_t.  see if we need to provide
+# our own pread/pwrite
+
+AC_CHECK_DECLS([pwrite])
+
 
 ####################################################################
 # We're about to mess with CC etc.  No more feature tests past here,

-----------------------------------------------------------------------

Summary of changes:
 src/mpi/romio/adio/ad_lustre/ad_lustre_rwcontig.c |    5 ---
 src/mpi/romio/adio/ad_xfs/ad_xfs.h                |    5 ---
 src/mpi/romio/adio/common/ad_read.c               |    5 ---
 src/mpi/romio/adio/common/ad_write.c              |    5 ---
 src/mpi/romio/adio/common/utils.c                 |   29 +++++++++++++++++++++
 src/mpi/romio/adio/include/adioi.h                |    7 +++++
 src/mpi/romio/configure.ac                        |    8 ++++++
 7 files changed, 44 insertions(+), 20 deletions(-)


hooks/post-receive
-- 
MPICH primary repository


More information about the commits mailing list