Fix compile of RDMA engine for SunOS 5.x
authorJens Axboe <axboe@kernel.dk>
Thu, 28 Feb 2013 07:28:05 +0000 (08:28 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 28 Feb 2013 07:28:05 +0000 (08:28 +0100)
- byteswap.h include that doesn't exist there. Kill it, we
  have no use for it.

- No RLIMIT_MEMLOCK on SunOS. The use in the engine is a bit
  suspect, so not a problem if we don't have it. Add configure
  check for that.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
configure
engines/rdma.c

index 8125fc3ccfb685ae0f8149b191a079121adfbc81..1a5295a1e77db62fc33c87933096b68905918ee4 100755 (executable)
--- a/configure
+++ b/configure
@@ -909,6 +909,23 @@ if compile_prog "" "" "TCP_NODELAY"; then
 fi
 echo "TCP_NODELAY                   $tcp_nodelay"
 
+##########################################
+# Check whether we have RLIMIT_MEMLOCK
+rlimit_memlock="no"
+cat > $TMPC << EOF
+#include <sys/time.h>
+#include <sys/resource.h>
+int main(int argc, char **argv)
+{
+  struct rlimit rl;
+  return getrlimit(RLIMIT_MEMLOCK, &rl);
+}
+EOF
+if compile_prog "" "" "RLIMIT_MEMLOCK"; then
+  rlimit_memlock="yes"
+fi
+echo "RLIMIT_MEMLOCK                $rlimit_memlock"
+
 #############################################################################
 
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
@@ -1017,6 +1034,9 @@ fi
 if test "$tcp_nodelay" = "yes" ; then
   output_sym "CONFIG_TCP_NODELAY"
 fi
+if test "$rlimit_memlock" = "yes" ; then
+  output_sym "CONFIG_RLIMIT_MEMLOCK"
+fi
 
 echo "LIBS+=$LIBS" >> $config_host_mak
 echo "CC=$cc" >> $config_host_mak
index e1fb380a044c6680ee03e4b2a526164495a6aaf7..ea1af2ba5dffdd7ae62df40341fe597b0fccfe94 100644 (file)
@@ -36,7 +36,6 @@
 #include <sys/time.h>
 #include <sys/resource.h>
 
-#include <byteswap.h>
 #include <pthread.h>
 #include <inttypes.h>
 
@@ -1013,26 +1012,11 @@ static int fio_rdmaio_setup_listen(struct thread_data *td, short port)
        return 0;
 }
 
-static int fio_rdmaio_init(struct thread_data *td)
+static int check_set_rlimits(struct thread_data *td)
 {
-       struct rdmaio_data *rd = td->io_ops->data;
-       struct flist_head *entry;
-       unsigned int max_bs;
-       unsigned int port;
-       char host[64], buf[128];
-       char *sep, *portp, *modep;
-       int ret, i = 0;
+#ifdef CONFIG_RLIMIT_MEMLOCK
        struct rlimit rl;
 
-       if (td_rw(td)) {
-               log_err("fio: rdma connections must be read OR write\n");
-               return 1;
-       }
-       if (td_random(td)) {
-               log_err("fio: RDMA network IO can't be random\n");
-               return 1;
-       }
-
        /* check RLIMIT_MEMLOCK */
        if (getrlimit(RLIMIT_MEMLOCK, &rl) != 0) {
                log_err("fio: getrlimit fail: %d(%s)\n",
@@ -1057,6 +1041,32 @@ static int fio_rdmaio_init(struct thread_data *td)
                        return 1;
                }
        }
+#endif
+
+       return 0;
+}
+
+static int fio_rdmaio_init(struct thread_data *td)
+{
+       struct rdmaio_data *rd = td->io_ops->data;
+       struct flist_head *entry;
+       unsigned int max_bs;
+       unsigned int port;
+       char host[64], buf[128];
+       char *sep, *portp, *modep;
+       int ret, i = 0;
+
+       if (td_rw(td)) {
+               log_err("fio: rdma connections must be read OR write\n");
+               return 1;
+       }
+       if (td_random(td)) {
+               log_err("fio: RDMA network IO can't be random\n");
+               return 1;
+       }
+
+       if (check_set_rlimits(td))
+               return 1;
 
        strcpy(buf, td->o.filename);