Whamcloud - gitweb
build fixes for posix 2008 enviroment
authorshadow <shadow>
Fri, 13 Nov 2009 10:05:58 +0000 (10:05 +0000)
committershadow <shadow>
Fri, 13 Nov 2009 10:05:58 +0000 (10:05 +0000)
Branch HEAD
b=19808
i=tappro
i=lee@sandia

libsysio/configure.in
libsysio/include/sysio.h
libsysio/include/xtio.h
libsysio/src/readdir.c
libsysio/src/rw.c

index 4fcd3c0..5ce600f 100644 (file)
@@ -360,6 +360,51 @@ if test x$have_st_gen = xyes; then
        AC_DEFINE(HAVE_GENERATION)
 fi
 
        AC_DEFINE(HAVE_GENERATION)
 fi
 
+AC_MSG_CHECKING(for POSIX 2008 preadv)
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Werror"
+AC_TRY_COMPILE([
+#include <sys/uio.h>
+ssize_t preadv (int __fd, const struct iovec *__iovec,
+                int __count, off_t off)
+{
+    return 0;
+}
+],[
+],[
+AC_DEFINE(HAVE_POSIX2008_PREADV, 1, [POSIX 2008 preadv])
+AC_MSG_RESULT(yes)
+],[
+AC_MSG_RESULT(no)
+])
+CFLAGS="$tmp_flags"
+
+AC_MSG_CHECKING(for POSIX 2008 scandir)
+tmp_flags="$CFLAGS"
+CFLAGS="$CFLAGS -Wall -Werror"
+AC_TRY_COMPILE([
+#define _BSD_SOURCE
+
+#include <stdio.h>
+#include <dirent.h>
+
+int scandir(const char *dir,
+        struct dirent ***namelist,
+        int(*filter)(const struct dirent *),
+        int(*compar)(const struct dirent **,
+                     const struct dirent **)
+       );
+
+],[
+], [
+AC_DEFINE(HAVE_POSIX2008_SCANDIR, 1, [POSIX 2008 scandir])
+AC_MSG_RESULT(yes) 
+],[
+AC_MSG_RESULT(no)
+])
+CFLAGS="$tmp_flags"
+
+
 AC_MSG_CHECKING(whether .text pseudo-op must be used)
 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
 cat > conftest.s <<EOF
 AC_MSG_CHECKING(whether .text pseudo-op must be used)
 AC_CACHE_VAL(am_cv_sysio_asm_dot_text, [dnl
 cat > conftest.s <<EOF
index e64ead5..c9eab42 100644 (file)
@@ -279,11 +279,17 @@ extern int SYSIO_INTERFACE_NAME(umount)(const char *target);
 extern DIR *SYSIO_INTERFACE_NAME(opendir)(const char *name);
 extern int SYSIO_INTERFACE_NAME(closedir)(DIR *dir);
 extern struct dirent *SYSIO_INTERFACE_NAME(readdir)(DIR *dir);
 extern DIR *SYSIO_INTERFACE_NAME(opendir)(const char *name);
 extern int SYSIO_INTERFACE_NAME(closedir)(DIR *dir);
 extern struct dirent *SYSIO_INTERFACE_NAME(readdir)(DIR *dir);
+
 extern int SYSIO_INTERFACE_NAME(scandir)(const char *dir,
                                         struct dirent ***namelist,
                                         int(*filter)(const struct dirent *),
 extern int SYSIO_INTERFACE_NAME(scandir)(const char *dir,
                                         struct dirent ***namelist,
                                         int(*filter)(const struct dirent *),
-                                        int(*compar)(const void *,
-                                                     const void *));
+#ifdef HAVE_POSIX2008_SCANDIR
+                                        int(*compar)(const struct dirent **,
+                                                     const struct dirent **)
+#else
+                                        int(*compar)(const void *, const void *)
+#endif
+                                       );
 #if defined(_BSD_SOURCE) || defined(_SVID_SOURCE)
 extern ssize_t SYSIO_INTERFACE_NAME(getdirentries)(int fd,
                                                   char *buf,
 #if defined(_BSD_SOURCE) || defined(_SVID_SOURCE)
 extern ssize_t SYSIO_INTERFACE_NAME(getdirentries)(int fd,
                                                   char *buf,
index a5798f1..8e67d2e 100644 (file)
@@ -86,6 +86,12 @@ struct xtvec64 {
 };
 #endif
 
 };
 #endif
 
+#ifdef HAVE_POSIX2008_PREADV
+#define _SYSIO_PREADV_T int
+#else
+#define _SYSIO_PREADV_T size_t
+#endif
+
 struct iovec;
 
 /*
 struct iovec;
 
 /*
@@ -139,7 +145,7 @@ extern ioid_t SYSIO_INTERFACE_NAME(ipread64)(int fd,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
                                            const struct iovec *iov,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
                                            const struct iovec *iov,
-                                           size_t count,
+                                           _SYSIO_PREADV_T count,
                                            off_t offset);
 
 #ifdef _LARGEFILE64_SOURCE
                                            off_t offset);
 
 #ifdef _LARGEFILE64_SOURCE
@@ -148,7 +154,7 @@ extern ssize_t SYSIO_INTERFACE_NAME(preadv)(int fd,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pread64v)(int fd,
                                              const struct iovec *iov, 
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pread64v)(int fd,
                                              const struct iovec *iov, 
-                                             size_t count,
+                                             _SYSIO_PREADV_T count,
                                              off64_t offset);
 #endif
 
                                              off64_t offset);
 #endif
 
@@ -258,7 +264,7 @@ extern ioid_t SYSIO_INTERFACE_NAME(ipwrite64)(int fd,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
                                             const struct iovec *iov,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
                                             const struct iovec *iov,
-                                            size_t count,
+                                            _SYSIO_PREADV_T count,
                                             off_t offset);
 
 #ifdef _LARGEFILE64_SOURCE
                                             off_t offset);
 
 #ifdef _LARGEFILE64_SOURCE
@@ -267,7 +273,7 @@ extern ssize_t SYSIO_INTERFACE_NAME(pwritev)(int fd,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pwrite64v)(int fd,
                                               const struct iovec *iov,
  */
 extern ssize_t SYSIO_INTERFACE_NAME(pwrite64v)(int fd,
                                               const struct iovec *iov,
-                                              size_t count,
+                                              _SYSIO_PREADV_T count,
                                               off64_t offset);
 #endif
 
                                               off64_t offset);
 #endif
 
index c232b29..2633f96 100644 (file)
@@ -105,7 +105,12 @@ int
 _SCANDIR(const char *dirname, 
         _DIRENT_T ***namelist, 
         int (*filter) (const _DIRENT_T *), 
 _SCANDIR(const char *dirname, 
         _DIRENT_T ***namelist, 
         int (*filter) (const _DIRENT_T *), 
-        int (*compar) (const void *, const void *))
+#ifdef HAVE_POSIX2008_SCANDIR
+        int(*compar)(const _DIRENT_T **, const  _DIRENT_T **)
+#else
+        int(*compar)(const void *, const void *)
+#endif
+       )
 {
        DIR *dir = NULL;
        _DIRENT_T *de     = NULL,
 {
        DIR *dir = NULL;
        _DIRENT_T *de     = NULL,
index 300f073..ebbca58 100644 (file)
@@ -487,7 +487,7 @@ SYSIO_INTERFACE_NAME(ipreadv)(int fd,
 static ssize_t
 PREPEND(_, SYSIO_INTERFACE_NAME(preadv))(int fd, 
                                         const struct iovec *iov, 
 static ssize_t
 PREPEND(_, SYSIO_INTERFACE_NAME(preadv))(int fd, 
                                         const struct iovec *iov, 
-                                        size_t count, 
+                                        _SYSIO_PREADV_T count, 
                                         _SYSIO_OFF_T offset)
 {
        struct file *fil;
                                         _SYSIO_OFF_T offset)
 {
        struct file *fil;
@@ -524,7 +524,7 @@ sysio_sym_weak_alias(PREPEND(_, SYSIO_INTERFACE_NAME(preadv)),
 ssize_t
 SYSIO_INTERFACE_NAME(preadv)(int fd, 
                             const struct iovec *iov, 
 ssize_t
 SYSIO_INTERFACE_NAME(preadv)(int fd, 
                             const struct iovec *iov, 
-                            size_t count, 
+                            _SYSIO_PREADV_T count, 
                             off_t offset)
 {
 
                             off_t offset)
 {
 
@@ -844,7 +844,8 @@ SYSIO_INTERFACE_NAME(iwritev)(int fd,
 }
 
 ssize_t
 }
 
 ssize_t
-SYSIO_INTERFACE_NAME(writev)(int fd, const struct iovec *iov, int count)
+SYSIO_INTERFACE_NAME(writev)(int fd, const struct iovec *iov,
+                            int count)
 {
        struct file *fil;
        struct intnl_xtvec xtvector;
 {
        struct file *fil;
        struct intnl_xtvec xtvector;
@@ -1015,7 +1016,7 @@ SYSIO_INTERFACE_NAME(ipwritev)(int fd,
 static ssize_t
 PREPEND(_, SYSIO_INTERFACE_NAME(pwritev))(int fd, 
                                          const struct iovec *iov, 
 static ssize_t
 PREPEND(_, SYSIO_INTERFACE_NAME(pwritev))(int fd, 
                                          const struct iovec *iov, 
-                                         size_t count, 
+                                         _SYSIO_PREADV_T count, 
                                          _SYSIO_OFF_T offset)
 {
        struct file *fil;
                                          _SYSIO_OFF_T offset)
 {
        struct file *fil;
@@ -1052,7 +1053,7 @@ sysio_sym_weak_alias(PREPEND(_, SYSIO_INTERFACE_NAME(pwritev)),
 ssize_t
 SYSIO_INTERFACE_NAME(pwritev)(int fd, 
                              const struct iovec *iov, 
 ssize_t
 SYSIO_INTERFACE_NAME(pwritev)(int fd, 
                              const struct iovec *iov, 
-                             size_t count, 
+                             _SYSIO_PREADV_T count, 
                              off_t offset)
 {
 
                              off_t offset)
 {